mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tianyu Lan <Tianyu.Lan@microsoft.com>
To: Junaid Shahid <junaids@google.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Tianyu Lan <Tianyu.Lan@microsoft.com>
Cc: "rkrcmar@redhat.com" <rkrcmar@redhat.com>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	"mingo@redhat.com" <mingo@redhat.com>,
	"hpa@zytor.com" <hpa@zytor.com>,
	"x86@kernel.org" <x86@kernel.org>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Xiao Guangrong <guangrong.xiao@linux.intel.com>
Subject: Re: [PATCH] KVM/MMU: Combine flushing remote tlb in mmu_set_spte()
Date: Wed, 25 Jul 2018 02:35:16 +0000	[thread overview]
Message-ID: <69a525da-32d0-71c3-78e6-f8f8e8d8abb5@microsoft.com> (raw)
In-Reply-To: <8b07e487-0d7c-a8c5-5109-461ffea6e0a5@google.com>

Hi Junaid:
	Thanks for your review.

On 7/25/2018 10:26 AM, Junaid Shahid wrote:
> On 07/24/2018 07:35 AM, Paolo Bonzini wrote:
>> On 24/07/2018 10:17, Tianyu Lan wrote:
>>> mmu_set_spte() flushes remote tlbs for drop_parent_pte/drop_spte()
>>> and set_spte() separately. This may introduce redundant flush. This
>>> patch is to combine these flushes and check flush request after
>>> calling set_spte().
>>>
>>> Signed-off-by: Lan Tianyu <Tianyu.Lan@microsoft.com>
>>
>> Looks good, but I'd like a second opinion.  Guangrong, Junaid, can you
>> review this?
>>
>> Thanks,
>>
>> Paolo
>>
>>> ---
>>>   arch/x86/kvm/mmu.c | 7 ++++---
>>>   1 file changed, 4 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
>>> index 22a7984..8f21632 100644
>>> --- a/arch/x86/kvm/mmu.c
>>> +++ b/arch/x86/kvm/mmu.c
>>> @@ -2901,6 +2901,7 @@ static int mmu_set_spte(struct kvm_vcpu *vcpu, u64 *sptep, unsigned pte_access,
>>>   	int rmap_count;
>>>   	int set_spte_ret;
>>>   	int ret = RET_PF_RETRY;
>>> +	bool flush = false;
>>>   
>>>   	pgprintk("%s: spte %llx write_fault %d gfn %llx\n", __func__,
>>>   		 *sptep, write_fault, gfn);
>>> @@ -2917,12 +2918,12 @@ static int mmu_set_spte(struct kvm_vcpu *vcpu, u64 *sptep, unsigned pte_access,
>>>   
>>>   			child = page_header(pte & PT64_BASE_ADDR_MASK);
>>>   			drop_parent_pte(child, sptep);
>>> -			kvm_flush_remote_tlbs(vcpu->kvm);
>>> +			flush = true;
>>>   		} else if (pfn != spte_to_pfn(*sptep)) {
>>>   			pgprintk("hfn old %llx new %llx\n",
>>>   				 spte_to_pfn(*sptep), pfn);
>>>   			drop_spte(vcpu->kvm, sptep);
>>> -			kvm_flush_remote_tlbs(vcpu->kvm);
>>> +			flush = true;
>>>   		} else
>>>   			was_rmapped = 1;
>>>   	}
>>> @@ -2934,7 +2935,7 @@ static int mmu_set_spte(struct kvm_vcpu *vcpu, u64 *sptep, unsigned pte_access,
>>>   			ret = RET_PF_EMULATE;
>>>   		kvm_make_request(KVM_REQ_TLB_FLUSH, vcpu);
>>>   	}
>>> -	if (set_spte_ret & SET_SPTE_NEED_REMOTE_TLB_FLUSH)
>>> +	if (set_spte_ret & SET_SPTE_NEED_REMOTE_TLB_FLUSH || flush)
>>>   		kvm_flush_remote_tlbs(vcpu->kvm);
>>>   
>>>   	if (unlikely(is_mmio_spte(*sptep)))
>>>
>>
> 
> Reviewed-by: Junaid Shahid <junaids@google.com>
> 

  reply	other threads:[~2018-07-25  2:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-24  8:17 Tianyu Lan
2018-07-24 14:35 ` Paolo Bonzini
2018-07-25  2:26   ` Junaid Shahid
2018-07-25  2:35     ` Tianyu Lan [this message]
2018-07-25  6:22   ` Xiao Guangrong

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=69a525da-32d0-71c3-78e6-f8f8e8d8abb5@microsoft.com \
    --to=tianyu.lan@microsoft.com \
    --cc=guangrong.xiao@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=junaids@google.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=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

all inboxes | Powered by JetHome®