[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v6 03/13] vpci: move lock outside of struct vpci
- To: Oleksandr Andrushchenko <Oleksandr_Andrushchenko@xxxxxxxx>
- From: Jan Beulich <jbeulich@xxxxxxxx>
- Date: Mon, 7 Feb 2022 13:34:44 +0100
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Z4HYMEJVPW4eKi04+wILEJ/uWqOBbCmoano1A7sqoUI=; b=drNh7IWtVAUlPIZW2ZR2VgPLjuMVlCKfgHlaLme9xZK/0+EkrZXNJ71cD+homjJCqvup47xc6myKCZegeqw+OJPl/4GyINBuaQURAFn+xYPB2JTcZsoeA51ibESNZXp8HlJrB3jPG/PRP7w9TdW6KDzGEHReUPTfnRPTb85aKkQX3BA3SEzvZaASl4VPwI/eHzjMP/f9G5dDpAZ/xBE27/mrb24zEo2bHMEBGsK5oV3OnLNCb/R2RLmP7+SkKEQV0Hum4CrtDKOvZ2PtM4SgYJD0myxg8XLki3uNYFJlRQnDI0DRIDHA6Jk9pqPoh9mg/YTUgrqq1F3nEr9qv8Ewog==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fPCunMMh6ig0r6QBgHcyCEJFx2uJLNuHcHLK3F8c7WRTEXMMPzzBglGbZBVhiGw7zStxjN8e9SkDwjmufjPztOqHhe5vg58M/X4J1isQbXo/CpMlnc55opnaJXCFKsaVLCRrCFf6Z9PSMhbvcvmWNSdplFYofC/Lz8dWossTg48JZ1TE4//TW+y5lc8ULKFUNN5cpZqLIZQ7sLl/SBLSfxqa+AjU4a+B1nK7LnRpjaeqI4zkTgy2vce5O2NL8xMvaDfvtQS5HU3T+assVqmqmlTQLNOR7LoUMcz2QdQ/Q+VXpEQu+HqGRJ8+f4qfEZxJ32FtnwnSl21/9P5gCPsftw==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
- Cc: "julien@xxxxxxx" <julien@xxxxxxx>, "sstabellini@xxxxxxxxxx" <sstabellini@xxxxxxxxxx>, Oleksandr Tyshchenko <Oleksandr_Tyshchenko@xxxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Artem Mygaiev <Artem_Mygaiev@xxxxxxxx>, "andrew.cooper3@xxxxxxxxxx" <andrew.cooper3@xxxxxxxxxx>, "george.dunlap@xxxxxxxxxx" <george.dunlap@xxxxxxxxxx>, "paul@xxxxxxx" <paul@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Rahul Singh <rahul.singh@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
- Delivery-date: Mon, 07 Feb 2022 12:35:00 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 07.02.2022 12:08, Oleksandr Andrushchenko wrote:
> 1. vpci_{read|write} are not protected with pcidevs_lock and can run in
> parallel with pci_remove_device which can remove pdev after vpci_{read|write}
> acquired the pdev pointer. This may lead to a fail due to pdev dereference.
>
> So, to protect pdev dereference vpci_{read|write} must also use pdevs_lock.
I think this is not the only place where there is a theoretical race
against pci_remove_device(). I would recommend to separate the
overall situation with pcidevs_lock from the issue here. I don't view
it as an option to acquire pcidevs_lock in vpci_{read,write}(). If
anything, we need proper refcounting of PCI devices (at which point
likely a number of lock uses can go away).
Jan
|