Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp436704pxu; Wed, 7 Oct 2020 07:03:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzAN3t9hzSw1PFlk6qPYrbr4RsirhKuLy1FVnz2B/PlO9CtPC2Qv4KaOqwJVH7dOkQFDy6e X-Received: by 2002:a17:906:fb86:: with SMTP id lr6mr3473376ejb.510.1602079431820; Wed, 07 Oct 2020 07:03:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602079431; cv=none; d=google.com; s=arc-20160816; b=RmEFbhzDOHrSLfo+ZUT25U5jrN0Scxj2/B+5Nhes0Q3RfstL0EFM4gA8ivc9Iv3yfk ekUedn5wg9qunG/mzKSoNdlVYl7dy2cX0m+07XLrrIazVI30LqIJA1VrJd1lr0yLPapg zhGfMRYMWVMT1TDNRNtvMbwsm6u91Pu+yDE7U/n+TOTkiLypMU8Pt8KjnFuGBL9QYqxg tCdgEGYNdKH49jW2agt/Bhe/RA4dLL/ZFA+XJqhJYBMysFS7OY0yYDNa0QTpQPNih/HE /6bemrSR5+fANQ/+tcRef0kFbGe/pS1P/xq/mAYZPTIenTSt28L+mMEMFdzj/9gUBjWk otqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=dFl7xuD4GDwohFhExL3X3RMLZwtA4a2j71AUtiyNSK0=; b=lQq2xjt1dzZZmZDAKvNukJH/ajdPsCwypj4eAxd6H+BnOrAy46PL4mr491ActvQlMn vxrWR5O6dKD5lu0KJ898aXkMRMA/jpvcYnpx8sXfvHlazH7cG8E9RNr9JZQruAVrheiq oqM2pWm7dBGjMsj8oFDxDHckfnEgZtzSgZMGHRmB8qrlasdhQwfo7FKjbwFVQ33jpfdl JA1jz+WJdTtEptXwvAFPyxNrAq3hZrDCPDUjHrcnduah/M5l+YRDs7lRs7l0ooPMuUO+ MFPWXoyEj6DCAEf7jYk68yz4M9F5nK31gcFaMHn+ZOAKTE7N2aMqB1fhTsO941jTvUXb 1KeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=tz5Yt8rI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n25si1448119eju.96.2020.10.07.07.03.24; Wed, 07 Oct 2020 07:03:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=tz5Yt8rI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728549AbgJGOCP (ORCPT + 99 others); Wed, 7 Oct 2020 10:02:15 -0400 Received: from smtp-fw-4101.amazon.com ([72.21.198.25]:10885 "EHLO smtp-fw-4101.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728535AbgJGOCP (ORCPT ); Wed, 7 Oct 2020 10:02:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1602079335; x=1633615335; h=subject:to:cc:references:from:message-id:date: mime-version:in-reply-to:content-transfer-encoding; bh=dFl7xuD4GDwohFhExL3X3RMLZwtA4a2j71AUtiyNSK0=; b=tz5Yt8rI3KHvC5fIBN8ihwWjXWSQFHNHlkc9pcGyh9S+Uo+zHUtaxh9P tXcjRPm4PkIikBhjc42Mn7GtBaFilH/wbC4ZasVM6TehEgbYVUjUP349U RIRdlt0gTD50gSzq9gqkij+0TWOI1DP7Ioyry/WlFMuXuaFYZwpskGx93 A=; X-IronPort-AV: E=Sophos;i="5.77,347,1596499200"; d="scan'208";a="58561326" Received: from iad12-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-2a-d0be17ee.us-west-2.amazon.com) ([10.43.8.6]) by smtp-border-fw-out-4101.iad4.amazon.com with ESMTP; 07 Oct 2020 14:02:06 +0000 Received: from EX13MTAUWC002.ant.amazon.com (pdx4-ws-svc-p6-lb7-vlan3.pdx.amazon.com [10.170.41.166]) by email-inbound-relay-2a-d0be17ee.us-west-2.amazon.com (Postfix) with ESMTPS id 771E3A2056; Wed, 7 Oct 2020 14:02:04 +0000 (UTC) Received: from EX13D20UWC001.ant.amazon.com (10.43.162.244) by EX13MTAUWC002.ant.amazon.com (10.43.162.240) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 7 Oct 2020 14:02:04 +0000 Received: from Alexanders-MacBook-Air.local (10.43.161.64) by EX13D20UWC001.ant.amazon.com (10.43.162.244) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 7 Oct 2020 14:02:01 +0000 Subject: Re: [PATCH 2/2] KVM: VMX: Ignore userspace MSR filters for x2APIC when APICV is enabled To: Sean Christopherson , Paolo Bonzini CC: Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , , , Aaron Lewis , Peter Xu References: <20201005195532.8674-1-sean.j.christopherson@intel.com> <20201005195532.8674-3-sean.j.christopherson@intel.com> From: Alexander Graf Message-ID: Date: Wed, 7 Oct 2020 16:01:59 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:78.0) Gecko/20100101 Thunderbird/78.3.1 MIME-Version: 1.0 In-Reply-To: <20201005195532.8674-3-sean.j.christopherson@intel.com> Content-Language: en-US X-Originating-IP: [10.43.161.64] X-ClientProxiedBy: EX13D10UWB001.ant.amazon.com (10.43.161.111) To EX13D20UWC001.ant.amazon.com (10.43.162.244) Content-Type: text/plain; charset="windows-1252"; format="flowed" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05.10.20 21:55, Sean Christopherson wrote: > = > Rework the resetting of the MSR bitmap for x2APIC MSRs to ignore > userspace filtering when APICV is enabled. Allowing userspace to > intercept reads to x2APIC MSRs when APICV is fully enabled for the guest > simply can't work. The LAPIC and thus virtual APIC is in-kernel and > cannot be directly accessed by userspace. If userspace wants to > intercept x2APIC MSRs, then it should first disable APICV. > = > Opportunistically change the behavior to reset the full range of MSRs if > and only if APICV is enabled for KVM. The MSR bitmaps are initialized > to intercept all reads and writes by default, and enable_apicv cannot be > toggled after KVM is loaded. I.e. if APICV is disabled, simply toggle > the TPR MSR accordingly. > = > Note, this still allows userspace to intercept reads and writes to TPR, > and writes to EOI and SELF_IPI. It is at least plausible userspace > interception could work for those registers, though it is still silly. > = > Cc: Alexander Graf > Cc: Aaron Lewis > Cc: Peter Xu > Signed-off-by: Sean Christopherson I'm not opposed in general to leaving APICV handled registers out of the = filtering logic. However, this really needs a note in the documentation = then, no? Alex Amazon Development Center Germany GmbH Krausenstr. 38 10117 Berlin Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B Sitz: Berlin Ust-ID: DE 289 237 879