linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: pbonzini@redhat.com (Paolo Bonzini)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 07/16] KVM: Move vcpu_load to arch-specific kvm_arch_vcpu_ioctl_set_sregs
Date: Tue, 12 Dec 2017 17:33:53 +0100	[thread overview]
Message-ID: <6c05dc6c-5028-9b45-3478-b09c4563bbcd@redhat.com> (raw)
In-Reply-To: <20171211091921.GE910@cbox>

On 11/12/2017 10:19, Christoffer Dall wrote:
> On Fri, Dec 08, 2017 at 05:26:02PM +0100, David Hildenbrand wrote:
>>
>>>  
>>>  int kvm_arch_vcpu_ioctl_get_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
>>> diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
>>> index f647e121070e..cdf0be02c95a 100644
>>> --- a/arch/powerpc/kvm/booke.c
>>> +++ b/arch/powerpc/kvm/booke.c
>>> @@ -1632,18 +1632,25 @@ int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
>>>  {
>>>  	int ret;
>>>  
>>> +	vcpu_load(vcpu);
>>> +
>>> +	ret = -EINVAL;
>>
>> you can initialize this directly.
>>
>>>  	if (vcpu->arch.pvr != sregs->pvr)
>>> -		return -EINVAL;
>>> +		goto out;
>>>  
>>>  	ret = set_sregs_base(vcpu, sregs);
>>>  	if (ret < 0)
>>> -		return ret;
>>> +		goto out;
>>>  
>>>  	ret = set_sregs_arch206(vcpu, sregs);
>>>  	if (ret < 0)
>>> -		return ret;
>>> +		goto out;
>>> +
>>> +	ret = vcpu->kvm->arch.kvm_ops->set_sregs(vcpu, sregs);
>>>  
>>> -	return vcpu->kvm->arch.kvm_ops->set_sregs(vcpu, sregs);
>>> +out:
>>> +	vcpu_put(vcpu);
>>> +	return ret;
>>>  }
>>>  
>>>  int kvmppc_get_one_reg(struct kvm_vcpu *vcpu, u64 id,
>>> diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
>>> index 18011fc4ac49..d95b4f15e52b 100644
>>> --- a/arch/s390/kvm/kvm-s390.c
>>> +++ b/arch/s390/kvm/kvm-s390.c
>>> @@ -2729,8 +2729,12 @@ int kvm_arch_vcpu_ioctl_get_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
>>>  int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
>>>  				  struct kvm_sregs *sregs)
>>>  {
>>> +	vcpu_load(vcpu);
>>> +
>>>  	memcpy(&vcpu->run->s.regs.acrs, &sregs->acrs, sizeof(sregs->acrs));
>>>  	memcpy(&vcpu->arch.sie_block->gcr, &sregs->crs, sizeof(sregs->crs));
>>> +
>>> +	vcpu_put(vcpu);
>>>  	return 0;
>>>  }
>>>  
>>> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
>>> index 20a5f6776eea..a31a80aee0b9 100644
>>> --- a/arch/x86/kvm/x86.c
>>> +++ b/arch/x86/kvm/x86.c
>>> @@ -7500,15 +7500,19 @@ int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
>>>  	int mmu_reset_needed = 0;
>>>  	int pending_vec, max_bits, idx;
>>>  	struct desc_ptr dt;
>>> +	int ret;
>>> +
>>> +	vcpu_load(vcpu);
>>>  
>>> +	ret = -EINVAL;
>>
>> dito
> 
> Sure.

I'm doing it when applying.

Paolo

>> Reviewed-by: David Hildenbrand <david@redhat.com>

  reply	other threads:[~2017-12-12 16:33 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-04 20:35 [PATCH v3 00/16] Move vcpu_load and vcpu_put calls to arch code Christoffer Dall
2017-12-04 20:35 ` [PATCH v3 01/16] KVM: Take vcpu->mutex outside vcpu_load Christoffer Dall
2017-12-05 14:32   ` Christian Borntraeger
2017-12-11 11:51   ` Cornelia Huck
2017-12-04 20:35 ` [PATCH v3 02/16] KVM: Prepare for moving vcpu_load/vcpu_put into arch specific code Christoffer Dall
2017-12-11 11:57   ` Cornelia Huck
2017-12-04 20:35 ` [PATCH v3 03/16] KVM: Move vcpu_load to arch-specific kvm_arch_vcpu_ioctl_run Christoffer Dall
2017-12-05 14:39   ` Christian Borntraeger
2017-12-11 12:02   ` Cornelia Huck
2017-12-04 20:35 ` [PATCH v3 04/16] KVM: Move vcpu_load to arch-specific kvm_arch_vcpu_ioctl_get_regs Christoffer Dall
2017-12-08 16:21   ` David Hildenbrand
2017-12-11 12:07   ` Cornelia Huck
2017-12-04 20:35 ` [PATCH v3 05/16] KVM: Move vcpu_load to arch-specific kvm_arch_vcpu_ioctl_set_regs Christoffer Dall
2017-12-08 16:22   ` David Hildenbrand
2017-12-11 12:09   ` Cornelia Huck
2017-12-04 20:35 ` [PATCH v3 06/16] KVM: Move vcpu_load to arch-specific kvm_arch_vcpu_ioctl_get_sregs Christoffer Dall
2017-12-08 16:23   ` David Hildenbrand
2017-12-11 12:13   ` Cornelia Huck
2017-12-04 20:35 ` [PATCH v3 07/16] KVM: Move vcpu_load to arch-specific kvm_arch_vcpu_ioctl_set_sregs Christoffer Dall
2017-12-08 16:26   ` David Hildenbrand
2017-12-11  9:19     ` Christoffer Dall
2017-12-12 16:33       ` Paolo Bonzini [this message]
2017-12-11 12:15   ` Cornelia Huck
2017-12-04 20:35 ` [PATCH v3 08/16] KVM: Move vcpu_load to arch-specific kvm_arch_vcpu_ioctl_get_mpstate Christoffer Dall
2017-12-11 12:23   ` Cornelia Huck
2017-12-04 20:35 ` [PATCH v3 09/16] KVM: Move vcpu_load to arch-specific kvm_arch_vcpu_ioctl_set_mpstate Christoffer Dall
2017-12-11 12:25   ` Cornelia Huck
2017-12-04 20:35 ` [PATCH v3 10/16] KVM: Move vcpu_load to arch-specific kvm_arch_vcpu_ioctl_translate Christoffer Dall
2017-12-11 12:29   ` Cornelia Huck
2017-12-04 20:35 ` [PATCH v3 11/16] KVM: Move vcpu_load to arch-specific kvm_arch_vcpu_ioctl_set_guest_debug Christoffer Dall
2017-12-11 12:39   ` Cornelia Huck
2017-12-11 15:18     ` Christoffer Dall
2017-12-12 16:36     ` Paolo Bonzini
2017-12-04 20:35 ` [PATCH v3 12/16] KVM: Move vcpu_load to arch-specific kvm_arch_vcpu_ioctl_get_fpu Christoffer Dall
2017-12-11 12:43   ` Cornelia Huck
2017-12-04 20:35 ` [PATCH v3 13/16] KVM: Move vcpu_load to arch-specific kvm_arch_vcpu_ioctl_set_fpu Christoffer Dall
2017-12-11 12:45   ` Cornelia Huck
2017-12-04 20:35 ` [PATCH v3 14/16] KVM: Move vcpu_load to arch-specific kvm_arch_vcpu_ioctl Christoffer Dall
2017-12-11 13:12   ` Cornelia Huck
2017-12-11 15:22     ` Christoffer Dall
2017-12-12 16:47       ` Paolo Bonzini
2017-12-04 20:35 ` [PATCH v3 15/16] KVM: arm/arm64: Avoid vcpu_load for other vcpu ioctls than KVM_RUN Christoffer Dall
2017-12-04 20:35 ` [PATCH v3 16/16] KVM: arm/arm64: Move vcpu_load call after kvm_vcpu_first_run_init Christoffer Dall

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=6c05dc6c-5028-9b45-3478-b09c4563bbcd@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).