netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tim Sander <tstone@vlsi.informatik.tu-darmstadt.de>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	Hector Palacios <hector.palacios@digi.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"shawn.guo@linaro.org" <shawn.guo@linaro.org>,
	"jgq516@gmail.com" <jgq516@gmail.com>,
	"tim.sander@hbm.com" <tim.sander@hbm.com>,
	"u.kleine-koenig@pengutronix.de" <u.kleine-koenig@pengutronix.de>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	Zeng Zhaoming <b32542@freescale.com>,
	Frank Li <Frank.Li@freescale.com>
Subject: [PATCH] Re: [PATCH] net/fec: infinite spin on sirq-net-tx on real-time
Date: Tue, 7 Feb 2012 01:48:06 +0100	[thread overview]
Message-ID: <201202070148.06411.tstone@vlsi.informatik.tu-darmstadt.de> (raw)
In-Reply-To: <1328535599.2220.31.camel@edumazet-HP-Compaq-6005-Pro-SFF-PC>

Hi
Am Montag 06 Februar 2012, 14:39:59 schrieb Eric Dumazet:
> Le lundi 06 février 2012 à 08:25 -0500, Steven Rostedt a écrit :
> > On Mon, 2012-02-06 at 12:03 +0100, Hector Palacios wrote:
> > > >> @@ -530,6 +531,7 @@ fec_stop(struct net_device *ndev)
> > > >> 
> > > >>   	udelay(10);
> > > >>   	writel(fep->phy_speed, fep->hwp + FEC_MII_SPEED);
> > > >>   	writel(FEC_DEFAULT_IMASK, fep->hwp + FEC_IMASK);
> > > >> 
> > > >> +	fep->link = 0;
> > > > 
> > > > Why not call netif_stop_queue(dev) here ?
> > > 
> > > I'm no network driver expert so I'll leave it up to others to comment.
> > > I just forward ported a patch I came across in Freescale's BSP which
> > > solves the problem in mainline and in RT.
> > 
> > Hector,
> > 
> > Eric's suggestion may also work. Could your revert this patch and add
> > the netif_stop_queue(dev) there, and see if it fixes the problems in
> > both mainline and -rt?
> 
> Not sure it will be enough to call netif_stop_queue(dev) in fec_stop()
> 
> We probably need to start the device with its tx queue stopped, then
> later when device is really ready wakeup the queue.
I am talking about 3.0-rt33 kernel since this is the one i can test the best.

Ok i just found out that removing:

        if (!fep->link) {
                /* Link is down or autonegotiation is in progress. */
                netif_stop_queue(ndev);
                return NETDEV_TX_BUSY;
        }
does not seem to work. Also netif_stop_queue seems to be mandantory to get the driver working.
If this condition in the hotpath is removed i see the ksoftirq high cpuload problem again.
I am not sure if the patch for lines 470 if netif_stop_queue(ndev); is really nessary.
I also found an double cleanup in my earlier patch. So heres the next iteration of the
fec ksoftirq fix for preempt rt.

Tim

diff --git a/drivers/net/fec.c b/drivers/net/fec.c
index 885d8ba..140cb13 100644
--- a/drivers/net/fec.c
+++ b/drivers/net/fec.c
@@ -244,6 +244,7 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *ndev)
 
        if (!fep->link) {
                /* Link is down or autonegotiation is in progress. */
+               netif_stop_queue(ndev);
                return NETDEV_TX_BUSY;
        }
 
@@ -470,6 +471,9 @@ fec_stop(struct net_device *ndev)
        udelay(10);
        writel(fep->phy_speed, fep->hwp + FEC_MII_SPEED);
        writel(FEC_DEFAULT_IMASK, fep->hwp + FEC_IMASK);
+
+       netif_stop_queue(ndev);
+       fep->link = 0;
 }
 
 
@@ -787,6 +791,7 @@ static void fec_enet_adjust_link(struct net_device *ndev)
        if (phy_dev->link) {
                if (fep->full_duplex != phy_dev->duplex) {
                        fec_restart(ndev, phy_dev->duplex);
+                       netif_wake_queue(ndev);
                        status_change = 1;
                }
        }
@@ -1118,6 +1123,10 @@ static int fec_enet_alloc_buffers(struct net_device *ndev)
        bdp = fep->tx_bd_base;
        for (i = 0; i < TX_RING_SIZE; i++) {
                fep->tx_bounce[i] = kmalloc(FEC_ENET_TX_FRSIZE, GFP_KERNEL);
+               if(!fep->tx_bounce[i])  {
+                       fec_enet_free_buffers(ndev);
+                       return -ENOMEM;
+               }
 
                bdp->cbd_sc = 0;
                bdp->cbd_bufaddr = 0;

      reply	other threads:[~2012-02-07  0:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-06  9:33 [PATCH] net/fec: infinite spin on sirq-net-tx on real-time Hector Palacios
2012-02-06  9:56 ` Eric Dumazet
2012-02-06 11:03   ` Hector Palacios
2012-02-06 12:55     ` Eric Dumazet
2012-02-06 13:43       ` [PATCH]Re: " Tim Sander
2012-02-06 13:44       ` [PATCH] fec: fix tx bounce handling Eric Dumazet
2012-02-06 16:09         ` Tim Sander
2012-02-06 16:25           ` Eric Dumazet
2012-02-06 13:25     ` [PATCH] net/fec: infinite spin on sirq-net-tx on real-time Steven Rostedt
2012-02-06 13:39       ` Eric Dumazet
2012-02-07  0:48         ` Tim Sander [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201202070148.06411.tstone@vlsi.informatik.tu-darmstadt.de \
    --to=tstone@vlsi.informatik.tu-darmstadt.de \
    --cc=Frank.Li@freescale.com \
    --cc=b32542@freescale.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=hector.palacios@digi.com \
    --cc=jgq516@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=shawn.guo@linaro.org \
    --cc=tglx@linutronix.de \
    --cc=tim.sander@hbm.com \
    --cc=u.kleine-koenig@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).