Blame SOURCES/0001-Fix-for-timer-r-option-to-display-all-the-per-CPU-cl.patch

8c35ac
From 70a27ae9f2b45d6dba56ee4240b6adf79c544ee1 Mon Sep 17 00:00:00 2001
8c35ac
From: Lianbo Jiang <lijiang@redhat.com>
8c35ac
Date: Thu, 6 Jan 2022 22:34:26 +0800
8c35ac
Subject: [PATCH 01/10] Fix for "timer -r" option to display all the per-CPU
8c35ac
 clocks
8c35ac
8c35ac
Currently, the hrtimer_max_clock_bases is hard-coded to 3, which
8c35ac
makes that crash only prints three clocks, and the rest of clocks
8c35ac
are not displayed.
8c35ac
8c35ac
Without the patch:
8c35ac
crash> timer -r -C 11
8c35ac
CPU: 11  HRTIMER_CPU_BASE: ffff9a775f95ee00
8c35ac
  CLOCK: 0  HRTIMER_CLOCK_BASE: ffff9a775f95ee80  [ktime_get]
8c35ac
  (empty)
8c35ac
8c35ac
  CLOCK: 1  HRTIMER_CLOCK_BASE: ffff9a775f95ef00  [ktime_get_real]
8c35ac
  (empty)
8c35ac
8c35ac
  CLOCK: 2  HRTIMER_CLOCK_BASE: ffff9a775f95ef80  [ktime_get_boottime]
8c35ac
  (empty)
8c35ac
8c35ac
With the patch:
8c35ac
crash> timer -r -C 11
8c35ac
CPU: 11  HRTIMER_CPU_BASE: ffff9a775f95ee00
8c35ac
  CLOCK: 0  HRTIMER_CLOCK_BASE: ffff9a775f95ee80  [ktime_get]
8c35ac
  (empty)
8c35ac
8c35ac
  CLOCK: 1  HRTIMER_CLOCK_BASE: ffff9a775f95ef00  [ktime_get_real]
8c35ac
  (empty)
8c35ac
8c35ac
  CLOCK: 2  HRTIMER_CLOCK_BASE: ffff9a775f95ef80  [ktime_get_boottime]
8c35ac
  (empty)
8c35ac
...
8c35ac
  CLOCK: 7  HRTIMER_CLOCK_BASE: ffff9a775f95f200  [ktime_get_clocktai]
8c35ac
  (empty)
8c35ac
8c35ac
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
8c35ac
---
8c35ac
 kernel.c | 3 ++-
8c35ac
 1 file changed, 2 insertions(+), 1 deletion(-)
8c35ac
8c35ac
diff --git a/kernel.c b/kernel.c
8c35ac
index 37b7af74ed2e..36c57ed501ad 100644
8c35ac
--- a/kernel.c
8c35ac
+++ b/kernel.c
8c35ac
@@ -7675,7 +7675,8 @@ dump_hrtimer_data(const ulong *cpus)
8c35ac
 	if (VALID_STRUCT(hrtimer_clock_base)) {
8c35ac
 		hrtimer_max_clock_bases = 2;
8c35ac
 		if (symbol_exists("ktime_get_boottime"))
8c35ac
-			hrtimer_max_clock_bases = 3;
8c35ac
+			hrtimer_max_clock_bases = MEMBER_SIZE("hrtimer_cpu_base", "clock_base") /
8c35ac
+							SIZE(hrtimer_clock_base);
8c35ac
 	} else if (VALID_STRUCT(hrtimer_base)) {
8c35ac
 		max_hrtimer_bases = 2;
8c35ac
 	} else
8c35ac
-- 
8c35ac
2.20.1
8c35ac