smp, irq_work: Continue smp_call_function*() and irq_work*() integration
Instead of relying on BUG_ON() to ensure the various data structures line up, use a bunch of horrible unions to make it all automatic. Much of the union magic is to ensure irq_work and smp_call_function do not (yet) see the members of their respective data structures change name. Suggested-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Reviewed-by: Frederic Weisbecker <frederic@kernel.org> Link: https://lkml.kernel.org/r/20200622100825.844455025@infradead.org
This commit is contained in:

committed by
Borislav Petkov

parent
739f70b476
commit
8c4890d1c3
@@ -2,7 +2,7 @@
|
||||
#ifndef _LINUX_IRQ_WORK_H
|
||||
#define _LINUX_IRQ_WORK_H
|
||||
|
||||
#include <linux/llist.h>
|
||||
#include <linux/smp_types.h>
|
||||
|
||||
/*
|
||||
* An entry can be in one of four states:
|
||||
@@ -13,24 +13,14 @@
|
||||
* busy NULL, 2 -> {free, claimed} : callback in progress, can be claimed
|
||||
*/
|
||||
|
||||
/* flags share CSD_FLAG_ space */
|
||||
|
||||
#define IRQ_WORK_PENDING BIT(0)
|
||||
#define IRQ_WORK_BUSY BIT(1)
|
||||
|
||||
/* Doesn't want IPI, wait for tick: */
|
||||
#define IRQ_WORK_LAZY BIT(2)
|
||||
/* Run hard IRQ context, even on RT */
|
||||
#define IRQ_WORK_HARD_IRQ BIT(3)
|
||||
|
||||
#define IRQ_WORK_CLAIMED (IRQ_WORK_PENDING | IRQ_WORK_BUSY)
|
||||
|
||||
/*
|
||||
* structure shares layout with single_call_data_t.
|
||||
*/
|
||||
struct irq_work {
|
||||
struct llist_node llnode;
|
||||
atomic_t flags;
|
||||
union {
|
||||
struct __call_single_node node;
|
||||
struct {
|
||||
struct llist_node llnode;
|
||||
atomic_t flags;
|
||||
};
|
||||
};
|
||||
void (*func)(struct irq_work *);
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user