* [PATCH] x86, setup: Check early serial console per string instead of one char
@ 2010-10-11 17:50 Yinghai Lu
2010-10-11 18:19 ` H. Peter Anvin
0 siblings, 1 reply; 4+ messages in thread
From: Yinghai Lu @ 2010-10-11 17:50 UTC (permalink / raw)
To: H. Peter Anvin, Ingo Molnar, Thomas Gleixner; +Cc: linux-kernel@vger.kernel.org
Move out serial_putchar() calling out of putchar
Let puts() to call serial_putchar() directly.
So only need to check early_serial_base per string.
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
arch/x86/boot/tty.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
Index: linux-2.6/arch/x86/boot/tty.c
===================================================================
--- linux-2.6.orig/arch/x86/boot/tty.c
+++ linux-2.6/arch/x86/boot/tty.c
@@ -52,16 +52,22 @@ static void __attribute__((section(".ini
void __attribute__((section(".inittext"))) putchar(int ch)
{
if (ch == '\n')
- putchar('\r'); /* \n -> \r\n */
+ bios_putchar('\r'); /* \n -> \r\n */
bios_putchar(ch);
-
- if (early_serial_base != 0)
- serial_putchar(ch);
}
void __attribute__((section(".inittext"))) puts(const char *str)
{
+ if (early_serial_base) {
+ const char *s = str;
+ while (*s) {
+ if (*s == '\n')
+ serial_putchar('\r');
+ serial_putchar(*s++);
+ }
+ }
+
while (*str)
putchar(*str++);
}
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] x86, setup: Check early serial console per string instead of one char
2010-10-11 17:50 [PATCH] x86, setup: Check early serial console per string instead of one char Yinghai Lu
@ 2010-10-11 18:19 ` H. Peter Anvin
2010-10-11 19:47 ` Yinghai Lu
0 siblings, 1 reply; 4+ messages in thread
From: H. Peter Anvin @ 2010-10-11 18:19 UTC (permalink / raw)
To: Yinghai Lu; +Cc: Ingo Molnar, Thomas Gleixner, linux-kernel@vger.kernel.org
On 10/11/2010 10:50 AM, Yinghai Lu wrote:
>
> Move out serial_putchar() calling out of putchar
> Let puts() to call serial_putchar() directly.
>
> So only need to check early_serial_base per string.
>
> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
>
This seems to add a bunch of code for zero benefit. Testing a global
variable is zero cost compared to either a BIOS call or poking a serial
port.
-hpa
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] x86, setup: Check early serial console per string instead of one char
2010-10-11 18:19 ` H. Peter Anvin
@ 2010-10-11 19:47 ` Yinghai Lu
2010-10-11 19:56 ` H. Peter Anvin
0 siblings, 1 reply; 4+ messages in thread
From: Yinghai Lu @ 2010-10-11 19:47 UTC (permalink / raw)
To: H. Peter Anvin; +Cc: Ingo Molnar, Thomas Gleixner, linux-kernel@vger.kernel.org
On 10/11/2010 11:19 AM, H. Peter Anvin wrote:
> On 10/11/2010 10:50 AM, Yinghai Lu wrote:
>>
>> Move out serial_putchar() calling out of putchar
>> Let puts() to call serial_putchar() directly.
>>
>> So only need to check early_serial_base per string.
>>
>> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
>>
>
> This seems to add a bunch of code for zero benefit. Testing a global
> variable is zero cost compared to either a BIOS call or poking a serial
> port.
some server have bios serial console redirection support, and bios int call could send char to screen and serial port.
in that case, take out serial_putchar from putchar could produce more readable print out from serial console
Thanks
Yinghai
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] x86, setup: Check early serial console per string instead of one char
2010-10-11 19:47 ` Yinghai Lu
@ 2010-10-11 19:56 ` H. Peter Anvin
0 siblings, 0 replies; 4+ messages in thread
From: H. Peter Anvin @ 2010-10-11 19:56 UTC (permalink / raw)
To: Yinghai Lu; +Cc: Ingo Molnar, Thomas Gleixner, linux-kernel@vger.kernel.org
On 10/11/2010 12:47 PM, Yinghai Lu wrote:
>>
>> This seems to add a bunch of code for zero benefit. Testing a global
>> variable is zero cost compared to either a BIOS call or poking a serial
>> port.
>
> some server have bios serial console redirection support, and bios int call could send char to screen and serial port.
>
> in that case, take out serial_putchar from putchar could produce more readable print out from serial console
>
That doesn't appear to have anything to do with this code change. What
you're saying is that "if BIOS does serial console redirection, we
shouldn't output to both the serial console and the BIOS console", which
is of course a truism, but that doesn't justify in any way this
particular code reconfiguration.
-hpa
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-10-11 19:56 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-11 17:50 [PATCH] x86, setup: Check early serial console per string instead of one char Yinghai Lu
2010-10-11 18:19 ` H. Peter Anvin
2010-10-11 19:47 ` Yinghai Lu
2010-10-11 19:56 ` H. Peter Anvin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox