public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: "Radim Krčmář" <rkrcmar@redhat.com>
To: Ken Hofsass <hofsass@google.com>
Cc: David Hildenbrand <david@redhat.com>,
	kvm@vger.kernel.org, pbonzini@redhat.com, jmattson@google.com
Subject: Re: [PATCH v4 2/2] KVM: x86: KVM_CAP_SYNC_REGS
Date: Fri, 2 Feb 2018 22:04:35 +0100	[thread overview]
Message-ID: <20180202210434.GC27896@flask> (raw)
In-Reply-To: <ac1118b1-6f44-be85-f4c4-7c9e2db2b750@redhat.com>

2018-02-01 14:05+0100, David Hildenbrand:
> > @@ -7351,6 +7363,17 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
> >  		goto out;
> >  	}
> >  
> > +	if (vcpu->run->kvm_valid_regs) {
> 
> You can check directly, without this if. (and not sure if the extra
> function is needed here).

Right, it's unlikely that we'll be doing more checks on kvm_valid_regs,
so I've moved it here and replaced the block with

  if (vcpu->run->kvm_valid_regs & ~KVM_SYNC_X86_VALID_FIELDS) {
  	r = -EINVAL;
  	goto out;
  }

You can see the result in kvm/queue.

Btw. the userspace doesn't know what the next userspace exit is going to
be, so it the purpose of kvm_valid_regs to avoid needless writes of
registers on old userspaces?

Thanks.

> > +		r = check_valid_regs(vcpu);
> > +		if (r != 0)
> > +			goto out;
> > +	}

  reply	other threads:[~2018-02-02 21:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-01  0:03 [PATCH v4 0/2] KVM: x86: Add SYNC REGS functionality Ken Hofsass
2018-02-01  0:03 ` [PATCH v4 1/2] KVM: x86: add SYNC_REGS_SIZE_BYTES #define Ken Hofsass
2018-02-01  0:03 ` [PATCH v4 2/2] KVM: x86: KVM_CAP_SYNC_REGS Ken Hofsass
2018-02-01 13:05   ` David Hildenbrand
2018-02-02 21:04     ` Radim Krčmář [this message]
2018-02-02 23:54       ` Ken Hofsass
2018-02-05  1:29   ` Wanpeng Li
2018-02-06  0:32     ` Ken Hofsass
2018-02-06  0:46       ` Wanpeng Li
2018-02-06 20:03         ` Ken Hofsass

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=20180202210434.GC27896@flask \
    --to=rkrcmar@redhat.com \
    --cc=david@redhat.com \
    --cc=hofsass@google.com \
    --cc=jmattson@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.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