From: Wanpeng Li <kernellwp@gmail.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
"Chen, Tiejun" <tiejun.chen@intel.com>,
Wanpeng Li <wanpeng.li@linux.intel.com>
Cc: Gleb Natapov <gleb@kernel.org>,
Alexei Starovoitov <alexei.starovoitov@gmail.com>,
Takashi Iwai <tiwai@suse.de>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] KVM: x86: fix access memslots w/o hold srcu read lock
Date: Sat, 01 Nov 2014 10:49:41 +0800 [thread overview]
Message-ID: <54544A45.1000505@gmail.com> (raw)
In-Reply-To: <5453663B.90500@redhat.com>
Hi Paolo,
On 14/10/31 下午6:36, Paolo Bonzini wrote:
>
> On 31/10/2014 06:30, Chen, Tiejun wrote:
>> @@ -4442,6 +4442,7 @@ static void vmx_vcpu_reset(struct kvm_vcpu *vcpu)
>> {
>> struct vcpu_vmx *vmx = to_vmx(vcpu);
>> struct msr_data apic_base_msr;
>> + int idx;
>>
>> vmx->rmode.vm86_active = 0;
>>
>> @@ -4509,7 +4510,9 @@ static void vmx_vcpu_reset(struct kvm_vcpu *vcpu)
>> vmcs_write32(TPR_THRESHOLD, 0);
>> }
>>
>> + idx = srcu_read_lock(&vcpu->kvm->srcu);
>> kvm_vcpu_reload_apic_access_page(vcpu);
>> + srcu_read_unlock(&vcpu->kvm->srcu, idx);
>>
>> if (vmx_vm_has_apicv(vcpu->kvm))
>> memset(&vmx->pi_desc, 0, sizeof(struct pi_desc));
> Not enough; you can call vcpu_enter_guest -> kvm_apic_accept_events ->
> kvm_vcpu_reset -> vmx_vcpu_reset while under the SRCU lock. The right
> place to add the lock is kvm_arch_vcpu_setup.
This is also not enough. I see the warning in the below path during the
test:
kvm_arch_vcpu_ioctl_run
-> kvm_apic_accept_events
-> kvm_vcpu_reset
I just send out the version 3 and hope it can take care all the
situations. ;-)
Regards,
Wanpeng Li
>
> Thanks,
>
> Paolo
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
next prev parent reply other threads:[~2014-11-01 2:49 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-31 4:33 [PATCH] KVM: x86: fix access memslots w/o hold srcu read lock Wanpeng Li
2014-10-31 5:30 ` Chen, Tiejun
2014-10-31 6:11 ` Wanpeng Li
2014-10-31 10:36 ` Paolo Bonzini
2014-10-31 11:10 ` Wanpeng Li
2014-11-01 2:49 ` Wanpeng Li [this message]
2014-11-02 6:50 ` Paolo Bonzini
2014-11-02 7:10 ` Wanpeng Li
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=54544A45.1000505@gmail.com \
--to=kernellwp@gmail.com \
--cc=alexei.starovoitov@gmail.com \
--cc=gleb@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=tiejun.chen@intel.com \
--cc=tiwai@suse.de \
--cc=wanpeng.li@linux.intel.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;
as well as URLs for NNTP newsgroup(s).