public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [2.6.30] What's in the async boot tree
@ 2009-03-15 18:23 Arjan van de Ven
  2009-03-15 18:24 ` [PATCH] async: remove the temporary (2.6.29) "async is off by default" code Arjan van de Ven
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Arjan van de Ven @ 2009-03-15 18:23 UTC (permalink / raw)
  To: linux-kernel

The following changes since commit 326d8519fc97be186c55ac605c3a7c957c758ae1:
  Linus Torvalds (1):
        Merge branch 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/arjan/linux-2.6-async-for-30.git master

Arjan van de Ven (2):
      async: remove the temporary (2.6.29) "async is off by default" code
      ide/net: flip the order of SATA and network init

Li, Shaohua (1):
      fastboot: remove duplicate unpack_to_rootfs()

 drivers/Makefile |    5 ++-
 init/initramfs.c |   71 ++++++++++++++++++++++++++++++++++++++++++-----------
 kernel/async.c   |   10 +-------
 3 files changed, 60 insertions(+), 26 deletions(-)


I will reply to this email with the three patches


-- 
Arjan van de Ven 	Intel Open Source Technology Centre
For development, discussion and tips for power savings, 
visit http://www.lesswatts.org

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

* [PATCH] async: remove the temporary (2.6.29) "async is off by default" code
  2009-03-15 18:23 [2.6.30] What's in the async boot tree Arjan van de Ven
@ 2009-03-15 18:24 ` Arjan van de Ven
  2009-03-16 16:12   ` Woody Suwalski
  2009-03-16 19:29   ` Stefan Richter
  2009-03-15 18:25 ` [PATCH] ide/net: flip the order of SATA and network init Arjan van de Ven
  2009-03-15 18:25 ` [PATCH] fastboot: remove duplicate unpack_to_rootfs() Arjan van de Ven
  2 siblings, 2 replies; 7+ messages in thread
From: Arjan van de Ven @ 2009-03-15 18:24 UTC (permalink / raw)
  To: linux-kernel; +Cc: Arjan van de Ven

>From bfcfecd5ccfaa76011d8eba8f6c8ed486d57e0ab Mon Sep 17 00:00:00 2001
From: Arjan van de Ven <arjan@linux.intel.com>
Date: Sun, 15 Mar 2009 11:11:44 -0700
Subject: [PATCH] async: remove the temporary (2.6.29) "async is off by default" code

Now that everyone has been able to test the async code (and it's being used
in the Moblin betas by default), we can enable it by default.
The various fixes needed have gone into 2.6.29 already.

Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
---
 kernel/async.c |   10 +---------
 1 files changed, 1 insertions(+), 9 deletions(-)

diff --git a/kernel/async.c b/kernel/async.c
index f565891..247ab12 100644
--- a/kernel/async.c
+++ b/kernel/async.c
@@ -391,16 +391,8 @@ static int __init async_init(void)
 		if (IS_ERR(kthread_run(async_manager_thread, NULL,
 				       "async/mgr")))
 			async_enabled = 0;
-	return 0;
-}
-
-static int __init setup_async(char *str)
-{
 	async_enabled = 1;
-	return 1;
+	return 0;
 }
 
-__setup("fastboot", setup_async);
-
-
 core_initcall(async_init);
-- 
1.6.0.6




-- 
Arjan van de Ven 	Intel Open Source Technology Centre
For development, discussion and tips for power savings, 
visit http://www.lesswatts.org

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

* [PATCH] ide/net: flip the order of SATA and network init
  2009-03-15 18:23 [2.6.30] What's in the async boot tree Arjan van de Ven
  2009-03-15 18:24 ` [PATCH] async: remove the temporary (2.6.29) "async is off by default" code Arjan van de Ven
@ 2009-03-15 18:25 ` Arjan van de Ven
  2009-03-15 18:25 ` [PATCH] fastboot: remove duplicate unpack_to_rootfs() Arjan van de Ven
  2 siblings, 0 replies; 7+ messages in thread
From: Arjan van de Ven @ 2009-03-15 18:25 UTC (permalink / raw)
  To: linux-kernel; +Cc: Arjan van de Ven

>From 7c73393acfcce11a8d8ee661e08bae24fc17af61 Mon Sep 17 00:00:00 2001
From: Arjan van de Ven <arjan@linux.intel.com>
Date: Mon, 26 Jan 2009 18:58:11 -0800
Subject: [PATCH] ide/net: flip the order of SATA and network init

this patch flips the order in which sata and network drivers are initialized.

SATA probing takes quite a bit of time, and with the asynchronous infrastructure
other drivers that run after it can execute in parallel. Network drivers do tend
to take some real time talking to the hardware, so running these later is
a good thing (the sata probe then runs concurrent)

This saves about 15% of my kernels boot time.

Both Dave and Jeff acked this patch and suggested it should go via the async
tree.

Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Acked-by: David S. Miller <davem@davemloft.net>
Acked-by: Jeff Garzik <jeff@garzik.org>
---
 drivers/Makefile |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/Makefile b/drivers/Makefile
index c1bf417..2618a61 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -36,13 +36,14 @@ obj-$(CONFIG_FB_INTEL)          += video/intelfb/
 
 obj-y				+= serial/
 obj-$(CONFIG_PARPORT)		+= parport/
-obj-y				+= base/ block/ misc/ mfd/ net/ media/
+obj-y				+= base/ block/ misc/ mfd/ media/
 obj-$(CONFIG_NUBUS)		+= nubus/
-obj-$(CONFIG_ATM)		+= atm/
 obj-y				+= macintosh/
 obj-$(CONFIG_IDE)		+= ide/
 obj-$(CONFIG_SCSI)		+= scsi/
 obj-$(CONFIG_ATA)		+= ata/
+obj-y				+= net/
+obj-$(CONFIG_ATM)		+= atm/
 obj-$(CONFIG_FUSION)		+= message/
 obj-$(CONFIG_FIREWIRE)		+= firewire/
 obj-y				+= ieee1394/
-- 
1.6.0.6




-- 
Arjan van de Ven 	Intel Open Source Technology Centre
For development, discussion and tips for power savings, 
visit http://www.lesswatts.org

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

* [PATCH] fastboot: remove duplicate unpack_to_rootfs()
  2009-03-15 18:23 [2.6.30] What's in the async boot tree Arjan van de Ven
  2009-03-15 18:24 ` [PATCH] async: remove the temporary (2.6.29) "async is off by default" code Arjan van de Ven
  2009-03-15 18:25 ` [PATCH] ide/net: flip the order of SATA and network init Arjan van de Ven
@ 2009-03-15 18:25 ` Arjan van de Ven
  2 siblings, 0 replies; 7+ messages in thread
From: Arjan van de Ven @ 2009-03-15 18:25 UTC (permalink / raw)
  To: linux-kernel; +Cc: Arjan van de Ven

>From 4ea6c5331652555dcc96b86e078b7dceaa38005b Mon Sep 17 00:00:00 2001
From: Li, Shaohua <shaohua.li@intel.com>
Date: Wed, 13 Aug 2008 17:26:01 +0800
Subject: [PATCH] fastboot: remove duplicate unpack_to_rootfs()

we check if initrd is initramfs first and then do the real unpack. The check
isn't required, we can directly do unpack.  If the initrd isn't an
initramfs, we can remove the garbage.  In my laptop, this saves 0.1s boot
time.

This patch penalizes non-initramfs initrd case, but nowadays, initramfs is
the most widely used method for initrds.

Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Acked-by: Arjan van de Ven <arjan@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 init/initramfs.c |   71 ++++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 56 insertions(+), 15 deletions(-)

diff --git a/init/initramfs.c b/init/initramfs.c
index d9c941c..d3c56fc 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -5,6 +5,7 @@
 #include <linux/fcntl.h>
 #include <linux/delay.h>
 #include <linux/string.h>
+#include <linux/dirent.h>
 #include <linux/syscalls.h>
 #include <linux/utime.h>
 
@@ -166,8 +167,6 @@ static __initdata char *victim;
 static __initdata unsigned count;
 static __initdata loff_t this_header, next_header;
 
-static __initdata int dry_run;
-
 static inline void __init eat(unsigned n)
 {
 	victim += n;
@@ -229,10 +228,6 @@ static int __init do_header(void)
 	parse_header(collected);
 	next_header = this_header + N_ALIGN(name_len) + body_len;
 	next_header = (next_header + 3) & ~3;
-	if (dry_run) {
-		read_into(name_buf, N_ALIGN(name_len), GotName);
-		return 0;
-	}
 	state = SkipIt;
 	if (name_len <= 0 || name_len > PATH_MAX)
 		return 0;
@@ -303,8 +298,6 @@ static int __init do_name(void)
 		free_hash();
 		return 0;
 	}
-	if (dry_run)
-		return 0;
 	clean_path(collected, mode);
 	if (S_ISREG(mode)) {
 		int ml = maybe_link();
@@ -476,10 +469,9 @@ static void __init flush_window(void)
 	outcnt = 0;
 }
 
-static char * __init unpack_to_rootfs(char *buf, unsigned len, int check_only)
+static char * __init unpack_to_rootfs(char *buf, unsigned len)
 {
 	int written;
-	dry_run = check_only;
 	header_buf = kmalloc(110, GFP_KERNEL);
 	symlink_buf = kmalloc(PATH_MAX + N_ALIGN(PATH_MAX) + 1, GFP_KERNEL);
 	name_buf = kmalloc(N_ALIGN(PATH_MAX), GFP_KERNEL);
@@ -574,10 +566,57 @@ skip:
 	initrd_end = 0;
 }
 
+#define BUF_SIZE 1024
+static void __init clean_rootfs(void)
+{
+	int fd;
+	void *buf;
+	struct linux_dirent64 *dirp;
+	int count;
+
+	fd = sys_open("/", O_RDONLY, 0);
+	WARN_ON(fd < 0);
+	if (fd < 0)
+		return;
+	buf = kzalloc(BUF_SIZE, GFP_KERNEL);
+	WARN_ON(!buf);
+	if (!buf) {
+		sys_close(fd);
+		return;
+	}
+
+	dirp = buf;
+	count = sys_getdents64(fd, dirp, BUF_SIZE);
+	while (count > 0) {
+		while (count > 0) {
+			struct stat st;
+			int ret;
+
+			ret = sys_newlstat(dirp->d_name, &st);
+			WARN_ON_ONCE(ret);
+			if (!ret) {
+				if (S_ISDIR(st.st_mode))
+					sys_rmdir(dirp->d_name);
+				else
+					sys_unlink(dirp->d_name);
+			}
+
+			count -= dirp->d_reclen;
+			dirp = (void *)dirp + dirp->d_reclen;
+		}
+		dirp = buf;
+		memset(buf, 0, BUF_SIZE);
+		count = sys_getdents64(fd, dirp, BUF_SIZE);
+	}
+
+	sys_close(fd);
+	kfree(buf);
+}
+
 static int __init populate_rootfs(void)
 {
 	char *err = unpack_to_rootfs(__initramfs_start,
-			 __initramfs_end - __initramfs_start, 0);
+			 __initramfs_end - __initramfs_start);
 	if (err)
 		panic(err);
 	if (initrd_start) {
@@ -585,13 +624,15 @@ static int __init populate_rootfs(void)
 		int fd;
 		printk(KERN_INFO "checking if image is initramfs...");
 		err = unpack_to_rootfs((char *)initrd_start,
-			initrd_end - initrd_start, 1);
+			initrd_end - initrd_start);
 		if (!err) {
 			printk(" it is\n");
-			unpack_to_rootfs((char *)initrd_start,
-				initrd_end - initrd_start, 0);
 			free_initrd();
 			return 0;
+		} else {
+			clean_rootfs();
+			unpack_to_rootfs(__initramfs_start,
+				 __initramfs_end - __initramfs_start);
 		}
 		printk("it isn't (%s); looks like an initrd\n", err);
 		fd = sys_open("/initrd.image", O_WRONLY|O_CREAT, 0700);
@@ -604,7 +645,7 @@ static int __init populate_rootfs(void)
 #else
 		printk(KERN_INFO "Unpacking initramfs...");
 		err = unpack_to_rootfs((char *)initrd_start,
-			initrd_end - initrd_start, 0);
+			initrd_end - initrd_start);
 		if (err)
 			panic(err);
 		printk(" done\n");
-- 
1.6.0.6




-- 
Arjan van de Ven 	Intel Open Source Technology Centre
For development, discussion and tips for power savings, 
visit http://www.lesswatts.org

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

* Re: [PATCH] async: remove the temporary (2.6.29) "async is off by default" code
  2009-03-15 18:24 ` [PATCH] async: remove the temporary (2.6.29) "async is off by default" code Arjan van de Ven
@ 2009-03-16 16:12   ` Woody Suwalski
  2009-03-16 19:29   ` Stefan Richter
  1 sibling, 0 replies; 7+ messages in thread
From: Woody Suwalski @ 2009-03-16 16:12 UTC (permalink / raw)
  To: Arjan van de Ven; +Cc: linux-kernel

Arjan van de Ven wrote:
> From bfcfecd5ccfaa76011d8eba8f6c8ed486d57e0ab Mon Sep 17 00:00:00 2001
> From: Arjan van de Ven <arjan@linux.intel.com>
> Date: Sun, 15 Mar 2009 11:11:44 -0700
> Subject: [PATCH] async: remove the temporary (2.6.29) "async is off by default" code
>
> Now that everyone has been able to test the async code (and it's being used
> in the Moblin betas by default), we can enable it by default.
> The various fixes needed have gone into 2.6.29 already.
>
> Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
> ---
>  kernel/async.c |   10 +---------
>  1 files changed, 1 insertions(+), 9 deletions(-)
>
> diff --git a/kernel/async.c b/kernel/async.c
> index f565891..247ab12 100644
> --- a/kernel/async.c
> +++ b/kernel/async.c
> @@ -391,16 +391,8 @@ static int __init async_init(void)
>  		if (IS_ERR(kthread_run(async_manager_thread, NULL,
>  				       "async/mgr")))
>  			async_enabled = 0;
> -	return 0;
> -}
> -
> -static int __init setup_async(char *str)
> -{
>  	async_enabled = 1;
> -	return 1;
> +	return 0;
>  }
>  
> -__setup("fastboot", setup_async);
> -
> -
>  core_initcall(async_init);
>   
Arjan, when I try this one - kernel will not boot. I see it initializing 
the touchpad and then wait for ever.
If I pass fastboot on cmdline - it works OK. Any ideas?

Thanks, Woody


-- 
Woody Suwalski, Xandros, Ottawa, Canada, 1-613-842-3498 x414


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

* Re: [PATCH] async: remove the temporary (2.6.29) "async is off by default" code
  2009-03-15 18:24 ` [PATCH] async: remove the temporary (2.6.29) "async is off by default" code Arjan van de Ven
  2009-03-16 16:12   ` Woody Suwalski
@ 2009-03-16 19:29   ` Stefan Richter
  2009-03-16 20:26     ` Arjan van de Ven
  1 sibling, 1 reply; 7+ messages in thread
From: Stefan Richter @ 2009-03-16 19:29 UTC (permalink / raw)
  To: Arjan van de Ven; +Cc: linux-kernel

On 15 Mar, Arjan van de Ven wrote:
> --- a/kernel/async.c
> +++ b/kernel/async.c
> @@ -391,16 +391,8 @@ static int __init async_init(void)
>  		if (IS_ERR(kthread_run(async_manager_thread, NULL,
>  				       "async/mgr")))
>  			async_enabled = 0;
> -	return 0;
> -}
> -
> -static int __init setup_async(char *str)
> -{
>  	async_enabled = 1;
> -	return 1;
> +	return 0;
>  }
>  
> -__setup("fastboot", setup_async);
> -
> -
>  core_initcall(async_init);


From: Stefan Richter <stefanr@s5r6.in-berlin.de>
Subject: async: enable it for real

Fix 'async: remove the temporary (2.6.29) "async is off by default" code'.

Also warn if the thread couldn't be started.  A start failure may have
serious side effects when more code starts to use <linux/async.h>.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
---

Only compile-tested.

 kernel/async.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Index: linux/kernel/async.c
===================================================================
--- linux.orig/kernel/async.c
+++ linux/kernel/async.c
@@ -49,6 +49,7 @@ asynchronous and synchronous parts of th
 */
 
 #include <linux/async.h>
+#include <linux/bug.h>
 #include <linux/module.h>
 #include <linux/wait.h>
 #include <linux/sched.h>
@@ -387,11 +388,10 @@ static int async_manager_thread(void *un
 
 static int __init async_init(void)
 {
-	if (async_enabled)
-		if (IS_ERR(kthread_run(async_manager_thread, NULL,
-				       "async/mgr")))
-			async_enabled = 0;
-	async_enabled = 1;
+	async_enabled =
+		!IS_ERR(kthread_run(async_manager_thread, NULL, "async/mgr"));
+
+	WARN_ON(!async_enabled);
 	return 0;
 }
 


-- 
Stefan Richter
-=====-==--= --== =----
http://arcgraph.de/sr/


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

* Re: [PATCH] async: remove the temporary (2.6.29) "async is off by default" code
  2009-03-16 19:29   ` Stefan Richter
@ 2009-03-16 20:26     ` Arjan van de Ven
  0 siblings, 0 replies; 7+ messages in thread
From: Arjan van de Ven @ 2009-03-16 20:26 UTC (permalink / raw)
  To: Stefan Richter; +Cc: linux-kernel

On Mon, 16 Mar 2009 20:29:04 +0100 (CET)
Stefan Richter <stefanr@s5r6.in-berlin.de> wrote:

> (async_manager_thread, NULL,
> >  				      

DOh brown paper bag time.

This is so bad that I feel I need to redo the original patch; I'll
credit it to you though.


-- 
Arjan van de Ven 	Intel Open Source Technology Centre
For development, discussion and tips for power savings, 
visit http://www.lesswatts.org

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

end of thread, other threads:[~2009-03-16 20:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-15 18:23 [2.6.30] What's in the async boot tree Arjan van de Ven
2009-03-15 18:24 ` [PATCH] async: remove the temporary (2.6.29) "async is off by default" code Arjan van de Ven
2009-03-16 16:12   ` Woody Suwalski
2009-03-16 19:29   ` Stefan Richter
2009-03-16 20:26     ` Arjan van de Ven
2009-03-15 18:25 ` [PATCH] ide/net: flip the order of SATA and network init Arjan van de Ven
2009-03-15 18:25 ` [PATCH] fastboot: remove duplicate unpack_to_rootfs() 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