Received: by 10.223.176.5 with SMTP id f5csp1900116wra; Wed, 31 Jan 2018 13:20:41 -0800 (PST) X-Google-Smtp-Source: AH8x225+CZ22jj0h3UKfJ/DR4mZBF6F0JG/WfVL6UbTYZCpQsZmhPX28MwUmt4Ly31BUx9ghMngh X-Received: by 2002:a17:902:7586:: with SMTP id j6-v6mr17611004pll.23.1517433641565; Wed, 31 Jan 2018 13:20:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517433641; cv=none; d=google.com; s=arc-20160816; b=a8j2SvDj9Ls0jPcReCesCWi1boWJKwY1rIIbF2+BrwWaAAy1lMuLVOjqa/Dbr4wAGX mNGRDV0cR9LlYi1Jo60ZVbG/YAltx2knphpkePGxBrV0fmqCV+34WTEDhuo3tFr9WUUh CTavtOjW7XhWdPoWy2RIYWiG3GuXKhev5Bz7wjWy35aM9YS/45Y3Tit1j1tPO8bdRADv EZSOzk1BR82MUzrU8c+tzPHMlXSowDg4KhXWrfjQ7uzdtaLG8UhB2wn4WfojkXkBG9Ad ShpCaRhDdMf7IF40ig2IFKXJ7uviYGnqOhLjT8xQFcHQwzLbk92uUzDjTIkP/7GNUxbQ Vqtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=127r3rvE19Sr20YNZ1MJ0B9/Z3GTTNtEqBxH+LB6f5s=; b=Wp8tVMWpo4iJK8K87YfCygZCLlPNWuG8yboWZQYT+chWZou/oPAKD8vaCH14VTOgjl bBleTvrtUGeOpXrH7Z6A3aG9MzSuWeqOzaGcuzwjhOGin3hZ62CYyZZuJcPW/KUhFkYd 80WR33y9yJw6WZ1WNI3fSOB9STnDiJ13lO+RK7iJgRNSPM5BdNlcqupiab7Sfc8tS3G0 caTW0Aip8JCzyjQUwYadG7tRYhsMUH3xrcSXhumrlRchIKK05smN/Flk6ESjGOiCKxT+ 6fGvXRTgK+Kb8uzm8I+pAHZOj/mPt9FqqF2wEJdulCAK/OHqGbCa/gBRUpSOkP1hylci xSdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=dHiF4zxr; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o2-v6si6764460pls.152.2018.01.31.13.20.26; Wed, 31 Jan 2018 13:20:41 -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=@google.com header.s=20161025 header.b=dHiF4zxr; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753271AbeAaVSh (ORCPT + 99 others); Wed, 31 Jan 2018 16:18:37 -0500 Received: from mail-io0-f182.google.com ([209.85.223.182]:40343 "EHLO mail-io0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753236AbeAaVSf (ORCPT ); Wed, 31 Jan 2018 16:18:35 -0500 Received: by mail-io0-f182.google.com with SMTP id t22so16753681ioa.7 for ; Wed, 31 Jan 2018 13:18:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=127r3rvE19Sr20YNZ1MJ0B9/Z3GTTNtEqBxH+LB6f5s=; b=dHiF4zxrPAgJsBHS/5aDuueWApTyDELLFeyNZBduFClFpYkE7ydWCrNHV87uQ/dVPp 695tEMvfNuMFG+3D5MZ3pubSnh688HT/N3XhbgxMIoI1twgMYD/Q9J9t92EloVl16K02 BHvTlj33AABjzB2d7Qv/6LtBB4UYX13cw4oPxXVGlQJe6+tmtIY+Zk5Z1y1a4yxE6T9v UljFhF1DU9Z/6UzMbrG9qnprihGvd2jZTg92CfeBUb0A126VmhMt+CpMe9WiL04wqmvD LxBHZH0IB9Y3ndktEBiabrSqNNY3DkBFBqO1sR8Nu+phhGAd5/+5AuLQNoNbR+tJqWe/ WmGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=127r3rvE19Sr20YNZ1MJ0B9/Z3GTTNtEqBxH+LB6f5s=; b=Bo6V8czjhovL0i5i4nCY59C+p1mNwk49eJy+MRZhlAp1aP2YI4lnpuV4MQOgNISA17 rhOAz5h+kxN7SNrJz2cHppxKlIPJs0keuZdFry0Lrn50fvO+yMkumBdIKiu8LdbdGVfz uI3DEkwdRv3U0MAjxY17jKvvIvrhcQeWhQhFV0+h7VWDls02Eg+CNRagPd5Oxw5JwDE2 r6f6O2BoaAijqDCRnsPpSXM09sFHWeZ3qVRCBTloF9ZiApDq1llklAHZEWboxcEzlZhq c8qzFg9OCuTDp/stzQX86qTqCDQsKC0aatiGlfMsemEkIVURPcGb0PoK39/gQqeC+M05 ZADg== X-Gm-Message-State: AKwxytdy8Vogg6ZVm9unZkSylkxwt/HMa+iaxYEjBJDeUF0dtUFpAF0M mdjeRt64ENbXR4MRMmtPDh0QIbbkXm9DL6FIU0K6eQ== X-Received: by 10.107.97.24 with SMTP id v24mr35461720iob.296.1517433514194; Wed, 31 Jan 2018 13:18:34 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.128.7 with HTTP; Wed, 31 Jan 2018 13:18:33 -0800 (PST) In-Reply-To: <1517430103.18619.203.camel@infradead.org> References: <1517427467-28567-1-git-send-email-karahmed@amazon.de> <1517427467-28567-5-git-send-email-karahmed@amazon.de> <06cb88da-f355-41ed-380f-7daa8ddf6159@amazon.com> <1517430103.18619.203.camel@infradead.org> From: Jim Mattson Date: Wed, 31 Jan 2018 13:18:33 -0800 Message-ID: Subject: Re: [PATCH v5 4/5] KVM: VMX: Allow direct access to MSR_IA32_SPEC_CTRL To: David Woodhouse Cc: KarimAllah Ahmed , KarimAllah Ahmed , kvm list , LKML , "the arch/x86 maintainers" , Asit Mallick , Arjan Van De Ven , Dave Hansen , Andi Kleen , Andrea Arcangeli , Linus Torvalds , Tim Chen , Thomas Gleixner , Dan Williams , Jun Nakajima , Paolo Bonzini , Greg KH , Andy Lutomirski , Ashok Raj Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 31, 2018 at 12:21 PM, David Woodhouse wrote: > Reading and writing this MSR is expensive. And if it's yielded to the > guest in the MSR bitmap, that means we have to save its value on vmexit > and set it back to zero. Agreed. But my point is that if it's not yielded to the guest in the MSR bitmap, then we don't have to save its value on VM-exit and set it back to zero. The vmcs02 MSR bitmap is reconstructed on every L1->L2 transition. Sometimes, it will yield the MSR and sometimes it won't. > Some of the gymnastics here are explicitly done to avoid having to do > that save-and-zero step unless the guest has *actually* touched the > MSR. Not just if we are *willing* to let it do so. > > That's the whole point in the yield-after-first-write dance. Sorry; bad choice of words on my part. All that L0 knows of L1's "willingness" to pass the MSR through to L2 comes from the vmcs12 MSR permission bitmap. If L1 also adopts a "clear the WRMSR intercept on first write" strategy, then as far as L0 can tell, L1 is "unwilling" to pass the MSR through until L2 has written it.