[PATCH]skge napi->poll() locking bug - Kernel

This is a discussion on [PATCH]skge napi->poll() locking bug - Kernel ; Hi all, According to: Documentation/networking/netdevices.txt: napi->poll: ........... Context: softirq will be called with interrupts disabled by netconsole. napi->poll() could be called either with interrupts enabled (in softirq context) or disabled (by netconsole), so the irq flag should be preserved. Inspired ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: [PATCH]skge napi->poll() locking bug

  1. [PATCH]skge napi->poll() locking bug

    Hi all,

    According to: Documentation/networking/netdevices.txt:


    napi->poll:
    ...........
    Context: softirq
    will be called with interrupts disabled by netconsole.


    napi->poll() could be called either with interrupts enabled
    (in softirq context) or disabled (by netconsole), so the irq flag
    should be preserved.

    Inspired by Ingo's resent forcedeth patch :-)

    Regards

    Marin Mitov

    Signed-off-by: Marin Mitov
    ===============================
    --- a/drivers/net/skge.c 2008-03-23 09:06:13.000000000 +0200
    +++ b/drivers/net/skge.c 2008-03-23 09:24:47.000000000 +0200
    @@ -3199,12 +3199,14 @@ static int skge_poll(struct napi_struct
    skge_write8(hw, Q_ADDR(rxqaddr[skge->port], Q_CSR), CSR_START);

    if (work_done < to_do) {
    - spin_lock_irq(&hw->hw_lock);
    + unsigned long flags;
    +
    + spin_lock_irqsave(&hw->hw_lock, flags);
    __netif_rx_complete(dev, napi);
    hw->intr_mask |= napimask[skge->port];
    skge_write32(hw, B0_IMSK, hw->intr_mask);
    skge_read32(hw, B0_IMSK);
    - spin_unlock_irq(&hw->hw_lock);
    + spin_unlock_irqrestore(&hw->hw_lock, flags);
    }

    return work_done;


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

  2. Re: [PATCH]skge napi->poll() locking bug

    From: Marin Mitov
    Date: Sun, 23 Mar 2008 10:20:09 +0200

    Please send networking things at least CC:'d to netdev
    as many networking developers do not subscribe to
    linux-kernel

    > According to: Documentation/networking/netdevices.txt:
    >
    >
    > napi->poll:
    > ..........
    > Context: softirq
    > will be called with interrupts disabled by netconsole.
    >

    >
    > napi->poll() could be called either with interrupts enabled
    > (in softirq context) or disabled (by netconsole), so the irq flag
    > should be preserved.
    >
    > Inspired by Ingo's resent forcedeth patch :-)
    >
    > Regards
    >
    > Marin Mitov
    >
    > Signed-off-by: Marin Mitov


    Acked-by: David S. Miller
    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  3. Re: [PATCH]skge napi->poll() locking bug

    Marin Mitov wrote:
    > Hi all,
    >
    > According to: Documentation/networking/netdevices.txt:
    >
    >
    > napi->poll:
    > ..........
    > Context: softirq
    > will be called with interrupts disabled by netconsole.
    >

    >
    > napi->poll() could be called either with interrupts enabled
    > (in softirq context) or disabled (by netconsole), so the irq flag
    > should be preserved.
    >
    > Inspired by Ingo's resent forcedeth patch :-)
    >
    > Regards
    >
    > Marin Mitov
    >
    > Signed-off-by: Marin Mitov
    > ===============================
    > --- a/drivers/net/skge.c 2008-03-23 09:06:13.000000000 +0200
    > +++ b/drivers/net/skge.c 2008-03-23 09:24:47.000000000 +0200
    > @@ -3199,12 +3199,14 @@ static int skge_poll(struct napi_struct
    > skge_write8(hw, Q_ADDR(rxqaddr[skge->port], Q_CSR), CSR_START);
    >
    > if (work_done < to_do) {
    > - spin_lock_irq(&hw->hw_lock);
    > + unsigned long flags;
    > +
    > + spin_lock_irqsave(&hw->hw_lock, flags);
    > __netif_rx_complete(dev, napi);
    > hw->intr_mask |= napimask[skge->port];
    > skge_write32(hw, B0_IMSK, hw->intr_mask);
    > skge_read32(hw, B0_IMSK);
    > - spin_unlock_irq(&hw->hw_lock);
    > + spin_unlock_irqrestore(&hw->hw_lock, flags);
    > }
    >
    > return work_done;
    >
    >
    > --


    applied


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

+ Reply to Thread