[PATCH] Skip alternate hz calculation in Linux 4.8+

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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-git-send-email-jack@xxxxxxx/) 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:

 

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

 

--
Crash-utility mailing list
Crash-utility@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/crash-utility

[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux