[PATCH] getty: Wait until all output written to stdout has beentransmitted

Michal Simek monstr at monstr.eu
Tue Jan 25 13:51:33 UTC 2011


Denys Vlasenko wrote:
> On Monday 24 January 2011 21:03, Peter Korsgaard wrote:
>>>>>>> "Jim" == Cathey, Jim <jcathey at ciena.com> writes:
>> This thread started by Michal, who's trying to use a very slow
>> serial-over-jtag setup on microblaze, and had issues with characters
>> getting lost when getty started up (because of the tcflush), so we
>> wanted to add a tcdrain() instead.
> 
> Unfortunately, Michal did not provide much of information:
> what is the speed of his serial link?

There is no HW setting about baudrate in HW. It is Jtag hw console -
xilinx mdm IP. It is compatible with uartlite Kernel driver.
http://www.xilinx.com/support/documentation/ip_documentation/mdm.pdf


  how many characters
> are lost on average?

Every boot is different but approximately 200 chars are lost.

> How he starts getty? 
getty: ttyUL0::respawn:/bin/getty -L 50 ttyUL0 vt100 (of course I
changed it to 0, 50 and 300 according to libbb/speed_table.c)

> What architecture and CPU?

architecture: Microblaze (I think you don't need to know which exactly
version/configuration I used) 90MHz (Some people use 25MHz too but without console on mdm)

> Anything?

More info in https://lkml.org/lkml/2011/1/16/13
or the first on linux serial because I thought that the problem is in
Peter's uarlite Linux kernel driver
http://www.spinics.net/lists/linux-serial/msg03173.html

> 
> His last mail says that sleep(1) doesn't help, which I find
> hard to believe.
> 

sleep just postpone flush. As you can see in that lkml thread. Peter
suggested to try tcdrain instead of tcflush based on my debugging/output
messages.

CPIO is available at
http://www.monstr.eu/20110125-busybox-rootfs.cpio

Some logs below.

Thanks,
Michal


1. Current behavior:

[ 42.297299] <  0.417384> Running local start scripts.
[ 42.499939] <  0.202640> Mounting sysfs:
[ 42.912690] <  0.412751> mdev: initialising /dev
[ 43.120934] <  0.208244> Mounting /etc/config:
[ 43.523944] <  0.403010> Populating /etc/config:
[ 44.528967] <  1.005023> flatfsd: Created 8 configuration files (168 net eth0: Promiscuous mode 
disabled.
[ 44.529072] <  0.000105> bytes)
[ 44.736594] <  0.207522> Mounting devpts:
[ 45.137225] <  0.400631> Setting hostname:
[ 45.536748] <  0.399523> Bringing up network interfaces:
[ 45.739614] <  0.202866> udhcpc (v1.18.2) started
[ 46.137376] <  0.397762> Sending discover.
[ 47.229770] <  1.092394> Xilinx-SP605-LTP-full-WB-pc-msr-next-22-watch-wt-mdm login:



2. sleep(3):
[ 45.882825] <  0.405516> Bringing up network interfaces:
[ 46.082834] <  0.200009> udhcpc (v1.18.2) started
[ 46.483630] <  0.400796> Sending discover...
[ 46.884336] <  0.400643> Sending select for 192.168.0.100...
[ 47.482714] <  0.598378> Lease of 192.168.0.100 obtained, lease time 7200
[ 47.878229] <  0.395515> Starting portmap:
[ 47.878281] <  0.000052>
[ 47.878298] <  0.000017> Welcome to
[ 48.474868] <  0.596570>  _____       _           _      _
[ 48.877371] <  0.402503> | ___ \     | |         | |    (_)
[ 49.264710] <  0.387339> | |_/ / ___ | |_   __ _ |
[ 50.058137] <  0.793427> Xilinx-SP605-LTP-full-WB-pc-msr-next-22-watch-wt-mdm login:




3. with tcdrain(from origin our patch)
[ 47.092812] <  0.591759> Lease of 192.168.0.100 obtained, lease time 7200
[ 47.332540] <  0.239728> Starting portmap:
[ 47.332649] <  0.000109>
[ 47.567536] <  0.234887> Welcome to
[ 48.045421] <  0.477885>  _____       _           _      _
[ 48.670993] <  0.625572> | ___ \     | |         | |    (_)
[ 49.266218] <  0.595225> | |_/ / ___ | |_   __ _ | |     _  _ __   _   _ __  __
[ 49.970985] <  0.704767> |  __/ / _ \| __| / _` || |    | || '_ \ | | | |\ \/ /
[ 50.494000] <  0.523015> | |   |  __/| |_ | (_| || |____| || | | || |_| | >  <
[ 51.198863] <  0.704863> \_|    \___| \__| \__,_|\_____/|_||_| |_| \__,_|/_/\_\
[ 51.198969] <  0.000106>
[ 51.714875] <  0.515906> on Xilinx-SP605-LTP-full-WB-pc-msr-next-22-watch-wt-mdm
[ 51.714921] <  0.000046>
[ 52.621779] <  0.702838> Xilinx-SP605-LTP-full-WB-pc-msr-next-22-watch-wt-mdm login:


4. with tcdrain with alarms has the same behavior as above.


-- 
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/
Microblaze U-BOOT custodian



More information about the busybox mailing list