mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Sean Christopherson <sean.j.christopherson@intel.com>
Cc: Vitaly Kuznetsov <vkuznets@redhat.com>,
	Wanpeng Li <wanpengli@tencent.com>,
	Jim Mattson <jmattson@google.com>, Joerg Roedel <joro@8bytes.org>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 03/15] KVM: VMX: Rename "vmx_find_msr_index" to "vmx_find_loadstore_msr_slot"
Date: Sat, 26 Sep 2020 00:04:36 +0200	[thread overview]
Message-ID: <86b26125-1f02-f3d7-2834-c8a1ed8aebf4@redhat.com> (raw)
In-Reply-To: <20200923180409.32255-4-sean.j.christopherson@intel.com>

On 23/09/20 20:03, Sean Christopherson wrote:
> Add "loadstore" to vmx_find_msr_index() to differentiate it from the so
> called shared MSRs helpers (which will soon be renamed), and replace
> "index" with "slot" to better convey that the helper returns slot in the
> array, not the MSR index (the value that gets stuffed into ECX).
> 
> No functional change intended.

"slot" is definitely better, I'll adjust SVM to use it too.

Paolo

> Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
> ---
>  arch/x86/kvm/vmx/nested.c | 16 ++++++++--------
>  arch/x86/kvm/vmx/vmx.c    | 10 +++++-----
>  arch/x86/kvm/vmx/vmx.h    |  2 +-
>  3 files changed, 14 insertions(+), 14 deletions(-)
> 
> diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
> index f818a406302a..87e5d606582e 100644
> --- a/arch/x86/kvm/vmx/nested.c
> +++ b/arch/x86/kvm/vmx/nested.c
> @@ -938,11 +938,11 @@ static bool nested_vmx_get_vmexit_msr_value(struct kvm_vcpu *vcpu,
>  	 * VM-exit in L0, use the more accurate value.
>  	 */
>  	if (msr_index == MSR_IA32_TSC) {
> -		int index = vmx_find_msr_index(&vmx->msr_autostore.guest,
> -					       MSR_IA32_TSC);
> +		int i = vmx_find_loadstore_msr_slot(&vmx->msr_autostore.guest,
> +						    MSR_IA32_TSC);
>  
> -		if (index >= 0) {
> -			u64 val = vmx->msr_autostore.guest.val[index].value;
> +		if (i >= 0) {
> +			u64 val = vmx->msr_autostore.guest.val[i].value;
>  
>  			*data = kvm_read_l1_tsc(vcpu, val);
>  			return true;
> @@ -1031,12 +1031,12 @@ static void prepare_vmx_msr_autostore_list(struct kvm_vcpu *vcpu,
>  	struct vcpu_vmx *vmx = to_vmx(vcpu);
>  	struct vmx_msrs *autostore = &vmx->msr_autostore.guest;
>  	bool in_vmcs12_store_list;
> -	int msr_autostore_index;
> +	int msr_autostore_slot;
>  	bool in_autostore_list;
>  	int last;
>  
> -	msr_autostore_index = vmx_find_msr_index(autostore, msr_index);
> -	in_autostore_list = msr_autostore_index >= 0;
> +	msr_autostore_slot = vmx_find_loadstore_msr_slot(autostore, msr_index);
> +	in_autostore_list = msr_autostore_slot >= 0;
>  	in_vmcs12_store_list = nested_msr_store_list_has_msr(vcpu, msr_index);
>  
>  	if (in_vmcs12_store_list && !in_autostore_list) {
> @@ -1057,7 +1057,7 @@ static void prepare_vmx_msr_autostore_list(struct kvm_vcpu *vcpu,
>  		autostore->val[last].index = msr_index;
>  	} else if (!in_vmcs12_store_list && in_autostore_list) {
>  		last = --autostore->nr;
> -		autostore->val[msr_autostore_index] = autostore->val[last];
> +		autostore->val[msr_autostore_slot] = autostore->val[last];
>  	}
>  }
>  
> diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
> index e99f3bbfa6e9..35291fd90ca0 100644
> --- a/arch/x86/kvm/vmx/vmx.c
> +++ b/arch/x86/kvm/vmx/vmx.c
> @@ -824,7 +824,7 @@ static void clear_atomic_switch_msr_special(struct vcpu_vmx *vmx,
>  	vm_exit_controls_clearbit(vmx, exit);
>  }
>  
> -int vmx_find_msr_index(struct vmx_msrs *m, u32 msr)
> +int vmx_find_loadstore_msr_slot(struct vmx_msrs *m, u32 msr)
>  {
>  	unsigned int i;
>  
> @@ -858,7 +858,7 @@ static void clear_atomic_switch_msr(struct vcpu_vmx *vmx, unsigned msr)
>  		}
>  		break;
>  	}
> -	i = vmx_find_msr_index(&m->guest, msr);
> +	i = vmx_find_loadstore_msr_slot(&m->guest, msr);
>  	if (i < 0)
>  		goto skip_guest;
>  	--m->guest.nr;
> @@ -866,7 +866,7 @@ static void clear_atomic_switch_msr(struct vcpu_vmx *vmx, unsigned msr)
>  	vmcs_write32(VM_ENTRY_MSR_LOAD_COUNT, m->guest.nr);
>  
>  skip_guest:
> -	i = vmx_find_msr_index(&m->host, msr);
> +	i = vmx_find_loadstore_msr_slot(&m->host, msr);
>  	if (i < 0)
>  		return;
>  
> @@ -925,9 +925,9 @@ static void add_atomic_switch_msr(struct vcpu_vmx *vmx, unsigned msr,
>  		wrmsrl(MSR_IA32_PEBS_ENABLE, 0);
>  	}
>  
> -	i = vmx_find_msr_index(&m->guest, msr);
> +	i = vmx_find_loadstore_msr_slot(&m->guest, msr);
>  	if (!entry_only)
> -		j = vmx_find_msr_index(&m->host, msr);
> +		j = vmx_find_loadstore_msr_slot(&m->host, msr);
>  
>  	if ((i < 0 && m->guest.nr == MAX_NR_LOADSTORE_MSRS) ||
>  	    (j < 0 &&  m->host.nr == MAX_NR_LOADSTORE_MSRS)) {
> diff --git a/arch/x86/kvm/vmx/vmx.h b/arch/x86/kvm/vmx/vmx.h
> index 9a418c274880..26887082118d 100644
> --- a/arch/x86/kvm/vmx/vmx.h
> +++ b/arch/x86/kvm/vmx/vmx.h
> @@ -353,7 +353,7 @@ void vmx_set_virtual_apic_mode(struct kvm_vcpu *vcpu);
>  struct shared_msr_entry *find_msr_entry(struct vcpu_vmx *vmx, u32 msr);
>  void pt_update_intercept_for_msr(struct vcpu_vmx *vmx);
>  void vmx_update_host_rsp(struct vcpu_vmx *vmx, unsigned long host_rsp);
> -int vmx_find_msr_index(struct vmx_msrs *m, u32 msr);
> +int vmx_find_loadstore_msr_slot(struct vmx_msrs *m, u32 msr);
>  void vmx_ept_load_pdptrs(struct kvm_vcpu *vcpu);
>  
>  #define POSTED_INTR_ON  0
> 


  reply	other threads:[~2020-09-25 22:04 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-23 18:03 [PATCH v2 00/15] KVM: x86: VMX: Fix MSR namespacing Sean Christopherson
2020-09-23 18:03 ` [PATCH v2 01/15] KVM: x86: Rename "shared_msrs" to "user_return_msrs" Sean Christopherson
2020-09-23 18:03 ` [PATCH v2 02/15] KVM: VMX: Prepend "MAX_" to MSR array size defines Sean Christopherson
2020-09-23 18:03 ` [PATCH v2 03/15] KVM: VMX: Rename "vmx_find_msr_index" to "vmx_find_loadstore_msr_slot" Sean Christopherson
2020-09-25 22:04   ` Paolo Bonzini [this message]
2020-09-23 18:03 ` [PATCH v2 04/15] KVM: VMX: Rename the "shared_msr_entry" struct to "vmx_uret_msr" Sean Christopherson
2020-09-23 18:03 ` [PATCH v2 05/15] KVM: VMX: Rename vcpu_vmx's "nmsrs" to "nr_uret_msrs" Sean Christopherson
2020-09-23 18:04 ` [PATCH v2 06/15] KVM: VMX: Rename vcpu_vmx's "save_nmsrs" to "nr_active_uret_msrs" Sean Christopherson
2020-09-23 18:04 ` [PATCH v2 07/15] KVM: VMX: Rename vcpu_vmx's "guest_msrs_ready" to "guest_uret_msrs_loaded" Sean Christopherson
2020-09-23 18:04 ` [PATCH v2 08/15] KVM: VMX: Rename "__find_msr_index" to "__vmx_find_uret_msr" Sean Christopherson
2020-09-23 18:04 ` [PATCH v2 09/15] KVM: VMX: Check guest support for RDTSCP before processing MSR_TSC_AUX Sean Christopherson
2020-09-23 18:04 ` [PATCH v2 10/15] KVM: VMX: Move uret MSR lookup into update_transition_efer() Sean Christopherson
2020-09-23 18:04 ` [PATCH v2 11/15] KVM: VMX: Add vmx_setup_uret_msr() to handle lookup and swap Sean Christopherson
2020-09-23 18:04 ` [PATCH v2 12/15] KVM: VMX: Rename "find_msr_entry" to "vmx_find_uret_msr" Sean Christopherson
2020-09-23 18:04 ` [PATCH v2 13/15] KVM: VMX: Rename "vmx_set_guest_msr" to "vmx_set_guest_uret_msr" Sean Christopherson
2020-09-23 18:04 ` [PATCH v2 14/15] KVM: VMX: Rename "vmx_msr_index" to "vmx_uret_msrs_list" Sean Christopherson
2020-09-23 18:04 ` [PATCH v2 15/15] KVM: VMX: Rename vmx_uret_msr's "index" to "slot" Sean Christopherson

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=86b26125-1f02-f3d7-2834-c8a1ed8aebf4@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=jmattson@google.com \
    --cc=joro@8bytes.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sean.j.christopherson@intel.com \
    --cc=vkuznets@redhat.com \
    --cc=wanpengli@tencent.com \
    /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

all inboxes | Powered by JetHome®