[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e53887f8-c09d-28db-5041-bf8822370c46@amd.com>
Date: Fri, 30 Apr 2021 14:52:08 -0500
From: "Saripalli, RK" <rsaripal@....com>
To: Reiji Watanabe <reijiw@...gle.com>
Cc: linux-kernel@...r.kernel.org, x86@...nel.org, tglx@...utronix.de,
mingo@...hat.com, bp@...en8.de, hpa@...or.com,
Jonathan Corbet <corbet@....net>, bsd@...hat.com
Subject: Re: [PATCH v4 1/1] x86/cpufeatures: Implement Predictive Store
Forwarding control.
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
>
Powered by blists - more mailing lists