From: Greg KH <greg@kroah.com>
To: Jacob Keller <jacob.e.keller@intel.com>
Cc: stable@vger.kernel.org
Subject: Re: [PATCH 1/2] ice: Fix race conditions between virtchnl handling and VF ndo ops
Date: Sat, 5 Mar 2022 14:40:07 +0100 [thread overview]
Message-ID: <YiNoN+pvklPaIMT4@kroah.com> (raw)
In-Reply-To: <20220228204700.3260650-1-jacob.e.keller@intel.com>
On Mon, Feb 28, 2022 at 12:46:59PM -0800, Jacob Keller wrote:
> From: Brett Creeley <brett.creeley@intel.com>
>
> commit e6ba5273d4ede03d075d7a116b8edad1f6115f4d upstream.
>
> [I had to fix the cherry-pick manually as the patch added a line around
> some context that was missing.]
>
> The VF can be configured via the PF's ndo ops at the same time the PF is
> receiving/handling virtchnl messages. This has many issues, with
> one of them being the ndo op could be actively resetting a VF (i.e.
> resetting it to the default state and deleting/re-adding the VF's VSI)
> while a virtchnl message is being handled. The following error was seen
> because a VF ndo op was used to change a VF's trust setting while the
> VIRTCHNL_OP_CONFIG_VSI_QUEUES was ongoing:
>
> [35274.192484] ice 0000:88:00.0: Failed to set LAN Tx queue context, error: ICE_ERR_PARAM
> [35274.193074] ice 0000:88:00.0: VF 0 failed opcode 6, retval: -5
> [35274.193640] iavf 0000:88:01.0: PF returned error -5 (IAVF_ERR_PARAM) to our request 6
>
> Fix this by making sure the virtchnl handling and VF ndo ops that
> trigger VF resets cannot run concurrently. This is done by adding a
> struct mutex cfg_lock to each VF structure. For VF ndo ops, the mutex
> will be locked around the critical operations and VFR. Since the ndo ops
> will trigger a VFR, the virtchnl thread will use mutex_trylock(). This
> is done because if any other thread (i.e. VF ndo op) has the mutex, then
> that means the current VF message being handled is no longer valid, so
> just ignore it.
>
> This issue can be seen using the following commands:
>
> for i in {0..50}; do
> rmmod ice
> modprobe ice
>
> sleep 1
>
> echo 1 > /sys/class/net/ens785f0/device/sriov_numvfs
> echo 1 > /sys/class/net/ens785f1/device/sriov_numvfs
>
> ip link set ens785f1 vf 0 trust on
> ip link set ens785f0 vf 0 trust on
>
> sleep 2
>
> echo 0 > /sys/class/net/ens785f0/device/sriov_numvfs
> echo 0 > /sys/class/net/ens785f1/device/sriov_numvfs
> sleep 1
> echo 1 > /sys/class/net/ens785f0/device/sriov_numvfs
> echo 1 > /sys/class/net/ens785f1/device/sriov_numvfs
>
> ip link set ens785f1 vf 0 trust on
> ip link set ens785f0 vf 0 trust on
> done
>
> Fixes: 7c710869d64e ("ice: Add handlers for VF netdevice operations")
> Cc: <stable@vger.kernel.org> # 5.14.x
> Signed-off-by: Brett Creeley <brett.creeley@intel.com>
> Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com>
> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> ---
> This should apply to 5.14.x
5.14 is long end-of-life, always look at the kernel.org page if you are
curious what the "active" kernel trees are.
thanks,
greg k-h
next prev parent reply other threads:[~2022-03-05 13:40 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-28 20:46 [PATCH 1/2] ice: Fix race conditions between virtchnl handling and VF ndo ops Jacob Keller
2022-02-28 20:47 ` [PATCH 2/2] ice: fix concurrent reset and removal of VFs Jacob Keller
2022-03-05 13:40 ` Greg KH [this message]
2022-03-07 18:38 ` [PATCH 1/2] ice: Fix race conditions between virtchnl handling and VF ndo ops Keller, Jacob E
-- strict thread matches above, loose matches on Subject: below --
2022-02-25 20:21 Jacob Keller
2022-02-28 11:10 ` Greg KH
2022-02-28 11:23 ` Greg KH
2022-02-28 19:13 ` Keller, Jacob E
2022-02-28 20:57 ` Keller, Jacob E
2022-03-05 13:43 ` Greg KH
2022-03-07 18:38 ` Keller, Jacob E
2022-02-28 19:13 ` Keller, Jacob E
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YiNoN+pvklPaIMT4@kroah.com \
--to=greg@kroah.com \
--cc=jacob.e.keller@intel.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox