Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754200AbeAIQ5N (ORCPT + 1 other); Tue, 9 Jan 2018 11:57:13 -0500 Received: from mail-wm0-f48.google.com ([74.125.82.48]:37936 "EHLO mail-wm0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750831AbeAIQ5M (ORCPT ); Tue, 9 Jan 2018 11:57:12 -0500 X-Google-Smtp-Source: ACJfBosXgRXcrlLFkQu944b9tgERJY0P01gNkhYR3i/A4PveTCTrwqR8oAJ1mjZYOmr9uK94FpF48A== Subject: Re: [PATCH 3/8] kvm: vmx: pass MSR_IA32_SPEC_CTRL and MSR_IA32_PRED_CMD down to the guest To: Liran Alon Cc: jmattson@google.com, x86@kernel.org, dwmw@amazon.co.uk, bp@alien8.de, aliguori@amazon.com, thomas.lendacky@amd.com, rkrcmar@redhat.com, linux-kernel@vger.kernel.org, kvm@vger.kernel.org References: <222d0a6b-820f-4d7c-a616-ac89f77c3c09@default> From: Paolo Bonzini Message-ID: <834e9b46-5d59-a81e-8cda-5f576964e1cb@redhat.com> Date: Tue, 9 Jan 2018 17:57:08 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <222d0a6b-820f-4d7c-a616-ac89f77c3c09@default> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On 09/01/2018 17:48, Liran Alon wrote: >>> >>> + if (have_spec_ctrl) { >>> + rdmsrl(MSR_IA32_SPEC_CTRL, vmx->spec_ctrl); >>> + if (vmx->spec_ctrl != 0) >>> + wrmsrl(MSR_IA32_SPEC_CTRL, 0); > > As I said also on the AMD patch, I think this is a bug. > Intel specify that we should set IBRS bit even if it was already set on every #VMExit. That's correct (though I'd like to understand _why_---I'm not inclined to blindly trust a spec), but for now it's saving a wrmsr of 0. That is quite obviously okay, and will be also okay after the bare-metal IBRS patches. Of course the code will become something like if (using_ibrs || vmx->spec_ctrl != 0) wrmsrl(MSR_IA32_SPEC_CTRL, host_ibrs); optimizing the case where the host is using retpolines. Paolo