[PATCH 0/7] globalvar: add multiple device support

Sascha Hauer s.hauer at pengutronix.de
Sun Jan 27 05:56:51 EST 2013


On Sun, Jan 27, 2013 at 11:38:56AM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 11:08 Sun 27 Jan     , Sascha Hauer wrote:
> > On Sat, Jan 26, 2013 at 12:53:26AM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > HI,
> > > 
> > > 	this will allow to reduce the scope of device and params to search
> > > 	during boot time
> > > 
> > > 	we keep the retro compatibility
> > > 
> > > The following changes since commit 2c93912f34ce06585c4ede0298aef7225e096df2:
> > > 
> > >   atmel_mci: gpio: request and configure card detect (2013-01-25 19:52:44 +0100)
> > > 
> > > are available in the git repository at:
> > > 
> > >   git://git.jcrosoft.org/barebox.git delivery/globalvar
> > 
> > When compiling this I get:
> > 
> > common/bootargs.c: In function 'linux_bootargs_get':
> > common/bootargs.c:50:2: warning: passing argument 1 of 'global_get_match' from incompatible pointer type [enabled by default]
> > In file included from common/bootargs.c:23:0:
> > include/globalvar.h:19:7: note: expected 'struct device_d *' but argument is of type 'char *'
> > common/bootargs.c:54:2: warning: passing argument 1 of 'global_get_match' from incompatible pointer type [enabled by default]
> > In file included from common/bootargs.c:23:0:
> > include/globalvar.h:19:7: note: expected 'struct device_d *' but argument is of type 'char *'
> > common/bootargs.c: In function 'bootargs_init':
> > common/bootargs.c:83:19: warning: assignment from incompatible pointer type [enabled by default]
> > 
> > When starting this I get:
> > 
> > unable to handle NULL pointer dereference at address 0x00000068
> > pc : [<a7f1f928>]    lr : [<a7f1faf8>]
> > sp : a6effc18  ip : 00000002  fp : 00000000
> > r10: a6ffdf2c  r9 : a6ffd704  r8 : a6ffb009
> > r7 : 00000000  r6 : 00000000  r5 : 00000000  r4 : 00000000
> > r3 : 00000000  r2 : 00000000  r1 : a6ffb009  r0 : 00000000
> > Flags: nZCv  IRQs off  FIQs off  Mode SVC_32
> > [<a7f1f928>] (get_param_by_name+0xc/0xb4) from [<a7f1faf8>] (dev_add_param+0x18/0x94)
> > [<a7f1faf8>] (dev_add_param+0x18/0x94) from [<a7f07800>] (global_add_simple+0x14/0x18)
> > [<a7f07800>] (global_add_simple+0x14/0x18) from [<a7f0789c>] (globalvar_add_simple+0x98/0xb0)
> > [<a7f0789c>] (globalvar_add_simple+0x98/0xb0) from [<a7f1e438>] (do_global+0x110/0x188)
> > [<a7f1e438>] (do_global+0x110/0x188) from [<a7f05940>] (execute_command+0x38/0x78)
> > [<a7f05940>] (execute_command+0x38/0x78) from [<a7f02150>] (run_list_real+0x7e0/0x938)
> > [<a7f02150>] (run_list_real+0x7e0/0x938) from [<a7f01798>] (parse_stream_outer+0x198/0x270)
> > [<a7f01798>] (parse_stream_outer+0x198/0x270) from [<a7f0190c>] (parse_string_outer+0x9c/0x100)
> > [<a7f0190c>] (parse_string_outer+0x9c/0x100) from [<a7f022e8>] (source_script+0x40/0x78)
> > ...
> > 
> > Overall I'm not sure this is worth it. I did some measurements on a
> > 400MHz ARM9 board. From startup until booting the kernel barebox spends
> > about 5.5ms in getenv/setenv. This can be reduced quite easily to 3ms
> > by moving globalvar_init to a core_initcall.
> > 
> > Anyway, the series is not mergable as is. Also the search through subdevices
> > of the globalvar device seems to have some undesirable side effects.
>  
> I test here no issue wired
> 
> I test also here with more global ar about 100
> 
> I found 200ms diff on the all boot (cold start)
> 
> which for my case is critical
> 
> which config do you use?

pcm038_defconfig

See the attached patch

commit 3bbc0037970e35dab9838980bbd5dfb67cf2dada
Author: Sascha Hauer <s.hauer at pengutronix.de>
Date:   Sun Jan 27 00:53:14 2013 +0100

    fix
    
    Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>

diff --git a/common/bootargs.c b/common/bootargs.c
index d82d853..e9248ab 100644
--- a/common/bootargs.c
+++ b/common/bootargs.c
@@ -26,7 +26,7 @@
 
 static char *linux_bootargs;
 static int linux_bootargs_overwritten;
-static char *global_linux_dev;
+static struct device_d *global_linux_dev;
 
 /*
  * This returns the Linux bootargs
diff --git a/common/globalvar.c b/common/globalvar.c
index d0aa2a3..aa4f8a0 100644
--- a/common/globalvar.c
+++ b/common/globalvar.c
@@ -135,6 +135,11 @@ int globalvar_add_simple(const char *name)
 		subname = ++data;
 
 		dev = global_get_child_by_name(tmp);
+		if (!dev) {
+			dev = global_device;
+			subname = name;
+		}
+
 	}
 
 	ret = global_add_simple(dev, subname);

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list