]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
[S390] qdio: clear shared DSCI before scheduling the queue handler
authorJan Glauber <jang@linux.vnet.ibm.com>
Sun, 24 Jul 2011 08:48:00 +0000 (10:48 +0200)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Sun, 24 Jul 2011 08:48:00 +0000 (10:48 +0200)
The following race can occur with qdio devices that use the shared device
state change indicator:

Device (Shared DSCI)    CPU0                            CPU1
===============================================================================

1. DSCI 0 => 1,
   INT pending
                        2. Thinint handler
                        * si_used = 1
                        * Inbound tasklet_schedule
                        * DSCI 1 => 0

3. DSCI 0 => 1,
   INT pending

                                                        4. Thinint handler
                                                        * si_used = 1
                                                        * Inbound tasklet_schedu
le
                                                           => NOP

                        5. Inbound tasklet run

6. DSCI = 1,
   INT surpressed

                                                        7. DSCI 1 => 0

The race would lead to a stall where new data in the input queue is
not recognized so the device stops working in case of no further traffic.

Fix the race by resetting the DSCI before scheduling the inbound tasklet
so the device generates an interrupt if new data arrives in the above
scenario in step 6.

Reviewed-by: Ursula Braun <ursula.braun@de.ibm.com>
Signed-off-by: Jan Glauber <jang@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
drivers/s390/cio/qdio_thinint.c

index 5c4e741d82217f37fe4e7c52081206b83f8163e9..68be6e1571261a23cf0eeabdb96a4f781590397c 100644 (file)
@@ -95,9 +95,11 @@ void tiqdio_remove_input_queues(struct qdio_irq *irq_ptr)
        }
 }
 
-static inline u32 shared_ind_set(void)
+static inline u32 clear_shared_ind(void)
 {
-       return q_indicators[TIQDIO_SHARED_IND].ind;
+       if (!atomic_read(&q_indicators[TIQDIO_SHARED_IND].count))
+               return 0;
+       return xchg(&q_indicators[TIQDIO_SHARED_IND].ind, 0);
 }
 
 /**
@@ -107,7 +109,7 @@ static inline u32 shared_ind_set(void)
  */
 static void tiqdio_thinint_handler(void *alsi, void *data)
 {
-       u32 si_used = shared_ind_set();
+       u32 si_used = clear_shared_ind();
        struct qdio_q *q;
 
        last_ai_time = S390_lowcore.int_clock;
@@ -150,13 +152,6 @@ static void tiqdio_thinint_handler(void *alsi, void *data)
                qperf_inc(q, adapter_int);
        }
        rcu_read_unlock();
-
-       /*
-        * If the shared indicator was used clear it now after all queues
-        * were processed.
-        */
-       if (si_used && shared_ind_set())
-               xchg(&q_indicators[TIQDIO_SHARED_IND].ind, 0);
 }
 
 static int set_subchannel_ind(struct qdio_irq *irq_ptr, int reset)