Issue with epoch_drain_callbacks and unloading iavf(4) [using iflib]

Mark Johnston markj at freebsd.org
Tue Apr 21 17:30:22 UTC 2020


On Mon, Apr 20, 2020 at 04:39:07PM -0700, Eric Joyner wrote:
> On Thu, Apr 9, 2020 at 2:29 PM Eric Joyner <erj at freebsd.org> wrote:
> 
> > On Thu, Apr 9, 2020 at 2:02 PM Eric Joyner <erj at freebsd.org> wrote:
> >
> >> On Tue, Apr 7, 2020 at 4:24 PM Mark Johnston <markj at freebsd.org> wrote:
> >>
> >>> I spent some time looking at the core.  It looks like we have yet
> >>> another problem: the gtaskqueue code won't exit the net epoch if it is
> >>> constantly running a net task.  Could you please retry with the patches
> >>> from before, and this one included?
> >>>
> >>> diff --git a/sys/kern/subr_gtaskqueue.c b/sys/kern/subr_gtaskqueue.c
> >>> index f52f32204644..2b1386a612ee 100644
> >>> --- a/sys/kern/subr_gtaskqueue.c
> >>> +++ b/sys/kern/subr_gtaskqueue.c
> >>> @@ -345,7 +345,7 @@ gtaskqueue_run_locked(struct gtaskqueue *queue)
> >>>         struct epoch_tracker et;
> >>>         struct gtaskqueue_busy tb;
> >>>         struct gtask *gtask;
> >>> -       bool in_net_epoch;
> >>> +       bool in net_epoch;
> >>>
> >>>         KASSERT(queue != NULL, ("tq is NULL"));
> >>>         TQ_ASSERT_LOCKED(queue);
> >>> @@ -361,20 +361,19 @@ gtaskqueue_run_locked(struct gtaskqueue *queue)
> >>>                 TQ_UNLOCK(queue);
> >>>
> >>>                 KASSERT(gtask->ta_func != NULL, ("task->ta_func is
> >>> NULL"));
> >>> -               if (!in_net_epoch && TASK_IS_NET(gtask)) {
> >>> -                       in_net_epoch = true;
> >>> +               if (TASK_IS_NET(gtask)) {
> >>>                         NET_EPOCH_ENTER(et);
> >>> -               } else if (in_net_epoch && !TASK_IS_NET(gtask)) {
> >>> +                       in_net_epoch = true;
> >>> +               }
> >>> +               gtask->ta_func(gtask->ta_context);
> >>> +               if (in_net_epoch) {
> >>>                         NET_EPOCH_EXIT(et);
> >>>                         in_net_epoch = false;
> >>>                 }
> >>> -               gtask->ta_func(gtask->ta_context);
> >>>
> >>>                 TQ_LOCK(queue);
> >>>                 wakeup(gtask);
> >>>         }
> >>> -       if (in_net_epoch)
> >>> -               NET_EPOCH_EXIT(et);
> >>>         LIST_REMOVE(&tb, tb_link);
> >>>  }
> >>>
> >>> _______________________________________________
> >>> freebsd-net at freebsd.org mailing list
> >>> https://lists.freebsd.org/mailman/listinfo/freebsd-net
> >>> To unsubscribe, send any mail to "freebsd-net-unsubscribe at freebsd.org"
> >>>
> >>
> >> Yeah, I'll give it a spin and try to get back to you before the end of
> >> the week.
> >>
> >> - Eric
> >>
> >
> > I was able to try it out just now, and it looks this (and all of the other
> > patches) finally causes the problem to not appear! I can unload the driver
> > while iavf1 is receiving heavy traffic!
> >
> > - Eric
> >
> 
>   Hi Mark,
> 
> Are you planning to commit these patches to HEAD? I see the reviews for
> D24214 and D24215 are still up, and I don't know if you created a review
> for the patch you put in this email chain.

Hi Eric,

Yes, I'm working on getting those patches reviewed and committed.  The
patch above was just to verify a theory, we still need a proper
solution.


More information about the freebsd-net mailing list