From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755830AbcBHQxG (ORCPT ); Mon, 8 Feb 2016 11:53:06 -0500 Received: from smtp.citrix.com ([66.165.176.89]:22315 "EHLO SMTP.CITRIX.COM" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755807AbcBHQxC (ORCPT ); Mon, 8 Feb 2016 11:53:02 -0500 X-IronPort-AV: E=Sophos;i="5.22,417,1449532800"; d="scan'208";a="330358845" Subject: Re: [Xen-devel] [PATCH v2 3/3] paravirt: rename paravirt_enabled to paravirt_legacy To: Borislav Petkov References: <20160206220437.GA4435@pd.tnic> <56B8B6BF.6030007@oracle.com> <20160208155507.GF28980@pd.tnic> <56B8BCDB.9040701@citrix.com> <56B8BE58.6070003@oracle.com> <56B8C1BC.9040603@citrix.com> <56B8C2C8.8050406@oracle.com> <20160208163526.GI28980@pd.tnic> <56B8C490.1060004@citrix.com> <20160208164545.GJ28980@pd.tnic> CC: Boris Ostrovsky , X86 ML , , Andrey Ryabinin , Lv Zheng , Jan Beulich , "H. Peter Anvin" , , , Xen Devel , Joerg Roedel , "Rafael J. Wysocki" , Robert Moore , Ingo Molnar , Andrey Ryabinin , Mauro Carvalho Chehab , "Luis R. Rodriguez" , Rusty Russell , Thomas Gleixner , , Juergen Gross , "linux-kernel@vger.kernel.org" , "Andy Lutomirski" , "Luis R. Rodriguez" , , Fengguang Wu From: Andrew Cooper X-Enigmail-Draft-Status: N1110 Message-ID: <56B8C7EC.3090403@citrix.com> Date: Mon, 8 Feb 2016 16:53:00 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.5.0 MIME-Version: 1.0 In-Reply-To: <20160208164545.GJ28980@pd.tnic> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-DLP: MIA2 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/02/16 16:45, Borislav Petkov wrote: > On Mon, Feb 08, 2016 at 04:38:40PM +0000, Andrew Cooper wrote: >> Does the early loader have extable support? If so, this is fairly easy >> to fix. If not, we have a problem. > It doesn't and regardless, you want to have this CPUID querying as > simple as possible. No special handling, no special prefixes as it > should be able to run on other hypervisors too. > > If one can't execute a simple CPUID(0x4...) on a xen guest and get the > results back, then for early, we will have to do what we've done until > now and simply emulate the MSR accesses. > > Later code can use then xen_cpuid() and all is fine. We should still get > rid of paravirt_enabled() though. > The force emulation prefix starts with a ud2a instruction, so extable is to prevent it breaking on non-Xen systems. However, if extable isn't available, this point is moot. As an alternative check which should be doable this early on, peeking in the head of hypercall_page should work. If Linux was booted as a PV guest, the hypercall_page will have been constructed by the domain builder, and won't have 0x90's in it. ~Andrew