Received: by 10.223.185.116 with SMTP id b49csp1010629wrg; Fri, 16 Feb 2018 10:45:59 -0800 (PST) X-Google-Smtp-Source: AH8x227awUAxMuskjouQGFcbFuIs2quIJN2058+99eKr54IennxtZaw5KFlxZuCTN4fLRpez6fTp X-Received: by 10.167.130.133 with SMTP id s5mr6867665pfm.238.1518806759760; Fri, 16 Feb 2018 10:45:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518806759; cv=none; d=google.com; s=arc-20160816; b=zNdmwkxPc6gwFxeCKTXkX3T+wqkxZTFY2DFmzdDdedGU3GCLTzu5ZWZxnFxTNDeG39 hfu/tUZ3Z49lcKMBtAO3GzUfHM/SWWlt50MUlDv57idYPeuRfPCYsONwpdUAw/w6Ojqs jg0IXtBfVhqtfXMnEtihkP2JirauF3sdzkWF6r5ZRCdrpjnFi4XLsuUiGtA1B8vFdCo7 qiF6qjPzM/2xpci2+s0TSCkkz/+vaoxA0Kr+l/TXm8RgoOzBQ0R0vP1OPO2aaJW5hnTF L+avKjC+tcfJCgB8Yq7kb9JDH503iBdOykn5HIiwtayVmFP9SG7NWj5h7C+4DrYyEAWW PzaQ== 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=gi1WKP2bmjplqt2NIWAEJ1esA8ZOcPCNFuUOxcIxeM0=; b=O0YFdwn9g0nlmzpA/fMKrxzFWDSdH5Gbd9F+zP0shggYBAO5hwS9k7o0o/xYEd0h+N VrzEYvW5RCGXJNPBtdzYP3UFHOWD0uP4xLzBqvUhgJClFmCjDignf+6Dzmj8VE/PocqB yeklpSWQaCZip/1QPSj1oLryPpckcLZdWmNIjU8EoamdDnzDTIRuhGiSFz9+KCQJp5e5 Z+70oOnuK5pUOGEojjtI0iV79BgkiaqwlUf4BEdp1q+5wCjSin/gsulvTuRXfGJvZaP6 z4dOaFO9P+gK0G49gwFfNb2OSXPS+RT9esGlpZAKw4Mn3+vimRoaqw7hu/zbxJOfWov4 5thg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=cDImy0N5; 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 k5si433875pgq.557.2018.02.16.10.45.45; Fri, 16 Feb 2018 10:45:59 -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=cDImy0N5; 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 S1751334AbeBPECU (ORCPT + 99 others); Thu, 15 Feb 2018 23:02:20 -0500 Received: from mail-io0-f173.google.com ([209.85.223.173]:44340 "EHLO mail-io0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751299AbeBPECS (ORCPT ); Thu, 15 Feb 2018 23:02:18 -0500 Received: by mail-io0-f173.google.com with SMTP id z6so2930908iob.11 for ; Thu, 15 Feb 2018 20:02:18 -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=gi1WKP2bmjplqt2NIWAEJ1esA8ZOcPCNFuUOxcIxeM0=; b=cDImy0N5fteyx8wyXn7ES4oG0W2AwCtnF7TKnazXWmzuorqgfhlaq896ldMIaCpHk+ yOuKeTuinz8LAFJULfXumUhjZxLeQkiccLTr6v4S902eYzfTn8BoKmX880uiGlQmbiOZ if/LkTAvCL5Pe4AoVeyX9Oyc2WtGojopq0GIcYzCJF9gOhcjhQVLIS0fvi0VAhmTSM1i HqpEvY3Pd1BXP0Y7ceEjc4ktOI87wW7jgdcWcc689aujLEin18xub2enPvDCm6QJipMA 7xKmQ/B8XccjnDLF8IfOoPSNsEq66wsnm8Gdc1s1fC845cOqLzk0ujB4tekhZgVMDnr9 6aZg== 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=gi1WKP2bmjplqt2NIWAEJ1esA8ZOcPCNFuUOxcIxeM0=; b=BQhob23Ob0GYwyqP1m4FWKfsHiJ0vw5Pua2ryQR5Z7bMr2zxhZtpl/LQA0LQ5YIYYd Qonq/5bCncwC6fECcoX78mPWurTxgEkhwQI50tpUiLK5nwyNvTq0JyMM+l3lg+srpmtK jY6g1+i1LfMsJABZ1aiMSMvmDrtPqywQrkvj/ouUgdEOx5N51VIMG9ESUmNaFTibAC4F QNUv7fgPEY1ua+lb7qCCh9FMTyRdT4WD5T2/7lKeswiqpbjYT462W+5EOJZ8LFQii0zR l8d/Y0r4i7mMlk2607jTv2xdEiq4Ae6Sbj1lcx6diB6VRAFYsEdain7LAMsgcEN10nHG 5g9g== X-Gm-Message-State: APf1xPCmeaZ+eKyP3CGRhBEp17k/7GIcjv612cazx1ZWjKT51lSE+mq2 EJSGU8yF6TGDW1wv/vk240Jz2WrC9EEHETULvypxHQ== X-Received: by 10.107.164.134 with SMTP id d6mr6663649ioj.176.1518753735877; Thu, 15 Feb 2018 20:02:15 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.128.36 with HTTP; Thu, 15 Feb 2018 20:02:15 -0800 (PST) In-Reply-To: <1517938181-15317-9-git-send-email-dwmw@amazon.co.uk> References: <1517938181-15317-1-git-send-email-dwmw@amazon.co.uk> <1517938181-15317-9-git-send-email-dwmw@amazon.co.uk> From: Jim Mattson Date: Thu, 15 Feb 2018 20:02:15 -0800 Message-ID: Subject: Re: [PATCH 8/9] KVM/VMX: Allow direct access to MSR_IA32_SPEC_CTRL To: David Woodhouse Cc: Paolo Bonzini , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , LKML , kvm list , KarimAllah Ahmed , Greg Kroah-Hartman , stable@vger.kernel.org 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 Tue, Feb 6, 2018 at 9:29 AM, David Woodhouse wrote: > @@ -8828,6 +8890,15 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu) > > vmx_arm_hv_timer(vcpu); > > + /* > + * If this vCPU has touched SPEC_CTRL, restore the guest's value if > + * it's non-zero. Since vmentry is serialising on affected CPUs, there > + * is no need to worry about the conditional branch over the wrmsr > + * being speculatively taken. > + */ > + if (vmx->spec_ctrl) > + wrmsrl(MSR_IA32_SPEC_CTRL, vmx->spec_ctrl); > + Shouldn't this be wrmsrl_safe? Userspace can make an ioctl to set vmx->spec_ctrl to non-zero even if the MSR is not supported on the host.