Re: [PATCH v6 04/27] x86, boot: Move lldt/ltr out of 64bit code section

2012-12-18 Thread Yinghai Lu
On Sat, Dec 15, 2012 at 9:28 AM, Borislav Petkov  wrote:
> On Thu, Dec 13, 2012 at 02:01:58PM -0800, Yinghai Lu wrote:
>> commit 08da5a2ca
>>
>> x86_64: Early segment setup for VT
>>
>> add lldt/ltr to clean more segments.
>>
>> Those code are put in code64, and it is using gdt that is only
>> loaded from code32 path.
>>
>> That breaks booting with 64bit bootloader that does not go through
>> code32 path. It get at startup_64 directly,  and it has different
>> gdt.
>>
>> Move those lines into code32 after their gdt is loaded.
>
> Let me rewrite that commit message for ya, you tell me whether I got it
> right:
>
> "08da5a2ca479 ("x86_64: Early segment setup for VT") sets up LDT and TR
> into a valid state in order to speed up boot decompression under VT. The
> code which loads the GDT is executed in the 32-bit startup code while
> the above change in the 64-bit part.
>
> However, this breaks 64-bit bootloaders which jump straight to the
> 64-bit startup entry point and thus skip LDR and TR setup because they
> use a different GDT.
>
> Fix this by moving the LDT and TR setup to the 32-bit section."
>
> Is that correct?
yes

update to:

---
Subject: [PATCH] x86, boot: Move lldt/ltr out of 64bit code section

commit 08da5a2ca

x86_64: Early segment setup for VT

sets up LDT and TR into a valid state in order to speed up boot
decompression under VT.

Those code are put in code64, and it is using GDT that is only
loaded from code32 path.

That breaks booting with 64bit bootloader that does not go through
code32 path and jump to startup_64 directly, and it has different
GDT.

Move those lines into code32 after their GDT is loaded.
---
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v6 04/27] x86, boot: Move lldt/ltr out of 64bit code section

2012-12-18 Thread Yinghai Lu
On Sat, Dec 15, 2012 at 9:28 AM, Borislav Petkov b...@alien8.de wrote:
 On Thu, Dec 13, 2012 at 02:01:58PM -0800, Yinghai Lu wrote:
 commit 08da5a2ca

 x86_64: Early segment setup for VT

 add lldt/ltr to clean more segments.

 Those code are put in code64, and it is using gdt that is only
 loaded from code32 path.

 That breaks booting with 64bit bootloader that does not go through
 code32 path. It get at startup_64 directly,  and it has different
 gdt.

 Move those lines into code32 after their gdt is loaded.

 Let me rewrite that commit message for ya, you tell me whether I got it
 right:

 08da5a2ca479 (x86_64: Early segment setup for VT) sets up LDT and TR
 into a valid state in order to speed up boot decompression under VT. The
 code which loads the GDT is executed in the 32-bit startup code while
 the above change in the 64-bit part.

 However, this breaks 64-bit bootloaders which jump straight to the
 64-bit startup entry point and thus skip LDR and TR setup because they
 use a different GDT.

 Fix this by moving the LDT and TR setup to the 32-bit section.

 Is that correct?
yes

update to:

---
Subject: [PATCH] x86, boot: Move lldt/ltr out of 64bit code section

commit 08da5a2ca

x86_64: Early segment setup for VT

sets up LDT and TR into a valid state in order to speed up boot
decompression under VT.

Those code are put in code64, and it is using GDT that is only
loaded from code32 path.

That breaks booting with 64bit bootloader that does not go through
code32 path and jump to startup_64 directly, and it has different
GDT.

Move those lines into code32 after their GDT is loaded.
---
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v6 04/27] x86, boot: Move lldt/ltr out of 64bit code section

2012-12-15 Thread Borislav Petkov
On Thu, Dec 13, 2012 at 02:01:58PM -0800, Yinghai Lu wrote:
> commit 08da5a2ca
> 
> x86_64: Early segment setup for VT
> 
> add lldt/ltr to clean more segments.
> 
> Those code are put in code64, and it is using gdt that is only
> loaded from code32 path.
> 
> That breaks booting with 64bit bootloader that does not go through
> code32 path. It get at startup_64 directly,  and it has different
> gdt.
> 
> Move those lines into code32 after their gdt is loaded.

Let me rewrite that commit message for ya, you tell me whether I got it
right:

"08da5a2ca479 ("x86_64: Early segment setup for VT") sets up LDT and TR
into a valid state in order to speed up boot decompression under VT. The
code which loads the GDT is executed in the 32-bit startup code while
the above change in the 64-bit part.

However, this breaks 64-bit bootloaders which jump straight to the
64-bit startup entry point and thus skip LDR and TR setup because they
use a different GDT.

Fix this by moving the LDT and TR setup to the 32-bit section."

Is that correct?

If so, why not take the time and try to write your commits more
understandably so that bystanders like me don't have to look at the code
first and scramble to understand what you mean?

Thanks.

-- 
Regards/Gruss,
Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v6 04/27] x86, boot: Move lldt/ltr out of 64bit code section

2012-12-15 Thread Borislav Petkov
On Thu, Dec 13, 2012 at 02:01:58PM -0800, Yinghai Lu wrote:
 commit 08da5a2ca
 
 x86_64: Early segment setup for VT
 
 add lldt/ltr to clean more segments.
 
 Those code are put in code64, and it is using gdt that is only
 loaded from code32 path.
 
 That breaks booting with 64bit bootloader that does not go through
 code32 path. It get at startup_64 directly,  and it has different
 gdt.
 
 Move those lines into code32 after their gdt is loaded.

Let me rewrite that commit message for ya, you tell me whether I got it
right:

08da5a2ca479 (x86_64: Early segment setup for VT) sets up LDT and TR
into a valid state in order to speed up boot decompression under VT. The
code which loads the GDT is executed in the 32-bit startup code while
the above change in the 64-bit part.

However, this breaks 64-bit bootloaders which jump straight to the
64-bit startup entry point and thus skip LDR and TR setup because they
use a different GDT.

Fix this by moving the LDT and TR setup to the 32-bit section.

Is that correct?

If so, why not take the time and try to write your commits more
understandably so that bystanders like me don't have to look at the code
first and scramble to understand what you mean?

Thanks.

-- 
Regards/Gruss,
Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v6 04/27] x86, boot: Move lldt/ltr out of 64bit code section

2012-12-13 Thread Yinghai Lu
commit 08da5a2ca

x86_64: Early segment setup for VT

add lldt/ltr to clean more segments.

Those code are put in code64, and it is using gdt that is only
loaded from code32 path.

That breaks booting with 64bit bootloader that does not go through
code32 path. It get at startup_64 directly,  and it has different
gdt.

Move those lines into code32 after their gdt is loaded.

Signed-off-by: Yinghai Lu 
Cc: Zachary Amsden 
Cc: Matt Fleming 
---
 arch/x86/boot/compressed/head_64.S |9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/arch/x86/boot/compressed/head_64.S 
b/arch/x86/boot/compressed/head_64.S
index fb984c0..5c80b94 100644
--- a/arch/x86/boot/compressed/head_64.S
+++ b/arch/x86/boot/compressed/head_64.S
@@ -154,6 +154,12 @@ ENTRY(startup_32)
btsl$_EFER_LME, %eax
wrmsr
 
+   /* After gdt is loaded */
+   xorl%eax, %eax
+   lldt%ax
+   movl$0x20, %eax
+   ltr %ax
+
/*
 * Setup for the jump to 64bit mode
 *
@@ -239,9 +245,6 @@ preferred_addr:
movl%eax, %ss
movl%eax, %fs
movl%eax, %gs
-   lldt%ax
-   movl$0x20, %eax
-   ltr %ax
 
/*
 * Compute the decompressed kernel start address.  It is where
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v6 04/27] x86, boot: Move lldt/ltr out of 64bit code section

2012-12-13 Thread Yinghai Lu
commit 08da5a2ca

x86_64: Early segment setup for VT

add lldt/ltr to clean more segments.

Those code are put in code64, and it is using gdt that is only
loaded from code32 path.

That breaks booting with 64bit bootloader that does not go through
code32 path. It get at startup_64 directly,  and it has different
gdt.

Move those lines into code32 after their gdt is loaded.

Signed-off-by: Yinghai Lu ying...@kernel.org
Cc: Zachary Amsden zams...@gmail.com
Cc: Matt Fleming matt.flem...@intel.com
---
 arch/x86/boot/compressed/head_64.S |9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/arch/x86/boot/compressed/head_64.S 
b/arch/x86/boot/compressed/head_64.S
index fb984c0..5c80b94 100644
--- a/arch/x86/boot/compressed/head_64.S
+++ b/arch/x86/boot/compressed/head_64.S
@@ -154,6 +154,12 @@ ENTRY(startup_32)
btsl$_EFER_LME, %eax
wrmsr
 
+   /* After gdt is loaded */
+   xorl%eax, %eax
+   lldt%ax
+   movl$0x20, %eax
+   ltr %ax
+
/*
 * Setup for the jump to 64bit mode
 *
@@ -239,9 +245,6 @@ preferred_addr:
movl%eax, %ss
movl%eax, %fs
movl%eax, %gs
-   lldt%ax
-   movl$0x20, %eax
-   ltr %ax
 
/*
 * Compute the decompressed kernel start address.  It is where
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/