[<prev] [next>] [day] [month] [year] [list]
Message-ID: <1f2dd537556548ed8e1de9df9eb130c5@huawei.com>
Date: Wed, 6 Nov 2019 02:02:59 +0000
From: linmiaohe <linmiaohe@...wei.com>
To: Alex Williamson <alex.williamson@...hat.com>
CC: "cohuck@...hat.com" <cohuck@...hat.com>,
"eric.auger@...hat.com" <eric.auger@...hat.com>,
"aik@...abs.ru" <aik@...abs.ru>,
"mpe@...erman.id.au" <mpe@...erman.id.au>,
"bhelgaas@...gle.com" <bhelgaas@...gle.com>,
"tglx@...utronix.de" <tglx@...utronix.de>,
"hexin.op@...il.com" <hexin.op@...il.com>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] VFIO: PCI: eliminate unnecessary overhead in
vfio_pci_reflck_find
On Wed, 6 Nov 2019 03:25
Alex Williamson wrote
>> From: Miaohe Lin <linmiaohe@...wei.com>
>>
>> The driver of the pci device may not equal to vfio_pci_driver, but we
>> fetch vfio_device from pci_dev unconditionally in func
>> vfio_pci_reflck_find. This overhead, such as the competition of
>> vfio.group_lock, can be eliminated by check pci_dev_driver with
>> vfio_pci_driver first.
>>
>
>I believe this introduces a race. When we hold a reference to the vfio device, an unbind from a vfio bus driver will be blocked in vfio_del_group_dev(). Therefore if we test the driver is vfio-pci while holding this reference, we know that it cannot be released and the device_data is a valid vfio_pci_device. Testing the driver prior to acquiring a vfio device reference is meaningless as we have no guarantee that the driver has not changed by the time we acquire a reference. Are you actually seeing contention here or was this a code inspection optimization? Thanks,
>
>Alex
Thanks for your reply and patient explanation. It was a code inspection optimization, and obviously, I missed something. I'm really sorry about that.
Best wishes.
Have a nice day.
Powered by blists - more mailing lists