2007-11-22 20:19:49

by Mikulas Patocka

[permalink] [raw]
Subject: [PATCH] fix plip 1

Hi

netif_rx is meant to be called from interrupts because it doesn't wake up
ksoftirqd. For calling from outside interrupts, netif_rx_ni exists.

This patch fixes plip to use netif_rx_ni. It fixes the infamous error
"NOHZ: local_softirq_panding 08" that happens on some machines with NOHZ
and plip --- it is caused by the fact that softirq is pending and
ksoftirqd is sleeping.

Mikulas

diff -u -r linux-2.6.24-rc2/drivers/net/plip.c linux-2.6.24-test/drivers/net/plip.c
--- linux-2.6.24-rc2/drivers/net/plip.c 2007-11-06 22:57:46.000000000 +0100
+++ linux-2.6.24-test/drivers/net/plip.c 2007-11-22 21:11:28.000000000 +0100
@@ -663,7 +663,7 @@
case PLIP_PK_DONE:
/* Inform the upper layer for the arrival of a packet. */
rcv->skb->protocol=plip_type_trans(rcv->skb, dev);
- netif_rx(rcv->skb);
+ netif_rx_ni(rcv->skb);
dev->last_rx = jiffies;
dev->stats.rx_bytes += rcv->length.h;
dev->stats.rx_packets++;


2007-11-22 20:20:53

by Mikulas Patocka

[permalink] [raw]
Subject: Re: [PATCH] fix plip 1

I forgot to add:
Signed-off-by: Mikulas Patocka <[email protected]>

> diff -u -r linux-2.6.24-rc2/drivers/net/plip.c linux-2.6.24-test/drivers/net/plip.c
> --- linux-2.6.24-rc2/drivers/net/plip.c 2007-11-06 22:57:46.000000000 +0100
> +++ linux-2.6.24-test/drivers/net/plip.c 2007-11-22 21:11:28.000000000 +0100
> @@ -663,7 +663,7 @@
> case PLIP_PK_DONE:
> /* Inform the upper layer for the arrival of a packet. */
> rcv->skb->protocol=plip_type_trans(rcv->skb, dev);
> - netif_rx(rcv->skb);
> + netif_rx_ni(rcv->skb);
> dev->last_rx = jiffies;
> dev->stats.rx_bytes += rcv->length.h;
> dev->stats.rx_packets++;
>

2007-11-22 20:26:18

by Mikulas Patocka

[permalink] [raw]
Subject: [PATCH] fix plip 2

This is my second patch for plip. Plip passes string "name" that is
allocated on stack to parport_register_device. parport_register_device
holds the pointer to "name" and when the registering function exits, it
points nowhere.

On some machine, this bug causes bad names to appear in /proc filesystem,
such as /proc/sys/dev/parport/parport0/devices/T^/?X^/?, on others, the
plip proc node is completely missing.

The patch also fixes documentation to note this requirement.

Mikulas

Signed-off-by: Mikulas Patocka <[email protected]>

diff -u -r linux-2.6.24-rc2/Documentation/parport-lowlevel.txt linux-2.6.24-test/Documentation/parport-lowlevel.txt
--- linux-2.6.24-rc2/Documentation/parport-lowlevel.txt 2007-11-06 22:57:46.000000000 +0100
+++ linux-2.6.24-test/Documentation/parport-lowlevel.txt 2007-11-22 21:11:28.000000000 +0100
@@ -339,6 +339,10 @@
('port'). Once you have done that, you will be able to use
parport_claim and parport_release in order to use the port.

+The ('name') argument is the name of the device that appears in /proc
+filesystem. The string must be valid for the whole lifetime of the
+device (until parport_unregister_device is called).
+
This function will register three callbacks into your driver:
'preempt', 'wakeup' and 'irq'. Each of these may be NULL in order to
indicate that you do not want a callback.
diff -u -r linux-2.6.24-rc2/drivers/net/plip.c linux-2.6.24-test/drivers/net/plip.c
--- linux-2.6.24-rc2/drivers/net/plip.c 2007-11-06 22:57:46.000000000 +0100
+++ linux-2.6.24-test/drivers/net/plip.c 2007-11-22 21:11:28.000000000 +0100
@@ -1269,7 +1269,7 @@

nl = netdev_priv(dev);
nl->dev = dev;
- nl->pardev = parport_register_device(port, name, plip_preempt,
+ nl->pardev = parport_register_device(port, dev->name, plip_preempt,
plip_wakeup, plip_interrupt,
0, dev);

2007-11-27 03:33:15

by Linus Torvalds

[permalink] [raw]
Subject: Re: [PATCH] fix plip 1



On Thu, 22 Nov 2007, Mikulas Patocka wrote:
>
> netif_rx is meant to be called from interrupts because it doesn't wake up
> ksoftirqd. For calling from outside interrupts, netif_rx_ni exists.

Argh. Can you _please_ use more useful subject lines than "fix plip 1/2"?

Those subject lines are what becomes the single-line description of the
problem, used by visualizers like gitk and gitweb. So "fix plip 1" is a
singularly bad such line!

Which is why it should be something like

Subject: [PATCH 1/2] plip: use netif_rx_ni() for packet receive

or similar.. (My scripts will then get rid of the stuff in brackets, so
all that is useful for giving information that is interesting while in
*email*, but not when actually applied as a patch)

Linus

2007-11-29 02:35:24

by Mikulas Patocka

[permalink] [raw]
Subject: Re: [PATCH] fix plip 1



On Mon, 26 Nov 2007, Linus Torvalds wrote:

>
>
> On Thu, 22 Nov 2007, Mikulas Patocka wrote:
> >
> > netif_rx is meant to be called from interrupts because it doesn't wake up
> > ksoftirqd. For calling from outside interrupts, netif_rx_ni exists.
>
> Argh. Can you _please_ use more useful subject lines than "fix plip 1/2"?
>
> Those subject lines are what becomes the single-line description of the
> problem, used by visualizers like gitk and gitweb. So "fix plip 1" is a
> singularly bad such line!

OK, I see

Mikulas