[PATCH] x86/kvm: Downgrade host poll messages to pr_debug_once()

lirongqing posted 1 patch 2 months, 2 weeks ago
arch/x86/kernel/kvm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] x86/kvm: Downgrade host poll messages to pr_debug_once()
Posted by lirongqing 2 months, 2 weeks ago
From: Li RongQing <lirongqing@baidu.com>

The current host-side polling messages are misleading, as they will be
printed when the hypervisor intentionally disables polling (by providing
MWAIT to the guest) rather than due to version incompatibility. so
Downgrade to pr_debug_once() to prevent spurious log messages.

Signed-off-by: Li RongQing <lirongqing@baidu.com>
---
 arch/x86/kernel/kvm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c
index 9cda79f..c5f96ee 100644
--- a/arch/x86/kernel/kvm.c
+++ b/arch/x86/kernel/kvm.c
@@ -1136,8 +1136,8 @@ static void kvm_enable_host_haltpoll(void *i)
 void arch_haltpoll_enable(unsigned int cpu)
 {
 	if (!kvm_para_has_feature(KVM_FEATURE_POLL_CONTROL)) {
-		pr_err_once("host does not support poll control\n");
-		pr_err_once("host upgrade recommended\n");
+		pr_debug_once("host does not support poll control\n");
+		pr_debug_once("host upgrade recommended\n");
 		return;
 	}
 
-- 
2.9.4
Re: [PATCH] x86/kvm: Downgrade host poll messages to pr_debug_once()
Posted by Sean Christopherson 2 months, 2 weeks ago
On Tue, Jul 22, 2025, lirongqing wrote:
> From: Li RongQing <lirongqing@baidu.com>
> 
> The current host-side polling messages are misleading, as they will be
> printed when the hypervisor intentionally disables polling (by providing
> MWAIT to the guest) rather than due to version incompatibility. so
> Downgrade to pr_debug_once() to prevent spurious log messages.

I agree the messages are unfortunate, but the guest can't possibly know that the
host is correctly configured.  E.g. if MWAIT is allowed, but the host is still
intercepting HLT and the guest happens to choose HLT for idling, then the guest
is absolutely right to complain.

And there's really no reason for the host to NOT provide KVM_FEATURE_POLL_CONTROL.
The only thing the guest can do with MSR_KVM_POLL_CONTROL is to disable host-side
halt-polling, and for a KVM_HINTS_REALTIME vCPU, single_task_running() should hold
true the vast majority of the time.  I.e. a properly configured host won't actually
poll anyways, so providing KVM_FEATURE_POLL_CONTROL is basically a nop.

In other words, I agree using pr_err is annoying, but I don't think downgrading
it is quite right either.

> Signed-off-by: Li RongQing <lirongqing@baidu.com>
> ---
>  arch/x86/kernel/kvm.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c
> index 9cda79f..c5f96ee 100644
> --- a/arch/x86/kernel/kvm.c
> +++ b/arch/x86/kernel/kvm.c
> @@ -1136,8 +1136,8 @@ static void kvm_enable_host_haltpoll(void *i)
>  void arch_haltpoll_enable(unsigned int cpu)
>  {
>  	if (!kvm_para_has_feature(KVM_FEATURE_POLL_CONTROL)) {
> -		pr_err_once("host does not support poll control\n");
> -		pr_err_once("host upgrade recommended\n");
> +		pr_debug_once("host does not support poll control\n");
> +		pr_debug_once("host upgrade recommended\n");
>  		return;
>  	}
>  
> -- 
> 2.9.4
>