Received: by 10.223.176.5 with SMTP id f5csp1700394wra; Wed, 31 Jan 2018 10:11:29 -0800 (PST) X-Google-Smtp-Source: AH8x2275c8TUo8OMNMFqurQkznu4fYo3gplFsFdTkAmwGqAks2n83fkSvnnnjosJ+XlR+8dXDvAo X-Received: by 10.98.166.195 with SMTP id r64mr34216618pfl.175.1517422289644; Wed, 31 Jan 2018 10:11:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517422289; cv=none; d=google.com; s=arc-20160816; b=kqAPEavNq/mIOQdiqWC+9Q7aAUhBfpZoulx6N4+9zCZN05CnEI1oLrn3Ge8zA2rO9W oirG7k3hpeGCxt9RvYwuhtKqo+JZI2IYKV78163YtvQvRkFyn/vBBzqYsQqAQVCPoJ13 0ZpMn9Iu8MNr6T4T9LHBaEU6XZkHzP698FpiAEFSuAtjcj8cBBtXu2O7wfxLfUoLwwS6 vUEnoYDzDWWN1icIGxbLE8gr8e9aNLb1f7LYaTitKC0b4u62XDArq7RMP8DfpOqbXxQC ZjAx53CYzkWEerXaVROFBbpNzvDdmarOKiqYAT4Er5N6EHWhBiOiyuu49Z3l4HYTlfyf M3OA== 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:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=zwrBN7oF3TqKiA2sGgXv4Agui/o25iP7ca5UH3WRPnc=; b=hDU+DlRLM7qE0vmWmpSu11JDG8Rx4IOCPBytGtywC8OvDNCxgtwh25q1Kr2M1GTdwN E4UoX2cNwtZ3wDblJGMWbsrA92xIG5+4BUosnzbmPHzruNGQxSfzcpaoQFl6NDE8h2db JrCEyXkXgLkXkz/gx0/sU5LuiA+YE4MVbAeogtFBf27l0EK6VIAZaZY921APJEXClnyt 88Mxz1ZpMJKWBMrifroc0mzYgd4MAWNoMk43IRMmcykFKM9lM0MYrN5eSFCX2FBcNtNh +GYNAgLi0hojThPguuR2dYSDXFfaoWuvHjZqkTsGTIFUPJBXZLl/r8qQptuCGH+GvbxA eQJQ== 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 f9-v6si5964673pln.211.2018.01.31.10.11.15; Wed, 31 Jan 2018 10:11:29 -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 S1753499AbeAaRhO (ORCPT + 99 others); Wed, 31 Jan 2018 12:37:14 -0500 Received: from mx1.redhat.com ([209.132.183.28]:43708 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753158AbeAaRhN (ORCPT ); Wed, 31 Jan 2018 12:37:13 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4FE621752C9; Wed, 31 Jan 2018 17:37:13 +0000 (UTC) Received: from [10.36.116.69] (ovpn-116-69.ams2.redhat.com [10.36.116.69]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 985686090B; Wed, 31 Jan 2018 17:37:11 +0000 (UTC) Subject: Re: [PATCH v2 3/3] KVM: VMX: make MSR bitmaps per-VCPU To: =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, David Woodhouse , KarimAllah Ahmed References: <1517043027-7655-1-git-send-email-pbonzini@redhat.com> <1517043027-7655-4-git-send-email-pbonzini@redhat.com> <20180130162357.GE22015@flask> From: Paolo Bonzini Message-ID: Date: Wed, 31 Jan 2018 12:37:09 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <20180130162357.GE22015@flask> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 31 Jan 2018 17:37:13 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 30/01/2018 11:23, Radim Krčmář wrote: > 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)); Hmm you're right, it should be in prepare_vmcs02() here (4.15-based), and then moved to prepare_vmcs02_full() as part of the conflict resolution. I'll send a v3. Paolo