lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Tue, 07 Feb 2012 13:37:18 +0900 From: Takuya Yoshikawa <yoshikawa.takuya@....ntt.co.jp> To: Liu Ping Fan <kernelfans@...il.com> CC: kvm@...r.kernel.org, linux-kernel@...r.kernel.org, avi@...hat.com, aliguori@...ibm.com, gleb@...hat.com, mtosatti@...hat.com, xiaoguangrong.eric@...il.com, jan.kiszka@....de Subject: Re: [PATCH v8] kvm: make vcpu life cycle separated from kvm instance (2012/02/07 11:34), Liu Ping Fan wrote: > static int kvm_vcpu_release(struct inode *inode, struct file *filp) Is this a hot path? If no, do you really need to pre-allocate the space for the next vcpus? > { > + int i; > struct kvm_vcpu *vcpu = filp->private_data; > + struct kvm *kvm = vcpu->kvm; > + struct kvm_vcpu *vcpus_next; > + filp->private_data = NULL; > + > + for (i = 0; i< atomic_read(&kvm->online_vcpus); i++) { > + if (vcpu == kvm->vcpus+i) > + break; > + } > + mutex_lock(&kvm->lock); > + vcpus_next = kvm->vcpus_array + > + ((kvm->vcpus - kvm->vcpus_array) ? 0 : KVM_MAX_VCPUS); > + > + memset(vcpus_next, 0, KVM_MAX_VCPUS*sizeof(struct kvm_vcpu *)); > + memcpy(vcpus_next, kvm->vcpus, i*sizeof(struct kvm_vcpu *)); > + memcpy(vcpus_next+i, kvm->vcpus+i+1, > + (atomic_read(&kvm->online_vcpus)-i)*sizeof(struct kvm_vcpu *)); > + atomic_dec(&kvm->online_vcpus); > + /* Removed vcpu can not be seen from vcpus[] */ This comment is confusing. > + rcu_assign_pointer(kvm->vcpus, vcpus_next); > + mutex_unlock(&kvm->lock); > + > + synchronize_rcu(); > > - kvm_put_kvm(vcpu->kvm); > + /* vcpu is out of list,drop it safely */ Ditto. Do you mean something like "now that there is no reader of it we can safely free this" ? (Please do not trust me: I am not a native English speaker as you know.) > + kvm_vcpu_destruct(vcpu); > return 0; > } Takuya -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@...r.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists