From: Brian Gerst <brgerst@gmail.com>
To: linux-kernel@vger.kernel.org, x86@kernel.org
Cc: Ingo Molnar <mingo@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>, Brian Gerst <brgerst@gmail.com>
Subject: [RFC PATCH 00/11] Add a percpu subsection for hot data
Date: Sat, 22 Feb 2025 14:06:12 -0500 [thread overview]
Message-ID: <20250222190623.262689-1-brgerst@gmail.com> (raw)
Add a new percpu subsection for data that is frequently accessed and
exclusive to each processor. This is intended to replace the pcpu_hot
struct on X86, and is available to all architectures.
The one caveat with this approach is that it depends on the linker to
effeciently pack data that is smaller than machine word size. The
binutils linker does this properly:
ffffffff842f6000 D __per_cpu_hot_start
ffffffff842f6000 D softirq_pending
ffffffff842f6002 D hardirq_stack_inuse
ffffffff842f6008 D hardirq_stack_ptr
ffffffff842f6010 D __ref_stack_chk_guard
ffffffff842f6010 D __stack_chk_guard
ffffffff842f6018 D const_cpu_current_top_of_stack
ffffffff842f6018 D cpu_current_top_of_stack
ffffffff842f6020 D const_current_task
ffffffff842f6020 D current_task
ffffffff842f6028 D __preempt_count
ffffffff842f602c D cpu_number
ffffffff842f6030 D this_cpu_off
ffffffff842f6038 D __x86_call_depth
ffffffff842f6040 D __per_cpu_hot_end
The LLVM linker doesn't do as well with packing smaller data objects,
causing it to spill over into a second cacheline.
Brian Gerst (11):
percpu: Introduce 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/percpu: Move top_of_stack to percpu hot section
x86/percpu: Move current_task to percpu hot section
x86/softirq: Move softirq_pending to percpu hot section
x86/irq: Move irq stacks to percpu hot section
x86/percpu: Remove pcpu_hot
x86/stackprotector: Move __stack_chk_guard to percpu hot section
x86/smp: Move this_cpu_off to percpu hot section
arch/x86/entry/entry_32.S | 4 +--
arch/x86/entry/entry_64.S | 6 ++---
arch/x86/entry/entry_64_compat.S | 4 +--
arch/x86/include/asm/current.h | 35 ++++-----------------------
arch/x86/include/asm/hardirq.h | 3 ++-
arch/x86/include/asm/irq_stack.h | 12 ++++-----
arch/x86/include/asm/nospec-branch.h | 10 +++++---
arch/x86/include/asm/percpu.h | 4 +--
arch/x86/include/asm/preempt.h | 25 ++++++++++---------
arch/x86/include/asm/processor.h | 15 ++++++++++--
arch/x86/include/asm/smp.h | 7 +++---
arch/x86/include/asm/stackprotector.h | 2 +-
arch/x86/kernel/asm-offsets.c | 5 ----
arch/x86/kernel/callthunks.c | 3 +++
arch/x86/kernel/cpu/common.c | 17 +++++++------
arch/x86/kernel/dumpstack_32.c | 4 +--
arch/x86/kernel/dumpstack_64.c | 2 +-
arch/x86/kernel/head_64.S | 4 +--
arch/x86/kernel/irq.c | 8 ++++++
arch/x86/kernel/irq_32.c | 12 +++++----
arch/x86/kernel/irq_64.c | 6 ++---
arch/x86/kernel/process_32.c | 6 ++---
arch/x86/kernel/process_64.c | 6 ++---
arch/x86/kernel/setup_percpu.c | 7 ++++--
arch/x86/kernel/smpboot.c | 4 +--
arch/x86/kernel/vmlinux.lds.S | 5 +++-
arch/x86/lib/retpoline.S | 2 +-
include/asm-generic/vmlinux.lds.h | 10 ++++++++
include/linux/percpu-defs.h | 10 ++++++++
kernel/bpf/verifier.c | 4 +--
scripts/gdb/linux/cpus.py | 2 +-
31 files changed, 135 insertions(+), 109 deletions(-)
base-commit: 01157ddc58dc2fe428ec17dd5a18cc13f134639f
--
2.48.1
next reply other threads:[~2025-02-22 19:06 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-22 19:06 Brian Gerst [this message]
2025-02-22 19:06 ` [RFC PATCH 01/11] percpu: Introduce percpu hot section Brian Gerst
2025-02-22 19:06 ` [RFC PATCH 02/11] x86/preempt: Move preempt count to " Brian Gerst
2025-02-23 10:05 ` kernel test robot
2025-02-23 10:49 ` kernel test robot
2025-02-23 11:31 ` kernel test robot
2025-02-22 19:06 ` [RFC PATCH 03/11] x86/smp: Move cpu number " Brian Gerst
2025-02-22 19:06 ` [RFC PATCH 04/11] x86/retbleed: Move call depth " Brian Gerst
2025-02-22 19:06 ` [RFC PATCH 05/11] x86/percpu: Move top_of_stack " Brian Gerst
2025-02-22 19:06 ` [RFC PATCH 06/11] x86/percpu: Move current_task " Brian Gerst
2025-02-22 19:06 ` [RFC PATCH 07/11] x86/softirq: Move softirq_pending " Brian Gerst
2025-02-22 19:06 ` [RFC PATCH 08/11] x86/irq: Move irq stacks " Brian Gerst
2025-02-22 19:06 ` [RFC PATCH 09/11] x86/percpu: Remove pcpu_hot Brian Gerst
2025-02-22 19:06 ` [RFC PATCH 10/11] x86/stackprotector: Move __stack_chk_guard to percpu hot section Brian Gerst
2025-02-22 19:06 ` [RFC PATCH 11/11] x86/smp: Move this_cpu_off " Brian Gerst
2025-02-23 9:36 ` [RFC PATCH 00/11] Add a percpu subsection for hot data Ingo Molnar
2025-02-23 10:20 ` Ard Biesheuvel
2025-02-23 10:30 ` Uros Bizjak
2025-02-23 17:25 ` Brian Gerst
2025-02-23 17:30 ` Ard Biesheuvel
2025-02-23 14:44 ` Brian Gerst
2025-02-23 18:00 ` Linus Torvalds
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=20250222190623.262689-1-brgerst@gmail.com \
--to=brgerst@gmail.com \
--cc=ardb@kernel.org \
--cc=bp@alien8.de \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=tglx@linutronix.de \
--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.