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

Re: [PATCH] xen/gntdev: fix unmap notification order


  • To: Oleksandr Andrushchenko <andr2000@xxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx
  • From: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
  • Date: Fri, 10 Dec 2021 19:47:06 -0500
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; 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=jRRZynkeiDfsyhXjA6TFGTv6xSoyW7P3MlF8MKByi/I=; b=Re6LvqsclUT9/jVaZqei0DWNFyxu5i8BhH3wWIVevv7bAqgdn4WQp2oP1dq6bLBEg48w2f5w06VCiJ+bnJx5K+5NE/ztHRfheBZMjIOYjijbzvkr7UdF9x/BWkwvEJbwSJcja+080PEEqC7ppPasuxSlJzrUqMY/P6+nkSOKCmUYV7CoaUxQym109MIFg8gA6ifPlEfBGrUuBqEuSENFAbNW1vYUNiGtLDgN326De94h37l+M+baXIiEi26fFWA1tmITn87S+TSqWTS9nRViJUTqUlfZYnZEe/GxbTklKJAxmA63i0TUQ8MWf2zyoenic6dJTHTNXlHQGmejc7EUTg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BWGR5o1tdIO9dfUDBvqwSb7++Bk27SwpjF7Vy2nYVVtnSNK7KMOO/80yoZb7oOvn8n181MIRHMrDi/AcqeAd71Ml/EdDhnv1mbak0VBE5OoNe+Wck5x0WlmKru78NucRiA20pMGcnFlrPkX03MYZ3idinrgnhpX6Kw8IVh0rur+H3C7gyMF78iP2G6UwRXgJmIErev70bPcDDzGAS/IpdjOj13PsEK1zkqYwhdQ68Jod2a0vxSMrS6PkvFKaWa+mPgnKjYEFoup2peoF52+NEhYtZeqs/tq5jV9WcijsNenMqA3s1gdAdYckbp9AI5ZsWpuRPBBYnylWDu6JseVcuw==
  • Cc: jgross@xxxxxxxx, sstabellini@xxxxxxxxxx, Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>, stable@xxxxxxxxxxxxxxx
  • Delivery-date: Sat, 11 Dec 2021 00:48:07 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>


On 12/10/21 4:28 AM, Oleksandr Andrushchenko wrote:
From: Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>

While working with Xen's libxenvchan library I have faced an issue with
unmap notifications sent in wrong order if both UNMAP_NOTIFY_SEND_EVENT
and UNMAP_NOTIFY_CLEAR_BYTE were requested: first we send an event channel
notification and then clear the notification byte which renders in the below
inconsistency (cli_live is the byte which was requested to be cleared on unmap):

[  444.514243] gntdev_put_map UNMAP_NOTIFY_SEND_EVENT map->notify.event 6
libxenvchan_is_open cli_live 1
[  444.515239] __unmap_grant_pages UNMAP_NOTIFY_CLEAR_BYTE at 14

Thus it is not possible to reliably implement the checks like
- wait for the notification (UNMAP_NOTIFY_SEND_EVENT)
- check the variable (UNMAP_NOTIFY_CLEAR_BYTE)
because it is possible that the variable gets checked before it is cleared
by the kernel.

To fix that we need to re-order the notifications, so the variable is first
gets cleared and then the event channel notification is sent.
With this fix I can see the correct order of execution:

[   54.522611] __unmap_grant_pages UNMAP_NOTIFY_CLEAR_BYTE at 14
[   54.537966] gntdev_put_map UNMAP_NOTIFY_SEND_EVENT map->notify.event 6
libxenvchan_is_open cli_live 0

Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>



Reviewed-by: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>




 


Rackspace

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