Re: [PATCH v3 07/16] KVM: Move vcpu_load to arch-specific kvm_arch_vcpu_ioctl_set_sregs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux