* [PATCH] xen/gntdev: Do not use mm notifiers with autotranslating guests
@ 2020-01-28 16:24 Boris Ostrovsky
2020-01-28 16:28 ` Jürgen Groß
2020-01-28 16:30 ` Jason Gunthorpe
0 siblings, 2 replies; 3+ messages in thread
From: Boris Ostrovsky @ 2020-01-28 16:24 UTC (permalink / raw)
To: xen-devel; +Cc: jgg, jgross, linux-kernel, ilpo.jarvinen, stable
Commit d3eeb1d77c5d ("xen/gntdev: use mmu_interval_notifier_insert")
missed a test for use_ptemod when calling mmu_interval_read_begin(). Fix
that.
Fixes: d3eeb1d77c5d ("xen/gntdev: use mmu_interval_notifier_insert")
CC: stable@vger.kernel.org # 5.5
Reported-by: Ilpo Järvinen <ilpo.jarvinen@cs.helsinki.fi>
Tested-by: Ilpo Järvinen <ilpo.jarvinen@cs.helsinki.fi>
Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
---
drivers/xen/gntdev.c | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c
index 4fc83e3f5ad3..0258415ca0b2 100644
--- a/drivers/xen/gntdev.c
+++ b/drivers/xen/gntdev.c
@@ -1006,19 +1006,19 @@ static int gntdev_mmap(struct file *flip, struct vm_area_struct *vma)
}
mutex_unlock(&priv->lock);
- /*
- * gntdev takes the address of the PTE in find_grant_ptes() and passes
- * it to the hypervisor in gntdev_map_grant_pages(). The purpose of
- * the notifier is to prevent the hypervisor pointer to the PTE from
- * going stale.
- *
- * Since this vma's mappings can't be touched without the mmap_sem,
- * and we are holding it now, there is no need for the notifier_range
- * locking pattern.
- */
- mmu_interval_read_begin(&map->notifier);
-
if (use_ptemod) {
+ /*
+ * gntdev takes the address of the PTE in find_grant_ptes() and
+ * passes it to the hypervisor in gntdev_map_grant_pages(). The
+ * purpose of the notifier is to prevent the hypervisor pointer
+ * to the PTE from going stale.
+ *
+ * Since this vma's mappings can't be touched without the
+ * mmap_sem, and we are holding it now, there is no need for
+ * the notifier_range locking pattern.
+ */
+ mmu_interval_read_begin(&map->notifier);
+
map->pages_vm_start = vma->vm_start;
err = apply_to_page_range(vma->vm_mm, vma->vm_start,
vma->vm_end - vma->vm_start,
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] xen/gntdev: Do not use mm notifiers with autotranslating guests
2020-01-28 16:24 [PATCH] xen/gntdev: Do not use mm notifiers with autotranslating guests Boris Ostrovsky
@ 2020-01-28 16:28 ` Jürgen Groß
2020-01-28 16:30 ` Jason Gunthorpe
1 sibling, 0 replies; 3+ messages in thread
From: Jürgen Groß @ 2020-01-28 16:28 UTC (permalink / raw)
To: Boris Ostrovsky, xen-devel; +Cc: jgg, linux-kernel, ilpo.jarvinen, stable
On 28.01.20 17:24, Boris Ostrovsky wrote:
> Commit d3eeb1d77c5d ("xen/gntdev: use mmu_interval_notifier_insert")
> missed a test for use_ptemod when calling mmu_interval_read_begin(). Fix
> that.
>
> Fixes: d3eeb1d77c5d ("xen/gntdev: use mmu_interval_notifier_insert")
> CC: stable@vger.kernel.org # 5.5
> Reported-by: Ilpo Järvinen <ilpo.jarvinen@cs.helsinki.fi>
> Tested-by: Ilpo Järvinen <ilpo.jarvinen@cs.helsinki.fi>
> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Acked-by: Juergen Gross <jgross@suse.com>
Juergen
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] xen/gntdev: Do not use mm notifiers with autotranslating guests
2020-01-28 16:24 [PATCH] xen/gntdev: Do not use mm notifiers with autotranslating guests Boris Ostrovsky
2020-01-28 16:28 ` Jürgen Groß
@ 2020-01-28 16:30 ` Jason Gunthorpe
1 sibling, 0 replies; 3+ messages in thread
From: Jason Gunthorpe @ 2020-01-28 16:30 UTC (permalink / raw)
To: Boris Ostrovsky; +Cc: xen-devel, jgross, linux-kernel, ilpo.jarvinen, stable
On Tue, Jan 28, 2020 at 11:24:19AM -0500, Boris Ostrovsky wrote:
> Commit d3eeb1d77c5d ("xen/gntdev: use mmu_interval_notifier_insert")
> missed a test for use_ptemod when calling mmu_interval_read_begin(). Fix
> that.
>
> Fixes: d3eeb1d77c5d ("xen/gntdev: use mmu_interval_notifier_insert")
> CC: stable@vger.kernel.org # 5.5
> Reported-by: Ilpo Järvinen <ilpo.jarvinen@cs.helsinki.fi>
> Tested-by: Ilpo Järvinen <ilpo.jarvinen@cs.helsinki.fi>
> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> ---
> drivers/xen/gntdev.c | 24 ++++++++++++------------
> 1 file changed, 12 insertions(+), 12 deletions(-)
Yes, this looks like it for the ptemod miss, thanks
Reviewed-by: Jason Gunthorpe <jgg@mellanox.com>
Jason
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-01-28 16:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-28 16:24 [PATCH] xen/gntdev: Do not use mm notifiers with autotranslating guests Boris Ostrovsky
2020-01-28 16:28 ` Jürgen Groß
2020-01-28 16:30 ` Jason Gunthorpe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).