Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Jan 2020 13:30:55 -0800
From:      Eric Joyner <erj@freebsd.org>
To:        freebsd-net@freebsd.org
Subject:   Issue with epoch_drain_callbacks and unloading iavf(4) [using iflib]
Message-ID:  <CAKdFRZjxp=mTkUzFU8qsacP86OQOC9vCDCQ%2BO2iF7svRRGDK8w@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
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?

- Eric



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAKdFRZjxp=mTkUzFU8qsacP86OQOC9vCDCQ%2BO2iF7svRRGDK8w>