Received: by 2002:ac0:a679:0:0:0:0:0 with SMTP id p54csp1448186imp; Fri, 22 Feb 2019 03:48:50 -0800 (PST) X-Google-Smtp-Source: AHgI3IY90XbrgvpQk24Z1FBQJ8GuNOrfAR4fmx5Mj1TMCJasS1WApS0ANuhxH6ditwiZw8VEQoYG X-Received: by 2002:a17:902:b590:: with SMTP id a16mr3875939pls.22.1550836130893; Fri, 22 Feb 2019 03:48:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550836130; cv=none; d=google.com; s=arc-20160816; b=fQR02VOHz0yoEt3B67E31apCmApCFxVP7W1n6c9NFBeV+Hfwdlg9VhiwMfqdimiV5e XEiRRNk2y5NNrBTCSGi6/FeqHwoVweOHw1Hd3fJ4WyohpplrZjJU+29RGjvh9Wcaout4 8foi96DoUD1q4NfHecJQiomGGGLkfk4q30q8yvo3290MZumr97mXJsq3UJDlqjNdnp8J skh4f0j1VY3Q0gCX113QxOAsmkkgzNDncwuDcxgjquNZbZ9/sfKK76id8fSNoiNBEOB/ eVUPCm1yPD0Pgpzt24WkgF8Hkf/DgkOhc9OgcNH7gHRO0u3nGI4v1QBUZpLfH3FqFlBC 0smQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:date:message-id :references:cc:to:subject:from:dkim-signature; bh=2C9Ng6U9cOU7nqkoy3l21e5sJus8aWttTV0JL/Nl7nc=; b=D/cPuvdEFdncJ6ERuWAoDS+mB6wdWh144M8yJ39UaMkWaS2Pcb0x946L8nStkC87oz VSXSMfGK+IA1EA0fWWMc6eaxrxDj2er6omPz9ydo3i7daAeMWqDwU/nSo6odtgD15a/s xskQoW3Z8hUTknq6M0N9Qdv0ZP+HBATdYfKViE1izyeQ2CJRVoCmHjF/h1ERiy/kg3qx M+sSvi4njmuYiMMdUdhUH9AdfRX7SJyKGzch5xaS8tCcIhWlEyF9oQCfDFzVoUvdhtBE CXxClHb8z8eWE+/S78a9ERxNOPNZ2+uTrr7avDA5jhfQxC8cm1nSXBNS+YXqNWjs19nz foWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=qwySv7Ke; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c23si1223079pgk.54.2019.02.22.03.48.35; Fri, 22 Feb 2019 03:48:50 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=qwySv7Ke; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726921AbfBVLsI (ORCPT + 99 others); Fri, 22 Feb 2019 06:48:08 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:45030 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726154AbfBVLsI (ORCPT ); Fri, 22 Feb 2019 06:48:08 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x1MBiFkw097900; Fri, 22 Feb 2019 11:47:47 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : subject : to : cc : references : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2018-07-02; bh=2C9Ng6U9cOU7nqkoy3l21e5sJus8aWttTV0JL/Nl7nc=; b=qwySv7Ke5n0fOrnTumGpUk6HNFKHDnC+bFsICQEE4/ivIj33/VEEmsUzZ7J2VNsOthX/ 5I5lzp0WZcOgPTuIctWkVVrXcKTC1LHtiYtovtuRmI1VQitLPehxyKtV05GPkIB9PSbH OYBnlIm9sqXupkTOJzy0aks/4poZpDWLHxRrgy0Q2OjydbidPUV0yhKBOyXjhM4qYdod PQwJ2DN3IR5y4W9YyXrYBKJo1lbm+PZmPlLXOFwp/t+TV8zCSIFQa4OIBZVMHIFKHk9N l0Oq5vGJns8w7dcLT1osNMiNrZzvGmW8iyV3JmYMyLT6ViKg77C39jYQdnlOaGTc9btv yg== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2120.oracle.com with ESMTP id 2qpb5rxr7j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 22 Feb 2019 11:47:47 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id x1MBllte012441 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 22 Feb 2019 11:47:47 GMT Received: from abhmp0002.oracle.com (abhmp0002.oracle.com [141.146.116.8]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x1MBlkKK006503; Fri, 22 Feb 2019 11:47:46 GMT Received: from [192.168.1.67] (/94.61.137.133) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 22 Feb 2019 03:47:46 -0800 From: Joao Martins Subject: Re: [PATCH RFC 01/39] KVM: x86: fix Xen hypercall page msr handling To: Sean Christopherson Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Ankur Arora , Boris Ostrovsky , Paolo Bonzini , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , x86@kernel.org References: <20190220201609.28290-1-joao.m.martins@oracle.com> <20190220201609.28290-2-joao.m.martins@oracle.com> <20190222013008.GG7224@linux.intel.com> Message-ID: Date: Fri, 22 Feb 2019 11:47:41 +0000 MIME-Version: 1.0 In-Reply-To: <20190222013008.GG7224@linux.intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9174 signatures=668684 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1902220084 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/22/19 1:30 AM, Sean Christopherson wrote: > On Wed, Feb 20, 2019 at 08:15:31PM +0000, Joao Martins wrote: >> Xen usually places its MSR at 0x4000000 or 0x4000200 depending on >> whether it is running in viridian mode or not. Note that this is not >> ABI guaranteed, so it is possible for Xen to advertise the MSR some >> place else. >> >> Given the way xen_hvm_config() is handled, if the former address is >> selected, this will conflict with HyperV's MSR >> (HV_X64_MSR_GUEST_OS_ID) which uses the same address. > > Unconditionally servicing Hyper-V and KVM MSRs seems wrong, i.e. KVM > should only expose MSRs specific to a hypervisor if userspace has > configured CPUID to advertise support for said hypervisor. > Yeah, that makes sense. > If we do the > same thing for Xen, then the common MSR code looks like: > > if (kvm_advertise_kvm()) { > if () > return ...; > } else if (kvm_advertise_hyperv()) { > if () > return ...; > } else if (kvm_advertise_xen()) { > if () > return ...; > } > > > > Obviously assumes KVM only advertises itself as one hypervisor, and so > the ordering is arbitrary. > One thing to consider on the above is that there might be multiple hypervisors in advertised in the hypervisor leaf. Which is used when you want to run a KVM guest but with Hyper-V drivers, or an Hyper-V guest with KVM extensions or VirtIO. The else part would probably need to be removed as IIUC when multiple hypervisors are advertised (e.g. KVM in leaf 0x40000000, Hyper-V in leaf 0x40000100) you are still allowed to use all of its features.