[PATCH] vdpa/sfc: resolve race between libvhost and dev_conf

Maxime Coquelin maxime.coquelin at redhat.com
Fri Jul 8 12:39:42 CEST 2022



On 7/8/22 12:25, Saini, Abhimanyu wrote:
> [AMD Official Use Only - General]
> 
> Sorry Maxime, I forgot to copy stable.
> Yes it's required, the faulty commit is : 630be406dcbfc26260e9d9688c40a381d0f012db

Thanks, ammended the commit message and applied to
dpdk-next-virtio/main.

> 
> -----Original Message-----
> From: Maxime Coquelin <maxime.coquelin at redhat.com>
> Sent: Friday, July 8, 2022 2:55 PM
> To: abhimanyu.saini at xilinx.com; dev at dpdk.org
> Cc: chenbo.xia at intel.com; andrew.rybchenko at oktetlabs.ru; Saini, Abhimanyu <abhimanyu.saini at amd.com>
> Subject: Re: [PATCH] vdpa/sfc: resolve race between libvhost and dev_conf
> 
> [CAUTION: External Email]
> 
> On 7/8/22 11:23, Maxime Coquelin wrote:
>>
>>
>> On 7/6/22 11:24, abhimanyu.saini at xilinx.com wrote:
>>> From: Abhimanyu Saini <absaini at amd.com>
>>>
>>> libvhost calls dev_conf() before prosessing the
>>> VHOST_USER_SET_VRING_CALL message for the last VQ. So
>>> this message is processed after dev_conf() returns.
>>>
>>> However, the dev_conf() function spawns a thread to set
>>> rte_vhost_host_notifier_ctrl() before returning control to
>>> libvhost. This parallel thread in turn invokes get_notify_area().
>>> To get the notify_area, the vdpa driver needs to query the HW and
>>> for this query it needs an enabled VQ.
>>>
>>> But at the same time libvhost is processing the last
>>> VHOST_USER_SET_VRING_CALL, and to do that it disables the last VQ.
>>>
>>> Hence there is a race b/w the libvhost and the vdpa driver.
>>>
>>> To resolve this race condition, query the HW and cache notify_area
>>> inside dev_conf() instead of doing it the parallel thread.
>>>
>>> Signed-off-by: Abhimanyu Saini <absaini at amd.com>
>>> ---
>>>    drivers/vdpa/sfc/sfc_vdpa_ops.c | 36
>>> ++++++++++++++++++------------------
>>>    drivers/vdpa/sfc/sfc_vdpa_ops.h |  1 +
>>>    2 files changed, 19 insertions(+), 18 deletions(-)
>>>
>>
>> Applied to dpdk-next-virtio/main.
> 
> Sorry, I notice it is missing the Fixes tag, and cc'ing stable.
> Can you confirm this is needed and provide the faulty commit?
> 
> Thanks,
> Maxime
> 
>> Thanks,
>> Maxime



More information about the dev mailing list