From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37955) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e83yv-0003Gm-0I for qemu-devel@nongnu.org; Fri, 27 Oct 2017 08:43:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e83yr-0008RS-TY for qemu-devel@nongnu.org; Fri, 27 Oct 2017 08:43:25 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:45404 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e83yr-0008Ik-NU for qemu-devel@nongnu.org; Fri, 27 Oct 2017 08:43:21 -0400 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v9RCaT7q040695 for ; Fri, 27 Oct 2017 08:43:05 -0400 Received: from e06smtp10.uk.ibm.com (e06smtp10.uk.ibm.com [195.75.94.106]) by mx0b-001b2d01.pphosted.com with ESMTP id 2dv4g19wv8-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 27 Oct 2017 08:43:04 -0400 Received: from localhost by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 27 Oct 2017 13:43:02 +0100 References: <20171020145437.18549-1-borntraeger@de.ibm.com> From: Christian Borntraeger Date: Fri, 27 Oct 2017 14:42:57 +0200 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Message-Id: Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH/QEMU] s390x/kvm: use cpu_model_available for guarded storage on compat machines List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Halil Pasic , jjherne@linux.vnet.ibm.com, Marc Hartmayer , Cornelia Huck Cc: libvir-list@redhat.com, Jiri Denemark , Boris Fiuczynski , qemu-devel@nongnu.org, Viktor Mihajlovski On 10/27/2017 02:31 PM, Halil Pasic wrote: >=20 >=20 > On 10/25/2017 08:13 PM, Jason J. Herne wrote: >> On 10/20/2017 10:54 AM, Christian Borntraeger wrote: >>> Starting a guest with >>> =C2=A0=C2=A0=C2=A0 >>> =C2=A0=C2=A0=C2=A0=C2=A0 hvm >>> =C2=A0=C2=A0 >>> =C2=A0=C2=A0 >>> >>> on an IBM z14 results in >>> >>> "qemu-system-s390x: Some features requested in the CPU model are not >>> available in the configuration: gs" >>> >>> This is because guarded storage is fenced for compat machines that di= d not have >>> guarded storage support, but libvirt expands the cpu model according = to the >>> latest available machine. >>> >>> While this prevents future migration abort (by not starting the guest= at all), >>> not being able to start a "host-model" guest is very much unexpected.= =C2=A0 As it >>> turns out, even if we would modify libvirt to not expand the cpu mode= l to >>> contain "gs" for compat machines, it cannot guarantee that a migratio= n will >>> succeed. For example if the kernel changes its features (or the user = has >>> nested=3D1 on one host but not on the other) the migration will fail >>> nevertheless.=C2=A0 So instead of fencing "gs" for machines <=3D 2.9 = lets allow it for >>> all machine types that support the CPU model. This will make "host-mo= del" >>> runnable all the time, while relying on the CPU model to reject inval= id >>> migration attempts. >> ... >>> -=C2=A0=C2=A0=C2=A0 if (gs_allowed()) { >>> +=C2=A0=C2=A0=C2=A0 if (cpu_model_allowed()) { >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (kvm_vm_ena= ble_cap(s, KVM_CAP_S390_GS, 0) =3D=3D 0) { >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 cap_gs =3D 1; >=20 >=20 > @Jason >=20 > Hi Jason, >=20 > I don't have access to a z14 at the moment, and since you do, I would > like to try out something. >=20 > I will first describe my concern, and then the test scenario. >=20 > The last line above, cap_gs =3D 1, has the side effect of returning > true ever after. >=20 > int kvm_s390_get_gs(void) = =20 > { = =20 > return cap_gs; = =20 > } =20 >=20 > Now considering > static bool gscb_needed(void *opaque) > { > return kvm_s390_get_gs(); > } Yes, we should also replace that with return s390_has_feat(S390_FEAT_GUARDED_STORAGE) I can fixup my patch or provide a 2nd one.