]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - kernel/padata.c
ata: ahci_brcm: Allow using driver or DSL SoCs
[mirror_ubuntu-bionic-kernel.git] / kernel / padata.c
index 57c0074d50cc485b706579aaa616e4a004775a8e..f13b850417d8d5e86ff85ab0d445fb6c9d0765e0 100644 (file)
@@ -266,7 +266,12 @@ static void padata_reorder(struct parallel_data *pd)
         * The next object that needs serialization might have arrived to
         * the reorder queues in the meantime, we will be called again
         * from the timer function if no one else cares for it.
+        *
+        * Ensure reorder_objects is read after pd->lock is dropped so we see
+        * an increment from another task in padata_do_serial.  Pairs with
+        * smp_mb__after_atomic in padata_do_serial.
         */
+       smp_mb();
        if (atomic_read(&pd->reorder_objects)
                        && !(pinst->flags & PADATA_RESET))
                mod_timer(&pd->timer, jiffies + HZ);
@@ -386,6 +391,13 @@ void padata_do_serial(struct padata_priv *padata)
        list_add_tail(&padata->list, &pqueue->reorder.list);
        spin_unlock(&pqueue->reorder.lock);
 
+       /*
+        * Ensure the atomic_inc of reorder_objects above is ordered correctly
+        * with the trylock of pd->lock in padata_reorder.  Pairs with smp_mb
+        * in padata_reorder.
+        */
+       smp_mb__after_atomic();
+
        put_cpu();
 
        /* If we're running on the wrong CPU, call padata_reorder() via a