All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Takuya Yoshikawa <yoshikawa_takuya_b1@lab.ntt.co.jp>, gleb@kernel.org
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH A] KVM: Simplify kvm->tlbs_dirty handling
Date: Wed, 19 Feb 2014 13:04:37 +0100	[thread overview]
Message-ID: <53049DD5.3040702@redhat.com> (raw)
In-Reply-To: <5303FE62.1080101@lab.ntt.co.jp>

Il 19/02/2014 01:44, Takuya Yoshikawa ha scritto:
> (2014/02/18 18:07), Paolo Bonzini wrote:
>> Il 18/02/2014 09:22, Takuya Yoshikawa ha scritto:
>>> When this was introduced, kvm_flush_remote_tlbs() could be called
>>> without holding mmu_lock.  It is now acknowledged that the function
>>> must be called before releasing mmu_lock, and all callers have already
>>> been changed to do so.
>>>
>>> There is no need to use smp_mb() and cmpxchg() any more.
>>>
>>> Signed-off-by: Takuya Yoshikawa <yoshikawa_takuya_b1@lab.ntt.co.jp>
>>
>> I prefer this patch, and in fact we can make it even simpler:
>>
>> diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
>> index ed1cc89..9816b68 100644
>> --- a/include/linux/kvm_host.h
>> +++ b/include/linux/kvm_host.h
>> @@ -401,7 +401,9 @@ struct kvm {
>>       unsigned long mmu_notifier_seq;
>>       long mmu_notifier_count;
>>   #endif
>> +    /* Protected by mmu_lock */
>>       bool tlbs_dirty;
>> +
>>       struct list_head devices;
>>   };
>>
>> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
>> index 51744da..f5668a4 100644
>> --- a/virt/kvm/kvm_main.c
>> +++ b/virt/kvm/kvm_main.c
>> @@ -188,12 +188,6 @@ void kvm_flush_remote_tlbs(struct kvm *kvm)
>>   {
>>       if (make_all_cpus_request(kvm, KVM_REQ_TLB_FLUSH))
>>           ++kvm->stat.remote_tlb_flush;
>> -    /*
>> -     * tlbs_dirty is used only for optimizing x86's shadow paging
>> code with
>> -     * mmu notifiers in mind, see the note on sync_page().  Since it is
>> -     * always protected with mmu_lock there, should
>> kvm_flush_remote_tlbs()
>> -     * be called before releasing mmu_lock, this is safe.
>> -     */
>>       kvm->tlbs_dirty = false;
>>   }
>>   EXPORT_SYMBOL_GPL(kvm_flush_remote_tlbs);
>>
>>
>> What do you think?
>
> I agree.
>
> But please check Xiao's comment and my reply to it.

Yes, I'll wait some time in case Xiao can get back to his patch set, and 
then make up my mind on what patch to apply.

In any case, if Xiao patches go in a change will be needed.  For patch A 
it would be reverted, for patch B it would edit the comment.  So the two 
patches aren't a lot different in this respect.

Paolo

  reply	other threads:[~2014-02-19 12:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-18  8:21 [PATCH A or B] KVM: kvm->tlbs_dirty handling Takuya Yoshikawa
2014-02-18  8:22 ` [PATCH A] KVM: Simplify " Takuya Yoshikawa
2014-02-18  9:07   ` Paolo Bonzini
2014-02-19  0:44     ` Takuya Yoshikawa
2014-02-19 12:04       ` Paolo Bonzini [this message]
2014-02-18  9:43   ` Xiao Guangrong
2014-02-19  0:40     ` Takuya Yoshikawa
2014-02-18  8:23 ` [PATCH B] KVM: Explain tlbs_dirty trick in kvm_flush_remote_tlbs() Takuya Yoshikawa

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=53049DD5.3040702@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=gleb@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=yoshikawa_takuya_b1@lab.ntt.co.jp \
    /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.