Skip to contentSkip to conversation

x86/boot: fix early error display

PATCH In review Doug Goldstein 3 participants 10 messages Oct 17, 2017 – Oct 27, 2017

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 x86/boot: fix early error display

From: David Esler <[email protected]>

In 9180f5365524 a change was made to the send_chr function to take in C-strings and print out a character at a time until a NULL was encountered. However there is no code to increment the current character position resulting in an endless loop of the first character. This adds a simple increment.

---
 xen/arch/x86/boot/head.S | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
xen/arch/x86/boot/head.S +4 -3
index fd6fc337fe..9cc35da558 100644
@@ -173,10 +173,11 @@ not_multiboot:
 .Lget_vtb:
         mov     sym_esi(vga_text_buffer),%edi
 .Lsend_chr:
-        mov     (%esi),%bl
-        test    %bl,%bl        # Terminate on '\0' sentinel
+        lodsb
+        test    %al,%al        # Terminate on '\0' sentinel
         je      .Lhalt
         mov     $0x3f8+5,%dx   # UART Line Status Register
+        mov     %al,%bl
 2:      in      %dx,%al
         test    $0x20,%al      # Test THR Empty flag
         je      2b
@@ -185,7 +186,7 @@ not_multiboot:
         out     %al,%dx        # Send a character over the serial line
         test    %edi,%edi      # Is the VGA text buffer available?
         jz      .Lsend_chr
-        movsb                  # Write a character to the VGA text buffer
+        stosb                  # Write a character to the VGA text buffer
         mov     $7,%al
         stosb                  # Write an attribute to the VGA text buffer
         jmp     .Lsend_chr
Signature · 7 lines
2.13.5


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#1 lore raw

PATCH v2 2/2 x86/boot: rename send_chr to print_err

From: David Esler <[email protected]>

The send_chr function sends an entire C-string and not one character and doesn't necessarily just send it over the serial UART anymore so rename it to print_err so that its closer in name to what it does.

---
 xen/arch/x86/boot/head.S | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
xen/arch/x86/boot/head.S +5 -5
index 9cc35da558..475c678f2c 100644
@@ -161,7 +161,7 @@ not_multiboot:
          */
         add     $sym_offs(.Lbad_ldr_nbs),%esi   # Error message
         xor     %edi,%edi                       # No VGA text buffer
-        jmp     .Lsend_chr
+        jmp     .Lprint_err
 .Lmb2_efi_ia_32:
         /*
          * Here we are on EFI IA-32 platform. Then reliable vga_text_buffer zap is
@@ -169,10 +169,10 @@ not_multiboot:
          */
         add     $sym_offs(.Lbad_efi_msg),%esi   # Error message
         xor     %edi,%edi                       # No VGA text buffer
-        jmp     .Lsend_chr
+        jmp     .Lprint_err
 .Lget_vtb:
         mov     sym_esi(vga_text_buffer),%edi
-.Lsend_chr:
+.Lprint_err:
         lodsb
         test    %al,%al        # Terminate on '\0' sentinel
         je      .Lhalt
@@ -185,11 +185,11 @@ not_multiboot:
         mov     %bl,%al
         out     %al,%dx        # Send a character over the serial line
         test    %edi,%edi      # Is the VGA text buffer available?
-        jz      .Lsend_chr
+        jz      .Lprint_err
         stosb                  # Write a character to the VGA text buffer
         mov     $7,%al
         stosb                  # Write an attribute to the VGA text buffer
-        jmp     .Lsend_chr
+        jmp     .Lprint_err
 .Lhalt: hlt
         jmp     .Lhalt
 
Signature · 7 lines
2.13.5


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Acked-by on v2 2/2
#2 lore raw

Re: [PATCH v2 2/2] x86/boot: rename send_chr to print_err

Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 17.10.17 at 23:41, <[email protected]> wrote:

From: David Esler <[email protected]>

The send_chr function sends an entire C-string and not one character and doesn't necessarily just send it over the serial UART anymore so rename it to print_err so that its closer in name to what it does.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#3 lore raw

Re: [PATCH v2 2/2] x86/boot: rename send_chr to print_err

In reply to Doug Goldstein
Quoted 7 lines · Doug Goldstein

From: David Esler <[email protected]>

The send_chr function sends an entire C-string and not one character and doesn't necessarily just send it over the serial UART anymore so rename it to print_err so that its closer in name to what it does.

Ditto.

Quoted 1 line

Anyway, Reviewed-by: Daniel Kiper <[email protected]>

Daniel

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#4 lore raw
In reply to Doug Goldstein
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 17.10.17 at 23:41, <[email protected]> wrote:

From: David Esler <[email protected]>

In 9180f5365524 a change was made to the send_chr function to take in C-strings and print out a character at a time until a NULL was encountered. However there is no code to increment the current character position resulting in an endless loop of the first character. This adds a simple increment.

This description is not accurate (it should have changed together with the change to how you fix the issue) - with VGA the increment does happen. Hence "display" in the title is perhaps also at least misleading. I would be fine to adjust both while committing (and then adding my R-b), but feel free to propose an alternative.

Quoted 6 lines
xen/arch/x86/boot/head.S +0 -0
@@ -173,10 +173,11 @@ not_multiboot:
 .Lget_vtb:
         mov     sym_esi(vga_text_buffer),%edi
 .Lsend_chr:

xen/arch/x86/boot/head.S not_multiboot: · line 183

Quoted 10 lines
xen/arch/x86/boot/head.S +3 -2
-        mov     (%esi),%bl
-        test    %bl,%bl        # Terminate on '\0' sentinel
+        lodsb
+        test    %al,%al        # Terminate on '\0' sentinel
         je      .Lhalt
         mov     $0x3f8+5,%dx   # UART Line Status Register
+        mov     %al,%bl
 2:      in      %dx,%al
         test    $0x20,%al      # Test THR Empty flag
         je      2b

Daniel: What tells you that there is a UART at 0x3f8? Aren't we risking to enter an infinite loop here if there isn't? At the very least it would seem better to me if the VGA output was done first - when you have a screen, you'd at least know something was attempted to be output by seeing the first character. And when you have neither screen nor UART (at the right port) you're hosed anyway.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#5 lore raw
Quoted 9 lines · Jan Beulich
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 17.10.17 at 23:41, <[email protected]> wrote:

From: David Esler <[email protected]>

In 9180f5365524 a change was made to the send_chr function to take in C-strings and print out a character at a time until a NULL was encountered. However there is no code to increment the current character position resulting in an endless loop of the first character. This adds a simple increment.

Quoted 5 lines

This description is not accurate (it should have changed together with the change to how you fix the issue) - with VGA the increment does happen. Hence "display" in the title is perhaps also at least misleading. I would be fine to adjust both while committing (and then adding my R-b), but feel free to propose an alternative.

David and I are both ok with you changing the wording as necessary. I apologize for not updating the commit message.

Signature · 6 lines
Doug Goldstein

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#6 lore raw
In reply to Jan Beulich
Quoted 9 lines · Jan Beulich
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 17.10.17 at 23:41, <[email protected]> wrote:

From: David Esler <[email protected]>

In 9180f5365524 a change was made to the send_chr function to take in C-strings and print out a character at a time until a NULL was encountered. However there is no code to increment the current character position resulting in an endless loop of the first character. This adds a simple increment.

Quoted 5 lines

This description is not accurate (it should have changed together with the change to how you fix the issue) - with VGA the increment does happen. Hence "display" in the title is perhaps also at least misleading. I would be fine to adjust both while committing (and then adding my R-b), but feel free to propose an alternative.

Jan,

Can you queue this for 4.9 as well? That's where we ran into the issue in the first place.

Signature · 6 lines
Doug Goldstein

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#7 lore raw
Quoted 17 lines
Quoted 1 line
Quoted 1 line · On 26.10.17 at 23:05, <[email protected]> wrote:
Quoted 9 lines · Jan Beulich
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 17.10.17 at 23:41, <[email protected]> wrote:

From: David Esler <[email protected]>

In 9180f5365524 a change was made to the send_chr function to take in C-strings and print out a character at a time until a NULL was encountered. However there is no code to increment the current character position resulting in an endless loop of the first character. This adds a simple increment.

Quoted 5 lines

This description is not accurate (it should have changed together with the change to how you fix the issue) - with VGA the increment does happen. Hence "display" in the title is perhaps also at least misleading. I would be fine to adjust both while committing (and then adding my R-b), but feel free to propose an alternative.

Quoted 4 lines

Jan,

Can you queue this for 4.9 as well? That's where we ran into the issue in the first place.

That how I did understand it, so I've queued this already, but for it to become eligible to applying to 4.9 it first needs to pass the push gate on master.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#8 lore raw
Quoted 19 lines · Jan Beulich
Quoted 19 lines
Quoted 1 line
Quoted 1 line · On 26.10.17 at 23:05, <[email protected]> wrote:
Quoted 9 lines · Jan Beulich
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 17.10.17 at 23:41, <[email protected]> wrote:

From: David Esler <[email protected]>

In 9180f5365524 a change was made to the send_chr function to take in C-strings and print out a character at a time until a NULL was encountered. However there is no code to increment the current character position resulting in an endless loop of the first character. This adds a simple increment.

Quoted 5 lines

This description is not accurate (it should have changed together with the change to how you fix the issue) - with VGA the increment does happen. Hence "display" in the title is perhaps also at least misleading. I would be fine to adjust both while committing (and then adding my R-b), but feel free to propose an alternative.

Jan,

Quoted 9 lines
Quoted 2 lines

Can you queue this for 4.9 as well? That's where we ran into the issue in the first place.

That how I did understand it, so I've queued this already, but for it to become eligible to applying to 4.9 it first needs to pass the push gate on master.

Jan

Of course. I didn't mean to imply this should jump any existing process. I had just realized that I didn't explicitly mention versions in my original email and I just wanted to make sure I was explicit instead of assuming.

Thanks again.

Signature · 6 lines
Doug Goldstein

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#9 lore raw
In reply to Doug Goldstein
Quoted 9 lines · Doug Goldstein

From: David Esler <[email protected]>

In 9180f5365524 a change was made to the send_chr function to take in C-strings and print out a character at a time until a NULL was encountered. However there is no code to increment the current character position resulting in an endless loop of the first character. This adds a simple increment.

I was told that "Reviewed-by: ..." should be after SOB.

Quoted 1 line

In general Reviewed-by: Daniel Kiper <[email protected]> Though please take into account Jan's request WRT to commit message. Or I am OK with Jan's changes before committing.

Daniel

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel