mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Like Xu <like.xu@linux.intel.com>
To: Anton Kuchin <antonkuchin@yandex-team.ru>, kvm@vger.kernel.org
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
	"Radim Krčmář" <rkrcmar@redhat.com>,
	"Borislav Petkov" <bp@alien8.de>,
	x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
	linux-kernel@vger.kernel.org,
	"Thomas Gleixner" <tglx@linutronix.de>,
	"Ingo Molnar" <mingo@redhat.com>,
	"Evgeny Yakovlev" <wrfsh@yandex-team.ru>
Subject: Re: [PATCH] KVM: Ignore LBR MSRs with no effect
Date: Tue, 19 Feb 2019 14:38:54 +0800	[thread overview]
Message-ID: <ccdb6e15-7cdf-7e96-19aa-b02c7d5b5b3e@linux.intel.com> (raw)
In-Reply-To: <20190128174322.8529-1-antonkuchin@yandex-team.ru>

On 2019/1/29 1:43, Anton Kuchin wrote:
> Win10 attempts to save these registers during KiSaveDebugRegisterState
> if LBR or BTF bits are set in MSR_IA32_DEBUGCTLMSR. It uses DR7 GE and LE
> flags for per-thread switching of these these features so zero value that
> is returned for MSR_IA32_DEBUGCTLMSR has no effect.
> 
> These registers are used for debugging and shouldn't cause #GP and
> guest crash so just return zeroes just like we do for common x86 LBR
> MSRs (DEBUGCTLMSR, LAST[BRANCH|INT][TO|FROM]IP).
> 
> Signed-off-by: Anton Kuchin <antonkuchin@yandex-team.ru>
> ---
>   arch/x86/kvm/vmx/vmx.c | 7 +++++++
>   1 file changed, 7 insertions(+)
> 
> diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
> index f6915f10e584..8bc56cf027ed 100644
> --- a/arch/x86/kvm/vmx/vmx.c
> +++ b/arch/x86/kvm/vmx/vmx.c
> @@ -1769,6 +1769,13 @@ static int vmx_get_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
>   		else
>   			msr_info->data = vmx->pt_desc.guest.addr_a[index / 2];
>   		break;
> +	case MSR_LBR_TOS:
> +	case MSR_LBR_NHM_FROM ... MSR_LBR_NHM_FROM + 31:
> +	case MSR_LBR_NHM_TO ... MSR_LBR_NHM_TO + 31:
> +	case MSR_LBR_CORE_FROM ... MSR_LBR_CORE_FROM + 7:
> +	case MSR_LBR_CORE_TO ... MSR_LBR_CORE_TO + 7:
> +		msr_info->data = 0;
> +		break;

It's better to move LBR stack MSRs set-up to 
vmx/pmu_intel.c:intel_pmu_get_msr and using specified sizes (31 or 7) is 
not a good practice.

vLBR is still in an unenabled state and
please check https://lkml.org/lkml/2018/12/26/82 for dependency check.

>   	case MSR_TSC_AUX:
>   		if (!msr_info->host_initiated &&
>   		    !guest_cpuid_has(vcpu, X86_FEATURE_RDTSCP))
> 


      reply	other threads:[~2019-02-19  6:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-28 17:43 Anton Kuchin
2019-02-19  6:38 ` Like Xu [this message]

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=ccdb6e15-7cdf-7e96-19aa-b02c7d5b5b3e@linux.intel.com \
    --to=like.xu@linux.intel.com \
    --cc=antonkuchin@yandex-team.ru \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=rkrcmar@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=wrfsh@yandex-team.ru \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome