All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: Brian Gerst <brgerst@gmail.com>
Cc: linux-kernel@vger.kernel.org, x86@kernel.org,
	"H . Peter Anvin" <hpa@zytor.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Borislav Petkov <bp@alien8.de>, Ard Biesheuvel <ardb@kernel.org>,
	Uros Bizjak <ubizjak@gmail.com>,
	Linus Torvalds <torvalds@linuxfoundation.org>,
	Andy Lutomirski <luto@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH v3 00/11] Add a percpu subsection for cache hot data
Date: Mon, 3 Mar 2025 21:38:57 +0100	[thread overview]
Message-ID: <Z8YTYWs-DeDHal1Q@gmail.com> (raw)
In-Reply-To: <20250303165246.2175811-1-brgerst@gmail.com>


* Brian Gerst <brgerst@gmail.com> wrote:

> Add a new percpu subsection for data that is frequently accessed and
> exclusive to each processor.  This replaces the pcpu_hot struct on x86,
> and is available to all architectures and the core kernel.
> 
> ffffffff834f5000 D __per_cpu_hot_start
> ffffffff834f5000 D hardirq_stack_ptr
> ffffffff834f5008 D __ref_stack_chk_guard
> ffffffff834f5008 D __stack_chk_guard
> ffffffff834f5010 D const_cpu_current_top_of_stack
> ffffffff834f5010 D cpu_current_top_of_stack
> ffffffff834f5018 D const_current_task
> ffffffff834f5018 D current_task
> ffffffff834f5020 D __x86_call_depth
> ffffffff834f5028 D this_cpu_off
> ffffffff834f5030 D __preempt_count
> ffffffff834f5034 D cpu_number
> ffffffff834f5038 D __softirq_pending
> ffffffff834f503a D hardirq_stack_inuse
> ffffffff834f503b D __per_cpu_hot_pad
> ffffffff834f5040 D __per_cpu_hot_end
> 
> This applies to the tip/x86/asm branch.
> 
> Changes in v3:
> - Fix typo of CACHE_HOT_DATA()
> - Move hardirq_stack_inuse to irq_64.c
> - Add __per_cpu_hot_pad to show the end of the actual data
> 
> Brian Gerst (11):
>   percpu: Introduce percpu hot section
>   x86/percpu: Move pcpu_hot to percpu hot section
>   x86/preempt: Move preempt count to percpu hot section
>   x86/smp: Move cpu number to percpu hot section
>   x86/retbleed: Move call depth to percpu hot section
>   x86/softirq: Move softirq_pending to percpu hot section
>   x86/irq: Move irq stacks to percpu hot section
>   x86/percpu: Move top_of_stack to percpu hot section
>   x86/percpu: Move current_task to percpu hot section
>   x86/stackprotector: Move __stack_chk_guard to percpu hot section
>   x86/smp: Move this_cpu_off to percpu hot section

>  31 files changed, 146 insertions(+), 111 deletions(-)

Yeah, so the result is that on x86-64 allmodconfig we now get:

  ld: percpu cache hot section too large

See the relevant .tmp_vmlinux1.map below.

Which is due to:

   CONFIG_X86_INTERNODE_CACHE_SHIFT=12

Increasing 'cache alignment' to 4096 bytes:

        PERCPU_SECTION(INTERNODE_CACHE_BYTES)

... because of the vSMP muck:

  config X86_INTERNODE_CACHE_SHIFT
        int
        default "12" if X86_VSMP
        default X86_L1_CACHE_SHIFT

The workaround would be to use L1_CACHE_BYTES in, but I really dislike 
what vSMP is doing here.

Anyway, I applied the short-term fix to patch 02/11, but I'm not sure 
it's the right fix.

Thanks,

	Ingo

=====================>
                0xffffffff8664f000                . = ALIGN (0x1000)
                0xffffffff8664f000                __per_cpu_hot_start = .
 *(SORT_BY_ALIGNMENT(.data..percpu..hot.*))
 .data..percpu..hot..hardirq_stack_ptr
                0xffffffff8664f000        0x8 vmlinux.o
                0xffffffff8664f000                hardirq_stack_ptr
 .data..percpu..hot..__stack_chk_guard
                0xffffffff8664f008        0x8 vmlinux.o
                0xffffffff8664f008                __stack_chk_guard
 .data..percpu..hot..cpu_current_top_of_stack
                0xffffffff8664f010        0x8 vmlinux.o
                0xffffffff8664f010                cpu_current_top_of_stack
 .data..percpu..hot..current_task
                0xffffffff8664f018        0x8 vmlinux.o
                0xffffffff8664f018                current_task
 .data..percpu..hot..__x86_call_depth
                0xffffffff8664f020        0x8 vmlinux.o
                0xffffffff8664f020                __x86_call_depth
 .data..percpu..hot..this_cpu_off
                0xffffffff8664f028        0x8 vmlinux.o
                0xffffffff8664f028                this_cpu_off
 .data..percpu..hot..__preempt_count
                0xffffffff8664f030        0x4 vmlinux.o
                0xffffffff8664f030                __preempt_count
 .data..percpu..hot..cpu_number
                0xffffffff8664f034        0x4 vmlinux.o
                0xffffffff8664f034                cpu_number
 .data..percpu..hot..__softirq_pending
                0xffffffff8664f038        0x2 vmlinux.o
                0xffffffff8664f038                __softirq_pending
 .data..percpu..hot..hardirq_stack_inuse
                0xffffffff8664f03a        0x1 vmlinux.o
                0xffffffff8664f03a                hardirq_stack_inuse
                0xffffffff8664f03b                __per_cpu_hot_pad = .
                0xffffffff86650000                . = ALIGN (0x1000)
 *fill*         0xffffffff8664f03b      0xfc5 
                0xffffffff86650000                __per_cpu_hot_end = .
 *(.data..percpu..read_mostly)
 .data..percpu..read_mostly
                0xffffffff86650000      0xa30 vmlinux.o

=================>

 arch/x86/kernel/vmlinux.lds.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S
index 9ac6b42701fa..31f9102b107f 100644
--- a/arch/x86/kernel/vmlinux.lds.S
+++ b/arch/x86/kernel/vmlinux.lds.S
@@ -330,7 +330,7 @@ SECTIONS
 		EXIT_DATA
 	}
 
-	PERCPU_SECTION(INTERNODE_CACHE_BYTES)
+	PERCPU_SECTION(L1_CACHE_BYTES)
 	ASSERT(__per_cpu_hot_end - __per_cpu_hot_start <= 64, "percpu cache hot section too large")
 
 	RUNTIME_CONST_VARIABLES


  parent reply	other threads:[~2025-03-03 20:39 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-03 16:52 [PATCH v3 00/11] Add a percpu subsection for cache hot data Brian Gerst
2025-03-03 16:52 ` [PATCH v3 01/11] percpu: Introduce percpu hot section Brian Gerst
2025-03-04  8:27   ` [tip: x86/core] " tip-bot2 for Brian Gerst
2025-03-04 10:36   ` tip-bot2 for Brian Gerst
2025-03-04 19:34   ` tip-bot2 for Brian Gerst
2025-03-04 19:43   ` tip-bot2 for Brian Gerst
2025-03-03 16:52 ` [PATCH v3 02/11] x86/percpu: Move pcpu_hot to " Brian Gerst
2025-03-04  8:27   ` [tip: x86/core] " tip-bot2 for Brian Gerst
2025-03-04 10:36   ` tip-bot2 for Brian Gerst
2025-03-04 19:34   ` tip-bot2 for Brian Gerst
2025-03-04 19:43   ` tip-bot2 for Brian Gerst
2025-03-03 16:52 ` [PATCH v3 03/11] x86/preempt: Move preempt count " Brian Gerst
2025-03-04  8:27   ` [tip: x86/core] " tip-bot2 for Brian Gerst
2025-03-04 10:36   ` tip-bot2 for Brian Gerst
2025-03-04 19:34   ` tip-bot2 for Brian Gerst
2025-03-04 19:43   ` tip-bot2 for Brian Gerst
2025-03-03 16:52 ` [PATCH v3 04/11] x86/smp: Move cpu number " Brian Gerst
2025-03-04  8:27   ` [tip: x86/core] " tip-bot2 for Brian Gerst
2025-03-04 10:36   ` tip-bot2 for Brian Gerst
2025-03-04 19:34   ` tip-bot2 for Brian Gerst
2025-03-04 19:43   ` tip-bot2 for Brian Gerst
2025-03-03 16:52 ` [PATCH v3 05/11] x86/retbleed: Move call depth " Brian Gerst
2025-03-04  8:27   ` [tip: x86/core] " tip-bot2 for Brian Gerst
2025-03-04 10:36   ` tip-bot2 for Brian Gerst
2025-03-04 19:34   ` tip-bot2 for Brian Gerst
2025-03-04 19:43   ` tip-bot2 for Brian Gerst
2025-03-03 16:52 ` [PATCH v3 06/11] x86/softirq: Move softirq_pending " Brian Gerst
2025-03-04  8:27   ` [tip: x86/core] " tip-bot2 for Brian Gerst
2025-03-04 10:36   ` tip-bot2 for Brian Gerst
2025-03-04 19:34   ` tip-bot2 for Brian Gerst
2025-03-04 19:43   ` tip-bot2 for Brian Gerst
2025-03-03 16:52 ` [PATCH v3 07/11] x86/irq: Move irq stacks " Brian Gerst
2025-03-04  8:27   ` [tip: x86/core] " tip-bot2 for Brian Gerst
2025-03-04 10:36   ` tip-bot2 for Brian Gerst
2025-03-04 19:34   ` tip-bot2 for Brian Gerst
2025-03-04 19:43   ` tip-bot2 for Brian Gerst
2025-03-03 16:52 ` [PATCH v3 08/11] x86/percpu: Move top_of_stack " Brian Gerst
2025-03-04  8:27   ` [tip: x86/core] " tip-bot2 for Brian Gerst
2025-03-04 10:36   ` tip-bot2 for Brian Gerst
2025-03-04 19:33   ` tip-bot2 for Brian Gerst
2025-03-04 19:43   ` tip-bot2 for Brian Gerst
2025-03-03 16:52 ` [PATCH v3 09/11] x86/percpu: Move current_task " Brian Gerst
2025-03-04  8:27   ` [tip: x86/core] " tip-bot2 for Brian Gerst
2025-03-04 10:36   ` tip-bot2 for Brian Gerst
2025-03-04 19:33   ` tip-bot2 for Brian Gerst
2025-03-04 19:43   ` tip-bot2 for Brian Gerst
2025-03-03 16:52 ` [PATCH v3 10/11] x86/stackprotector: Move __stack_chk_guard " Brian Gerst
2025-03-04  8:27   ` [tip: x86/core] " tip-bot2 for Brian Gerst
2025-03-04 10:36   ` tip-bot2 for Brian Gerst
2025-03-04 19:33   ` tip-bot2 for Brian Gerst
2025-03-04 19:43   ` tip-bot2 for Brian Gerst
2025-03-03 16:52 ` [PATCH v3 11/11] x86/smp: Move this_cpu_off " Brian Gerst
2025-03-04  8:27   ` [tip: x86/core] " tip-bot2 for Brian Gerst
2025-03-04 10:36   ` tip-bot2 for Brian Gerst
2025-03-04 19:33   ` tip-bot2 for Brian Gerst
2025-03-04 19:43   ` tip-bot2 for Brian Gerst
2025-03-03 19:53 ` [PATCH v3 00/11] Add a percpu subsection for cache hot data Uros Bizjak
2025-03-03 20:38 ` Ingo Molnar [this message]
2025-03-03 20:55   ` Brian Gerst
2025-03-04  8:47     ` Ingo Molnar
2025-03-04  9:26       ` Brian Gerst
2025-03-04  9:47         ` Ingo Molnar
2025-03-04  9:52           ` Uros Bizjak
2025-03-04  9:55             ` Ingo Molnar
2025-03-04 15:00               ` Brian Gerst
2025-03-04 16:01                 ` Uros Bizjak
2025-03-04 16:42                   ` Brian Gerst
2025-03-04 16:48                     ` Uros Bizjak

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=Z8YTYWs-DeDHal1Q@gmail.com \
    --to=mingo@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=ardb@kernel.org \
    --cc=bp@alien8.de \
    --cc=brgerst@gmail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linuxfoundation.org \
    --cc=ubizjak@gmail.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 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.