mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: bot+bpf-ci@kernel.org
To: ihor.solodrai@linux.dev,bp@alien8.de,dave.hansen@linux.intel.com,mingo@redhat.com,tglx@kernel.org
Cc: ast@kernel.org,andrii@kernel.org,ryabinin.a.a@gmail.com,akpm@linux-foundation.org,hpa@zytor.com,andreyknvl@gmail.com,linux-kernel@vger.kernel.org,x86@kernel.org,bpf@vger.kernel.org,kasan-dev@googlegroups.com,linux-mm@kvack.org,kernel-team@meta.com,ast@kernel.org,andrii@kernel.org,daniel@iogearbox.net,martin.lau@kernel.org,eddyz87@gmail.com,yonghong.song@linux.dev,mason@kernel.org,ihor.solodrai@linux.dev
Subject: Re: [PATCH v3 2/5] x86/cpu: Initialize boot CPU cpuinfo defaults early
Date: Thu, 17 Sep 2026 23:49:50 +0000 (UTC)	[thread overview]
Message-ID: <e7ff3f8ea537dfb920e2eb4b8a10c729d4e40014cb801472f4be848eab69da2c@mail.kernel.org> (raw)
In-Reply-To: <20260916195203.1099646-3-ihor.solodrai@linux.dev>

[-- Attachment #1: Type: text/plain, Size: 2870 bytes --]

> diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
> index c3dce89ba5904..66695addbdf33 100644
> --- a/arch/x86/kernel/cpu/common.c
> +++ b/arch/x86/kernel/cpu/common.c
> @@ -1812,16 +1812,15 @@ static void init_cpu_info(struct cpuinfo_x86 *c)
>   * Do minimum CPU detection early.
>   * Fields really needed: vendor, cpuid_level, family, model, mask,
>   * cache alignment.
> - * The others are not touched to avoid unwanted side effects.
> + * The others are reset to their defaults here and only filled in later,
> + * by identify_cpu().
                         ^^

Does this comment match what the code does? The comment says fields
outside the "really needed" list are only reset here and filled in later
by identify_cpu(), but early_identify_cpu() itself fills in most of those
fields before it returns.

After init_cpu_info() resets the fields, early_identify_cpu() continues
to call:

  cpuid_scan_cpu(c);         /* re-populates c->cpuid */
  cpu_detect(c);             /* x86_clflush_size, x86_cache_alignment */
  get_cpu_cap(c);            /* x86_capability[], extended_cpuid_level */
  get_cpu_address_sizes(c);  /* x86_phys_bits, x86_virt_bits,
                                x86_cache_alignment */

Of the twelve fields init_cpu_info() resets, only three (x86_cache_size,
x86_model_id and, under CONFIG_X86_VMX_FEATURE_NAMES, vmx_capability) are
left for identify_cpu(); the capability array, the CPUID table,
extended_cpuid_level and the address sizes are all re-established in this
function.

The sentence also contradicts the line immediately above it, which already
lists "cache alignment" among the fields early detection does produce.

This matters more than a normal comment nit because the very next paragraph
is a WARNING about what may and may not be added to this function: a reader
who believes the non-essential fields are untouched until identify_cpu()
would draw the wrong conclusion about what state is valid at this point in
boot.

Could the comment say that the architectural defaults for the remaining
fields are established here, and that only the cache size, model string
(and VMX capabilities) are filled in later by identify_cpu()?

>   *
>   * WARNING: this function is only called on the boot CPU.  Don't add code
>   * here that is supposed to run on all CPUs.
>   */
>  static void __init early_identify_cpu(struct cpuinfo_x86 *c)
>  {
> -	memset(&c->x86_capability, 0, sizeof(c->x86_capability));
> -	memset(&c->cpuid, 0, sizeof(c->cpuid));
> -	c->extended_cpuid_level = 0;
> +	init_cpu_info(c);
>
>  	if (!cpuid_feature())
>  		identify_cpu_without_cpuid(c);


---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md

CI run summary: https://github.com/kernel-patches/bpf/actions/runs/35285131592

  parent reply	other threads:[~2026-09-17 23:49 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-16 19:51 [PATCH v3 0/5] x86/cpu: Refactor identify_cpu() Ihor Solodrai
2026-09-16 19:51 ` [PATCH v3 1/5] x86/cpu: Factor init_cpu_info() out of identify_cpu() Ihor Solodrai
2026-09-17  2:00   ` [tip: x86/cpu] " tip-bot2 for Ihor Solodrai
2026-09-17 23:49   ` [PATCH v3 1/5] " bot+bpf-ci
2026-09-16 19:52 ` [PATCH v3 2/5] x86/cpu: Initialize boot CPU cpuinfo defaults early Ihor Solodrai
2026-09-17  2:00   ` [tip: x86/cpu] " tip-bot2 for Ihor Solodrai
2026-09-17 23:49   ` bot+bpf-ci [this message]
2026-09-16 19:52 ` [PATCH v3 3/5] x86/cpu: Inline generic_identify() into identify_cpu() Ihor Solodrai
2026-09-17  2:00   ` [tip: x86/cpu] " tip-bot2 for Ihor Solodrai
2026-09-17 23:49   ` [PATCH v3 3/5] " bot+bpf-ci
2026-09-16 19:52 ` [PATCH v3 4/5] x86/cpu: Move 32-bit SEP setup " Ihor Solodrai
2026-09-17  2:00   ` [tip: x86/cpu] " tip-bot2 for Ihor Solodrai
2026-09-17 23:49   ` [PATCH v3 4/5] " bot+bpf-ci
2026-09-16 19:52 ` [PATCH v3 5/5] x86/cpu: Don't transiently clear the boot CPU's capabilities Ihor Solodrai
2026-09-17  2:00   ` [tip: x86/cpu] " tip-bot2 for Ihor Solodrai

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=e7ff3f8ea537dfb920e2eb4b8a10c729d4e40014cb801472f4be848eab69da2c@mail.kernel.org \
    --to=bot+bpf-ci@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=andreyknvl@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bp@alien8.de \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=dave.hansen@linux.intel.com \
    --cc=eddyz87@gmail.com \
    --cc=hpa@zytor.com \
    --cc=ihor.solodrai@linux.dev \
    --cc=kasan-dev@googlegroups.com \
    --cc=kernel-team@meta.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=martin.lau@kernel.org \
    --cc=mason@kernel.org \
    --cc=mingo@redhat.com \
    --cc=ryabinin.a.a@gmail.com \
    --cc=tglx@kernel.org \
    --cc=x86@kernel.org \
    --cc=yonghong.song@linux.dev \
    /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

all inboxes | Powered by JetHome®