Received: by 10.223.176.5 with SMTP id f5csp181438wra; Tue, 30 Jan 2018 09:50:37 -0800 (PST) X-Google-Smtp-Source: AH8x2255xMc45iCgqnfOlSw0dj8B0bGMoAZga6dLEmCG/htfYXYc/ZnWuNR2uEQsAWgLVcxQ6WAc X-Received: by 10.98.108.130 with SMTP id h124mr31068989pfc.33.1517334637528; Tue, 30 Jan 2018 09:50:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517334637; cv=none; d=google.com; s=arc-20160816; b=Edc8ts1YlamHh5oARv7wHqESBtBBSFUaMMzHZGtRLk0z6KRjbA4+Um2j9EU1P7vC6g zKq+YI8RDOsnVfuEjQ1h/N9V48qmRj2B9MkQrP/V0UjCOZheLoYspdHNrz3GAeBZKUyL mh2xyPUv7ecdEmIAagrn8/DpvIZwPr+/7C6oegafHK8fjHm9pB1nT6uuYpfCC5M/q6YC oPX8gVcXlrIhpWZUzUd6Ur2SbsBDMcjyMBCaIpziAbMs9J/8SI5RSHWQ7Mpnj/TZgbPM PPmWsSetjYr1UVb2g2rxwB7fM3BdflIW/CAAthCgHET80/jv+W6jpap+7gn1UbiZ4kmq Bbzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=Q05Hg3XVjOVTz/zBOO9i22QpcBvDu6JXBUB5jhXwF6Y=; b=CyW6hUaCQhYxnKknFw4NhGSfGfyDe47lUfL0uU/fyuEI93tt20bwXDnnrschBw9izD RJxsJ5GNNHKskx+jneZZpSVY9TpMrguiQYj2nkhJrXZghcsmykBPJY4wnnJnM1SzqV+G yxp+15ko5HJSaUnDxLo/gJQDqJndxhWn8aJHdeUOmWJvmTRlZjlM6RBDA1aDPvBEcmMW Cm3qpVxm/OVTr9yj4C8CSOaz8xCq1MCo9Ieq9OGbFo27evPbrA/jgOJgOdJ41ebXre2M LRwoR2lz440jDFHyAEgxdY/buoodrd/ioD7rHi8pCP+1Xf6p4/9tql+/PmWQLhjCP3Cr MLjQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g13si1695811pgu.229.2018.01.30.09.50.23; Tue, 30 Jan 2018 09:50:37 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752575AbeA3QYN (ORCPT + 99 others); Tue, 30 Jan 2018 11:24:13 -0500 Received: from mx1.redhat.com ([209.132.183.28]:38150 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751651AbeA3QYM (ORCPT ); Tue, 30 Jan 2018 11:24:12 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id ABFFE33BC1; Tue, 30 Jan 2018 16:24:12 +0000 (UTC) Received: from flask (unknown [10.43.2.80]) by smtp.corp.redhat.com (Postfix) with SMTP id DCEE2600C0; Tue, 30 Jan 2018 16:24:08 +0000 (UTC) Received: by flask (sSMTP sendmail emulation); Tue, 30 Jan 2018 17:23:57 +0100 Date: Tue, 30 Jan 2018 17:23:57 +0100 From: Radim =?utf-8?B?S3LEjW3DocWZ?= To: Paolo Bonzini Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, David Woodhouse , KarimAllah Ahmed Subject: Re: [PATCH v2 3/3] KVM: VMX: make MSR bitmaps per-VCPU Message-ID: <20180130162357.GE22015@flask> References: <1517043027-7655-1-git-send-email-pbonzini@redhat.com> <1517043027-7655-4-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1517043027-7655-4-git-send-email-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 30 Jan 2018 16:24:12 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2018-01-27 09:50+0100, Paolo Bonzini: > Place the MSR bitmap in struct loaded_vmcs, and update it in place > every time the x2apic or APICv state can change. This is rare and > the loop can handle 64 MSRs per iteration, in a similar fashion as > nested_vmx_prepare_msr_bitmap. > > This prepares for choosing, on a per-VM basis, whether to intercept > the SPEC_CTRL and PRED_CMD MSRs. > > Suggested-by: Jim Mattson > Signed-off-by: Paolo Bonzini > --- > diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c > @@ -10022,7 +10043,7 @@ static inline bool nested_vmx_merge_msr_bitmap(struct kvm_vcpu *vcpu, > int msr; > struct page *page; > unsigned long *msr_bitmap_l1; > - unsigned long *msr_bitmap_l0 = to_vmx(vcpu)->nested.msr_bitmap; > + unsigned long *msr_bitmap_l0 = to_vmx(vcpu)->nested.vmcs02.msr_bitmap; The physical address of the nested msr_bitmap is never loaded into vmcs. The resolution you provided had extra hunk in prepare_vmcs02_full(): + vmcs_write64(MSR_BITMAP, __pa(vmx->nested.vmcs02.msr_bitmap)); I have queued that as: + if (cpu_has_vmx_msr_bitmap()) + vmcs_write64(MSR_BITMAP, __pa(vmx->nested.vmcs02.msr_bitmap)); but it should be a part of the patch or a followup fix. Is the branch already merged into PTI? Thanks. > > /* This shortcut is ok because we support only x2APIC MSRs so far. */ > if (!nested_cpu_has_virt_x2apic_mode(vmcs12)) > @@ -11397,7 +11418,7 @@ static void load_vmcs12_host_state(struct kvm_vcpu *vcpu, > vmcs_write64(GUEST_IA32_DEBUGCTL, 0); > > if (cpu_has_vmx_msr_bitmap()) > - vmx_set_msr_bitmap(vcpu); > + vmx_update_msr_bitmap(vcpu); > > if (nested_vmx_load_msr(vcpu, vmcs12->vm_exit_msr_load_addr, > vmcs12->vm_exit_msr_load_count)) > -- > 1.8.3.1 >