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@suse.cz/) 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