mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
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:
parent
739f70b476
commit
8c4890d1c3
6 changed files with 86 additions and 58 deletions
|
@ -12,29 +12,22 @@
|
|||
#include <linux/list.h>
|
||||
#include <linux/cpumask.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/llist.h>
|
||||
#include <linux/smp_types.h>
|
||||
|
||||
typedef void (*smp_call_func_t)(void *info);
|
||||
typedef bool (*smp_cond_func_t)(int cpu, void *info);
|
||||
|
||||
enum {
|
||||
CSD_FLAG_LOCK = 0x01,
|
||||
|
||||
/* IRQ_WORK_flags */
|
||||
|
||||
CSD_TYPE_ASYNC = 0x00,
|
||||
CSD_TYPE_SYNC = 0x10,
|
||||
CSD_TYPE_IRQ_WORK = 0x20,
|
||||
CSD_TYPE_TTWU = 0x30,
|
||||
CSD_FLAG_TYPE_MASK = 0xF0,
|
||||
};
|
||||
|
||||
/*
|
||||
* structure shares (partial) layout with struct irq_work
|
||||
*/
|
||||
struct __call_single_data {
|
||||
struct llist_node llist;
|
||||
unsigned int flags;
|
||||
union {
|
||||
struct __call_single_node node;
|
||||
struct {
|
||||
struct llist_node llist;
|
||||
unsigned int flags;
|
||||
};
|
||||
};
|
||||
smp_call_func_t func;
|
||||
void *info;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue