Skip to contentSkip to conversation

x86/boot: fix early error display

PATCH Superseded Doug Goldstein 5 participants 13 messages Oct 12, 2017 – Oct 16, 2017

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 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 | 1 +
 1 file changed, 1 insertion(+)
xen/arch/x86/boot/head.S +1 -0
index fd6fc337fe..f48bbbd2e5 100644
@@ -174,6 +174,7 @@ not_multiboot:
         mov     sym_esi(vga_text_buffer),%edi
 .Lsend_chr:
         mov     (%esi),%bl
+        inc     %esi
         test    %bl,%bl        # Terminate on '\0' sentinel
         je      .Lhalt
         mov     $0x3f8+5,%dx   # UART Line Status Register
Signature · 7 lines
2.13.5


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

PATCH 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 f48bbbd2e5..22348b1bbe 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:
         mov     (%esi),%bl
         inc     %esi
         test    %bl,%bl        # Terminate on '\0' sentinel
@@ -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
         movsb                  # 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
Reviewed-by on v1 2/2
#2 lore raw

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

Quoted 8 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.

This should also be included in 4.10 IMO.

Quoted 34 lines
---
 xen/arch/x86/boot/head.S | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
xen/arch/x86/boot/head.S +3 -3
index f48bbbd2e5..22348b1bbe 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:
         mov     (%esi),%bl
         inc     %esi
         test    %bl,%bl        # Terminate on '\0' sentinel
@@ -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?

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

Quoted 10 lines
xen/arch/x86/boot/head.S +2 -2
-        jz      .Lsend_chr
+        jz      .Lprint_err
         movsb                  # 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
 

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

Reviewed-by
#3 lore raw

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

Quoted 11 lines · Andrew Cooper
Quoted 8 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.

Daniel

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

#4 lore raw

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

In reply to Andrew Cooper
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 12.10.17 at 22:56, <[email protected]> wrote:
Quoted 6 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.

Quoted 6 lines
Quoted 2 lines

This should also be included in 4.10 IMO.

I'm not convinced - this is merely a cleanup style patch, the more that the label really serves dual purpose and hence the original name isn't all that wrong anyway.

Jan

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

#5 lore raw

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

Quoted 13 lines · Jan Beulich
Quoted 13 lines
Quoted 1 line
Quoted 1 line · On 12.10.17 at 22:56, <[email protected]> wrote:
Quoted 8 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.

Quoted 8 lines
Quoted 1 line

This should also be included in 4.10 IMO.

I'm not convinced - this is merely a cleanup style patch, the more that the label really serves dual purpose and hence the original name isn't all that wrong anyway.

Jan

I purposefully broke it out so that it could be discussed. Prior to the commit I referenced in patch 1 the function sent out a character. Now it requires the supplied data to be a C-string (NULL terminated) so I would hope that you could agree that at else the "chr" part of "send_chr" is incorrect and should likely be "str" or "err".

But again this patch isn't really important its more to try to make the label match the behavior of the code below the label and if its unwanted then it can be dropped.

Signature · 6 lines
Doug Goldstein

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

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

Quoted 26 lines · Doug Goldstein
Quoted 10 lines · Jan Beulich
Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 12.10.17 at 22:56, <[email protected]> wrote:
Quoted 8 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.

Quoted 9 lines
Quoted 3 lines

This should also be included in 4.10 IMO.

I'm not convinced - this is merely a cleanup style patch, the more that the label really serves dual purpose and hence the original name isn't all that wrong anyway.

Jan

I purposefully broke it out so that it could be discussed. Prior to the commit I referenced in patch 1 the function sent out a character. Now it requires the supplied data to be a C-string (NULL terminated) so I would hope that you could agree that at else the "chr" part of "send_chr" is incorrect and should likely be "str" or "err".

Quoted 4 lines

But again this patch isn't really important its more to try to make the label match the behavior of the code below the label and if its unwanted then it can be dropped.

We've not hit RC1 yet, and this is fixing a misleading bit of documentation in a hard-to-follow piece of code.

I'm still of the opinion that it is 4.10 material.

~Andrew

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

#7 lore raw

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

In reply to Doug Goldstein
Quoted 27 lines
Quoted 1 line
Quoted 1 line · On 13.10.17 at 18:07, <[email protected]> wrote:
Quoted 11 lines · Jan Beulich
Quoted 11 lines
Quoted 1 line
Quoted 1 line · On 12.10.17 at 22:56, <[email protected]> wrote:
Quoted 8 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.

Quoted 7 lines
Quoted 3 lines

This should also be included in 4.10 IMO.

I'm not convinced - this is merely a cleanup style patch, the more that the label really serves dual purpose and hence the original name isn't all that wrong anyway.

I purposefully broke it out so that it could be discussed. Prior to the commit I referenced in patch 1 the function sent out a character. Now it requires the supplied data to be a C-string (NULL terminated) so I would hope that you could agree that at else the "chr" part of "send_chr" is incorrect and should likely be "str" or "err".

Quoted 3 lines

But again this patch isn't really important its more to try to make the label match the behavior of the code below the label and if its unwanted then it can be dropped.

Oh, in case my earlier reply was ambiguous: I didn't mean to object to the patch. I'm just unconvinced it should go into 4.10.

Jan

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

Reviewed-by on v1 1/2
#8 lore raw
In reply to Doug Goldstein
Quoted 10 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.

CC'ing Julien as release manager. This should be included in 4.10 IMO, and is a backport candidate.

Quoted 9 lines
---
 xen/arch/x86/boot/head.S | 1 +
 1 file changed, 1 insertion(+)
xen/arch/x86/boot/head.S +0 -0
index fd6fc337fe..f48bbbd2e5 100644

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

Quoted 7 lines
xen/arch/x86/boot/head.S +1 -0
@@ -174,6 +174,7 @@ not_multiboot:
         mov     sym_esi(vga_text_buffer),%edi
 .Lsend_chr:
         mov     (%esi),%bl
+        inc     %esi
         test    %bl,%bl        # Terminate on '\0' sentinel
         je      .Lhalt
         mov     $0x3f8+5,%dx   # UART Line Status Register

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

#9 lore raw

Hi Andrew,

Quoted 9 lines · Andrew Cooper
Quoted 8 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.

Quoted 7 lines
Quoted 2 lines

CC'ing Julien as release manager. This should be included in 4.10 IMO, and is a backport candidate.

I agree.

Cheers,

Quoted 24 lines
Quoted 10 lines
---
  xen/arch/x86/boot/head.S | 1 +
  1 file changed, 1 insertion(+)
xen/arch/x86/boot/head.S +0 -0
index fd6fc337fe..f48bbbd2e5 100644

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

Quoted 7 lines
xen/arch/x86/boot/head.S +1 -0
@@ -174,6 +174,7 @@ not_multiboot:
          mov     sym_esi(vga_text_buffer),%edi
  .Lsend_chr:
          mov     (%esi),%bl
+        inc     %esi
          test    %bl,%bl        # Terminate on '\0' sentinel
          je      .Lhalt
          mov     $0x3f8+5,%dx   # UART Line Status Register

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

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#10 lore raw
Quoted 14 lines
Quoted 1 line
Quoted 1 line · On 13.10.17 at 11:51, <[email protected]> wrote:
Quoted 12 lines · Andrew Cooper
Quoted 10 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.

Quoted 8 lines
Quoted 4 lines

CC'ing Julien as release manager. This should be included in 4.10 IMO, and is a backport candidate.

I agree.

So I take this is a pre-ack to the eventual patch with the bug fixed that Daniel has pointed out?

Jan

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

#11 lore raw
In reply to Doug Goldstein
Quoted 19 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.

---
 xen/arch/x86/boot/head.S | 1 +
 1 file changed, 1 insertion(+)
xen/arch/x86/boot/head.S +0 -0
index fd6fc337fe..f48bbbd2e5 100644

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

Quoted 7 lines
xen/arch/x86/boot/head.S +1 -0
@@ -174,6 +174,7 @@ not_multiboot:
         mov     sym_esi(vga_text_buffer),%edi
 .Lsend_chr:
         mov     (%esi),%bl
+        inc     %esi
         test    %bl,%bl        # Terminate on '\0' sentinel
         je      .Lhalt
         mov     $0x3f8+5,%dx   # UART Line Status Register

I have a feeling that you have tested this on machine without VGA text buffer available. Then your fix works. However, if VGA text buffer is available then %esi is increased twice. First time by inc here and once again by movsb below. So, I think that the issue have to be fixed in a bit different way.

Daniel

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

#12 lore raw
Quoted 37 lines · Daniel Kiper
Quoted 23 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.

---
xen/arch/x86/boot/head.S | 1 +

1 file changed, 1 insertion(+)
xen/arch/x86/boot/head.S +0 -0
index fd6fc337fe..f48bbbd2e5 100644
@@ -174,6 +174,7 @@ not_multiboot:
        mov     sym_esi(vga_text_buffer),%edi

.Lsend_chr:

Quoted 5 lines
        mov     (%esi),%bl
+        inc     %esi
        test    %bl,%bl        # Terminate on '\0' sentinel
        je      .Lhalt
        mov     $0x3f8+5,%dx   # UART Line Status Register

I have a feeling that you have tested this on machine without VGA text buffer available. Then your fix works. However, if VGA text buffer is available then %esi is increased twice. First time by inc here and once again by movsb below. So, I think that the issue have to be fixed in a bit different way.

Quoted 1 line

Daniel

Correct. It was an EFI machine with serial only where I saw it in action. David has put together a new change and I’ll get it submitted tomorrow.

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