9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* Re: [9fans] [sources] applied patch: /n/atom/patch/applied/termrcnodhcp
       [not found] <250d3e7e5500a6e7d72c8ab3d49f9641@coraid.com>
@ 2013-10-15 12:32 ` Steffen Daode Nurpmeso
  2013-10-15 12:58   ` erik quanstrom
                     ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Steffen Daode Nurpmeso @ 2013-10-15 12:32 UTC (permalink / raw)
  To: erik quanstrom; +Cc: Fans of the OS Plan 9 from Bell Labs

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

Hello,

erik quanstrom <quanstro@labs.coraid.com> wrote:
 |email
 | quanstro@quanstro.net
 |readme
 | don't dhcp by default.  it looks like a hang.
 [.]
 |+ #if(! test -e /net/ipifc/0/ctl || ~ 127.0.0.1 `{cat /net/ipifc/0/local})
 |+ #   ip/ipconfig >/dev/null >[2=1]
 [.]

after looking into the ipconfig source and placing some fprint()
the actual "hang" is caused by a faulty length of the sleep.
If i add

	--- a/sys/src/cmd/ip/ipconfig/main.c
	+++ b/sys/src/cmd/ip/ipconfig/main.c
	@@ -469,6 +469,12 @@ main(int argc, char **argv)
	 	int retry, action;
	 	Ctl *cp;
	 
	+	for (retry = 0; retry < 10; ++retry) {
	+		long t = time(nil);
	+		fprint(2, "retry %d, time %ld\n", retry, t);
	+		sleep(1000);
	+	}
	+
	 	init();
	 	retry = 0;
	 	ARGBEGIN {

then each tick sleeps ~1 second (sometimes a tick needed 3 in the
tests i've done).  But if i add

	--- a/sys/src/cmd/ip/ipconfig/main.c
	+++ b/sys/src/cmd/ip/ipconfig/main.c
	@@ -621,10 +621,13 @@ doadd(int retry)
	 	if(dodhcp){
	 		mkclientid();
	 		for(tries = 0; tries < 30; tries++){
	+			long t;
	 			dhcpquery(!noconfig, Sselecting);
	 			if(conf.state == Sbound)
	 				break;
	 			sleep(1000);
	+			t = time(nil);
	+			fprint(2, "retry %d, time %ld\n", tries, t);
	 		}
	 	}

then that sleep takes reproducably 12 seconds.  Without having any
ideas what this could be about (VirtualBox?), i nonetheless wonder
wether something like this would be imaginable, since a time
difference is used later on in the code, too:

	--- a/sys/src/cmd/ip/ipconfig/main.c
	+++ b/sys/src/cmd/ip/ipconfig/main.c
	@@ -619,12 +619,15 @@ doadd(int retry)
	 
	 	/* run dhcp if we need something */
	 	if(dodhcp){
	+		long start = time(nil);
	 		mkclientid();
	 		for(tries = 0; tries < 30; tries++){
	 			dhcpquery(!noconfig, Sselecting);
	 			if(conf.state == Sbound)
	 				break;
	 			sleep(1000);
	+			if (tries > 1 && time(nil) - start > 30)
	+				break;
	 		}
	 	}

Apologies for the patch format (it's all half-baked here).

--steffen

[-- Attachment #2: Original message content --]
[-- Type: message/rfc822, Size: 2815 bytes --]

From: erik quanstrom <quanstro@labs.coraid.com>
To: sources@9atom.org
Subject: [sources] applied patch: /n/atom/patch/applied/termrcnodhcp
Date: Sun, 13 Oct 2013 13:18:00 -0400
Message-ID: <250d3e7e5500a6e7d72c8ab3d49f9641@coraid.com>

email
	quanstro@quanstro.net
readme
	don't dhcp by default.  it looks like a hang.
	set sysname, even if ndb not cooperative
	use diskparts instead of inline code
removed
	
files
	/rc/bin/termrc	termrc

/rc/bin/termrc	termrc
termrc.orig:10,18 - termrc:10,22
  mntgen -s slashn && chmod 666 /srv/slashn
  ndb/cs -f $ndbfile
  sysname=`{cat /dev/sysname}
+ if(~ $#sysname 0){
+ 	sysname = gnot
+ 	echo -n $sysname >/dev/sysname
+ }
  
- if(! test -e /net/ipifc/0/ctl || ~ 127.0.0.1 `{cat /net/ipifc/0/local})
- 	ip/ipconfig >/dev/null >[2=1]
+ #if(! test -e /net/ipifc/0/ctl || ~ 127.0.0.1 `{cat /net/ipifc/0/local})
+ #	ip/ipconfig >/dev/null >[2=1]
  if(test -e /net/ipifc/0/ctl)
  	ndb/dns -rf $ndbfile
  for(i in /net/ether?)
termrc.orig:30,41 - termrc:34,44
  
  for(i in A w f t m u v L '$' Ι Σ κ æ ©)
  	/bin/bind -a '#'^$i /dev >/dev/null >[2=1]
- for(disk in /dev/sd??) {
- 	if(test -f $disk/data && test -f $disk/ctl)
- 		disk/fdisk -p $disk/data >$disk/ctl >[2]/dev/null
- 	for(part in $disk/plan9*)
- 		if(test -f $part)
- 			disk/prep -p $part >$disk/ctl >[2]/dev/null
+ diskparts
+ sysname=`{cat /dev/sysname}
+ if (~ $#sysname 0 || ~ $sysname '') {
+ 	sysname = gnot
+ 	echo -n $sysname >/dev/sysname
  }
  
  # hacks
------
merge...backup...copy...
cpfile termrc /n/dist/rc/bin/termrc
# remove these files if you want. I will not remove them for you
# (apatch/undo will not restore them)
done


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

* Re: [9fans] [sources] applied patch: /n/atom/patch/applied/termrcnodhcp
  2013-10-15 12:32 ` [9fans] [sources] applied patch: /n/atom/patch/applied/termrcnodhcp Steffen Daode Nurpmeso
@ 2013-10-15 12:58   ` erik quanstrom
  2013-10-15 13:15   ` Steffen Daode Nurpmeso
       [not found]   ` <ca2e3c3a59e76e71362f34b52b6502fc@coraid.com>
  2 siblings, 0 replies; 5+ messages in thread
From: erik quanstrom @ 2013-10-15 12:58 UTC (permalink / raw)
  To: 9fans

> then each tick sleeps ~1 second (sometimes a tick needed 3 in the
> tests i've done).  But if i add

hmm.  can you explain more about the environment, and kernel you
were using?  i'd like to correct the kernel timing.  sleep(n) must be
fairly accurate.  i would define that as accurate to ±1/HZ on an
otherwise unloaded system.

- erik



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

* Re: [9fans] [sources] applied patch: /n/atom/patch/applied/termrcnodhcp
  2013-10-15 12:32 ` [9fans] [sources] applied patch: /n/atom/patch/applied/termrcnodhcp Steffen Daode Nurpmeso
  2013-10-15 12:58   ` erik quanstrom
@ 2013-10-15 13:15   ` Steffen Daode Nurpmeso
       [not found]   ` <ca2e3c3a59e76e71362f34b52b6502fc@coraid.com>
  2 siblings, 0 replies; 5+ messages in thread
From: Steffen Daode Nurpmeso @ 2013-10-15 13:15 UTC (permalink / raw)
  To: erik quanstrom; +Cc: Fans of the OS Plan 9 from Bell Labs

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

hmm, i'm braindead.
And that made it especially hard to deal with ipconfig(8):

  by default, ipconfig exits after trying DHCP for 15 seconds
  with no answer

--steffen

[-- Attachment #2: Original message content --]
[-- Type: message/rfc822, Size: 5964 bytes --]

[-- Attachment #2.1.1: Type: text/plain, Size: 2057 bytes --]

Hello,

erik quanstrom <quanstro@labs.coraid.com> wrote:
 |email
 | quanstro@quanstro.net
 |readme
 | don't dhcp by default.  it looks like a hang.
 [.]
 |+ #if(! test -e /net/ipifc/0/ctl || ~ 127.0.0.1 `{cat /net/ipifc/0/local})
 |+ #   ip/ipconfig >/dev/null >[2=1]
 [.]

after looking into the ipconfig source and placing some fprint()
the actual "hang" is caused by a faulty length of the sleep.
If i add

	--- a/sys/src/cmd/ip/ipconfig/main.c
	+++ b/sys/src/cmd/ip/ipconfig/main.c
	@@ -469,6 +469,12 @@ main(int argc, char **argv)
	 	int retry, action;
	 	Ctl *cp;
	 
	+	for (retry = 0; retry < 10; ++retry) {
	+		long t = time(nil);
	+		fprint(2, "retry %d, time %ld\n", retry, t);
	+		sleep(1000);
	+	}
	+
	 	init();
	 	retry = 0;
	 	ARGBEGIN {

then each tick sleeps ~1 second (sometimes a tick needed 3 in the
tests i've done).  But if i add

	--- a/sys/src/cmd/ip/ipconfig/main.c
	+++ b/sys/src/cmd/ip/ipconfig/main.c
	@@ -621,10 +621,13 @@ doadd(int retry)
	 	if(dodhcp){
	 		mkclientid();
	 		for(tries = 0; tries < 30; tries++){
	+			long t;
	 			dhcpquery(!noconfig, Sselecting);
	 			if(conf.state == Sbound)
	 				break;
	 			sleep(1000);
	+			t = time(nil);
	+			fprint(2, "retry %d, time %ld\n", tries, t);
	 		}
	 	}

then that sleep takes reproducably 12 seconds.  Without having any
ideas what this could be about (VirtualBox?), i nonetheless wonder
wether something like this would be imaginable, since a time
difference is used later on in the code, too:

	--- a/sys/src/cmd/ip/ipconfig/main.c
	+++ b/sys/src/cmd/ip/ipconfig/main.c
	@@ -619,12 +619,15 @@ doadd(int retry)
	 
	 	/* run dhcp if we need something */
	 	if(dodhcp){
	+		long start = time(nil);
	 		mkclientid();
	 		for(tries = 0; tries < 30; tries++){
	 			dhcpquery(!noconfig, Sselecting);
	 			if(conf.state == Sbound)
	 				break;
	 			sleep(1000);
	+			if (tries > 1 && time(nil) - start > 30)
	+				break;
	 		}
	 	}

Apologies for the patch format (it's all half-baked here).

--steffen

[-- Attachment #2.1.2: Original message content --]
[-- Type: message/rfc822, Size: 2815 bytes --]

From: erik quanstrom <quanstro@labs.coraid.com>
To: sources@9atom.org
Subject: [sources] applied patch: /n/atom/patch/applied/termrcnodhcp
Date: Sun, 13 Oct 2013 13:18:00 -0400
Message-ID: <250d3e7e5500a6e7d72c8ab3d49f9641@coraid.com>

email
	quanstro@quanstro.net
readme
	don't dhcp by default.  it looks like a hang.
	set sysname, even if ndb not cooperative
	use diskparts instead of inline code
removed
	
files
	/rc/bin/termrc	termrc

/rc/bin/termrc	termrc
termrc.orig:10,18 - termrc:10,22
  mntgen -s slashn && chmod 666 /srv/slashn
  ndb/cs -f $ndbfile
  sysname=`{cat /dev/sysname}
+ if(~ $#sysname 0){
+ 	sysname = gnot
+ 	echo -n $sysname >/dev/sysname
+ }
  
- if(! test -e /net/ipifc/0/ctl || ~ 127.0.0.1 `{cat /net/ipifc/0/local})
- 	ip/ipconfig >/dev/null >[2=1]
+ #if(! test -e /net/ipifc/0/ctl || ~ 127.0.0.1 `{cat /net/ipifc/0/local})
+ #	ip/ipconfig >/dev/null >[2=1]
  if(test -e /net/ipifc/0/ctl)
  	ndb/dns -rf $ndbfile
  for(i in /net/ether?)
termrc.orig:30,41 - termrc:34,44
  
  for(i in A w f t m u v L '$' Ι Σ κ æ ©)
  	/bin/bind -a '#'^$i /dev >/dev/null >[2=1]
- for(disk in /dev/sd??) {
- 	if(test -f $disk/data && test -f $disk/ctl)
- 		disk/fdisk -p $disk/data >$disk/ctl >[2]/dev/null
- 	for(part in $disk/plan9*)
- 		if(test -f $part)
- 			disk/prep -p $part >$disk/ctl >[2]/dev/null
+ diskparts
+ sysname=`{cat /dev/sysname}
+ if (~ $#sysname 0 || ~ $sysname '') {
+ 	sysname = gnot
+ 	echo -n $sysname >/dev/sysname
  }
  
  # hacks
------
merge...backup...copy...
cpfile termrc /n/dist/rc/bin/termrc
# remove these files if you want. I will not remove them for you
# (apatch/undo will not restore them)
done


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

* Re: [9fans] [sources] applied patch: /n/atom/patch/applied/termrcnodhcp
       [not found]   ` <ca2e3c3a59e76e71362f34b52b6502fc@coraid.com>
@ 2013-10-15 13:19     ` Steffen Daode Nurpmeso
  2013-10-15 13:22       ` erik quanstrom
  0 siblings, 1 reply; 5+ messages in thread
From: Steffen Daode Nurpmeso @ 2013-10-15 13:19 UTC (permalink / raw)
  To: erik quanstrom; +Cc: Fans of the OS Plan 9 from Bell Labs

erik quanstrom <quanstro@labs.coraid.com> wrote:
 |- 9fans
 |
 |thanks for the interest!

no, i'm just totally brain dead.



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

* Re: [9fans] [sources] applied patch: /n/atom/patch/applied/termrcnodhcp
  2013-10-15 13:19     ` Steffen Daode Nurpmeso
@ 2013-10-15 13:22       ` erik quanstrom
  0 siblings, 0 replies; 5+ messages in thread
From: erik quanstrom @ 2013-10-15 13:22 UTC (permalink / raw)
  To: 9fans

On Tue Oct 15 09:20:16 EDT 2013, sdaoden@gmail.com wrote:
> erik quanstrom <quanstro@labs.coraid.com> wrote:
>  |- 9fans
>  |
>  |thanks for the interest!
>
> no, i'm just totally brain dead.

i didn't think so.  seems like sleep should be fixed.  but i need
more information on your environment to fix it.

if you're running 9atom, could you send me the output of
- aux/cpuid -iv
- pci
- cat '#P/cputype'

- erik



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

end of thread, other threads:[~2013-10-15 13:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <250d3e7e5500a6e7d72c8ab3d49f9641@coraid.com>
2013-10-15 12:32 ` [9fans] [sources] applied patch: /n/atom/patch/applied/termrcnodhcp Steffen Daode Nurpmeso
2013-10-15 12:58   ` erik quanstrom
2013-10-15 13:15   ` Steffen Daode Nurpmeso
     [not found]   ` <ca2e3c3a59e76e71362f34b52b6502fc@coraid.com>
2013-10-15 13:19     ` Steffen Daode Nurpmeso
2013-10-15 13:22       ` erik quanstrom

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).