Re: [Xen-devel] [PATCH 06/34] drm/i915: convert put_page() to put_user_page*()
On 8/2/19 11:48 AM, John Hubbard wrote: > On 8/2/19 2:19 AM, Joonas Lahtinen wrote: >> Quoting john.hubb...@gmail.com (2019-08-02 05:19:37) >>> From: John Hubbard ... > In order to deal with the merge problem, I'll drop this patch from my series, > and I'd recommend that the drm-intel-next take the following approach: Actually, I just pulled the latest linux.git, and there are a few changes: > > 1) For now, s/put_page/put_user_page/ in i915_gem_userptr_put_pages(), > and fix up the set_page_dirty() --> set_page_dirty_lock() issue, like this > (based against linux.git): > > diff --git a/drivers/gpu/drm/i915/gem/i915_gem_userptr.c > b/drivers/gpu/drm/i915/gem/i915_gem_userptr.c > index 528b61678334..94721cc0093b 100644 > --- a/drivers/gpu/drm/i915/gem/i915_gem_userptr.c > +++ b/drivers/gpu/drm/i915/gem/i915_gem_userptr.c > @@ -664,10 +664,10 @@ i915_gem_userptr_put_pages(struct drm_i915_gem_object > *obj, > > for_each_sgt_page(page, sgt_iter, pages) { > if (obj->mm.dirty) > - set_page_dirty(page); > + set_page_dirty_lock(page); I see you've already applied this fix to your tree, in linux.git already. > > mark_page_accessed(page); > - put_page(page); > + put_user_page(page); But this conversion still needs doing. So I'll repost a patch that only does this (plus the other call sites). That can go in via either your tree, or Andrew's -mm tree, without generating any conflicts. thanks, -- John Hubbard NVIDIA ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH 06/34] drm/i915: convert put_page() to put_user_page*()
On 8/2/19 2:19 AM, Joonas Lahtinen wrote: Quoting john.hubb...@gmail.com (2019-08-02 05:19:37) From: John Hubbard For pages that were retained via get_user_pages*(), release those pages via the new put_user_page*() routines, instead of via put_page() or release_pages(). This is part a tree-wide conversion, as described in commit fc1d8e7cca2d ("mm: introduce put_user_page*(), placeholder versions"). Note that this effectively changes the code's behavior in i915_gem_userptr_put_pages(): it now calls set_page_dirty_lock(), instead of set_page_dirty(). This is probably more accurate. We've already fixed this in drm-tip where the current code uses set_page_dirty_lock(). This would conflict with our tree. Rodrigo is handling drm-intel-next for 5.4, so you guys want to coordinate how to merge. Hi Joonas, Rodrigo, First of all, I apologize for the API breakage: put_user_pages_dirty_lock() has an additional "dirty" parameter. In order to deal with the merge problem, I'll drop this patch from my series, and I'd recommend that the drm-intel-next take the following approach: 1) For now, s/put_page/put_user_page/ in i915_gem_userptr_put_pages(), and fix up the set_page_dirty() --> set_page_dirty_lock() issue, like this (based against linux.git): diff --git a/drivers/gpu/drm/i915/gem/i915_gem_userptr.c b/drivers/gpu/drm/i915/gem/i915_gem_userptr.c index 528b61678334..94721cc0093b 100644 --- a/drivers/gpu/drm/i915/gem/i915_gem_userptr.c +++ b/drivers/gpu/drm/i915/gem/i915_gem_userptr.c @@ -664,10 +664,10 @@ i915_gem_userptr_put_pages(struct drm_i915_gem_object *obj, for_each_sgt_page(page, sgt_iter, pages) { if (obj->mm.dirty) - set_page_dirty(page); + set_page_dirty_lock(page); mark_page_accessed(page); - put_page(page); + put_user_page(page); } obj->mm.dirty = false; That will leave you with your original set_page_dirty_lock() calls and everything works properly. 2) Next cycle, move to the new put_user_pages_dirty_lock(). thanks, -- John Hubbard NVIDIA Regards, Joonas ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH 06/34] drm/i915: convert put_page() to put_user_page*()
Quoting john.hubb...@gmail.com (2019-08-02 05:19:37) > From: John Hubbard > > For pages that were retained via get_user_pages*(), release those pages > via the new put_user_page*() routines, instead of via put_page() or > release_pages(). > > This is part a tree-wide conversion, as described in commit fc1d8e7cca2d > ("mm: introduce put_user_page*(), placeholder versions"). > > Note that this effectively changes the code's behavior in > i915_gem_userptr_put_pages(): it now calls set_page_dirty_lock(), > instead of set_page_dirty(). This is probably more accurate. We've already fixed this in drm-tip where the current code uses set_page_dirty_lock(). This would conflict with our tree. Rodrigo is handling drm-intel-next for 5.4, so you guys want to coordinate how to merge. Regards, Joonas ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
[Xen-devel] [PATCH 06/34] drm/i915: convert put_page() to put_user_page*()
From: John Hubbard For pages that were retained via get_user_pages*(), release those pages via the new put_user_page*() routines, instead of via put_page() or release_pages(). This is part a tree-wide conversion, as described in commit fc1d8e7cca2d ("mm: introduce put_user_page*(), placeholder versions"). Note that this effectively changes the code's behavior in i915_gem_userptr_put_pages(): it now calls set_page_dirty_lock(), instead of set_page_dirty(). This is probably more accurate. As Christophe Hellwig put it, "set_page_dirty() is only safe if we are dealing with a file backed page where we have reference on the inode it hangs off." [1] [1] https://lore.kernel.org/r/20190723153640.gb...@lst.de Cc: Jani Nikula Cc: Joonas Lahtinen Cc: Rodrigo Vivi Cc: David Airlie Cc: intel-...@lists.freedesktop.org Cc: dri-de...@lists.freedesktop.org Signed-off-by: John Hubbard --- drivers/gpu/drm/i915/gem/i915_gem_userptr.c | 9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/i915/gem/i915_gem_userptr.c b/drivers/gpu/drm/i915/gem/i915_gem_userptr.c index 528b61678334..c18008d3cc2a 100644 --- a/drivers/gpu/drm/i915/gem/i915_gem_userptr.c +++ b/drivers/gpu/drm/i915/gem/i915_gem_userptr.c @@ -527,7 +527,7 @@ __i915_gem_userptr_get_pages_worker(struct work_struct *_work) } mutex_unlock(>mm.lock); - release_pages(pvec, pinned); + put_user_pages(pvec, pinned); kvfree(pvec); i915_gem_object_put(obj); @@ -640,7 +640,7 @@ static int i915_gem_userptr_get_pages(struct drm_i915_gem_object *obj) __i915_gem_userptr_set_active(obj, true); if (IS_ERR(pages)) - release_pages(pvec, pinned); + put_user_pages(pvec, pinned); kvfree(pvec); return PTR_ERR_OR_ZERO(pages); @@ -663,11 +663,8 @@ i915_gem_userptr_put_pages(struct drm_i915_gem_object *obj, i915_gem_gtt_finish_pages(obj, pages); for_each_sgt_page(page, sgt_iter, pages) { - if (obj->mm.dirty) - set_page_dirty(page); - mark_page_accessed(page); - put_page(page); + put_user_pages_dirty_lock(, 1, obj->mm.dirty); } obj->mm.dirty = false; -- 2.22.0 ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel