[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] vpci: introduce per-domain lock to protect vpci structure


  • To: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • From: Oleksandr Andrushchenko <Oleksandr_Andrushchenko@xxxxxxxx>
  • Date: Tue, 15 Feb 2022 08:39:09 +0000
  • Accept-language: en-US
  • 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=AGzOZK3P9jyQlgkJZoxGfV7/9NOsCNN2B0DcYqsZgPA=; b=EsCCn8zV4p3h/TkJEF28yuQa51tGKFLW+SqDCEBzCAcqLBeQSAh6RmyVukcIbcfWhLMIxssa9L7tTiU04RFX0Hqk98G8PMVSEqC4844DJ388z+whInotEiuO14HI9/wEIuqdVeZWNT5QNMglA3gaWefcWNLvKdsYdKd0DJ8HllZUAzCKAqmZl0+9uKJP882gS9sfcOWidJtgYKlxyrwHJ27Rg1wRKR2Qa/SmYnJR9YTcNyeaBKRu0Y+eQLQizLonKjJjGACC0mktEQbeOxj+2QPIc3nZZGksMFUlKjrUBKc76l2P+nimmSpq7fYACJBARL2+mzga0hmhnHoQ9gYbag==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RitoJCT30OOU6dbbw/cVLY6gmnL8N23GOVmoxKORYdlVtJr7Gth4/wISZ+D8waSHuLh3DBCkrRVRUUdiwM4TE4wKV85APqsgjm1DxeumQjLca4+QFL3fvUozzyrppSEcQ201pnYu3XydHcqds4UJmw1axV1OwZb2nhAyO6Pe+qC5uoVIlzi89KBMjnWHiUsA7yvw19+77IpUWBEFoNiTAuOvQ7x16SSq5h6xVES3/TOz4CMlha7rf4vrqyJfUkd81NVfSOkTulHVt08RYD+W3vQ/khH2e/3dNZQkdQ7McEcV3NDtMimUW511G1xW3i/oMbAJ5/2MvBu2BxsQi43GwA==
  • Cc: Jan Beulich <jbeulich@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "julien@xxxxxxx" <julien@xxxxxxx>, "sstabellini@xxxxxxxxxx" <sstabellini@xxxxxxxxxx>, Oleksandr Tyshchenko <Oleksandr_Tyshchenko@xxxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Artem Mygaiev <Artem_Mygaiev@xxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Rahul Singh <rahul.singh@xxxxxxx>, Oleksandr Andrushchenko <Oleksandr_Andrushchenko@xxxxxxxx>
  • Delivery-date: Tue, 15 Feb 2022 08:40:04 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHYHboQT3cBWYI1/EGunE7hOwop6ayM95MAgAD+qQCAAEaDAIAElIcAgAAQEwCAAAV1AIAABOQAgAABMICAAALZgIAAAzmAgAAWXYCAAARtAIAAAoIAgAABpICAAAWvgIAAA2aAgAE2DQCAAAKFgA==
  • Thread-topic: [PATCH] vpci: introduce per-domain lock to protect vpci structure


On 15.02.22 10:30, Roger Pau Monné wrote:
> On Mon, Feb 14, 2022 at 02:00:26PM +0000, Oleksandr Andrushchenko wrote:
>> /*
>> * FIXME: apply_map is called from dom0 specific init code when
>> * system_state < SYS_STATE_active, so there is no race condition
>> * possible between this code and vpci_process_pending. So, neither
>> * vpci_process_pending may try to acquire the lock in read mode and
>> * also destroy pdev->vpci in its error path nor pdev may be disposed yet.
>> * This means that it is not required to check if the relevant pdev
>> * still exists after re-acquiring the lock.
> I'm not sure why you need to mention vpci_process_pending here:
> apply_map and defer_map are mutually exclusive, so given the current
> code it's impossible to get in a situation where apply_map is called
> while there's pending work on the vCPU (ie: v->vpci.mem != NULL).
>
> Also there's no need for a FIXME tag: the current approach doesn't
> require any fixes unless we start using apply_map in a different
> context.
>
> Hence I think the comment should be along the lines of:
>
> /*
>   * It's safe to drop and reacquire the lock in this context without
>   * risking pdev disappearing because devices cannot be removed until the
>   * initial domain has been started.
>   */
Urgh, I've just sent v2. I'll move this there and answer
>
> Thanks, Roger.
>
Thank you,
Oleksandr

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.