From: Gaurav Kohli <gauravkohli@linux.microsoft.com>
To: Haiyang Zhang <haiyangz@microsoft.com>, Jakub Kicinski <kuba@kernel.org>
Cc: KY Srinivasan <kys@microsoft.com>,
Stephen Hemminger <sthemmin@microsoft.com>,
"wei.liu@kernel.org" <wei.liu@kernel.org>,
Dexuan Cui <decui@microsoft.com>,
"linux-hyperv@vger.kernel.org" <linux-hyperv@vger.kernel.org>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: [PATCH net] hv_netvsc: Fix race between VF offering and VF association message from host
Date: Thu, 6 Oct 2022 09:43:30 +0530 [thread overview]
Message-ID: <c118bbfa-7e55-333c-b8b1-91d6fb0536ac@linux.microsoft.com> (raw)
In-Reply-To: <PH7PR21MB31166EEAA957F467D953D1C1CA569@PH7PR21MB3116.namprd21.prod.outlook.com>
On 9/30/2022 6:33 PM, Haiyang Zhang wrote:
>
>> -----Original Message-----
>> From: Jakub Kicinski <kuba@kernel.org>
>> Sent: Thursday, September 29, 2022 10:26 PM
>> To: Gaurav Kohli <gauravkohli@linux.microsoft.com>
>> Cc: KY Srinivasan <kys@microsoft.com>; Haiyang Zhang
>> <haiyangz@microsoft.com>; Stephen Hemminger
>> <sthemmin@microsoft.com>; wei.liu@kernel.org; Dexuan Cui
>> <decui@microsoft.com>; linux-hyperv@vger.kernel.org;
>> netdev@vger.kernel.org
>> Subject: Re: [PATCH net] hv_netvsc: Fix race between VF offering and VF
>> association message from host
>>
>> On Wed, 28 Sep 2022 06:48:33 -0700 Gaurav Kohli wrote:
>>> During vm boot, there might be possibility that vf registration
>>> call comes before the vf association from host to vm.
>>>
>>> And this might break netvsc vf path, To prevent the same block
>>> vf registration until vf bind message comes from host.
>>>
>>> Cc: stable@vger.kernel.org
>>> Fixes: 00d7ddba11436 ("hv_netvsc: pair VF based on serial number")
>>> Signed-off-by: Gaurav Kohli <gauravkohli@linux.microsoft.com>
>> Is it possible to add a timeout or such? Waiting for an external
>> event while holding rtnl lock seems a little scary.
> We used to have time-out in many places of this driver. But there is
> no protocol guarantees of the host response time, so the time out value
> cannot be set. These time-outs were removed several years ago.
>
>
>> The other question is - what protects the completion and ->vf_alloc
>> from races? Is there some locking? ->vf_alloc only goes from 0 to 1
>> and never back?
Thanks for the comment, i understand your concern for vf_alloc and
reinit completion part, I think
we can move reinit completion to unregistration part of vf code.
Let me send v2 patch.
> When Vf is removed, the vf_assoc msg will set it to 0 here:
> net_device_ctx->vf_alloc = nvmsg->msg.v4_msg.vf_assoc.allocated;
> net_device_ctx->vf_serial = nvmsg->msg.v4_msg.vf_assoc.serial;
>
> Also, I think this condition can be changed from:
> + if (vf_is_up && !net_device_ctx->vf_alloc) {
Thanks for the comment.
This is needed to maintain state machine, as netvsc change event can
comes multiple time. That's why i have put
extra check to avoid any deadlock.
> to:
> + if (vf_is_up) {
> So when VF comes up, it always wait for the completion without depending
> on the vf_alloc.
>
> Thanks,
> - Haiyang
prev parent reply other threads:[~2022-10-06 4:13 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-28 13:48 [PATCH net] hv_netvsc: Fix race between VF offering and VF association message from host Gaurav Kohli
2022-09-29 20:39 ` Haiyang Zhang
2022-09-29 21:09 ` Stephen Hemminger
2022-09-29 21:33 ` Haiyang Zhang
2022-09-29 22:02 ` Stephen Hemminger
2022-09-30 2:26 ` Jakub Kicinski
2022-09-30 13:03 ` Haiyang Zhang
2022-10-06 4:13 ` Gaurav Kohli [this message]
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=c118bbfa-7e55-333c-b8b1-91d6fb0536ac@linux.microsoft.com \
--to=gauravkohli@linux.microsoft.com \
--cc=decui@microsoft.com \
--cc=haiyangz@microsoft.com \
--cc=kuba@kernel.org \
--cc=kys@microsoft.com \
--cc=linux-hyperv@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=sthemmin@microsoft.com \
--cc=wei.liu@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;
as well as URLs for NNTP newsgroup(s).