[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <8A96C0F7-FBE4-4B23-8565-E814401BF927@linux.alibaba.com>
Date: Thu, 8 Jul 2021 11:11:28 +0800
From: Linux <zhaoyan.liao@...ux.alibaba.com>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: mingo@...hat.com, hpa@...or.com, dwmw@...zon.co.uk,
linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org,
songmuchun@...edance.com, likunkun@...edance.com,
guancheng.rjk@...baba-inc.com, duanxiongchun@...edance.com,
wenan.mao@...ux.alibaba.com
Subject: Re: [PATCH] use 64bit timer for hpet
Gleixner,
> Seriously? The wrap-around time for 32bit HPET @24MHz is ~3 minutes.
In some cases, our system will be very busy, and the timeout of 3 minutes
is not an exaggeration. Then, the system considers that the tsc clock is
inaccurate and switches the tsc clock to the hpet clock, which brings
greater performance overhead.
> Aside of that the reason why the kernel does not support 64bit HPET is
> that there are HPETs which advertise 64bit support, but the
> implementation is buggy.
Can you tell me what is the buggy with the 64-bit hpet clock? In my opinion,
it is unreasonable to use a lower-bit width clock to calibrate a higher-bit width
clock, and the hardware already supports the higher-bit width.
> 2021年7月7日 下午6:04,Thomas Gleixner <tglx@...utronix.de> 写道:
>
> Liao,
>
> On Fri, Jul 02 2021 at 16:13, zhaoyan liao wrote:
>> The kernel judges whether the tsc clock is accurate in the
>> clocksource_watchdog background thread function. The hpet clock source
>> is 32-bit, but tsc is 64-bit. Therefore, when the system is busy and the
>> clocksource_watchdog cannot be scheduled in time, the hpet clock may
>> overflow and cause the system to misjudge tsc as unreliable.
>
> Seriously? The wrap-around time for 32bit HPET @24MHz is ~3 minutes.
>
>> In this case, we recommend that the kernel adopts the 64-bit hpet clock
>> by default to keep the width of the two clock sources the same to reduce
>> misjudgment. Some CPU models may not support 64-bit hpet, but according
>> to the description of the CPU's register manual, it does not affect our
>> reading action.
>
> So much for the theory.
>
>> -#define HPET_MASK CLOCKSOURCE_MASK(32)
>> +#define HPET_MASK CLOCKSOURCE_MASK(64)
>
> How is that valid for a 32bit HPET? This breaks the clocksource.
>
>> +inline unsigned long hpet_readq(unsigned int a)
>> +{
>> + return readq(hpet_virt_address + a);
>
> Breaks 32bit build immediately.
>
> Aside of that the reason why the kernel does not support 64bit HPET is
> that there are HPETs which advertise 64bit support, but the
> implementation is buggy.
>
> IOW, while this works for your hardware this breaks quite some parts of
> the universe. Not really a good approach.
>
> Thanks,
>
> tglx
Powered by blists - more mailing lists