| @@ -29,16 +29,16 @@ static DEFINE_PER_CPU(struct llist_head, lazy_list); · 28 unmodified lines |
| 29 | */ | 29 | */ |
| 30 | static bool irq_work_claim(struct irq_work *work) | 30 | static bool irq_work_claim(struct irq_work *work) |
| 31 | { | 31 | { |
| 32 | unsigned long flags, oflags, nflags; | 32 | int flags, oflags, nflags; |
| 33 | | 33 | |
| 34 | /* | 34 | /* |
| 35 | * Start with our best wish as a premise but only trust any | 35 | * Start with our best wish as a premise but only trust any |
| 36 | * flag value after cmpxchg() result. | 36 | * flag value after cmpxchg() result. |
| 37 | */ | 37 | */ |
| 38 | flags = work->flags & ~IRQ_WORK_PENDING; | 38 | flags = atomic_read(&work->flags) & ~IRQ_WORK_PENDING; |
| 39 | for (;;) { | 39 | for (;;) { |
| 40 | nflags = flags | IRQ_WORK_CLAIMED; | 40 | nflags = flags | IRQ_WORK_CLAIMED; |
| 41 | oflags = cmpxchg(&work->flags, flags, nflags); | 41 | oflags = atomic_cmpxchg(&work->flags, flags, nflags); |
| 42 | if (oflags == flags) | 42 | if (oflags == flags) |
| 43 | break; | 43 | break; |
| 44 | if (oflags & IRQ_WORK_PENDING) | 44 | if (oflags & IRQ_WORK_PENDING) |
| @@ -61,7 +61,7 @@ void __weak arch_irq_work_raise(void) · 16 unmodified lines |
| 61 | static void __irq_work_queue_local(struct irq_work *work) | 61 | static void __irq_work_queue_local(struct irq_work *work) |
| 62 | { | 62 | { |
| 63 | /* If the work is "lazy", handle it from next tick if any */ | 63 | /* If the work is "lazy", handle it from next tick if any */ |
| 64 | if (work->flags & IRQ_WORK_LAZY) { | 64 | if (atomic_read(&work->flags) & IRQ_WORK_LAZY) { |
| 65 | if (llist_add(&work->llnode, this_cpu_ptr(&lazy_list)) && | 65 | if (llist_add(&work->llnode, this_cpu_ptr(&lazy_list)) && |
| 66 | tick_nohz_tick_stopped()) | 66 | tick_nohz_tick_stopped()) |
| 67 | arch_irq_work_raise(); | 67 | arch_irq_work_raise(); |
| @@ -143,7 +143,7 @@ static void irq_work_run_list(struct llist_head *list) · 75 unmodified lines |
| 143 | { | 143 | { |
| 144 | struct irq_work *work, *tmp; | 144 | struct irq_work *work, *tmp; |
| 145 | struct llist_node *llnode; | 145 | struct llist_node *llnode; |
| 146 | unsigned long flags; | 146 | int flags; |
| 147 | | 147 | |
| 148 | BUG_ON(!irqs_disabled()); | 148 | BUG_ON(!irqs_disabled()); |
| 149 | | 149 | |
| @@ -159,15 +159,15 @@ static void irq_work_run_list(struct llist_head *list) · 9 unmodified lines |
| 159 | * to claim that work don't rely on us to handle their data | 159 | * to claim that work don't rely on us to handle their data |
| 160 | * while we are in the middle of the func. | 160 | * while we are in the middle of the func. |
| 161 | */ | 161 | */ |
| 162 | flags = work->flags & ~IRQ_WORK_PENDING; | 162 | flags = atomic_read(&work->flags) & ~IRQ_WORK_PENDING; |
| 163 | xchg(&work->flags, flags); | 163 | atomic_xchg(&work->flags, flags); |
| 164 | | 164 | |
| 165 | work->func(work); | 165 | work->func(work); |
| 166 | /* | 166 | /* |
| 167 | * Clear the BUSY bit and return to the free state if | 167 | * Clear the BUSY bit and return to the free state if |
| 168 | * no-one else claimed it meanwhile. | 168 | * no-one else claimed it meanwhile. |
| 169 | */ | 169 | */ |
| 170 | (void)cmpxchg(&work->flags, flags, flags & ~IRQ_WORK_BUSY); | 170 | (void)atomic_cmpxchg(&work->flags, flags, flags & ~IRQ_WORK_BUSY); |
| 171 | } | 171 | } |
| 172 | } | 172 | } |
| 173 | | 173 | |
| @@ -199,7 +199,7 @@ void irq_work_sync(struct irq_work *work) · 25 unmodified lines |
| 199 | { | 199 | { |
| 200 | lockdep_assert_irqs_enabled(); | 200 | lockdep_assert_irqs_enabled(); |
| 201 | | 201 | |
| 202 | while (work->flags & IRQ_WORK_BUSY) | 202 | while (atomic_read(&work->flags) & IRQ_WORK_BUSY) |
| 203 | cpu_relax(); | 203 | cpu_relax(); |
| 204 | } | 204 | } |
| 205 | EXPORT_SYMBOL_GPL(irq_work_sync); | 205 | EXPORT_SYMBOL_GPL(irq_work_sync); |