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

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