Hi Martin,
-----Original Message-----
From: crash-utility-bounces(a)redhat.com <crash-utility-bounces(a)redhat.com> On Behalf
Of Moore, Martin
(Linux ERT)
Sent: Thursday, April 15, 2021 5:44 AM
To: Discussion list for crash utility usage, maintenance and development
<crash-utility(a)redhat.com>
Subject: [Crash-utility] [PATCH] Skip alternate hz calculation in Linux 4.8+
In task_init() there is a calculation of machdep->hz based on the value of
cfq_slice_async if the symbol
exists:
if (symbol_exists("cfq_slice_async")) {
uint cfq_slice_async;
get_symbol_data("cfq_slice_async", sizeof(int),
&cfq_slice_async);
if (cfq_slice_async) {
machdep->hz = cfq_slice_async * 25;
if (CRASHDEBUG(2))
fprintf(fp,
"cfq_slice_async exists: setting hz to
%d\n",
machdep->hz);
}
}
However, patch “cfq-iosched: Convert from jiffies to nanoseconds”
(
https://patchwork.kernel.org/project/linux-block/patch/1465391499-27867-2...
/) changed the definition of cfq_slice_async from (HZ / 25) to (NSEC_PER_SEC / 25). As
such, the above
calculation will result in a value of 1000000000 for machdep->hz. In vmcores where
the symbol exists and
has this definition, this causes incorrect results for some calculations. I have a
couple of 4.12 vmcores
in this situation, and in them crash shows the uptime as 3 seconds, which also throws off
the timestamps
in “log -T”.
Fix this by skipping the above code block for kernels 4.8 and above:
Thank you for the report and patch, there is another discussion about the
HZ calculation [1], but anyway I think we should have this patch.
Acked-by: Kazuhito Hagio <k-hagio-ab(a)nec.com>
Could I have your Signed-off-by: tag?
Thanks,
Kazu
[1]
https://listman.redhat.com/archives/crash-utility/2021-April/msg00057.html
--- task.c.orig 2021-04-14 16:07:52.021137849 -0400
+++ task.c 2021-04-14 16:11:03.406626370 -0400
@@ -417,7 +417,8 @@
STRUCT_SIZE_INIT(cputime_t, "cputime_t");
- if (symbol_exists("cfq_slice_async")) {
+ if ((THIS_KERNEL_VERSION < LINUX(4,8,0)) &&
+ symbol_exists("cfq_slice_async")) {
uint cfq_slice_async;
get_symbol_data("cfq_slice_async", sizeof(int),
Martin Moore
Linux Engineering Resolution Team
HPE Pointnext Services
Hewlett Packard Enterprise