All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: lirongqing@baidu.com
Cc: kvm@vger.kernel.org, x86@kernel.org,
	Paolo Bonzini <pbonzini@redhat.com>,
	Wanpeng Li <wanpengli@tencent.com>,
	Vitaly Kuznetsov <vkuznets@redhat.com>
Subject: Re: [PATCH] x86/kvm: refine condition for checking vCPU preempted
Date: Tue, 14 Mar 2023 17:15:39 -0700	[thread overview]
Message-ID: <ZBEOK6ws9wGqof3O@google.com> (raw)
In-Reply-To: <20230215121231.43436-1-lirongqing@baidu.com>

+Paolo, Wanpeng, and Vitaly

In the future, use get_maintainers.pl to build To: and Cc: so that the right folks
see the patch.  Not everyone habitually scours the KVM list. :-)

On Wed, Feb 15, 2023, lirongqing@baidu.com wrote:
> From: Li RongQing <lirongqing@baidu.com>
> 
> Check whether vcpu is preempted or not when HLT is trapped or there
> is not realtime hint.

Please explain _why_ there's no need to check for preemption in this setup.  What
may be obvious to you isn't necessarily obvious to reviewers or readers.

> In other words, it is unnecessary to check preemption if HLT is not
> intercepted and guest has realtime hint
> 
> Signed-off-by: Li RongQing <lirongqing@baidu.com>
> ---
>  arch/x86/kernel/kvm.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c
> index 1cceac5..1a2744d 100644
> --- a/arch/x86/kernel/kvm.c
> +++ b/arch/x86/kernel/kvm.c
> @@ -820,8 +820,10 @@ static void __init kvm_guest_init(void)
>  		has_steal_clock = 1;
>  		static_call_update(pv_steal_clock, kvm_steal_clock);
>  
> -		pv_ops.lock.vcpu_is_preempted =
> -			PV_CALLEE_SAVE(__kvm_vcpu_is_preempted);
> +		if (kvm_para_has_feature(KVM_FEATURE_PV_UNHALT) ||

Rather than have the guest rely on host KVM behavior clearing PV_UNHALT when HLT
is passed through), would it make sense to add something like KVM_HINTS_HLT_PASSTHROUGH
to more explicitly tell the guest that HLT isn't intercepted?

> +		     !kvm_para_has_hint(KVM_HINTS_REALTIME))

Misaligned indentation (one too many spaces).

> +			pv_ops.lock.vcpu_is_preempted =
> +				PV_CALLEE_SAVE(__kvm_vcpu_is_preempted);
>  	}
>  
>  	if (kvm_para_has_feature(KVM_FEATURE_PV_EOI))
> -- 
> 2.9.4
> 

  reply	other threads:[~2023-03-15  0:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-15 12:12 [PATCH] x86/kvm: refine condition for checking vCPU preempted lirongqing
2023-03-15  0:15 ` Sean Christopherson [this message]
2023-03-15  3:49   ` Li,Rongqing
2023-03-15 15:26     ` Sean Christopherson
2023-03-16  3:48       ` Li,Rongqing
2023-03-16 17:00         ` Sean Christopherson
2023-03-30  8:15           ` Li,Rongqing
2023-03-30 19:26             ` Sean Christopherson
2023-04-06  7:26               ` Li,Rongqing

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZBEOK6ws9wGqof3O@google.com \
    --to=seanjc@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=lirongqing@baidu.com \
    --cc=pbonzini@redhat.com \
    --cc=vkuznets@redhat.com \
    --cc=wanpengli@tencent.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.