From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756170AbdDRKCV (ORCPT ); Tue, 18 Apr 2017 06:02:21 -0400 Received: from smtp.eu.citrix.com ([185.25.65.24]:53939 "EHLO SMTP.EU.CITRIX.COM" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751228AbdDRKCS (ORCPT ); Tue, 18 Apr 2017 06:02:18 -0400 X-IronPort-AV: E=Sophos;i="5.37,218,1488844800"; d="scan'208";a="44486316" Subject: Re: [Xen-devel] [PATCH v3 09/11] x86/xen: use capabilities instead of fake cpuid values for xsave To: Juergen Gross , , References: <20170418063119.11654-1-jgross@suse.com> <20170418063119.11654-10-jgross@suse.com> CC: From: Andrew Cooper Message-ID: <2df54917-e8d1-403a-20ff-b956e568bce8@citrix.com> Date: Tue, 18 Apr 2017 11:02:03 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.6.0 MIME-Version: 1.0 In-Reply-To: <20170418063119.11654-10-jgross@suse.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-ClientProxiedBy: AMSPEX02CAS02.citrite.net (10.69.22.113) To AMSPEX02CL02.citrite.net (10.69.22.126) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 18/04/17 07:31, Juergen Gross wrote: > @@ -281,22 +274,24 @@ static bool __init xen_check_mwait(void) > return false; > #endif > } > -static void __init xen_init_cpuid_mask(void) > + > +static bool __init xen_check_xsave(void) > { > - unsigned int ax, bx, cx, dx; > - unsigned int xsave_mask; > + unsigned int err, eax, edx; > > - ax = 1; > - cx = 0; > - cpuid(1, &ax, &bx, &cx, &dx); > + /* Test OSXSAVE capability via xgetbv instruction. */ The code is fine, but this comment isn't going to be any help to people reading this code in 6 months time. How about this: "Xen 4.0 and older accidentally leaked the host XSAVE flag into guest view, despite not being able to support guests using the functionality. Probe for the actual availability of XSAVE by seeing whether xgetbv executes successfully or raises #UD." Everything else is fine, so Reviewed-by: Andrew Cooper ~Andrew