From: Sean Christopherson <seanjc@google.com>
To: Borislav Petkov <bp@alien8.de>
Cc: kernel test robot <oliver.sang@intel.com>,
oe-lkp@lists.linux.dev, lkp@intel.com,
linux-kernel@vger.kernel.org, x86@kernel.org,
Ingo Molnar <mingo@kernel.org>,
Srikanth Aithal <sraithal@amd.com>
Subject: Re: [tip:x86/alternatives] [x86/alternatives] ee8962082a: WARNING:at_arch/x86/kernel/cpu/cpuid-deps.c:#do_clear_cpu_cap
Date: Tue, 30 Apr 2024 11:40:14 -0700 [thread overview]
Message-ID: <ZjE7DkTBSbPlBN8k@google.com> (raw)
In-Reply-To: <20240430172313.GCZjEpAfUECkEZ9S5L@fat_crate.local>
On Tue, Apr 30, 2024, Borislav Petkov wrote:
> + Sean.
> > [ 0.055225][ T0] ? __warn (kernel/panic.c:694)
> > [ 0.055225][ T0] ? do_clear_cpu_cap (arch/x86/kernel/cpu/cpuid-deps.c:118 (discriminator 1))
> > [ 0.055225][ T0] ? report_bug (lib/bug.c:180 lib/bug.c:219)
> > [ 0.055225][ T0] ? handle_bug (arch/x86/kernel/traps.c:239 (discriminator 1))
> > [ 0.055225][ T0] ? exc_invalid_op (arch/x86/kernel/traps.c:260 (discriminator 1))
> > [ 0.055225][ T0] ? asm_exc_invalid_op (arch/x86/include/asm/idtentry.h:621)
> > [ 0.055225][ T0] ? do_clear_cpu_cap (arch/x86/kernel/cpu/cpuid-deps.c:118 (discriminator 1))
> > [ 0.055225][ T0] ? __pfx_do_clear_cpu_cap (arch/x86/kernel/cpu/cpuid-deps.c:109)
> > [ 0.055225][ T0] init_ia32_feat_ctl (arch/x86/kernel/cpu/feat_ctl.c:181)
>
> Yap, works as designed:
...
> won't work as expected because the patching has already happened.
>
> And I'm not sure even the dynamic testing *cpu_has() does will always
> work as we do this dance in get_cpu_cap() with forced flags.
>
> So, I'm thinking init_ia32_feat_ctl() should run in early_init_intel()
> which is before alternatives.
>
> And looking at init_ia32_feat_ctl(), all it does is set and clear
> a bunch of bits so I think it should be ok.
Hmm, I don't think the problem is that init_ia32_feat_ctl() is called too late.
It too is called from the BSP prior to alternative_instructions():
arch_cpu_finalize_init()
|
-> identify_boot_cpu()
|
-> identify_cpu()
|
-> .c_init() => init_intel()
Ah, and the WARN even specifically checks for the case where there's divergence
from the boot CPU:
if (boot_cpu_has(feature))
WARN_ON(alternatives_patched);
So I think this is a "real" warning about a misconfigured system, where VMX is
fully configured in MSR_IA32_FEAT_CTL on the boot CPU, but is disabled on a
secondary CPU.
FWIW, KVM will play nice with such a setup, as KVM specifically checks that VMX
is fully enabled all CPUs, but I would still consider this a misconfigured system.
> > [ 0.055225][ T0] init_intel (arch/x86/include/asm/msr.h:146 arch/x86/include/asm/msr.h:300 arch/x86/kernel/cpu/intel.c:583 arch/x86/kernel/cpu/intel.c:687)
> > [ 0.055225][ T0] identify_cpu (arch/x86/kernel/cpu/common.c:1824)
> > [ 0.055225][ T0] identify_secondary_cpu (arch/x86/kernel/cpu/common.c:1949)
> > [ 0.055225][ T0] smp_store_cpu_info (arch/x86/kernel/smpboot.c:333)
> > [ 0.055225][ T0] start_secondary (arch/x86/kernel/smpboot.c:197 arch/x86/kernel/smpboot.c:281)
> > [ 0.055225][ T0] ? __pfx_start_secondary (arch/x86/kernel/smpboot.c:231)
> > [ 0.055225][ T0] common_startup_64 (arch/x86/kernel/head_64.S:421)
> > [ 0.055225][ T0] </TASK>
> > [ 0.055225][ T0] ---[ end trace 0000000000000000 ]---
next prev parent reply other threads:[~2024-04-30 18:40 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-30 15:00 [tip:x86/alternatives] [x86/alternatives] ee8962082a: WARNING:at_arch/x86/kernel/cpu/cpuid-deps.c:#do_clear_cpu_cap kernel test robot
2024-04-30 17:23 ` Borislav Petkov
2024-04-30 18:40 ` Sean Christopherson [this message]
2024-04-30 19:32 ` Borislav Petkov
2024-04-30 19:51 ` Sean Christopherson
2024-04-30 22:33 ` Borislav Petkov
2024-05-04 12:48 ` Borislav Petkov
2024-05-04 12:49 ` [PATCH 1/2] x86/alternatives: Check the correct cpu_data's caps Borislav Petkov
2024-05-04 12:50 ` [PATCH 2/2] x86/CPU/Intel: Do the MSR_IA32_FEAT_CTL setup before alternatives Borislav Petkov
2024-05-06 7:09 ` [tip:x86/alternatives] [x86/alternatives] ee8962082a: WARNING:at_arch/x86/kernel/cpu/cpuid-deps.c:#do_clear_cpu_cap Oliver Sang
2024-05-06 7:39 ` Borislav Petkov
2024-05-06 8:01 ` Borislav Petkov
2024-05-06 8:12 ` Borislav Petkov
2024-05-07 2:29 ` Oliver Sang
2024-05-06 15:28 ` Sean Christopherson
2024-05-06 15:57 ` Borislav Petkov
2024-05-07 7:08 ` Oliver Sang
2024-05-07 11:48 ` Borislav Petkov
2024-05-07 17:09 ` Sean Christopherson
2024-05-08 8:08 ` Oliver Sang
2024-05-08 8:24 ` Borislav Petkov
2024-05-08 8:37 ` Oliver Sang
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=ZjE7DkTBSbPlBN8k@google.com \
--to=seanjc@google.com \
--cc=bp@alien8.de \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=mingo@kernel.org \
--cc=oe-lkp@lists.linux.dev \
--cc=oliver.sang@intel.com \
--cc=sraithal@amd.com \
--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