dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/i915: use READ_ONCE() to read vma->iomap in concurrent environment
@ 2024-01-29  4:34 linke li
  2024-03-21  9:49 ` linke li
  0 siblings, 1 reply; 2+ messages in thread
From: linke li @ 2024-01-29  4:34 UTC (permalink / raw)
  To: airlied, daniel; +Cc: intel-gfx, dri-devel, linke li

In function i915_vma_pin_iomap(), vma->iomap is read using READ_ONCE()
in line 562

562    ptr = READ_ONCE(vma->iomap);

while read directly in line 597

592    if (unlikely(cmpxchg(&vma->iomap, NULL, ptr))) {
593        if (page_unmask_bits(ptr))
594            __i915_gem_object_release_map(vma->obj);
595        else
596            io_mapping_unmap(ptr);
597        ptr = vma->iomap;

There is patch similar to this. https://github.com/torvalds/linux/commit/c1c0ce31b2420d5c173228a2132a492ede03d81f
This patch find two read of same variable while one is protected, another
is not. And READ_ONCE() is added to protect.

Signed-off-by: linke li <lilinke99@qq.com>
---
 drivers/gpu/drm/i915/i915_vma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_vma.c b/drivers/gpu/drm/i915/i915_vma.c
index d09aad34ba37..9fcc11db0505 100644
--- a/drivers/gpu/drm/i915/i915_vma.c
+++ b/drivers/gpu/drm/i915/i915_vma.c
@@ -594,7 +594,7 @@ void __iomem *i915_vma_pin_iomap(struct i915_vma *vma)
 				__i915_gem_object_release_map(vma->obj);
 			else
 				io_mapping_unmap(ptr);
-			ptr = vma->iomap;
+			ptr = READ_ONCE(vma->iomap);
 		}
 	}
 
-- 
2.39.3 (Apple Git-145)


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/i915: use READ_ONCE() to read vma->iomap in concurrent environment
  2024-01-29  4:34 [PATCH] drm/i915: use READ_ONCE() to read vma->iomap in concurrent environment linke li
@ 2024-03-21  9:49 ` linke li
  0 siblings, 0 replies; 2+ messages in thread
From: linke li @ 2024-03-21  9:49 UTC (permalink / raw)
  To: lilinke99; +Cc: airlied, daniel, dri-devel, intel-gfx

Hi, I want to confirm the status of this patch and whether need any
additional information.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-03-21 15:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-29  4:34 [PATCH] drm/i915: use READ_ONCE() to read vma->iomap in concurrent environment linke li
2024-03-21  9:49 ` linke li

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).