[Crash-utility] [PATCH] Fix machdep->HZ calculation for kernel versions > 2.6.0

lijiang lijiang at redhat.com
Wed Apr 21 03:32:19 UTC 2021


在 2021年01月12日 16:24, HAGIO KAZUHITO(萩尾 一仁) 写道:
> Hi Bhupesh,
> 
> -----Original Message-----
>> We have hard-coded the HZ value for some ARCHs to either 1000 or 100
>> (mainly for kernel versions > 2.6.0), which causes 'help -m' to show
>> an incorrect hz value for various architectures.
> 
> Good catch.  but seems crash uses (cfq_slice_async * 25) for machdep->hz
> if it exists (please see task_init()), RHEL7 has it, but RHEL8 does not.
> What do you see on RHEL8 for x86_64 with your patch?
> 

The symbol 'cfq_slice_async' has been removed from upstream kernel:
f382fb0bcef4 ("block: remove legacy IO schedulers")

And RHEL8 also removed it.

> We should search for an alternate way like the current one first.
> 

Currently, there are several ways to get the value of HZ as below:

[1] calculate hz via the symbol 'cfq_slice_async'
    But this symbol has been removed from upstream kernel

[2] hardcode hz with the value 1000 (if kernel version > 2.6.0)

[3] get the hz value from vmcore, but that relies on kernel config
    such as CONFIG_IKCONFIG, etc.

[4] Use sysconf(_SC_CLK_TCK) on some arches, not all arches.
    See the micro definition of HZ in the defs.h

There seems to be no perfect solution. Any ideas?


Thanks.
Lianbo

> Thanks,
> Kazu
> 
>>
>> I tested this on ppc64le and x86_64 and the hz value reported is 1000,
>> whereas the kernel CONFIG_HZ_100 is set to Y. See some logs below:
>>
>> crash> help -m
>>               flags: 124000f5
>> (KSYMS_START|MACHDEP_BT_TEXT|VM_4_LEVEL|VMEMMAP|VMEMMAP_AWARE|PHYS_ENTRY_L4|SWAP_ENTRY_L4|RADIX_MMU|OP
>> AL_FW)
>>              kvbase: c000000000000000
>>   identity_map_base: c000000000000000
>>            pagesize: 65536
>>           pageshift: 16
>>            pagemask: ffffffffffff0000
>>          pageoffset: ffff
>>           stacksize: 16384
>>                  hz: 1000
>>                 mhz: 2800
>>
>> [host at rhel7]$ grep CONFIG_HZ_100= redhat/configs/kernel-3.10.0-ppc64le.config
>> CONFIG_HZ_100=y
>>
>> Fix the same by using the sysconf(_SC_CLK_TCK) value instead of the
>> hardcoded HZ values depending on kernel versions.
>>
> 




More information about the Crash-utility mailing list