Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966145AbeAJQ2C (ORCPT + 1 other); Wed, 10 Jan 2018 11:28:02 -0500 Received: from mx1.redhat.com ([209.132.183.28]:17785 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965369AbeAJQ2A (ORCPT ); Wed, 10 Jan 2018 11:28:00 -0500 Subject: Re: [PATCH 3/8] kvm: vmx: pass MSR_IA32_SPEC_CTRL and MSR_IA32_PRED_CMD down to the guest To: Liran Alon , dwmw@amazon.co.uk Cc: konrad.wilk@oracle.com, jmattson@google.com, x86@kernel.org, bp@alien8.de, nadav.amit@gmail.com, thomas.lendacky@amd.com, aliguori@amazon.com, arjan@linux.intel.com, rkrcmar@redhat.com, linux-kernel@vger.kernel.org, kvm@vger.kernel.org References: From: Paolo Bonzini Message-ID: <65578664-e3ec-f894-4e94-ff9fe6d7d6b3@redhat.com> Date: Wed, 10 Jan 2018 17:27:47 +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: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 10 Jan 2018 16:28:00 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: I can answer (2) only. On 10/01/2018 17:19, Liran Alon wrote: > (2) On VMExit, Intel recommends to always save guest SPEC_CTRL value, > set IBRS to 1 (even if it is already set by guest) and stuff RSB. What > exactly does this write of 1 to IBRS do? > * a) Does it keep all currently existing BTB/BHB entries created by > less-privileged prediction-mode and marks them as were created in > less-privileged prediction-mode such that they won't be used in current > prediction-mode? > * b) Or does it, as Paolo has mentioned multiple times, disables the > branch predictor to never consult the BTB/BHB at all as long as IBRS=1? > If (b) is true, why is setting IBRS=1 better than just issue an IBPB that clears all entries? At least in that case the > host kernel could still benefict branch prediction performance boost. Arjan said (b) is not true on all processor generations. But even if it were true, setting IBRS=1 is much, much faster than IBPB. > If (a) is true, does "IBRS ALL THE TIME" usage is basically a CPU > change to just create all BTB/BHB entries to be tagged with > prediction-mode at creation-time and that tag to be compared to current > prediction-mode when CPU attempts to use BTB/BHB? I hope so, and I hope said prediction mode includes PCID/VPID too. While I agree with David that "we have other things to work on for now before we support hypothetical future hardware", I'd like to make sure that Intel gets it right... Paolo