mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* netpoll/netconsole minor tweaks
@ 2003-09-17 18:24 Chris Wright
  2003-09-17 20:51 ` Matt Mackall
  2003-09-18 12:30 ` Alan Cox
  0 siblings, 2 replies; 10+ messages in thread
From: Chris Wright @ 2003-09-17 18:24 UTC (permalink / raw)
  To: Matt Mackall; +Cc: linux-kernel

Hi Matt,

Here's a couple small tweaks.  The first is to netpoll_setup.  The settle
time was too short for my e100, and the system would hang.  The second
is to netconsole so that it registers a console with CON_PRINTBUFFER.
This helps debugging early bootup issues where you want to capture data
from before netconsole is initialized.  Perhaps it should be a param
to netconsole?

thanks,
-chris

--- 2.6.0-test5-mm2/net/core/netpoll.c.wait_fix	2003-09-15 15:46:28.000000000 -0700
+++ 2.6.0-test5-mm2/net/core/netpoll.c	2003-09-15 16:14:20.000000000 -0700
@@ -526,7 +526,7 @@ int netpoll_setup(struct netpoll *np)
 		rtnl_shunlock();
 
 		/* Give driver a chance to settle */
-		jiff = jiffies + 2*HZ;
+		jiff = jiffies + 4*HZ;
 		while (time_before(jiffies, jiff))
 			;
 	}

--- 2.6.0-test5-mm2/drivers/net/netconsole.c.print_buf	2003-09-15 16:21:31.000000000 -0700
+++ 2.6.0-test5-mm2/drivers/net/netconsole.c	2003-09-17 11:09:59.000000000 -0700
@@ -95,7 +95,7 @@
 }
 
 static struct console netconsole = {
-	.flags = CON_ENABLED,
+	.flags = CON_ENABLED | CON_PRINTBUFFER,
 	.write = write_msg
 };

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: netpoll/netconsole minor tweaks
  2003-09-17 18:24 netpoll/netconsole minor tweaks Chris Wright
@ 2003-09-17 20:51 ` Matt Mackall
  2003-09-18  5:17   ` Chris Wright
  2003-09-18 12:30 ` Alan Cox
  1 sibling, 1 reply; 10+ messages in thread
From: Matt Mackall @ 2003-09-17 20:51 UTC (permalink / raw)
  To: Chris Wright; +Cc: linux-kernel

On Wed, Sep 17, 2003 at 11:24:47AM -0700, Chris Wright wrote:
> Hi Matt,
> 
> Here's a couple small tweaks.  The first is to netpoll_setup.  The settle
> time was too short for my e100, and the system would hang.  

This probably ought to be a command line arg, my tg3 apparently
doesn't need it at all. One second is what's in the nfs-root stuff,
perhaps they need to share an arg, I changed it to two because my tlan
was dropping stuff (but not hanging - that may be a driver bug).
Ideally, I'd like to find a way to wait until the damn thing is up
before sending.

net/ipv4/ipconfig.c:
 /* Define the friendly delay before and after opening net devices */
 #define CONF_PRE_OPEN           (HZ/2)  /* Before opening: 1/2 second */
 #define CONF_POST_OPEN          (1*HZ)  /* After opening: 1 second */
 
Anyway, I'm still struggling with getting stuff working on my Opteron
box, care to take a stab at it?

> The second
> is to netconsole so that it registers a console with CON_PRINTBUFFER.
> This helps debugging early bootup issues where you want to capture data
> from before netconsole is initialized.  Perhaps it should be a param
> to netconsole?

I think this can probably be unconditional. Merged.

-- 
Matt Mackall : http://www.selenic.com : of or relating to the moon

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: netpoll/netconsole minor tweaks
  2003-09-17 20:51 ` Matt Mackall
@ 2003-09-18  5:17   ` Chris Wright
  0 siblings, 0 replies; 10+ messages in thread
From: Chris Wright @ 2003-09-18  5:17 UTC (permalink / raw)
  To: Matt Mackall; +Cc: linux-kernel

* Matt Mackall (mpm@selenic.com) wrote:
> On Wed, Sep 17, 2003 at 11:24:47AM -0700, Chris Wright wrote:
> > Here's a couple small tweaks.  The first is to netpoll_setup.  The settle
> > time was too short for my e100, and the system would hang.  
> 
> This probably ought to be a command line arg, my tg3 apparently
> doesn't need it at all. One second is what's in the nfs-root stuff,
> perhaps they need to share an arg, I changed it to two because my tlan
> was dropping stuff (but not hanging - that may be a driver bug).
> Ideally, I'd like to find a way to wait until the damn thing is up
> before sending.

Yeah, I agree, that seems best.

> net/ipv4/ipconfig.c:
>  /* Define the friendly delay before and after opening net devices */
>  #define CONF_PRE_OPEN           (HZ/2)  /* Before opening: 1/2 second */
>  #define CONF_POST_OPEN          (1*HZ)  /* After opening: 1 second */
>  
> Anyway, I'm still struggling with getting stuff working on my Opteron
> box, care to take a stab at it?

Sure, I'll poke at it tomorrow, unless you get to it first.

> > The second
> > is to netconsole so that it registers a console with CON_PRINTBUFFER.
> > This helps debugging early bootup issues where you want to capture data
> > from before netconsole is initialized.  Perhaps it should be a param
> > to netconsole?
> 
> I think this can probably be unconditional. Merged.

Ok, cool.
thanks,
-chris
-- 
Linux Security Modules     http://lsm.immunix.org     http://lsm.bkbits.net

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: netpoll/netconsole minor tweaks
  2003-09-17 18:24 netpoll/netconsole minor tweaks Chris Wright
  2003-09-17 20:51 ` Matt Mackall
@ 2003-09-18 12:30 ` Alan Cox
  2003-09-18 16:48   ` Chris Wright
  1 sibling, 1 reply; 10+ messages in thread
From: Alan Cox @ 2003-09-18 12:30 UTC (permalink / raw)
  To: Chris Wright; +Cc: Matt Mackall, Linux Kernel Mailing List

On Mer, 2003-09-17 at 19:24, Chris Wright wrote: 
>  		/* Give driver a chance to settle */
> -		jiff = jiffies + 2*HZ;
> +		jiff = jiffies + 4*HZ;
>  		while (time_before(jiffies, jiff))
<pedant>
>  			;
should be cpu_relax();
</pedant>



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: netpoll/netconsole minor tweaks
  2003-09-18 12:30 ` Alan Cox
@ 2003-09-18 16:48   ` Chris Wright
  2003-09-18 17:13     ` Arjan van de Ven
  2003-09-18 21:12     ` Alan Cox
  0 siblings, 2 replies; 10+ messages in thread
From: Chris Wright @ 2003-09-18 16:48 UTC (permalink / raw)
  To: Alan Cox; +Cc: Matt Mackall, Linux Kernel Mailing List

* Alan Cox (alan@lxorguk.ukuu.org.uk) wrote:
> On Mer, 2003-09-17 at 19:24, Chris Wright wrote: 
> >  		/* Give driver a chance to settle */
> > -		jiff = jiffies + 2*HZ;
> > +		jiff = jiffies + 4*HZ;
> >  		while (time_before(jiffies, jiff))
> <pedant>
> should be cpu_relax();
> </pedant>

Hrm, there's many spots that aren't using it.  What's the benefit, less
power consumption?  Is it worth a patch to convert other things over?

thanks,
-chris
-- 
Linux Security Modules     http://lsm.immunix.org     http://lsm.bkbits.net

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: netpoll/netconsole minor tweaks
  2003-09-18 16:48   ` Chris Wright
@ 2003-09-18 17:13     ` Arjan van de Ven
  2003-09-18 17:50       ` Chris Wright
  2003-09-18 21:12     ` Alan Cox
  1 sibling, 1 reply; 10+ messages in thread
From: Arjan van de Ven @ 2003-09-18 17:13 UTC (permalink / raw)
  To: Chris Wright; +Cc: Alan Cox, Matt Mackall, Linux Kernel Mailing List

[-- Attachment #1: Type: text/plain, Size: 259 bytes --]


> Hrm, there's many spots that aren't using it.  What's the benefit, less
> power consumption? 

Less power consumption, and on HT/SMT CPU's it's a "yield" to the other
half/halves.
>
>  Is it worth a patch to convert other things over?
> 

yes


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: netpoll/netconsole minor tweaks
  2003-09-18 17:13     ` Arjan van de Ven
@ 2003-09-18 17:50       ` Chris Wright
  0 siblings, 0 replies; 10+ messages in thread
From: Chris Wright @ 2003-09-18 17:50 UTC (permalink / raw)
  To: Arjan van de Ven; +Cc: Alan Cox, Matt Mackall, Linux Kernel Mailing List

* Arjan van de Ven (arjanv@redhat.com) wrote:
> Less power consumption, and on HT/SMT CPU's it's a "yield" to the other
> half/halves.

I see, thanks.

> >  Is it worth a patch to convert other things over?
> yes

OK, I'll spin one up, thanks,
-chris
-- 
Linux Security Modules     http://lsm.immunix.org     http://lsm.bkbits.net

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: netpoll/netconsole minor tweaks
  2003-09-18 16:48   ` Chris Wright
  2003-09-18 17:13     ` Arjan van de Ven
@ 2003-09-18 21:12     ` Alan Cox
  2003-09-18 23:10       ` Jesper Juhl
  1 sibling, 1 reply; 10+ messages in thread
From: Alan Cox @ 2003-09-18 21:12 UTC (permalink / raw)
  To: Chris Wright; +Cc: Matt Mackall, Linux Kernel Mailing List

On Iau, 2003-09-18 at 17:48, Chris Wright wrote:
> > <pedant>
> > should be cpu_relax();
> > </pedant>
> 
> Hrm, there's many spots that aren't using it.  What's the benefit, less
> power consumption?  Is it worth a patch to convert other things over?

It speeds up hyperthreading CPUs by letting them know that this
paticular thread is waiting for stuff (sched_yield for silicon)


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: netpoll/netconsole minor tweaks
  2003-09-18 21:12     ` Alan Cox
@ 2003-09-18 23:10       ` Jesper Juhl
  2003-09-19  7:40         ` Arjan van de Ven
  0 siblings, 1 reply; 10+ messages in thread
From: Jesper Juhl @ 2003-09-18 23:10 UTC (permalink / raw)
  To: Alan Cox; +Cc: Chris Wright, Matt Mackall, Linux Kernel Mailing List


On Thu, 18 Sep 2003, Alan Cox wrote:

> On Iau, 2003-09-18 at 17:48, Chris Wright wrote:
> > > <pedant>
> > > should be cpu_relax();
> > > </pedant>
> >
> > Hrm, there's many spots that aren't using it.  What's the benefit, less
> > power consumption?  Is it worth a patch to convert other things over?
>
> It speeds up hyperthreading CPUs by letting them know that this
> paticular thread is waiting for stuff (sched_yield for silicon)
>

Does that mean that it would be benneficial to do something like this in
for example eepro100.c ??

diff -up linux-2.6.0-test5-orig/drivers/net/eepro100.c
linux-2.6.0-test5/drivers/net/eepro100.c
--- linux-2.6.0-test5-orig/drivers/net/eepro100.c       2003-09-08 21:50:09.000000000 +0200
+++ linux-2.6.0-test5/drivers/net/eepro100.c    2003-09-19 01:03:19.000000000 +0200
@@ -913,9 +913,11 @@ static void do_slow_command(struct net_d

        for (wait = 0; wait <= 100; wait++)
                if (inb(cmd_ioaddr) == 0) return;
-       for (; wait <= 20000; wait++)
+       for (; wait <= 20000; wait++) {
                if (inb(cmd_ioaddr) == 0) return;
                else udelay(1);
+               cpu_relax();
+       }
        printk(KERN_ERR "Command %4.4x was not accepted after %d polls!"
               "  Current status %8.8x.\n",
               cmd, wait, inl(dev->base_addr + SCBStatus));



or maybe even take it to the extreme like


diff -up linux-2.6.0-test5-orig/drivers/net/eepro100.c
linux-2.6.0-test5/drivers/net/eepro100.c
--- linux-2.6.0-test5-orig/drivers/net/eepro100.c       2003-09-08 21:50:09.000000000 +0200
+++ linux-2.6.0-test5/drivers/net/eepro100.c    2003-09-19 01:07:50.000000000 +0200
@@ -902,20 +902,25 @@ static void do_slow_command(struct net_d
 {
        long cmd_ioaddr = dev->base_addr + SCBCmd;
        int wait = 0;
-       do
+       do {
                if (inb(cmd_ioaddr) == 0) break;
-       while(++wait <= 200);
+               cpu_relax();
+       } while(++wait <= 200);
        if (wait > 100)
                printk(KERN_ERR "Command %4.4x never accepted (%d
polls)!\n",
                       inb(cmd_ioaddr), wait);

        outb(cmd, cmd_ioaddr);

-       for (wait = 0; wait <= 100; wait++)
+       for (wait = 0; wait <= 100; wait++) {
                if (inb(cmd_ioaddr) == 0) return;
-       for (; wait <= 20000; wait++)
+               cpu_relax();
+       }
+       for (; wait <= 20000; wait++) {
                if (inb(cmd_ioaddr) == 0) return;
                else udelay(1);
+               cpu_relax();
+       }
        printk(KERN_ERR "Command %4.4x was not accepted after %d polls!"
               "  Current status %8.8x.\n",
               cmd, wait, inl(dev->base_addr + SCBStatus));


How short/long waits are we talking about before it is benneficial to be
calling cpu_relax() ?


Kind regards,

Jesper Juhl <jju@dif.dk>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: netpoll/netconsole minor tweaks
  2003-09-18 23:10       ` Jesper Juhl
@ 2003-09-19  7:40         ` Arjan van de Ven
  0 siblings, 0 replies; 10+ messages in thread
From: Arjan van de Ven @ 2003-09-19  7:40 UTC (permalink / raw)
  To: Jesper Juhl
  Cc: Alan Cox, Chris Wright, Matt Mackall, Linux Kernel Mailing List

[-- Attachment #1: Type: text/plain, Size: 400 bytes --]

On Fri, 2003-09-19 at 01:10, Jesper Juhl wrote:
> 00; wait++)
>                 if (inb(cmd_ioaddr) == 0) return;
> -       for (; wait <= 20000; wait++)
> +       for (; wait <= 20000; wait++) {
>                 if (inb(cmd_ioaddr) == 0) return;
>                 else udelay(1);
> +               cpu_relax();
> +       }

udelay() should have cpu_relax() inside it already basically..

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2003-09-19  7:40 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-17 18:24 netpoll/netconsole minor tweaks Chris Wright
2003-09-17 20:51 ` Matt Mackall
2003-09-18  5:17   ` Chris Wright
2003-09-18 12:30 ` Alan Cox
2003-09-18 16:48   ` Chris Wright
2003-09-18 17:13     ` Arjan van de Ven
2003-09-18 17:50       ` Chris Wright
2003-09-18 21:12     ` Alan Cox
2003-09-18 23:10       ` Jesper Juhl
2003-09-19  7:40         ` Arjan van de Ven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®