From owner-freebsd-net@freebsd.org Wed Jan 29 21:44:59 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 141AA1F85F5 for ; Wed, 29 Jan 2020 21:44:59 +0000 (UTC) (envelope-from ricera10@gmail.com) Received: from mail-lj1-f175.google.com (mail-lj1-f175.google.com [209.85.208.175]) (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 487H8B26PLz4FWj for ; Wed, 29 Jan 2020 21:44:58 +0000 (UTC) (envelope-from ricera10@gmail.com) Received: by mail-lj1-f175.google.com with SMTP id h23so1028100ljc.8 for ; Wed, 29 Jan 2020 13:44:57 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=0kUUG1LZPcT5U3Ev0PQvQOLeoXoB1GQrwj/VwvnD39o=; b=k5lUHb3yUxKueBxxSDrJLV0ehlMkIh3MWHTsVKvNg2jTHcT0+7Xg9uu+kjVBUvirH0 WH8lUFdaRDqVy5hoORKf+3/Q+nffnuVKfiTs4ZV8FMD8/SMDhW25TY+6iKKoBTUCfPv9 yIZmIqJgOiu6+ZA33TuHrkOEPz68XqK9qtpgGNKiU/bcjwYHufEbcMO1LxP7bG6X3G8/ piKaj7lOpgySYZRL7RfPWAiWtp9mDQ6mbiCR7/RxRipZJnS7l5X1v4EOBTcy52f3503/ OpLvkOd2PA4MF0nD7i+A1eSsERi6HFwIBIttpskWVoZKDTgG7xEYSk/a3k3xC/hSH9cv wLOw== X-Gm-Message-State: APjAAAV7koz2NqMg8Pf8NsiWLCvx+otnJ3Quo1k9J9Kc9XKpD43ejkwt vNJaMB3BAEkiFVjgJgDpfWxSdtnq X-Google-Smtp-Source: APXvYqxDeDiL0Z0uTgGqFXkbR/K55W1ysMTH664enrpK7tn0MvkTVlWL3QpfjCSeuWsDuQYStA2SBA== X-Received: by 2002:a05:651c:20f:: with SMTP id y15mr772833ljn.7.1580334296041; Wed, 29 Jan 2020 13:44:56 -0800 (PST) Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com. [209.85.167.53]) by smtp.gmail.com with ESMTPSA id f11sm1972452lfa.9.2020.01.29.13.44.55 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 29 Jan 2020 13:44:55 -0800 (PST) Received: by mail-lf1-f53.google.com with SMTP id n25so794069lfl.0 for ; Wed, 29 Jan 2020 13:44:55 -0800 (PST) X-Received: by 2002:a19:c210:: with SMTP id l16mr712109lfc.35.1580334295008; Wed, 29 Jan 2020 13:44:55 -0800 (PST) MIME-Version: 1.0 References: <0e2e97f2-df75-3c6f-9bdd-e8c2ab7bf79e@selasky.org> In-Reply-To: <0e2e97f2-df75-3c6f-9bdd-e8c2ab7bf79e@selasky.org> From: Eric Joyner Date: Wed, 29 Jan 2020 13:44:44 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Issue with epoch_drain_callbacks and unloading iavf(4) [using iflib] To: Hans Petter Selasky Cc: freebsd-net@freebsd.org X-Rspamd-Queue-Id: 487H8B26PLz4FWj X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of ricera10@gmail.com designates 209.85.208.175 as permitted sender) smtp.mailfrom=ricera10@gmail.com X-Spamd-Result: default: False [-3.06 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-net@freebsd.org]; DMARC_NA(0.00)[freebsd.org]; RCVD_COUNT_THREE(0.00)[4]; MIME_TRACE(0.00)[0:+,1:+,2:~]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; RCVD_IN_DNSWL_NONE(0.00)[175.208.85.209.list.dnswl.org : 127.0.5.0]; IP_SCORE(-1.06)[ip: (-0.43), ipnet: 209.85.128.0/17(-3.05), asn: 15169(-1.78), country: US(-0.05)]; FORGED_SENDER(0.30)[erj@freebsd.org,ricera10@gmail.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[175.208.85.209.rep.mailspike.net : 127.0.0.17]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[erj@freebsd.org,ricera10@gmail.com]; RCVD_TLS_ALL(0.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 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: Wed, 29 Jan 2020 21:44:59 -0000 On Wed, Jan 29, 2020 at 1:41 PM Hans Petter Selasky wrote: > On 2020-01-29 22:30, Eric Joyner wrote: > > Hi freebsd-net, > > > > We've encountered an issue with unloading the iavf(4) driver on FreeBSD > > 12.1 (and stable). On a VM with two iavf(4) interfaces, if we send heavy > > traffic to iavf1 and try to kldunload the driver, the kldunload process > > hangs on iavf0 until iavf1 stops receiving traffic. > > > > After some debugging, it looks like epoch_drain_callbacks() [via > > if_detach_internal()] tries to switch CPUs to run on one that iavf1 is > > using for RX processing, but since iavf1 is busy, it can't make the > switch, > > so cpu_switch() just hangs and nothing happens until iavf1's RX thread > > stops being busy. > > > > I can work around this by inserting a kern_yield(PRI_USER) somewhere in > one > > of the iavf txrx functions that iflib calls into (e.g. > > iavf_isc_rxd_available), but that's not a proper fix. Does anyone know > what > > to do to prevent this from happening? > > > > Wildly guessing, does maybe epoch_drain_callbacks() need a higher > priority > > than the PI_SOFT used in the group taskqueues used in iflib's RX > processing? > > > > Hi, > > Which scheduler is this? ULE or BSD? > > EPOCH(9) expects some level of round-robin scheduling on the same > priority level. Setting a higher priority on EPOCH(9) might cause epoch > to start spinning w/o letting the lower priority thread which holds the > EPOCH() section to finish. > > --HPS > > Hi Hans, kern.sched.name gives me "ULE" - Eric