From owner-freebsd-net@freebsd.org Tue Apr 21 17:30:22 2020 Return-Path: Delivered-To: freebsd-net@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A5C142B17EF for ; Tue, 21 Apr 2020 17:30:22 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qt1-x82c.google.com (mail-qt1-x82c.google.com [IPv6:2607:f8b0:4864:20::82c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4969Z63zrRz3DdJ; Tue, 21 Apr 2020 17:30:22 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-qt1-x82c.google.com with SMTP id r19so2335905qtu.11; Tue, 21 Apr 2020 10:30:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=kHns07+EjZq5ngSI4Jekz9inK9W9e/2+8UVlc63OLfk=; b=CT7c0LSlQEmry+mGkG9Ui5Ecz28KIJUOAh+ycXvaxohlytXj5q1Ibo9dSmOpg9pJh8 iZK0tOrBfU9rLFCcsJEUoPQ4zCpAnDdeJjNmoGEYlHdG6sJX1g0SpyQYDTksT3kfiQhv daUkVHcK9WPh2f/UOkGx1EPQWrTUcF+w+0+P2C905rYdyYISweU3ldTOIZzTHj8reBo4 KzV/l7aasGmfYG+hv0u/Amod6gpjQEeNyBMf5n7BMrVdiO/QfT9tBnyNLPW8D8OqUpbi d/ghaxVug4NMOF6u1RB+1updbPaQTT1TMclyWdSYPyEK0DkOMecRKuva9yFlY1tSw7dE Uo6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=kHns07+EjZq5ngSI4Jekz9inK9W9e/2+8UVlc63OLfk=; b=VCW6SGz+A6qP69Mewu/+Ault29iWjgGDP/gUJ01ghmYNE4Y8H+Em3Kzt3qI9mewowR cEXHN6WOWZmInzFp/9O1qpK6rzjTc3glOwBrSbM7rXzyASuZz4SbGhnNKzTJ+ZmTwS/I MV8oLC6Om2EBUd/aVmahjYOIo1K1LW1k7bbsOATbX/hCQbxsdkTJrH26N9vHYITp2BVo /juGxn+FbbH30w9d/PSjgsq4smMOyCNJh9K9Ti/00yd7Ynqq9PDk6gDB6ZIkRuxmyVBx zvVK/aSmkJhQM8vsiduJREMNkmkhZlj+H+YH6CtA9CskumEGcIYhlbTfrMOcr1Ycumbm 84CQ== X-Gm-Message-State: AGi0PubFWc7+vUJ/N46fNSZ+xtNjNJnJjVNrGKiccM4PN7gFPEDSfpKJ EqQwNc+oYh+VTo+tMAbZkbwrlyMw X-Google-Smtp-Source: APiQypJjDnErkvlNG0m8kD6lQZ2G7Xgccf90eGeWYqwNY/aaVoE/SDnlJPKpKLADtiljFQtf4Cephg== X-Received: by 2002:ac8:550a:: with SMTP id j10mr22115683qtq.193.1587490220874; Tue, 21 Apr 2020 10:30:20 -0700 (PDT) Received: from raichu (toroon0560w-lp130-10-174-94-17-182.dsl.bell.ca. [174.94.17.182]) by smtp.gmail.com with ESMTPSA id r9sm2118995qke.5.2020.04.21.10.30.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Apr 2020 10:30:20 -0700 (PDT) Sender: Mark Johnston Date: Tue, 21 Apr 2020 13:30:18 -0400 From: Mark Johnston To: Eric Joyner Cc: freebsd-net@freebsd.org Subject: Re: Issue with epoch_drain_callbacks and unloading iavf(4) [using iflib] Message-ID: <20200421173018.GD86922@raichu> References: <20200331192024.GE97238@raichu> <20200406212903.GA55712@raichu> <20200407232347.GA5605@raichu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 4969Z63zrRz3DdJ X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Apr 2020 17:30:22 -0000 On Mon, Apr 20, 2020 at 04:39:07PM -0700, Eric Joyner wrote: > On Thu, Apr 9, 2020 at 2:29 PM Eric Joyner wrote: > > > On Thu, Apr 9, 2020 at 2:02 PM Eric Joyner wrote: > > > >> On Tue, Apr 7, 2020 at 4:24 PM Mark Johnston 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@freebsd.org mailing list > >>> https://lists.freebsd.org/mailman/listinfo/freebsd-net > >>> To unsubscribe, send any mail to "freebsd-net-unsubscribe@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.