From: "Saripalli, RK" <rsaripal@amd.com>
To: Reiji Watanabe <reijiw@google.com>
Cc: linux-kernel@vger.kernel.org, x86@kernel.org, tglx@linutronix.de,
mingo@redhat.com, bp@alien8.de, hpa@zytor.com,
Jonathan Corbet <corbet@lwn.net>,
bsd@redhat.com
Subject: Re: [PATCH v4 1/1] x86/cpufeatures: Implement Predictive Store Forwarding control.
Date: Fri, 30 Apr 2021 14:52:08 -0500 [thread overview]
Message-ID: <e53887f8-c09d-28db-5041-bf8822370c46@amd.com> (raw)
In-Reply-To: <CAAeT=Fw-nt5h3DhRCQr8Ma71NiP7dHB+WD2hie_55SpCHR=mDQ@mail.gmail.com>
On 4/30/2021 2:42 PM, Reiji Watanabe wrote:
>> +static int __init psf_cmdline(char *str)
>> +{
>> + u64 tmp = 0;
>> +
>> + if (!boot_cpu_has(X86_FEATURE_PSFD))
>> + return 0;
>> +
>> + if (!str)
>> + return -EINVAL;
>> +
>> + if (!strcmp(str, "off")) {
>> + set_cpu_cap(&boot_cpu_data, X86_FEATURE_MSR_SPEC_CTRL);
>> + rdmsrl(MSR_IA32_SPEC_CTRL, tmp);
>> + tmp |= SPEC_CTRL_PSFD;
>> + x86_spec_ctrl_base |= tmp;
>> + wrmsrl(MSR_IA32_SPEC_CTRL, x86_spec_ctrl_base);
>> + }
>> +
>> + return 0;
>> +}
>
>
> Shouldn't X86_FEATURE_MSR_SPEC_CTRL always be set if the CPU has
> X86_FEATURE_PSFD even if the new kernel parameter is not used ?
> (e.g. set X86_FEATURE_MSR_SPEC_CTRL in init_speculation_control()
> and have psf_cmdline() do the rest)
>
> Considering KVM/virtualization for a CPU that has X86_FEATURE_PSFD
> but no other existing feature with MSR_IA32_SPEC_CTRL, if a host
> doesn't enable PSFD with the new parameter, the host doesn't have
> X86_FEATURE_MSR_SPEC_CTRL. Then, it would be a problem if its
> guests want to use PSFD looking at x86_virt_spec_ctrl().
> (I'm not sure how you will change your previous KVM patch though)
Reiji, you are correct that X86_FEATURE_MSR_SPEC_CTRL should be enabled so KVM guests can use PSFD
even if host does not use it.
I have this change in my KVM patch.
Thanks for the review,
RK
>
> Thanks,
> Reiji
>
next prev parent reply other threads:[~2021-04-30 19:52 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-30 13:17 [PATCH v4 0/1] Introduce support for PSF control Ramakrishna Saripalli
2021-04-30 13:17 ` [PATCH v4 1/1] x86/cpufeatures: Implement Predictive Store Forwarding control Ramakrishna Saripalli
2021-04-30 14:50 ` Tom Lendacky
2021-04-30 14:56 ` Saripalli, RK
2021-04-30 19:42 ` Reiji Watanabe
2021-04-30 19:52 ` Saripalli, RK [this message]
2021-05-01 1:50 ` Reiji Watanabe
2021-05-04 21:01 ` Saripalli, RK
2021-05-04 22:11 ` Reiji Watanabe
2021-05-05 1:13 ` Saripalli, RK
2021-04-30 19:56 ` Borislav Petkov
2021-04-30 21:03 ` Reiji Watanabe
2021-04-30 21:11 ` Borislav Petkov
2021-05-01 1:01 ` Reiji Watanabe
2021-05-05 0:11 ` Pawan Gupta
2021-05-05 1:11 ` Saripalli, RK
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e53887f8-c09d-28db-5041-bf8822370c46@amd.com \
--to=rsaripal@amd.com \
--cc=bp@alien8.de \
--cc=bsd@redhat.com \
--cc=corbet@lwn.net \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=reijiw@google.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).