linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/7] x86/boot: Removed quiet flag and switched quiet output to debug flag
       [not found] <1342746282-28497-1-git-send-email-jmillenbach@gmail.com>
@ 2012-07-20  1:04 ` Joe Millenbach
  2012-07-22  0:53   ` [tip:x86/boot] x86, boot: " tip-bot for Joe Millenbach
  2012-07-20  1:04 ` [PATCH 2/7] x86/boot: Wrap debug printing in a new debug_putstr function Joe Millenbach
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 14+ messages in thread
From: Joe Millenbach @ 2012-07-20  1:04 UTC (permalink / raw)
  To: H. Peter Anvin, Thomas Gleixner, Ingo Molnar, x86, Gokul Caushik,
	Josh Triplett, Joe Millenbach, Jesper Juhl, linux-kernel
  Cc: team-fjord

There are only 3 uses of the quiet flag and they all protect output that
is only useful for debugging the stub, therefore we switched to using the
debug flag for all extra output.

Signed-off-by: Joe Millenbach <jmillenbach@gmail.com>
Signed-off-by: Gokul Caushik <caushik1@gmail.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
---
 arch/x86/boot/compressed/misc.c |    9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c
index 7116dcb..8f2355d 100644
--- a/arch/x86/boot/compressed/misc.c
+++ b/arch/x86/boot/compressed/misc.c
@@ -108,7 +108,6 @@ static void error(char *m);
  * This is set up by the setup-routine at boot-time
  */
 struct boot_params *real_mode;		/* Pointer to real-mode data */
-static int quiet;
 static int debug;
 
 void *memset(void *s, int c, size_t n);
@@ -294,7 +293,7 @@ static void parse_elf(void *output)
 		return;
 	}
 
-	if (!quiet)
+	if (debug)
 		putstr("Parsing ELF... ");
 
 	phdrs = malloc(sizeof(*phdrs) * ehdr.e_phnum);
@@ -332,8 +331,6 @@ asmlinkage void decompress_kernel(void *rmode, memptr heap,
 {
 	real_mode = rmode;
 
-	if (cmdline_find_option_bool("quiet"))
-		quiet = 1;
 	if (cmdline_find_option_bool("debug"))
 		debug = 1;
 
@@ -369,11 +366,11 @@ asmlinkage void decompress_kernel(void *rmode, memptr heap,
 		error("Wrong destination address");
 #endif
 
-	if (!quiet)
+	if (debug)
 		putstr("\nDecompressing Linux... ");
 	decompress(input_data, input_len, NULL, NULL, output, NULL, error);
 	parse_elf(output);
-	if (!quiet)
+	if (debug)
 		putstr("done.\nBooting the kernel.\n");
 	return;
 }
-- 
1.7.9.5


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

* [PATCH 2/7] x86/boot: Wrap debug printing in a new debug_putstr function
       [not found] <1342746282-28497-1-git-send-email-jmillenbach@gmail.com>
  2012-07-20  1:04 ` [PATCH 1/7] x86/boot: Removed quiet flag and switched quiet output to debug flag Joe Millenbach
@ 2012-07-20  1:04 ` Joe Millenbach
  2012-07-22  0:54   ` [tip:x86/boot] x86, boot: " tip-bot for Joe Millenbach
  2012-07-20  1:04 ` [PATCH 3/7] x86/boot: Changed error putstr path to match new debug_putstr format Joe Millenbach
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 14+ messages in thread
From: Joe Millenbach @ 2012-07-20  1:04 UTC (permalink / raw)
  To: H. Peter Anvin, Thomas Gleixner, Ingo Molnar, x86, Gokul Caushik,
	Josh Triplett, Joe Millenbach, Jesper Juhl, linux-kernel
  Cc: team-fjord

Change all instances of if (debug) putstr(...) to a new debug_putstr(...).
This allows a future change to conditionally stub out debug_putstr to save
space.

Signed-off-by: Joe Millenbach <jmillenbach@gmail.com>
Signed-off-by: Gokul Caushik <caushik1@gmail.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
---
 arch/x86/boot/compressed/misc.c |   18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c
index 8f2355d..49c6d56 100644
--- a/arch/x86/boot/compressed/misc.c
+++ b/arch/x86/boot/compressed/misc.c
@@ -223,6 +223,12 @@ void __putstr(int error, const char *s)
 	outb(0xff & (pos >> 1), vidport+1);
 }
 
+static void debug_putstr(const char *s)
+{
+	if (debug)
+		putstr(s);
+}
+
 void *memset(void *s, int c, size_t n)
 {
 	int i;
@@ -293,8 +299,7 @@ static void parse_elf(void *output)
 		return;
 	}
 
-	if (debug)
-		putstr("Parsing ELF... ");
+	debug_putstr("Parsing ELF... ");
 
 	phdrs = malloc(sizeof(*phdrs) * ehdr.e_phnum);
 	if (!phdrs)
@@ -346,8 +351,7 @@ asmlinkage void decompress_kernel(void *rmode, memptr heap,
 	cols = real_mode->screen_info.orig_video_cols;
 
 	console_init();
-	if (debug)
-		putstr("early console in decompress_kernel\n");
+	debug_putstr("early console in decompress_kernel\n");
 
 	free_mem_ptr     = heap;	/* Heap */
 	free_mem_end_ptr = heap + BOOT_HEAP_SIZE;
@@ -366,11 +370,9 @@ asmlinkage void decompress_kernel(void *rmode, memptr heap,
 		error("Wrong destination address");
 #endif
 
-	if (debug)
-		putstr("\nDecompressing Linux... ");
+	debug_putstr("\nDecompressing Linux... ");
 	decompress(input_data, input_len, NULL, NULL, output, NULL, error);
 	parse_elf(output);
-	if (debug)
-		putstr("done.\nBooting the kernel.\n");
+	debug_putstr("done.\nBooting the kernel.\n");
 	return;
 }
-- 
1.7.9.5


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

* [PATCH 3/7] x86/boot: Changed error putstr path to match new debug_putstr format
       [not found] <1342746282-28497-1-git-send-email-jmillenbach@gmail.com>
  2012-07-20  1:04 ` [PATCH 1/7] x86/boot: Removed quiet flag and switched quiet output to debug flag Joe Millenbach
  2012-07-20  1:04 ` [PATCH 2/7] x86/boot: Wrap debug printing in a new debug_putstr function Joe Millenbach
@ 2012-07-20  1:04 ` Joe Millenbach
  2012-07-22  0:55   ` [tip:x86/boot] x86, boot: " tip-bot for Joe Millenbach
  2012-07-20  1:04 ` [PATCH 4/7] x86/boot: Switch output functions from command-line flags to conditional compilation Joe Millenbach
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 14+ messages in thread
From: Joe Millenbach @ 2012-07-20  1:04 UTC (permalink / raw)
  To: H. Peter Anvin, Thomas Gleixner, Ingo Molnar, x86, Gokul Caushik,
	Josh Triplett, Joe Millenbach, Jesper Juhl, linux-kernel
  Cc: team-fjord

For consistency we changed the error output path to match the new debug path.

Signed-off-by: Joe Millenbach <jmillenbach@gmail.com>
Signed-off-by: Gokul Caushik <caushik1@gmail.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
---
 arch/x86/boot/compressed/misc.c |    6 +++---
 arch/x86/boot/compressed/misc.h |    1 +
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c
index 49c6d56..de1d54d 100644
--- a/arch/x86/boot/compressed/misc.c
+++ b/arch/x86/boot/compressed/misc.c
@@ -270,9 +270,9 @@ void *memcpy(void *dest, const void *src, size_t n)
 
 static void error(char *x)
 {
-	__putstr(1, "\n\n");
-	__putstr(1, x);
-	__putstr(1, "\n\n -- System halted");
+	error_putstr("\n\n");
+	error_putstr(x);
+	error_putstr("\n\n -- System halted");
 
 	while (1)
 		asm("hlt");
diff --git a/arch/x86/boot/compressed/misc.h b/arch/x86/boot/compressed/misc.h
index 3f19c81..4c1bfb6 100644
--- a/arch/x86/boot/compressed/misc.h
+++ b/arch/x86/boot/compressed/misc.h
@@ -26,6 +26,7 @@
 extern struct boot_params *real_mode;		/* Pointer to real-mode data */
 void __putstr(int error, const char *s);
 #define putstr(__x)  __putstr(0, __x)
+#define error_putstr(__x)  __putstr(1, __x)
 #define puts(__x)  __putstr(0, __x)
 
 /* cmdline.c */
-- 
1.7.9.5


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

* [PATCH 4/7] x86/boot: Switch output functions from command-line flags to conditional compilation
       [not found] <1342746282-28497-1-git-send-email-jmillenbach@gmail.com>
                   ` (2 preceding siblings ...)
  2012-07-20  1:04 ` [PATCH 3/7] x86/boot: Changed error putstr path to match new debug_putstr format Joe Millenbach
@ 2012-07-20  1:04 ` Joe Millenbach
  2012-07-22  0:56   ` [tip:x86/boot] x86, boot: " tip-bot for Joe Millenbach
  2012-07-20  1:04 ` [PATCH 5/7] x86/boot: Removed unused debug flag and set code Joe Millenbach
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 14+ messages in thread
From: Joe Millenbach @ 2012-07-20  1:04 UTC (permalink / raw)
  To: H. Peter Anvin, Thomas Gleixner, Ingo Molnar, x86, Gokul Caushik,
	Josh Triplett, Joe Millenbach, Jesper Juhl, linux-kernel
  Cc: team-fjord

Changed putstr flagging from parameter to conditional compilation for puts,
debug_putstr, and error_putstr. This allows for space savings since most
configurations won't use this feature.

Signed-off-by: Joe Millenbach <jmillenbach@gmail.com>
Signed-off-by: Gokul Caushik <caushik1@gmail.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
---
 arch/x86/boot/compressed/misc.c |   12 +-----------
 arch/x86/boot/compressed/misc.h |   17 +++++++++++++----
 2 files changed, 14 insertions(+), 15 deletions(-)

diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c
index de1d54d..8c29f82 100644
--- a/arch/x86/boot/compressed/misc.c
+++ b/arch/x86/boot/compressed/misc.c
@@ -169,15 +169,11 @@ static void serial_putchar(int ch)
 	outb(ch, early_serial_base + TXR);
 }
 
-void __putstr(int error, const char *s)
+void __putstr(const char *s)
 {
 	int x, y, pos;
 	char c;
 
-#ifndef CONFIG_X86_VERBOSE_BOOTUP
-	if (!error)
-		return;
-#endif
 	if (early_serial_base) {
 		const char *str = s;
 		while (*str) {
@@ -223,12 +219,6 @@ void __putstr(int error, const char *s)
 	outb(0xff & (pos >> 1), vidport+1);
 }
 
-static void debug_putstr(const char *s)
-{
-	if (debug)
-		putstr(s);
-}
-
 void *memset(void *s, int c, size_t n)
 {
 	int i;
diff --git a/arch/x86/boot/compressed/misc.h b/arch/x86/boot/compressed/misc.h
index 4c1bfb6..618e5c8 100644
--- a/arch/x86/boot/compressed/misc.h
+++ b/arch/x86/boot/compressed/misc.h
@@ -24,10 +24,19 @@
 
 /* misc.c */
 extern struct boot_params *real_mode;		/* Pointer to real-mode data */
-void __putstr(int error, const char *s);
-#define putstr(__x)  __putstr(0, __x)
-#define error_putstr(__x)  __putstr(1, __x)
-#define puts(__x)  __putstr(0, __x)
+void __putstr(const char *s);
+#define error_putstr(__x)  __putstr(__x)
+
+#ifdef CONFIG_X86_VERBOSE_BOOTUP
+
+#define debug_putstr(__x)  __putstr(__x)
+
+#else
+
+static inline void debug_putstr(const char *s)
+{ }
+
+#endif
 
 /* cmdline.c */
 int cmdline_find_option(const char *option, char *buffer, int bufsize);
-- 
1.7.9.5


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

* [PATCH 5/7] x86/boot: Removed unused debug flag and set code
       [not found] <1342746282-28497-1-git-send-email-jmillenbach@gmail.com>
                   ` (3 preceding siblings ...)
  2012-07-20  1:04 ` [PATCH 4/7] x86/boot: Switch output functions from command-line flags to conditional compilation Joe Millenbach
@ 2012-07-20  1:04 ` Joe Millenbach
  2012-07-22  0:57   ` [tip:x86/boot] x86, boot: " tip-bot for Joe Millenbach
  2012-07-20  1:04 ` [PATCH 6/7] x86/boot: Exclude early_serial_console.c if can't use it Joe Millenbach
  2012-07-20  1:04 ` [PATCH 7/7] x86/boot: Exclude cmdline.c if you can't " Joe Millenbach
  6 siblings, 1 reply; 14+ messages in thread
From: Joe Millenbach @ 2012-07-20  1:04 UTC (permalink / raw)
  To: H. Peter Anvin, Thomas Gleixner, Ingo Molnar, x86, Gokul Caushik,
	Josh Triplett, Joe Millenbach, Jesper Juhl, linux-kernel
  Cc: team-fjord

As we're no longer using the flag we don't need to extract the value from the
command line and store it. This is a step towards removing command line
parameter code.

Signed-off-by: Joe Millenbach <jmillenbach@gmail.com>
Signed-off-by: Gokul Caushik <caushik1@gmail.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
---
 arch/x86/boot/compressed/misc.c |    4 ----
 1 file changed, 4 deletions(-)

diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c
index 8c29f82..88f7ff6 100644
--- a/arch/x86/boot/compressed/misc.c
+++ b/arch/x86/boot/compressed/misc.c
@@ -108,7 +108,6 @@ static void error(char *m);
  * This is set up by the setup-routine at boot-time
  */
 struct boot_params *real_mode;		/* Pointer to real-mode data */
-static int debug;
 
 void *memset(void *s, int c, size_t n);
 void *memcpy(void *dest, const void *src, size_t n);
@@ -326,9 +325,6 @@ asmlinkage void decompress_kernel(void *rmode, memptr heap,
 {
 	real_mode = rmode;
 
-	if (cmdline_find_option_bool("debug"))
-		debug = 1;
-
 	if (real_mode->screen_info.orig_video_mode == 7) {
 		vidmem = (char *) 0xb0000;
 		vidport = 0x3b4;
-- 
1.7.9.5


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

* [PATCH 6/7] x86/boot: Exclude early_serial_console.c if can't use it.
       [not found] <1342746282-28497-1-git-send-email-jmillenbach@gmail.com>
                   ` (4 preceding siblings ...)
  2012-07-20  1:04 ` [PATCH 5/7] x86/boot: Removed unused debug flag and set code Joe Millenbach
@ 2012-07-20  1:04 ` Joe Millenbach
  2012-07-22  0:58   ` [tip:x86/boot] x86, boot: Exclude early_serial_console.c if can' t " tip-bot for Joe Millenbach
  2012-07-20  1:04 ` [PATCH 7/7] x86/boot: Exclude cmdline.c if you can't " Joe Millenbach
  6 siblings, 1 reply; 14+ messages in thread
From: Joe Millenbach @ 2012-07-20  1:04 UTC (permalink / raw)
  To: H. Peter Anvin, Thomas Gleixner, Ingo Molnar, x86, Gokul Caushik,
	Josh Triplett, Joe Millenbach, linux-kernel
  Cc: team-fjord

Removes early_serial_console.c code if we don't have the config option that
enables it (EARLY_PRINTK). When disabling this code, make early_serial_base a
constant 0 to allow the compiler to optimize away the code that checks for
early_serial_base.

Signed-off-by: Joe Millenbach <jmillenbach@gmail.com>
Signed-off-by: Gokul Caushik <caushik1@gmail.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
---
 arch/x86/boot/compressed/early_serial_console.c |    4 ++++
 arch/x86/boot/compressed/misc.h                 |   10 ++++++++++
 2 files changed, 14 insertions(+)

diff --git a/arch/x86/boot/compressed/early_serial_console.c b/arch/x86/boot/compressed/early_serial_console.c
index 261e81f..d3d003c 100644
--- a/arch/x86/boot/compressed/early_serial_console.c
+++ b/arch/x86/boot/compressed/early_serial_console.c
@@ -1,5 +1,9 @@
 #include "misc.h"
 
+#ifdef CONFIG_EARLY_PRINTK
+
 int early_serial_base;
 
 #include "../early_serial_console.c"
+
+#endif
diff --git a/arch/x86/boot/compressed/misc.h b/arch/x86/boot/compressed/misc.h
index 618e5c8..3ffee6e 100644
--- a/arch/x86/boot/compressed/misc.h
+++ b/arch/x86/boot/compressed/misc.h
@@ -43,7 +43,17 @@ int cmdline_find_option(const char *option, char *buffer, int bufsize);
 int cmdline_find_option_bool(const char *option);
 
 /* early_serial_console.c */
+#ifdef CONFIG_EARLY_PRINTK
+
 extern int early_serial_base;
 void console_init(void);
 
+#else
+
+static const int early_serial_base;
+static inline void console_init(void)
+{ }
+
+#endif
+
 #endif
-- 
1.7.9.5


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

* [PATCH 7/7] x86/boot: Exclude cmdline.c if you can't use it
       [not found] <1342746282-28497-1-git-send-email-jmillenbach@gmail.com>
                   ` (5 preceding siblings ...)
  2012-07-20  1:04 ` [PATCH 6/7] x86/boot: Exclude early_serial_console.c if can't use it Joe Millenbach
@ 2012-07-20  1:04 ` Joe Millenbach
  2012-07-22  0:59   ` [tip:x86/boot] x86, boot: " tip-bot for Gokul Caushik
  6 siblings, 1 reply; 14+ messages in thread
From: Joe Millenbach @ 2012-07-20  1:04 UTC (permalink / raw)
  To: H. Peter Anvin, Thomas Gleixner, Ingo Molnar, x86, Gokul Caushik,
	Josh Triplett, Joe Millenbach, linux-kernel
  Cc: team-fjord, Gokul Caushik

From: Gokul Caushik <gcaushik@pdx.edu>

CONFIG_EARLY_PRINTK is the only feature that might use command line
parsing in the decompression stage.  If it is disabled then we can
exclude the related code to save space. This can result in an estimated
space savings of 2240 bytes from the compressed kernel image.

Signed-off-by: Joe Millenbach <jmillenbach@gmail.com>
Signed-off-by: Gokul Caushik <caushik1@gmail.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
---
 arch/x86/boot/compressed/cmdline.c |    4 ++++
 arch/x86/boot/compressed/misc.h    |    5 +++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/arch/x86/boot/compressed/cmdline.c b/arch/x86/boot/compressed/cmdline.c
index cb62f78..10f6b11 100644
--- a/arch/x86/boot/compressed/cmdline.c
+++ b/arch/x86/boot/compressed/cmdline.c
@@ -1,5 +1,7 @@
 #include "misc.h"
 
+#ifdef CONFIG_EARLY_PRINTK
+
 static unsigned long fs;
 static inline void set_fs(unsigned long seg)
 {
@@ -19,3 +21,5 @@ int cmdline_find_option_bool(const char *option)
 {
 	return __cmdline_find_option_bool(real_mode->hdr.cmd_line_ptr, option);
 }
+
+#endif
diff --git a/arch/x86/boot/compressed/misc.h b/arch/x86/boot/compressed/misc.h
index 3ffee6e..0e6dc0e 100644
--- a/arch/x86/boot/compressed/misc.h
+++ b/arch/x86/boot/compressed/misc.h
@@ -38,18 +38,19 @@ static inline void debug_putstr(const char *s)
 
 #endif
 
+#ifdef CONFIG_EARLY_PRINTK
+
 /* cmdline.c */
 int cmdline_find_option(const char *option, char *buffer, int bufsize);
 int cmdline_find_option_bool(const char *option);
 
 /* early_serial_console.c */
-#ifdef CONFIG_EARLY_PRINTK
-
 extern int early_serial_base;
 void console_init(void);
 
 #else
 
+/* early_serial_console.c */
 static const int early_serial_base;
 static inline void console_init(void)
 { }
-- 
1.7.9.5


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

* [tip:x86/boot] x86, boot: Removed quiet flag and switched quiet output to debug flag
  2012-07-20  1:04 ` [PATCH 1/7] x86/boot: Removed quiet flag and switched quiet output to debug flag Joe Millenbach
@ 2012-07-22  0:53   ` tip-bot for Joe Millenbach
  0 siblings, 0 replies; 14+ messages in thread
From: tip-bot for Joe Millenbach @ 2012-07-22  0:53 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, caushik1, jmillenbach, josh, tglx

Commit-ID:  9f4e4392cbf72d731a489a3217fe810820b8ba96
Gitweb:     http://git.kernel.org/tip/9f4e4392cbf72d731a489a3217fe810820b8ba96
Author:     Joe Millenbach <jmillenbach@gmail.com>
AuthorDate: Thu, 19 Jul 2012 18:04:36 -0700
Committer:  H. Peter Anvin <hpa@zytor.com>
CommitDate: Sat, 21 Jul 2012 11:07:15 -0700

x86, boot: Removed quiet flag and switched quiet output to debug flag

There are only 3 uses of the quiet flag and they all protect output that
is only useful for debugging the stub, therefore we switched to using the
debug flag for all extra output.

Signed-off-by: Joe Millenbach <jmillenbach@gmail.com>
Link: http://lkml.kernel.org/r/1342746282-28497-2-git-send-email-jmillenbach@gmail.com
Signed-off-by: Gokul Caushik <caushik1@gmail.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
 arch/x86/boot/compressed/misc.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c
index 7116dcb..8f2355d 100644
--- a/arch/x86/boot/compressed/misc.c
+++ b/arch/x86/boot/compressed/misc.c
@@ -108,7 +108,6 @@ static void error(char *m);
  * This is set up by the setup-routine at boot-time
  */
 struct boot_params *real_mode;		/* Pointer to real-mode data */
-static int quiet;
 static int debug;
 
 void *memset(void *s, int c, size_t n);
@@ -294,7 +293,7 @@ static void parse_elf(void *output)
 		return;
 	}
 
-	if (!quiet)
+	if (debug)
 		putstr("Parsing ELF... ");
 
 	phdrs = malloc(sizeof(*phdrs) * ehdr.e_phnum);
@@ -332,8 +331,6 @@ asmlinkage void decompress_kernel(void *rmode, memptr heap,
 {
 	real_mode = rmode;
 
-	if (cmdline_find_option_bool("quiet"))
-		quiet = 1;
 	if (cmdline_find_option_bool("debug"))
 		debug = 1;
 
@@ -369,11 +366,11 @@ asmlinkage void decompress_kernel(void *rmode, memptr heap,
 		error("Wrong destination address");
 #endif
 
-	if (!quiet)
+	if (debug)
 		putstr("\nDecompressing Linux... ");
 	decompress(input_data, input_len, NULL, NULL, output, NULL, error);
 	parse_elf(output);
-	if (!quiet)
+	if (debug)
 		putstr("done.\nBooting the kernel.\n");
 	return;
 }

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

* [tip:x86/boot] x86, boot: Wrap debug printing in a new debug_putstr function
  2012-07-20  1:04 ` [PATCH 2/7] x86/boot: Wrap debug printing in a new debug_putstr function Joe Millenbach
@ 2012-07-22  0:54   ` tip-bot for Joe Millenbach
  0 siblings, 0 replies; 14+ messages in thread
From: tip-bot for Joe Millenbach @ 2012-07-22  0:54 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, caushik1, jmillenbach, josh, tglx

Commit-ID:  e605a425975b073aafebbb2c09d3ae266be2fd3e
Gitweb:     http://git.kernel.org/tip/e605a425975b073aafebbb2c09d3ae266be2fd3e
Author:     Joe Millenbach <jmillenbach@gmail.com>
AuthorDate: Thu, 19 Jul 2012 18:04:37 -0700
Committer:  H. Peter Anvin <hpa@zytor.com>
CommitDate: Sat, 21 Jul 2012 11:07:18 -0700

x86, boot: Wrap debug printing in a new debug_putstr function

Change all instances of if (debug) putstr(...) to a new debug_putstr(...).
This allows a future change to conditionally stub out debug_putstr to save
space.

Signed-off-by: Joe Millenbach <jmillenbach@gmail.com>
Link: http://lkml.kernel.org/r/1342746282-28497-3-git-send-email-jmillenbach@gmail.com
Signed-off-by: Gokul Caushik <caushik1@gmail.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
 arch/x86/boot/compressed/misc.c |   18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c
index 8f2355d..49c6d56 100644
--- a/arch/x86/boot/compressed/misc.c
+++ b/arch/x86/boot/compressed/misc.c
@@ -223,6 +223,12 @@ void __putstr(int error, const char *s)
 	outb(0xff & (pos >> 1), vidport+1);
 }
 
+static void debug_putstr(const char *s)
+{
+	if (debug)
+		putstr(s);
+}
+
 void *memset(void *s, int c, size_t n)
 {
 	int i;
@@ -293,8 +299,7 @@ static void parse_elf(void *output)
 		return;
 	}
 
-	if (debug)
-		putstr("Parsing ELF... ");
+	debug_putstr("Parsing ELF... ");
 
 	phdrs = malloc(sizeof(*phdrs) * ehdr.e_phnum);
 	if (!phdrs)
@@ -346,8 +351,7 @@ asmlinkage void decompress_kernel(void *rmode, memptr heap,
 	cols = real_mode->screen_info.orig_video_cols;
 
 	console_init();
-	if (debug)
-		putstr("early console in decompress_kernel\n");
+	debug_putstr("early console in decompress_kernel\n");
 
 	free_mem_ptr     = heap;	/* Heap */
 	free_mem_end_ptr = heap + BOOT_HEAP_SIZE;
@@ -366,11 +370,9 @@ asmlinkage void decompress_kernel(void *rmode, memptr heap,
 		error("Wrong destination address");
 #endif
 
-	if (debug)
-		putstr("\nDecompressing Linux... ");
+	debug_putstr("\nDecompressing Linux... ");
 	decompress(input_data, input_len, NULL, NULL, output, NULL, error);
 	parse_elf(output);
-	if (debug)
-		putstr("done.\nBooting the kernel.\n");
+	debug_putstr("done.\nBooting the kernel.\n");
 	return;
 }

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

* [tip:x86/boot] x86, boot: Changed error putstr path to match new debug_putstr format
  2012-07-20  1:04 ` [PATCH 3/7] x86/boot: Changed error putstr path to match new debug_putstr format Joe Millenbach
@ 2012-07-22  0:55   ` tip-bot for Joe Millenbach
  0 siblings, 0 replies; 14+ messages in thread
From: tip-bot for Joe Millenbach @ 2012-07-22  0:55 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, caushik1, jmillenbach, josh, tglx

Commit-ID:  cb454fe10400566214ec690318a0167ff7f5b8ca
Gitweb:     http://git.kernel.org/tip/cb454fe10400566214ec690318a0167ff7f5b8ca
Author:     Joe Millenbach <jmillenbach@gmail.com>
AuthorDate: Thu, 19 Jul 2012 18:04:38 -0700
Committer:  H. Peter Anvin <hpa@zytor.com>
CommitDate: Sat, 21 Jul 2012 11:07:22 -0700

x86, boot: Changed error putstr path to match new debug_putstr format

For consistency we changed the error output path to match the new debug path.

Signed-off-by: Joe Millenbach <jmillenbach@gmail.com>
Link: http://lkml.kernel.org/r/1342746282-28497-4-git-send-email-jmillenbach@gmail.com
Signed-off-by: Gokul Caushik <caushik1@gmail.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
 arch/x86/boot/compressed/misc.c |    6 +++---
 arch/x86/boot/compressed/misc.h |    1 +
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c
index 49c6d56..de1d54d 100644
--- a/arch/x86/boot/compressed/misc.c
+++ b/arch/x86/boot/compressed/misc.c
@@ -270,9 +270,9 @@ void *memcpy(void *dest, const void *src, size_t n)
 
 static void error(char *x)
 {
-	__putstr(1, "\n\n");
-	__putstr(1, x);
-	__putstr(1, "\n\n -- System halted");
+	error_putstr("\n\n");
+	error_putstr(x);
+	error_putstr("\n\n -- System halted");
 
 	while (1)
 		asm("hlt");
diff --git a/arch/x86/boot/compressed/misc.h b/arch/x86/boot/compressed/misc.h
index 3f19c81..4c1bfb6 100644
--- a/arch/x86/boot/compressed/misc.h
+++ b/arch/x86/boot/compressed/misc.h
@@ -26,6 +26,7 @@
 extern struct boot_params *real_mode;		/* Pointer to real-mode data */
 void __putstr(int error, const char *s);
 #define putstr(__x)  __putstr(0, __x)
+#define error_putstr(__x)  __putstr(1, __x)
 #define puts(__x)  __putstr(0, __x)
 
 /* cmdline.c */

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

* [tip:x86/boot] x86, boot: Switch output functions from command-line flags to conditional compilation
  2012-07-20  1:04 ` [PATCH 4/7] x86/boot: Switch output functions from command-line flags to conditional compilation Joe Millenbach
@ 2012-07-22  0:56   ` tip-bot for Joe Millenbach
  0 siblings, 0 replies; 14+ messages in thread
From: tip-bot for Joe Millenbach @ 2012-07-22  0:56 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, caushik1, jmillenbach, josh, tglx

Commit-ID:  7aac3015b533add3e85222f9fd2ab66216b38746
Gitweb:     http://git.kernel.org/tip/7aac3015b533add3e85222f9fd2ab66216b38746
Author:     Joe Millenbach <jmillenbach@gmail.com>
AuthorDate: Thu, 19 Jul 2012 18:04:39 -0700
Committer:  H. Peter Anvin <hpa@zytor.com>
CommitDate: Sat, 21 Jul 2012 11:07:25 -0700

x86, boot: Switch output functions from command-line flags to conditional compilation

Changed putstr flagging from parameter to conditional compilation for puts,
debug_putstr, and error_putstr. This allows for space savings since most
configurations won't use this feature.

Signed-off-by: Joe Millenbach <jmillenbach@gmail.com>
Link: http://lkml.kernel.org/r/1342746282-28497-5-git-send-email-jmillenbach@gmail.com
Signed-off-by: Gokul Caushik <caushik1@gmail.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
 arch/x86/boot/compressed/misc.c |   12 +-----------
 arch/x86/boot/compressed/misc.h |   17 +++++++++++++----
 2 files changed, 14 insertions(+), 15 deletions(-)

diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c
index de1d54d..8c29f82 100644
--- a/arch/x86/boot/compressed/misc.c
+++ b/arch/x86/boot/compressed/misc.c
@@ -169,15 +169,11 @@ static void serial_putchar(int ch)
 	outb(ch, early_serial_base + TXR);
 }
 
-void __putstr(int error, const char *s)
+void __putstr(const char *s)
 {
 	int x, y, pos;
 	char c;
 
-#ifndef CONFIG_X86_VERBOSE_BOOTUP
-	if (!error)
-		return;
-#endif
 	if (early_serial_base) {
 		const char *str = s;
 		while (*str) {
@@ -223,12 +219,6 @@ void __putstr(int error, const char *s)
 	outb(0xff & (pos >> 1), vidport+1);
 }
 
-static void debug_putstr(const char *s)
-{
-	if (debug)
-		putstr(s);
-}
-
 void *memset(void *s, int c, size_t n)
 {
 	int i;
diff --git a/arch/x86/boot/compressed/misc.h b/arch/x86/boot/compressed/misc.h
index 4c1bfb6..618e5c8 100644
--- a/arch/x86/boot/compressed/misc.h
+++ b/arch/x86/boot/compressed/misc.h
@@ -24,10 +24,19 @@
 
 /* misc.c */
 extern struct boot_params *real_mode;		/* Pointer to real-mode data */
-void __putstr(int error, const char *s);
-#define putstr(__x)  __putstr(0, __x)
-#define error_putstr(__x)  __putstr(1, __x)
-#define puts(__x)  __putstr(0, __x)
+void __putstr(const char *s);
+#define error_putstr(__x)  __putstr(__x)
+
+#ifdef CONFIG_X86_VERBOSE_BOOTUP
+
+#define debug_putstr(__x)  __putstr(__x)
+
+#else
+
+static inline void debug_putstr(const char *s)
+{ }
+
+#endif
 
 /* cmdline.c */
 int cmdline_find_option(const char *option, char *buffer, int bufsize);

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

* [tip:x86/boot] x86, boot: Removed unused debug flag and set code
  2012-07-20  1:04 ` [PATCH 5/7] x86/boot: Removed unused debug flag and set code Joe Millenbach
@ 2012-07-22  0:57   ` tip-bot for Joe Millenbach
  0 siblings, 0 replies; 14+ messages in thread
From: tip-bot for Joe Millenbach @ 2012-07-22  0:57 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, caushik1, jmillenbach, josh, tglx

Commit-ID:  641a1cebfe2f05fa1a48503d816fc70cf707d033
Gitweb:     http://git.kernel.org/tip/641a1cebfe2f05fa1a48503d816fc70cf707d033
Author:     Joe Millenbach <jmillenbach@gmail.com>
AuthorDate: Thu, 19 Jul 2012 18:04:40 -0700
Committer:  H. Peter Anvin <hpa@zytor.com>
CommitDate: Sat, 21 Jul 2012 11:07:29 -0700

x86, boot: Removed unused debug flag and set code

As we're no longer using the flag we don't need to extract the value from the
command line and store it. This is a step towards removing command line
parameter code.

Signed-off-by: Joe Millenbach <jmillenbach@gmail.com>
Link: http://lkml.kernel.org/r/1342746282-28497-6-git-send-email-jmillenbach@gmail.com
Signed-off-by: Gokul Caushik <caushik1@gmail.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
 arch/x86/boot/compressed/misc.c |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c
index 8c29f82..88f7ff6 100644
--- a/arch/x86/boot/compressed/misc.c
+++ b/arch/x86/boot/compressed/misc.c
@@ -108,7 +108,6 @@ static void error(char *m);
  * This is set up by the setup-routine at boot-time
  */
 struct boot_params *real_mode;		/* Pointer to real-mode data */
-static int debug;
 
 void *memset(void *s, int c, size_t n);
 void *memcpy(void *dest, const void *src, size_t n);
@@ -326,9 +325,6 @@ asmlinkage void decompress_kernel(void *rmode, memptr heap,
 {
 	real_mode = rmode;
 
-	if (cmdline_find_option_bool("debug"))
-		debug = 1;
-
 	if (real_mode->screen_info.orig_video_mode == 7) {
 		vidmem = (char *) 0xb0000;
 		vidport = 0x3b4;

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

* [tip:x86/boot] x86, boot: Exclude early_serial_console.c if can' t use it.
  2012-07-20  1:04 ` [PATCH 6/7] x86/boot: Exclude early_serial_console.c if can't use it Joe Millenbach
@ 2012-07-22  0:58   ` tip-bot for Joe Millenbach
  0 siblings, 0 replies; 14+ messages in thread
From: tip-bot for Joe Millenbach @ 2012-07-22  0:58 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, caushik1, jmillenbach, josh, tglx

Commit-ID:  cec49df9d331feaa2fea3d24c07147c7659940d1
Gitweb:     http://git.kernel.org/tip/cec49df9d331feaa2fea3d24c07147c7659940d1
Author:     Joe Millenbach <jmillenbach@gmail.com>
AuthorDate: Thu, 19 Jul 2012 18:04:41 -0700
Committer:  H. Peter Anvin <hpa@zytor.com>
CommitDate: Sat, 21 Jul 2012 11:07:34 -0700

x86, boot: Exclude early_serial_console.c if can't use it.

Removes early_serial_console.c code if we don't have the config option that
enables it (EARLY_PRINTK). When disabling this code, make early_serial_base a
constant 0 to allow the compiler to optimize away the code that checks for
early_serial_base.

Signed-off-by: Joe Millenbach <jmillenbach@gmail.com>
Link: http://lkml.kernel.org/r/1342746282-28497-7-git-send-email-jmillenbach@gmail.com
Signed-off-by: Gokul Caushik <caushik1@gmail.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
 arch/x86/boot/compressed/early_serial_console.c |    4 ++++
 arch/x86/boot/compressed/misc.h                 |   10 ++++++++++
 2 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/arch/x86/boot/compressed/early_serial_console.c b/arch/x86/boot/compressed/early_serial_console.c
index 261e81f..d3d003c 100644
--- a/arch/x86/boot/compressed/early_serial_console.c
+++ b/arch/x86/boot/compressed/early_serial_console.c
@@ -1,5 +1,9 @@
 #include "misc.h"
 
+#ifdef CONFIG_EARLY_PRINTK
+
 int early_serial_base;
 
 #include "../early_serial_console.c"
+
+#endif
diff --git a/arch/x86/boot/compressed/misc.h b/arch/x86/boot/compressed/misc.h
index 618e5c8..3ffee6e 100644
--- a/arch/x86/boot/compressed/misc.h
+++ b/arch/x86/boot/compressed/misc.h
@@ -43,7 +43,17 @@ int cmdline_find_option(const char *option, char *buffer, int bufsize);
 int cmdline_find_option_bool(const char *option);
 
 /* early_serial_console.c */
+#ifdef CONFIG_EARLY_PRINTK
+
 extern int early_serial_base;
 void console_init(void);
 
+#else
+
+static const int early_serial_base;
+static inline void console_init(void)
+{ }
+
+#endif
+
 #endif

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

* [tip:x86/boot] x86, boot: Exclude cmdline.c if you can't use it
  2012-07-20  1:04 ` [PATCH 7/7] x86/boot: Exclude cmdline.c if you can't " Joe Millenbach
@ 2012-07-22  0:59   ` tip-bot for Gokul Caushik
  0 siblings, 0 replies; 14+ messages in thread
From: tip-bot for Gokul Caushik @ 2012-07-22  0:59 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, gcaushik, hpa, mingo, caushik1, jmillenbach, tglx, josh

Commit-ID:  bd448d4d0a1bd88dc6fdc41217b2c25383fa8529
Gitweb:     http://git.kernel.org/tip/bd448d4d0a1bd88dc6fdc41217b2c25383fa8529
Author:     Gokul Caushik <gcaushik@pdx.edu>
AuthorDate: Thu, 19 Jul 2012 18:04:42 -0700
Committer:  H. Peter Anvin <hpa@zytor.com>
CommitDate: Sat, 21 Jul 2012 11:07:39 -0700

x86, boot: Exclude cmdline.c if you can't use it

CONFIG_EARLY_PRINTK is the only feature that might use command line
parsing in the decompression stage.  If it is disabled then we can
exclude the related code to save space. This can result in an estimated
space savings of 2240 bytes from the compressed kernel image.

Signed-off-by: Joe Millenbach <jmillenbach@gmail.com>
Link: http://lkml.kernel.org/r/1342746282-28497-8-git-send-email-jmillenbach@gmail.com
Signed-off-by: Gokul Caushik <caushik1@gmail.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
 arch/x86/boot/compressed/cmdline.c |    4 ++++
 arch/x86/boot/compressed/misc.h    |    5 +++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/arch/x86/boot/compressed/cmdline.c b/arch/x86/boot/compressed/cmdline.c
index cb62f78..10f6b11 100644
--- a/arch/x86/boot/compressed/cmdline.c
+++ b/arch/x86/boot/compressed/cmdline.c
@@ -1,5 +1,7 @@
 #include "misc.h"
 
+#ifdef CONFIG_EARLY_PRINTK
+
 static unsigned long fs;
 static inline void set_fs(unsigned long seg)
 {
@@ -19,3 +21,5 @@ int cmdline_find_option_bool(const char *option)
 {
 	return __cmdline_find_option_bool(real_mode->hdr.cmd_line_ptr, option);
 }
+
+#endif
diff --git a/arch/x86/boot/compressed/misc.h b/arch/x86/boot/compressed/misc.h
index 3ffee6e..0e6dc0e 100644
--- a/arch/x86/boot/compressed/misc.h
+++ b/arch/x86/boot/compressed/misc.h
@@ -38,18 +38,19 @@ static inline void debug_putstr(const char *s)
 
 #endif
 
+#ifdef CONFIG_EARLY_PRINTK
+
 /* cmdline.c */
 int cmdline_find_option(const char *option, char *buffer, int bufsize);
 int cmdline_find_option_bool(const char *option);
 
 /* early_serial_console.c */
-#ifdef CONFIG_EARLY_PRINTK
-
 extern int early_serial_base;
 void console_init(void);
 
 #else
 
+/* early_serial_console.c */
 static const int early_serial_base;
 static inline void console_init(void)
 { }

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

end of thread, other threads:[~2012-07-22  0:59 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1342746282-28497-1-git-send-email-jmillenbach@gmail.com>
2012-07-20  1:04 ` [PATCH 1/7] x86/boot: Removed quiet flag and switched quiet output to debug flag Joe Millenbach
2012-07-22  0:53   ` [tip:x86/boot] x86, boot: " tip-bot for Joe Millenbach
2012-07-20  1:04 ` [PATCH 2/7] x86/boot: Wrap debug printing in a new debug_putstr function Joe Millenbach
2012-07-22  0:54   ` [tip:x86/boot] x86, boot: " tip-bot for Joe Millenbach
2012-07-20  1:04 ` [PATCH 3/7] x86/boot: Changed error putstr path to match new debug_putstr format Joe Millenbach
2012-07-22  0:55   ` [tip:x86/boot] x86, boot: " tip-bot for Joe Millenbach
2012-07-20  1:04 ` [PATCH 4/7] x86/boot: Switch output functions from command-line flags to conditional compilation Joe Millenbach
2012-07-22  0:56   ` [tip:x86/boot] x86, boot: " tip-bot for Joe Millenbach
2012-07-20  1:04 ` [PATCH 5/7] x86/boot: Removed unused debug flag and set code Joe Millenbach
2012-07-22  0:57   ` [tip:x86/boot] x86, boot: " tip-bot for Joe Millenbach
2012-07-20  1:04 ` [PATCH 6/7] x86/boot: Exclude early_serial_console.c if can't use it Joe Millenbach
2012-07-22  0:58   ` [tip:x86/boot] x86, boot: Exclude early_serial_console.c if can' t " tip-bot for Joe Millenbach
2012-07-20  1:04 ` [PATCH 7/7] x86/boot: Exclude cmdline.c if you can't " Joe Millenbach
2012-07-22  0:59   ` [tip:x86/boot] x86, boot: " tip-bot for Gokul Caushik

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