mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Wanpeng Li <kernellwp@gmail.com>,
	linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Cc: "Radim Krčmář" <rkrcmar@redhat.com>,
	"Wanpeng Li" <wanpeng.li@hotmail.com>,
	"Nadav Amit" <nadav.amit@gmail.com>,
	"Dmitry Vyukov" <dvyukov@google.com>
Subject: Re: [PATCH v2] KVM: VMX: Fix rflags cache during vCPU reset
Date: Tue, 21 Nov 2017 00:09:14 +0100	[thread overview]
Message-ID: <eeb8c609-3fbb-bdd4-5556-d75dec87a6bd@redhat.com> (raw)
In-Reply-To: <1511218341-6221-1-git-send-email-wanpeng.li@hotmail.com>

On 20/11/2017 23:52, Wanpeng Li wrote:
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index b348920..131fa1c 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -5590,6 +5590,7 @@ static void vmx_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event)
>  		vmcs_write64(GUEST_IA32_DEBUGCTL, 0);
>  	}
>  
> +	kvm_set_rflags(vcpu, 2);
>  	vmcs_writel(GUEST_RFLAGS, 0x02);

I think the vmcs_writel can go, kvm_set_rflags ends up calling
vmx_set_rflags.

>  	kvm_rip_write(vcpu, 0xfff0);
>  
> 

Beautified testcase:

    #include <unistd.h>
    #include <sys/syscall.h>
    #include <string.h>
    #include <stdint.h>
    #include <linux/kvm.h>
    #include <fcntl.h>
    #include <sys/ioctl.h>

    long r[5];
    int main()
    {
        struct kvm_debugregs dr = { 0 };

        r[2] = open("/dev/kvm", O_RDONLY);
        r[3] = ioctl(r[2], KVM_CREATE_VM, 0);
        r[4] = ioctl(r[3], KVM_CREATE_VCPU, 7);
        struct kvm_guest_debug debug = {
                .control = 0xf0403,
                .arch = {
                        .debugreg[6] = 0x2,
                        .debugreg[7] = 0x2
                }
        };
        ioctl(r[4], KVM_SET_GUEST_DEBUG, &debug);
        ioctl(r[4], KVM_RUN, 0);
    }

No need to do anything, I'll handle this patch after -rc1.

Paolo

  reply	other threads:[~2017-11-20 23:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-20 22:52 Wanpeng Li
2017-11-20 23:09 ` Paolo Bonzini [this message]
2017-11-21  0:34   ` Wanpeng Li
2017-12-05  0:28     ` Jim Mattson
2017-12-05  0:53       ` Wanpeng Li
2017-12-05 13:54         ` Paolo Bonzini
2017-12-05 17:53           ` Jim Mattson

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=eeb8c609-3fbb-bdd4-5556-d75dec87a6bd@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=dvyukov@google.com \
    --cc=kernellwp@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nadav.amit@gmail.com \
    --cc=rkrcmar@redhat.com \
    --cc=wanpeng.li@hotmail.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®