From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christian Ehrhardt Subject: Re: [PATCH 4/6] kvm-s390: Unlink vcpu on destroy Date: Mon, 11 May 2009 15:00:35 +0200 Message-ID: <4A082173.9010001@linux.vnet.ibm.com> References: <1241534358-32172-1-git-send-email-ehrhardt@linux.vnet.ibm.com> <1241534358-32172-5-git-send-email-ehrhardt@linux.vnet.ibm.com> <4A017E8C.4010700@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: kvm@vger.kernel.org, Christian Borntraeger , Carsten Otte To: Avi Kivity Return-path: Received: from mtagate8.uk.ibm.com ([195.212.29.141]:58703 "EHLO mtagate8.uk.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751852AbZEKNAk (ORCPT ); Mon, 11 May 2009 09:00:40 -0400 Received: from d06nrmr1707.portsmouth.uk.ibm.com (d06nrmr1707.portsmouth.uk.ibm.com [9.149.39.225]) by mtagate8.uk.ibm.com (8.14.3/8.13.8) with ESMTP id n4BD0dfD178952 for ; Mon, 11 May 2009 13:00:39 GMT Received: from d06av04.portsmouth.uk.ibm.com (d06av04.portsmouth.uk.ibm.com [9.149.37.216]) by d06nrmr1707.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v9.2) with ESMTP id n4BD0dDn1884266 for ; Mon, 11 May 2009 14:00:39 +0100 Received: from d06av04.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av04.portsmouth.uk.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id n4BD0cjm012836 for ; Mon, 11 May 2009 14:00:39 +0100 In-Reply-To: <4A017E8C.4010700@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Avi Kivity wrote: > ehrhardt@linux.vnet.ibm.com wrote: >> From: Carsten Otte >> >> This patch makes sure we do unlink a vcpu's sie control block >> from the system control area in kvm_arch_vcpu_destroy. This >> prevents illegal accesses to the sie control block from other >> virtual cpus after free. >> >> Reported-by: Mijo Safradin >> Signed-off-by: Carsten Otte >> --- >> arch/s390/kvm/kvm-s390.c | 9 +++++++-- >> 1 file changed, 7 insertions(+), 2 deletions(-) >> >> Index: kvm/arch/s390/kvm/kvm-s390.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> --- kvm.orig/arch/s390/kvm/kvm-s390.c >> +++ kvm/arch/s390/kvm/kvm-s390.c >> @@ -195,6 +195,9 @@ out_nokvm: >> void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu) >> { >> VCPU_EVENT(vcpu, 3, "%s", "free cpu"); >> + if (vcpu->kvm->arch.sca->cpu[vcpu->vcpu_id].sda =3D=3D >> + (__u64) vcpu->arch.sie_block) >> + vcpu->kvm->arch.sca->cpu[vcpu->vcpu_id].sda =3D 0; >> free_page((unsigned long)(vcpu->arch.sie_block)); >> >> =20 > > If this is accessed by hardware on a different cpu, don't you need a=20 > memory barrier here? > > Right, will be in v2 --=20 Gr=C3=BCsse / regards,=20 Christian Ehrhardt IBM Linux Technology Center, Open Virtualization