[PW_SID:993186] riscv: introduce percpu.h - #803
Conversation
The arch/riscv/include/asm/bitops.h does not functionally require
including /linux/irqflags.h. Additionally, adding
arch/riscv/include/asm/percpu.h causes a circular inclusion:
kernel/bounds.c
->include/linux/log2.h
->include/linux/bitops.h
->arch/riscv/include/asm/bitops.h
->include/linux/irqflags.h
->include/linux/find.h
->return val ? __ffs(val) : size;
->arch/riscv/include/asm/bitops.h
The compilation log is as follows:
CC kernel/bounds.s
In file included from ./include/linux/bitmap.h:11,
from ./include/linux/cpumask.h:12,
from ./arch/riscv/include/asm/processor.h:55,
from ./arch/riscv/include/asm/thread_info.h:42,
from ./include/linux/thread_info.h:60,
from ./include/asm-generic/preempt.h:5,
from ./arch/riscv/include/generated/asm/preempt.h:1,
from ./include/linux/preempt.h:79,
from ./arch/riscv/include/asm/percpu.h:8,
from ./include/linux/irqflags.h:19,
from ./arch/riscv/include/asm/bitops.h:14,
from ./include/linux/bitops.h:68,
from ./include/linux/log2.h:12,
from kernel/bounds.c:13:
./include/linux/find.h: In function 'find_next_bit':
./include/linux/find.h:66:30: error: implicit declaration of function '__ffs' [-Wimplicit-function-declaration]
66 | return val ? __ffs(val) : size;
| ^~~~~
Signed-off-by: Yunhui Cui <cuiyunhui@bytedance.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Current percpu operations rely on generic implementations, where raw_local_irq_save() introduces substantial overhead. Optimization is achieved through atomic operations and preemption disabling. Since RISC-V does not support lr/sc.b/h, when ZABHA is not supported, we need to use lr/sc.w instead, which requires some additional mask operations. In fact, 8/16-bit per-CPU operations are very few. The counts during system startup are as follows: Reads: 8-bit: 3, 16-bit: 3, 32-bit: 1531, 64-bit: 471 Writes: 8-bit: 4, 16-bit: 3, 32-bit: 32, 64-bit: 238 Adds: 8-bit: 3, 16-bit: 3, 32-bit: 31858, 64-bit: 7656 Add-Returns: 8-bit: 0, 16-bit: 0, 32-bit: 0, 64-bit: 2 ANDs: 8-bit: 0, 16-bit: 0, 32-bit: 0, 64-bit: 0 ANDNOTs: 8-bit: 0, 16-bit: 0, 32-bit: 0, 64-bit: 0 ORs: 8-bit: 0, 16-bit: 0, 32-bit: 70, 64-bit: 0 hackbench -l 1000: Reads: 8-bit: 3, 16-bit: 3, 32-bit: 1531, 64-bit: 2522158 Writes: 8-bit: 4, 16-bit: 3, 32-bit: 34, 64-bit: 2521522 Adds: 8-bit: 3, 16-bit: 3, 32-bit: 47771, 64-bit: 19911 Add-Returns: 8-bit: 0, 16-bit: 0, 32-bit: 0, 64-bit: 2 ANDs: 8-bit: 0, 16-bit: 0, 32-bit: 0, 64-bit: 0 ANDNOTs: 8-bit: 0, 16-bit: 0, 32-bit: 0, 64-bit: 0 ORs: 8-bit: 0, 16-bit: 0, 32-bit: 70, 64-bit: 0 Based on this, 8bit/16bit per-CPU operations can directly fall back to the generic implementation. Signed-off-by: Yunhui Cui <cuiyunhui@bytedance.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
|
Patch 1: "[1/2] riscv: remove irqflags.h inclusion in asm/bitops.h" |
|
Patch 1: "[1/2] riscv: remove irqflags.h inclusion in asm/bitops.h" |
|
Patch 1: "[1/2] riscv: remove irqflags.h inclusion in asm/bitops.h" |
|
Patch 1: "[1/2] riscv: remove irqflags.h inclusion in asm/bitops.h" |
|
Patch 1: "[1/2] riscv: remove irqflags.h inclusion in asm/bitops.h" |
|
Patch 1: "[1/2] riscv: remove irqflags.h inclusion in asm/bitops.h" |
|
Patch 1: "[1/2] riscv: remove irqflags.h inclusion in asm/bitops.h" |
|
Patch 1: "[1/2] riscv: remove irqflags.h inclusion in asm/bitops.h" |
|
Patch 1: "[1/2] riscv: remove irqflags.h inclusion in asm/bitops.h" |
|
Patch 1: "[1/2] riscv: remove irqflags.h inclusion in asm/bitops.h" |
|
Patch 1: "[1/2] riscv: remove irqflags.h inclusion in asm/bitops.h" |
|
Patch 1: "[1/2] riscv: remove irqflags.h inclusion in asm/bitops.h" |
|
Patch 2: "[2/2] riscv: introduce percpu.h into include/asm" |
|
Patch 2: "[2/2] riscv: introduce percpu.h into include/asm" |
|
Patch 2: "[2/2] riscv: introduce percpu.h into include/asm" |
|
Patch 2: "[2/2] riscv: introduce percpu.h into include/asm" |
|
Patch 2: "[2/2] riscv: introduce percpu.h into include/asm" |
|
Patch 2: "[2/2] riscv: introduce percpu.h into include/asm" |
|
Patch 2: "[2/2] riscv: introduce percpu.h into include/asm" |
|
Patch 2: "[2/2] riscv: introduce percpu.h into include/asm" |
|
Patch 2: "[2/2] riscv: introduce percpu.h into include/asm" |
|
Patch 2: "[2/2] riscv: introduce percpu.h into include/asm" |
|
Patch 2: "[2/2] riscv: introduce percpu.h into include/asm" |
|
Patch 2: "[2/2] riscv: introduce percpu.h into include/asm" |
PR for series 993186 applied to workflow__riscv__fixes
Name: riscv: introduce percpu.h
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=993186
Version: 1