dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/i915/gt: Use standard API for seqcount read in TLB invalidation
@ 2025-10-22  9:15 Andi Shyti
  0 siblings, 0 replies; 4+ messages in thread
From: Andi Shyti @ 2025-10-22  9:15 UTC (permalink / raw)
  To: intel-gfx, dri-devel
  Cc: Andi Shyti, Andi Shyti, Jani Nikula, Christoph Lameter (Ampere)

From: Andi Shyti <andi.shyti@linux.intel.com>

seqprop_sequence() is not intended for use outside seqlock.h.
Although it is accessible as a macro, it is meant to be used only
internally within the header.

Replace it with its proper wrapper, raw_read_seqcount().

Signed-off-by: Andi Shyti <andi.shyti@linux.intel.com>
Co-developed-by: Jani Nikula <jani.nikula@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Christoph Lameter (Ampere) <cl@gentwo.org>
---
Hi,

this patch fixes an issue that came up during Christoph's
work[*], which made his series trickier to move forward.

I also added Jani to the chain of tags, since I later noticed he
had suggested the same thing. Joonas had some concerns about this
approach possibly introducing locking issues, so I ran a few
tests before posting to make sure everything behaves as
expected[**].

There could still be a more refined way to handle the seqcount
for TLB invalidation using raw_seqcount_try_begin() and
read_seqcount_retry(), but that would need a fair bit of
refactoring, and I am not sure it would bring enough benefit.

Thanks,
Andi

[*] https://lore.kernel.org/all/20240912-seq_optimize-v3-1-8ee25e04dffa@gentwo.org/
[**] https://patchwork.freedesktop.org/series/155638/

 drivers/gpu/drm/i915/gt/intel_tlb.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_tlb.h b/drivers/gpu/drm/i915/gt/intel_tlb.h
index 337327af92ac..ec7612216248 100644
--- a/drivers/gpu/drm/i915/gt/intel_tlb.h
+++ b/drivers/gpu/drm/i915/gt/intel_tlb.h
@@ -18,7 +18,7 @@ void intel_gt_fini_tlb(struct intel_gt *gt);
 
 static inline u32 intel_gt_tlb_seqno(const struct intel_gt *gt)
 {
-	return seqprop_sequence(&gt->tlb.seqno);
+	return raw_read_seqcount(&gt->tlb.seqno);
 }
 
 static inline u32 intel_gt_next_invalidate_tlb_full(const struct intel_gt *gt)
-- 
2.51.0


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

* [PATCH] drm/i915/gt: Use standard API for seqcount read in TLB invalidation
@ 2025-10-23 13:28 Andi Shyti
  2025-10-28 12:45 ` Sebastian Brzezinka
  0 siblings, 1 reply; 4+ messages in thread
From: Andi Shyti @ 2025-10-23 13:28 UTC (permalink / raw)
  To: intel-gfx, dri-devel
  Cc: Andi Shyti, Andi Shyti, Jani Nikula, Christoph Lameter (Ampere)

seqprop_sequence() is not intended for use outside seqlock.h.
Although it is accessible as a macro, it is meant to be used only
internally within the header.

Replace it with its proper wrapper, raw_read_seqcount().

Signed-off-by: Andi Shyti <andi.shyti@linux.intel.com>
Co-developed-by: Jani Nikula <jani.nikula@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Christoph Lameter (Ampere) <cl@gentwo.org>
---
Hi,

this patch fixes an issue that came up during Christoph's
work[*], which made his series trickier to move forward.

I also added Jani to the chain of tags, since I later noticed he
had suggested the same thing. Joonas had some concerns about this
approach possibly introducing locking issues, so I ran a few
tests before posting to make sure everything behaves as
expected[**].

There could still be a more refined way to handle the seqcount
for TLB invalidation using raw_seqcount_try_begin() and
read_seqcount_retry(), but that would need a fair bit of
refactoring, and I am not sure it would bring enough benefit.

Thanks,
Andi

[*] https://lore.kernel.org/all/20240912-seq_optimize-v3-1-8ee25e04dffa@gentwo.org/
[**] https://patchwork.freedesktop.org/series/155638/

 drivers/gpu/drm/i915/gt/intel_tlb.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_tlb.h b/drivers/gpu/drm/i915/gt/intel_tlb.h
index 337327af92ac..ec7612216248 100644
--- a/drivers/gpu/drm/i915/gt/intel_tlb.h
+++ b/drivers/gpu/drm/i915/gt/intel_tlb.h
@@ -18,7 +18,7 @@ void intel_gt_fini_tlb(struct intel_gt *gt);
 
 static inline u32 intel_gt_tlb_seqno(const struct intel_gt *gt)
 {
-	return seqprop_sequence(&gt->tlb.seqno);
+	return raw_read_seqcount(&gt->tlb.seqno);
 }
 
 static inline u32 intel_gt_next_invalidate_tlb_full(const struct intel_gt *gt)
-- 
2.51.0


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

* Re: [PATCH] drm/i915/gt: Use standard API for seqcount read in TLB invalidation
  2025-10-23 13:28 [PATCH] drm/i915/gt: Use standard API for seqcount read in TLB invalidation Andi Shyti
@ 2025-10-28 12:45 ` Sebastian Brzezinka
  2025-10-31  9:59   ` Andi Shyti
  0 siblings, 1 reply; 4+ messages in thread
From: Sebastian Brzezinka @ 2025-10-28 12:45 UTC (permalink / raw)
  To: Andi Shyti, intel-gfx, dri-devel
  Cc: Andi Shyti, Jani Nikula, Christoph Lameter (Ampere)

On Thu Oct 23, 2025 at 1:28 PM UTC, Andi Shyti wrote:
> seqprop_sequence() is not intended for use outside seqlock.h.
> Although it is accessible as a macro, it is meant to be used only
> internally within the header.
>
> Replace it with its proper wrapper, raw_read_seqcount().
>
> Signed-off-by: Andi Shyti <andi.shyti@linux.intel.com>
> Co-developed-by: Jani Nikula <jani.nikula@linux.intel.com>
> Signed-off-by: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: Christoph Lameter (Ampere) <cl@gentwo.org>
> ---

LGTM
Reviewed-by: Sebastian Brzezinka <sebastian.brzezinka@intel.com>

-- 
Best regards,
Sebastian


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

* Re: [PATCH] drm/i915/gt: Use standard API for seqcount read in TLB invalidation
  2025-10-28 12:45 ` Sebastian Brzezinka
@ 2025-10-31  9:59   ` Andi Shyti
  0 siblings, 0 replies; 4+ messages in thread
From: Andi Shyti @ 2025-10-31  9:59 UTC (permalink / raw)
  To: Sebastian Brzezinka
  Cc: Andi Shyti, intel-gfx, dri-devel, Jani Nikula,
	Christoph Lameter (Ampere)

Hi Sebastian,

On Tue, Oct 28, 2025 at 12:45:56PM +0000, Sebastian Brzezinka wrote:
> On Thu Oct 23, 2025 at 1:28 PM UTC, Andi Shyti wrote:
> > seqprop_sequence() is not intended for use outside seqlock.h.
> > Although it is accessible as a macro, it is meant to be used only
> > internally within the header.
> >
> > Replace it with its proper wrapper, raw_read_seqcount().
> >
> > Signed-off-by: Andi Shyti <andi.shyti@linux.intel.com>
> > Co-developed-by: Jani Nikula <jani.nikula@linux.intel.com>
> > Signed-off-by: Jani Nikula <jani.nikula@linux.intel.com>
> > Cc: Christoph Lameter (Ampere) <cl@gentwo.org>
> > ---
> 
> LGTM
> Reviewed-by: Sebastian Brzezinka <sebastian.brzezinka@intel.com>

Thank you! Pushed to drm-intel-gt-next.

Andi

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

end of thread, other threads:[~2025-10-31  9:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-23 13:28 [PATCH] drm/i915/gt: Use standard API for seqcount read in TLB invalidation Andi Shyti
2025-10-28 12:45 ` Sebastian Brzezinka
2025-10-31  9:59   ` Andi Shyti
  -- strict thread matches above, loose matches on Subject: below --
2025-10-22  9:15 Andi Shyti

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