Help: how to avoid flush_scheduled_work deadlocks?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I am working on a wireless driver. It seems to deadlock
on flush_scheduled_work while iface is being downed.

I've put debug printks in code:

static void
acx_s_down(netdevice_t *dev)
{
        wlandevice_t *priv = acx_netdev_priv(dev);
        unsigned long flags;

        FN_ENTER;
printk("acx_s_down: stop_queue\n");
        acx_stop_queue(dev, "during close");

        /* we really don't want to have an asynchronous tasklet disturb us
         * after something vital for its job has been shut down, so
         * end all remaining work now... */
printk("acx_s_down: set_status\n");
        acx_set_status(priv, ACX_STATUS_0_STOPPED);
printk("acx_s_down: flush_scheduled_work\n");
        flush_scheduled_work();
        /* kernel/timer.c says it's illegal to del_timer_sync()
        ** a timer which restarts itself. We guarantee this cannot
        ** ever happen because acx_i_timer() never does this if
        ** status is ACX_STATUS_0_STOPPED
        */
printk("acx_s_down: del_timer_sync\n");
        del_timer_sync(&priv->mgmt_timer);
...

"acx_s_down: del_timer_sync" never appears.
I verified that work function never gets called because it has
debug prints also:

static void
acx_e_after_interrupt_task(void *data)
{
        netdevice_t *dev = (netdevice_t *) data;
        wlandevice_t *priv;

        FN_ENTER;

        priv = (struct wlandevice *) dev->priv;

        /* Avoid deadlock - FLUSH_SCHEDULED_WORK()
        ** is called under sem and it waits for any
        ** already submitted work to complete! */
        if (priv->status == ACX_STATUS_0_STOPPED) {
printk("acx_e_after_interrupt_task: deadlock avoided\n");
                FN_EXIT0;
                return;
        }

and I don't see them.

kernel log:

...
20:45:50 kernel: 015c3e6a     ==> acx_e_close
20:45:50 kernel: 015c3e6c       ==> acx_s_down
20:45:50 kernel: acx_s_down: stop_queue
20:45:50 kernel: tx: stop queue during close
20:45:50 kernel: acx_s_down: set_status
20:45:50 kernel: 015c3e79         ==> acx_set_status
20:45:50 kernel: acx_set_status(0):STOPPED
20:45:50 kernel: tx: carrier off after losing association
20:45:50 kernel: tx: stop queue after losing association
20:45:50 kernel: 015c3e82         <== acx_set_status
20:45:50 kernel: acx_s_down: flush_scheduled_work
20:45:50 kernel: SysRq : Changing Loglevel
20:45:50 kernel: Loglevel set to 0
20:45:50 kernel: 015c3ebb         ==> acx_i_interrupt
20:45:50 kernel: IRQ type:0000, mask:D9F5 - all are masked, IRQ_NONE
20:45:50 kernel: 015c3ebb         <== acx_i_interrupt
20:45:50 kernel: 015c3ebb         ==> acx_i_interrupt
20:45:50 kernel: IRQ type:0000, mask:D9F5 - all are masked, IRQ_NONE
20:45:50 kernel: 015c3ebb         <== acx_i_interrupt
...

acx_i_interrupt lines indicate that interrupts still are serviced
(because we are on shared IRQ line), but as you can see, neither
"acx_s_down: del_timer_sync" nor "acx_e_after_interrupt_task: deadlock avoided"
appears after "acx_s_down: flush_scheduled_work"

Why?!

NB: acx_s_down is called under semaphore.
--
vda

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux