Received: by 10.223.185.116 with SMTP id b49csp1009287wrg; Fri, 16 Feb 2018 10:44:26 -0800 (PST) X-Google-Smtp-Source: AH8x225Jc6Gc2KqSM8J7xY4ejH/cAU7bJSI0oZVPo8EwhZ5GDzewo8lW9cRGSREKL2REinbUAIlk X-Received: by 10.101.91.140 with SMTP id i12mr5717280pgr.297.1518806666532; Fri, 16 Feb 2018 10:44:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518806666; cv=none; d=google.com; s=arc-20160816; b=tm5euegECd8wXGNB6698a23u/uXOxBYJojkodBuNVZbKNp+ftA1D0RhQ9cJbPCEpKM S1extn2ku2KP5FwFehgX8gk21T8sGinlJvZzFO4ewrws7jfct4uemHk39GydDBHfyT7b humQEhAGHLnDx0Eqq4yAcl6Dp1HScnF6hgSD9xmMCTJqrOtzHTmMUGa4z52JUbk9j1bY MhCX8+fxtSRYHsoLRc0JQnh8YUCEqh5bf0pHED2yVJSmXvIzfzFg4v3tveonqpH5UM4b PdT7H7KqFfz52bl9ARVHsMdu/QYPUfR79bsA6MJSJNNMDpsP6zhq7kgZ5gq+EBwZGdh6 JfwA== 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=cdjXba4UFcFe11E08OGZ7ic9p58PMQNAcUu7XClCMwg=; b=lgWdYxMoSKZBeGeEme7WC7Wjb7InEfZZFTcIC8bK5tOhxCz+tOc2k7xJtwpZhfQybS yNV9wMxoMhneP4OrmJRkjfI9irn9Zo8i9VAeB2JB45+E3vkid8Td/FqIxRYH0RDDrSA1 pwTBqAqsy/GwFN8KnTfe+AmaZ6oTXZbRrCNUvRjXKRjYZ55i6itZdHYXmcBP0FraJwBU ncev34M5Buqvicb1k4q8Q73zF2Lst4YsPHQUZI6bi+gE9hB8KHXMt8qRXhOU/BS64N3K HPFTURQ9fwpkChyrxUaSVgy/28K0HrUYqipzy82bw8u2zyGMQGMroOJl+0K4I+b9VqMH QQZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=r76kCtOi; 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 u7si154019pgq.712.2018.02.16.10.44.12; Fri, 16 Feb 2018 10:44:26 -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=r76kCtOi; 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 S1751192AbeBPDo3 (ORCPT + 99 others); Thu, 15 Feb 2018 22:44:29 -0500 Received: from mail-it0-f54.google.com ([209.85.214.54]:53550 "EHLO mail-it0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751121AbeBPDo0 (ORCPT ); Thu, 15 Feb 2018 22:44:26 -0500 Received: by mail-it0-f54.google.com with SMTP id w63so576541ita.3 for ; Thu, 15 Feb 2018 19:44:26 -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=cdjXba4UFcFe11E08OGZ7ic9p58PMQNAcUu7XClCMwg=; b=r76kCtOio5cuTWSHmxBvSpseaTYaCyzmCZvp+ET9tlgTfNpkOvOeqVY3WuI5EPq++s fmeKkga2UM5qpZVVS4WAhzZl0sK+9XiD/c4+hLNsOFhmZ1VcLHOFmnaYn8aHH6wyRamV +9fGHaxd/+I5RYsVfwySTt59GQqWbaj6NFYf4zWXqZ/1I2VoMVfOEp0ye+7KrJQNqbA7 +M4qn/e3buPbDjxVf/wnQPrr0+h6L01oOLA8zTQpupkig0rEZivLnl1wTksSZnafoS+I FN4+6L6iY867k9KzDJ0uykP4pFNpCmiAQCbmlPTV21ejtlEoYqUpw0Jrl1QCGAhREc7J xIRA== 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=cdjXba4UFcFe11E08OGZ7ic9p58PMQNAcUu7XClCMwg=; b=dAzc37w6/5dEGbY20dYxgUqojEZCfv+/0FuJYLaYNzT5ubaDkscJtx3aR87D72Y45j KMB4wNJyW+EJ8h9rUByHxWoqE3q45Mt9bxT7Af60xcruAnGNxmuT9ZN/SIvXflrYte5X WuSW1TuAep/OTEdjo9YSY9lnv4EYoWHXr4EG9HARqhX36SInUUL+VUu/+9U+d61oMVTs Q5OuvmkVgpWfM1U6O7OWyEUnk3LXn3SxwPZDAFKY/AuOY0xh6Xnox4u9ioat12y4B6C+ x013ylAWZkAmghgSBqE8t899uXpVtRxbO7f/MzHkkX2It/DuDLieveCnSgcVII1zAImA iIWg== X-Gm-Message-State: APf1xPCCwJKXK4g0iEt++PXSCBhtBkmwASmBO4RlhPtQ9mC62b7/QWVk qPgUH2FcyX1/kJD/5NeW5GBCMiGWqNNrLrikqZJOmTai X-Received: by 10.36.124.1 with SMTP id a1mr6496195itd.92.1518752665870; Thu, 15 Feb 2018 19:44:25 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.128.36 with HTTP; Thu, 15 Feb 2018 19:44:25 -0800 (PST) In-Reply-To: <1517522386-18410-3-git-send-email-karahmed@amazon.de> References: <1517522386-18410-1-git-send-email-karahmed@amazon.de> <1517522386-18410-3-git-send-email-karahmed@amazon.de> From: Jim Mattson Date: Thu, 15 Feb 2018 19:44:25 -0800 Message-ID: Subject: Re: [PATCH v6 2/5] KVM: x86: Add IBPB support To: KarimAllah Ahmed Cc: kvm list , LKML , "the arch/x86 maintainers" , Ashok Raj , Asit Mallick , Dave Hansen , Arjan Van De Ven , Tim Chen , Linus Torvalds , Andrea Arcangeli , Andi Kleen , Thomas Gleixner , Dan Williams , Jun Nakajima , Andy Lutomirski , Greg KH , Paolo Bonzini , Peter Zijlstra , David Woodhouse 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 Thu, Feb 1, 2018 at 1:59 PM, KarimAllah Ahmed wrote: > @@ -3684,6 +3696,22 @@ static int svm_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr) > case MSR_IA32_TSC: > kvm_write_tsc(vcpu, msr); > break; > + case MSR_IA32_PRED_CMD: > + if (!msr->host_initiated && > + !guest_cpuid_has(vcpu, X86_FEATURE_IBPB)) > + return 1; > + > + if (data & ~PRED_CMD_IBPB) > + return 1; > + > + if (!data) > + break; > + > + wrmsrl(MSR_IA32_PRED_CMD, PRED_CMD_IBPB); Should this be wrmsrl_safe? I don't see where we've verified host support of this MSR. > @@ -3342,6 +3369,34 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info) > case MSR_IA32_TSC: > kvm_write_tsc(vcpu, msr_info); > break; > + case MSR_IA32_PRED_CMD: > + if (!msr_info->host_initiated && > + !guest_cpuid_has(vcpu, X86_FEATURE_IBPB) && > + !guest_cpuid_has(vcpu, X86_FEATURE_SPEC_CTRL)) > + return 1; > + > + if (data & ~PRED_CMD_IBPB) > + return 1; > + > + if (!data) > + break; > + > + wrmsrl(MSR_IA32_PRED_CMD, PRED_CMD_IBPB); And here too...wrmsrl_safe?