Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756178AbdDRL47 (ORCPT ); Tue, 18 Apr 2017 07:56:59 -0400 Received: from mx2.suse.de ([195.135.220.15]:39236 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752672AbdDRL45 (ORCPT ); Tue, 18 Apr 2017 07:56:57 -0400 Subject: Re: [Xen-devel] [PATCH v3 09/11] x86/xen: use capabilities instead of fake cpuid values for xsave To: Andrew Cooper , linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org References: <20170418063119.11654-1-jgross@suse.com> <20170418063119.11654-10-jgross@suse.com> <2df54917-e8d1-403a-20ff-b956e568bce8@citrix.com> Cc: boris.ostrovsky@oracle.com From: Juergen Gross Message-ID: Date: Tue, 18 Apr 2017 13:56:54 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <2df54917-e8d1-403a-20ff-b956e568bce8@citrix.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1039 Lines: 37 On 18/04/17 12:02, Andrew Cooper wrote: > 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." I'll update the comment. > Everything else is fine, so Reviewed-by: Andrew Cooper > Thanks, Juergen