All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/7] Remove on-stack cpumask var for irq subsystem
@ 2024-04-16  8:54 Dawei Li
  2024-04-16  8:54 ` [PATCH v2 1/7] cpumask: introduce cpumask_first_and_and() Dawei Li
                   ` (6 more replies)
  0 siblings, 7 replies; 22+ messages in thread
From: Dawei Li @ 2024-04-16  8:54 UTC (permalink / raw)
  To: tglx, yury.norov, rafael
  Cc: akpm, maz, florian.fainelli, chenhuacai, jiaxun.yang, anup,
	palmer, samuel.holland, linux, daniel.lezcano, linux-kernel,
	Dawei Li

Hi,

This is v2 of previous series[1] on removal of onstack cpumask var.

Generally it's preferable to avoid placing cpumasks on the stack, as
for large values of NR_CPUS these can consume significant amounts of
stack space and make stack overflows more likely.

One may argue that alloc_cpumask_var() and its friends are the formal
way for these cases. But for struct irqchip::irq_set_affinity(), it's
called under atomic context(raw spinlock held), and dynamic memory
allocation in atomic context is less-favorable.

So a new helper is introduced to address all these issues above. It's
free of any context issue and intermediate cpumask variable allocation
issue(no matter it's on stack or heap).

The case with gic-v3-its(Patch 3) is special from others since it's not
related to intersections between 3 cpumask.

Patch#7 is not for irq subsystem, it's in this series only because it
uses new helper. Please ignore it if you found it's inappropriate for
this series.

Any comments are welcomed.

------------

Change since v1:

- Rebased against tip/irq/core;

- Patch[1]: [Yury]
  - Remove ifdefery nesting on find_first_and_and_bit; 
  - Update commit message;

- Patch[3]: [Marc]
  - Merge two bitmap ops into one;
  - Update commit message;

- Patch[2,4-6]: [Yury]
  - Unwrap lines;

- Patch[7]:
  Newly added. Feel free to drop/ignore it if you found it's inappropriate
  for this series.

[1] v1:
https://lore.kernel.org/lkml/20240412105839.2896281-1-dawei.li@shingroup.cn/

Dawei Li (7):
  cpumask: introduce cpumask_first_and_and()
  irqchip/irq-bcm6345-l1: Avoid explicit cpumask allocation on stack
  irqchip/gic-v3-its: Avoid explicit cpumask allocation on stack
  irqchip/loongson-eiointc: Avoid explicit cpumask allocation on stack
  irqchip/riscv-aplic-direct: Avoid explicit cpumask allocation on stack
  irqchip/sifive-plic: Avoid explicit cpumask allocation on stack
  cpuidle: Avoid explicit cpumask allocation on stack

 drivers/cpuidle/coupled.c                | 13 +++---------
 drivers/irqchip/irq-bcm6345-l1.c         |  6 +-----
 drivers/irqchip/irq-gic-v3-its.c         | 15 ++++++++-----
 drivers/irqchip/irq-loongson-eiointc.c   |  8 ++-----
 drivers/irqchip/irq-riscv-aplic-direct.c |  7 ++----
 drivers/irqchip/irq-sifive-plic.c        |  7 ++----
 include/linux/cpumask.h                  | 17 +++++++++++++++
 include/linux/find.h                     | 27 ++++++++++++++++++++++++
 lib/find_bit.c                           | 12 +++++++++++
 9 files changed, 76 insertions(+), 36 deletions(-)

base-commit: 35d77eb7b974f62aaef5a0dc72d93ddb1ada4074

Thanks,

    Dawei

-- 
2.27.0


^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2024-04-24 20:04 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-16  8:54 [PATCH v2 0/7] Remove on-stack cpumask var for irq subsystem Dawei Li
2024-04-16  8:54 ` [PATCH v2 1/7] cpumask: introduce cpumask_first_and_and() Dawei Li
2024-04-16 17:45   ` Yury Norov
2024-04-16 17:49     ` Yury Norov
2024-04-17  1:35       ` Dawei Li
2024-04-24 20:04   ` [tip: irq/core] cpumask: Introduce cpumask_first_and_and() tip-bot2 for Dawei Li
2024-04-16  8:54 ` [PATCH v2 2/7] irqchip/irq-bcm6345-l1: Avoid explicit cpumask allocation on stack Dawei Li
2024-04-24 20:04   ` [tip: irq/core] " tip-bot2 for Dawei Li
2024-04-16  8:54 ` [PATCH v2 3/7] irqchip/gic-v3-its: " Dawei Li
2024-04-17 10:56   ` Marc Zyngier
2024-04-24 20:04   ` [tip: irq/core] " tip-bot2 for Dawei Li
2024-04-16  8:54 ` [PATCH v2 4/7] irqchip/loongson-eiointc: " Dawei Li
2024-04-16 18:01   ` Yury Norov
2024-04-24 20:04   ` [tip: irq/core] " tip-bot2 for Dawei Li
2024-04-16  8:54 ` [PATCH v2 5/7] irqchip/riscv-aplic-direct: " Dawei Li
2024-04-17 11:22   ` Anup Patel
2024-04-24 20:04   ` [tip: irq/core] " tip-bot2 for Dawei Li
2024-04-16  8:54 ` [PATCH v2 6/7] irqchip/sifive-plic: " Dawei Li
2024-04-17 11:21   ` Anup Patel
2024-04-24 20:04   ` [tip: irq/core] " tip-bot2 for Dawei Li
2024-04-16  8:54 ` [PATCH v2 7/7] cpuidle: " Dawei Li
2024-04-24 20:04   ` [tip: irq/core] " tip-bot2 for Dawei Li

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.