All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hao Peng <flyingpenghao@gmail.com>
To: Xiaoyao Li <xiaoyao.li@intel.com>
Cc: Borislav Petkov <bp@alien8.de>,
	tglx@linutronix.de, mingo@redhat.com, x86@kernel.org,
	linux-kernel@vger.kernel.org,
	Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Subject: Re: [PATCH] x86/tsx: clear RTM and HLE when MSR_IA32_TSX_CTRL is not supported
Date: Tue, 7 Sep 2021 11:40:28 +0800	[thread overview]
Message-ID: <CAPm50aL_eJm2s5GJD1OMFK3vt_iHLQrBueiz-NWS38H=Zz378w@mail.gmail.com> (raw)
In-Reply-To: <77e8d483-4395-0017-300e-0886f75217bb@intel.com>

On Tue, Sep 7, 2021 at 10:56 AM Xiaoyao Li <xiaoyao.li@intel.com> wrote:
>
> On 9/7/2021 10:35 AM, Hao Peng wrote:
> > On Tue, Sep 7, 2021 at 10:08 AM Xiaoyao Li <xiaoyao.li@intel.com> wrote:
> >>
> >> On 9/7/2021 9:47 AM, Hao Peng wrote:
> >>> On Mon, Sep 6, 2021 at 5:30 PM Borislav Petkov <bp@alien8.de> wrote:
> >>>>
> >>>> On Mon, Sep 06, 2021 at 10:46:05AM +0800, Hao Peng wrote:
> >>>>> If hypervisor does not support MSR_IA32_TSX_CTRL, but guest supports
> >>>>> RTM and HLE features, it will affect TAA mitigation.
> >>>>>
> >>>>> Signed-off-by: Peng Hao <flyingpeng@tencent.com>
> >>>>> ---
> >>>>>    arch/x86/kernel/cpu/tsx.c | 7 +++++++
> >>>>>    1 file changed, 7 insertions(+)
> >>>>>
> >>>>> diff --git a/arch/x86/kernel/cpu/tsx.c b/arch/x86/kernel/cpu/tsx.c
> >>>>> index 9c7a5f049292..5e852c14fef2 100644
> >>>>> --- a/arch/x86/kernel/cpu/tsx.c
> >>>>> +++ b/arch/x86/kernel/cpu/tsx.c
> >>>>> @@ -122,6 +122,13 @@ void __init tsx_init(void)
> >>>>>
> >>>>>           if (!tsx_ctrl_is_supported()) {
> >>>>>                   tsx_ctrl_state = TSX_CTRL_NOT_SUPPORTED;
> >>>>> +
> >>>>> +               /* If hypervisor does not support MSR_IA32_TSX_CTRL emulation,
> >>>>> +                * but guest supports RTM and HLE features, it will affect TAA
> >>>>> +                * (tsx_async_abort)mitigation.
> >>>>> +                */
> >>>>> +               setup_clear_cpu_cap(X86_FEATURE_RTM);
> >>>>> +               setup_clear_cpu_cap(X86_FEATURE_HLE);
> >>
> >> anyway, IMHO, we shouldn't do anything here for TAA. It should be in
> >> taa_select_mitigation()
> >>
> >>>>>                   return;
> >>>>>           }
> >>>>
> >>>> How does that even happen - the hypervisor does not support the MSR but
> >>>> "guest supports" TSX features?!
> >>>>
> >>>> I guess the guest is detecting it wrong.
> >>>>
> >>>> What hypervisor, what guest, how do I reproduce?
> >>>>
> >>> hypervisor is kvm, guest is linux too.
> >>>> Please give full details.
> >>>>
> >>> The host I used is kernel-5.4, and guest is kernel-5.13.
> >>> MSR_IA32_TSX_CTRL is exposed
> >>> to guest and guest to support RTM and HLE features, no direct
> >>> dependence. at the qemu I
> >>> started guest with -cpu host-model.
> >>> I have viewed the code of kernel-5.4, and MSR_IA32_TSX_CTRL is not
> >>> exposed to guest.
> >>
> >> Does guest see TAA_NO bit?
> >>
> > Guest can't see taa_no, which requires updating qemu to solve. But I think
> > there is a compatibility process here.
>
> Anyway, there should be some existing code in kernel already to handle
> the case that CPUID reports TRM while MSR_IA32_CORE_CAPABILITIES doesn't
> report MSR_TSX_CTRL nor TAA_NO.
>
Can you point out which patches ? At present, guest is kernel-5.13
still has this problem.
Thanks.
> And the Patch itself makes no sense.
>
> >>> Thanks.
> >>>> --
> >>>> Regards/Gruss,
> >>>>       Boris.
> >>>>
> >>>> https://people.kernel.org/tglx/notes-about-netiquette
> >>
>

  reply	other threads:[~2021-09-07  3:41 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-06  2:46 [PATCH] x86/tsx: clear RTM and HLE when MSR_IA32_TSX_CTRL is not supported Hao Peng
2021-09-06  9:30 ` Borislav Petkov
2021-09-07  1:47   ` Hao Peng
2021-09-07  2:08     ` Xiaoyao Li
2021-09-07  2:35       ` Hao Peng
2021-09-07  2:56         ` Xiaoyao Li
2021-09-07  3:40           ` Hao Peng [this message]
2021-09-07  4:26             ` Xiaoyao Li
2021-09-07  4:39               ` Hao Peng
2021-09-07  5:38                 ` Pawan Gupta
2021-09-07  6:56                   ` Hao Peng
2021-09-07 23:07                     ` Pawan Gupta
2021-09-07  5:28           ` Pawan Gupta
2021-09-07  5:14 ` Pawan Gupta
2021-09-07  6:36   ` Hao Peng
2021-09-07 22:59     ` Pawan Gupta
2021-09-08  5:06       ` Hao Peng
2021-09-08 16:02         ` Pawan Gupta

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='CAPm50aL_eJm2s5GJD1OMFK3vt_iHLQrBueiz-NWS38H=Zz378w@mail.gmail.com' \
    --to=flyingpenghao@gmail.com \
    --cc=bp@alien8.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=pawan.kumar.gupta@linux.intel.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=xiaoyao.li@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.