diff options
author | Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com> | 2021-12-10 12:28:17 +0300 |
---|---|---|
committer | Juergen Gross <jgross@suse.com> | 2022-01-06 10:52:22 +0300 |
commit | ce2f46f3531a03781181b7f4bd1ff9f8c5086e7e (patch) | |
tree | 6aa5aea0cea2cad66e46d7c565afefa7d96d9896 /include/xen/pci.h | |
parent | c9e6606c7fe92b50a02ce51dda82586ebdf99b48 (diff) | |
download | linux-ce2f46f3531a03781181b7f4bd1ff9f8c5086e7e.tar.xz |
xen/gntdev: fix unmap notification order
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@vger.kernel.org
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Link: https://lore.kernel.org/r/20211210092817.580718-1-andr2000@gmail.com
Signed-off-by: Juergen Gross <jgross@suse.com>
Diffstat (limited to 'include/xen/pci.h')
0 files changed, 0 insertions, 0 deletions