Re: [PATCH v2.1] KVM: s390: protvirt: Add initial vm and cpu lifecycle handling

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

 



>>
>>> +	return r;
>>> +}
>>> +
>>> +static int kvm_s390_switch_to_pv(struct kvm *kvm, u16 *rc, u16 *rrc)
>>> +{
>>> +	int i, r = 0;
>>> +	u16 dummy;
>>> +
>>> +	struct kvm_vcpu *vcpu;
>>> +
>>> +	kvm_for_each_vcpu(i, vcpu, kvm) {
>>> +		mutex_lock(&vcpu->mutex);
>>> +		r = kvm_s390_pv_create_cpu(vcpu, rc, rrc);
>>> +		mutex_unlock(&vcpu->mutex);
>>> +		if (r)
>>> +			break;
>>> +	}
>>> +	if (r)
>>> +		kvm_s390_switch_from_pv(kvm,&dummy, &dummy);
>>> +	return r;
>>> +}
>>> +
>>> +static int kvm_s390_handle_pv(struct kvm *kvm, struct kvm_pv_cmd *cmd)
>>> +{
>>> +	int r = 0;
>>> +	u16 dummy;
>>> +	void __user *argp = (void __user *)cmd->data;
>>> +
>>> +	switch (cmd->cmd) {
>>> +	case KVM_PV_ENABLE: {
>>> +		r = -EINVAL;
>>> +		if (kvm_s390_pv_is_protected(kvm))
>>> +			break;
>>
>> Why not factor out this check, it's common for all sucommands.
> 
> Unfortunately it is not common. Sometimes it has an "!" sometimes not.

Right, makes sense.


-- 
Thanks,

David / dhildenb




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux