diff mbox series

[1/2] pseries/dtl: Use counter in !native case too

Message ID 20251112111051.826922-1-srikar@linux.ibm.com (mailing list archive)
State New
Headers show
Series [1/2] pseries/dtl: Use counter in !native case too | expand

Commit Message

Srikar Dronamraju Nov. 12, 2025, 11:10 a.m. UTC
Currently dtl_count is only under CONFIG_VIRT_CPU_ACCOUNTING_NATIVE.
Its used to track and clear dtl_consumer callback.

Going forward will be using this counter to track if dtl is in-use across
configs. Hence adding its use in !CONFIG_VIRT_CPU_ACCOUNTING_NATIVE case
too.

Signed-off-by: Srikar Dronamraju <srikar@linux.ibm.com>
---
 arch/powerpc/platforms/pseries/dtl.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Srikar Dronamraju March 31, 2026, 6:11 a.m. UTC | #1
* Srikar Dronamraju <srikar@linux.ibm.com> [2025-11-12 16:40:50]:

Hey Madhavan,

> Currently dtl_count is only under CONFIG_VIRT_CPU_ACCOUNTING_NATIVE.
> Its used to track and clear dtl_consumer callback.
> 

Any inputs on this?
Do you want me to repost or something?
diff mbox series

Patch

diff --git a/arch/powerpc/platforms/pseries/dtl.c b/arch/powerpc/platforms/pseries/dtl.c
index f293588b8c7b..6c95781cafb7 100644
--- a/arch/powerpc/platforms/pseries/dtl.c
+++ b/arch/powerpc/platforms/pseries/dtl.c
@@ -36,6 +36,8 @@  static u8 dtl_event_mask = DTL_LOG_ALL;
  * not cross a 4k boundary.
  */
 static int dtl_buf_entries = N_DISPATCH_LOG;
+static atomic_t dtl_count;
+
 
 #ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE
 
@@ -56,8 +58,6 @@  struct dtl_ring {
 
 static DEFINE_PER_CPU(struct dtl_ring, dtl_rings);
 
-static atomic_t dtl_count;
-
 /*
  * The cpu accounting code controls the DTL ring buffer, and we get
  * given entries as they are processed.
@@ -158,7 +158,7 @@  static int dtl_start(struct dtl *dtl)
 
 	/* enable event logging */
 	lppaca_of(dtl->cpu).dtl_enable_mask = dtl_event_mask;
-
+	atomic_inc(&dtl_count);
 	return 0;
 }
 
@@ -169,6 +169,7 @@  static void dtl_stop(struct dtl *dtl)
 	lppaca_of(dtl->cpu).dtl_enable_mask = 0x0;
 
 	unregister_dtl(hwcpu);
+	atomic_dec(&dtl_count);
 }
 
 static u64 dtl_current_index(struct dtl *dtl)