Re: [PATCH] cpuidle-haltpoll: Disable kvm guest polling when mwait_idle is used

From: Thomas Gleixner
Date: Tue Dec 06 2022 - 07:08:38 EST


On Tue, Dec 06 2022 at 12:59, Rafael J. Wysocki wrote:
> On Tue, Dec 6, 2022 at 7:43 AM <lirongqing@xxxxxxxxx> wrote:
>>
>> +bool is_mwait_idle(void)
>> +{
>> + return x86_idle == mwait_idle;
>> +}
>> +EXPORT_SYMBOL_GPL(is_mwait_idle);

No, this is just another adhoc check, which scratches ONE particular itch.

>> @@ -111,6 +112,9 @@ static int __init haltpoll_init(void)
>> if (!kvm_para_available() || !haltpoll_want())
>> return -ENODEV;
>>
>> + if (is_mwait_idle())
>> + return -ENODEV;
>> +
>
> So perhaps you could make default_enter_idle() be a bit more careful
> about what it calls as the "default idle" routine?

Correct. arch_cpu_idle() is the one which should be called.

Thanks,

tglx