virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
* Re: 2.6.22 x86_64 : kernel initial decompression hangs on vmware
       [not found] ` <46A7E606.4030001-KSe8qvLY914@public.gmane.org>
@ 2007-08-04 16:23   ` Zachary Amsden
       [not found]     ` <46B4A7E4.4030907-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Zachary Amsden @ 2007-08-04 16:23 UTC (permalink / raw)
  To: Gabriel Barazer, Andi Kleen, Jim Mattson
  Cc: kvm-devel, Virtualization Mailing List,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 1499 bytes --]

Gabriel Barazer wrote:
> Hi,
>
> After upgrading kernel to 2.6.22 on a Vmware workstation guest version 
> 5.5 and 6 , the kernel decompression stage ("Decompressing Linux...") 
> is hanging for a very long time (~5 minutes) before finally  
> succeeding (displaying "done.\nBooting the kernel.\n"). During this 
> time, the VM process is eating all the CPU time during the 
> decompression, like an infinite loop.
> Between these 2 strings is the gunzip() function at 
> boot/compressed/misc.c which does the real job, and the problem seemed 
> to appear since commit 1ab60e0f72f71ec54831e525a3e1154f1c092408. 
> (2.6.22-rc1 hangs, 2.6.21.6 works). The problem occurs with or without 
> CONFIG_RELOCATABLE enabled.
>
> What are the possible solutions to confirm where the problem is coming 
> from ?

Since I was just involved in the boot decompressor for another bug, I 
took a look at this.  2.6.22 switches it to be 64-bit code.  VT is very 
picky about what state it can run in.  Not using VT on Intel 64-bit 
hardware cripples performance, running at far below normal speed, and 
taking minutes to decompress the kernel, which is nearly instantaneous 
otherwise.

To get back into VT in this case, not only do we need to load FS and GS, 
we also need to setup an initial LDT and task.  Can you try the attached 
patch and see that it does the right thing?

I've also cc'd the KVM developers, as the same problem will affect them, 
and hopefully the same patch will fix it.

Thanks, Zach

Zach

[-- Attachment #2: boot-decompress-vt-fix.patch --]
[-- Type: text/x-patch, Size: 1206 bytes --]

VT is very picky about when it can enter execution.
Get all segments setup and get LDT and TR into valid state to allow
VT execution under VMware and KVM (untested).

This makes the boot decompression run under VT, which makes it several
orders of magnitude faster on 64-bit Intel hardware.

Before, I was seeing times up to a minute or more to decompress a 1.3MB kernel
on a very fast box.

Signed-off-by: Zachary Amsden <zach-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>


===================================================================
--- a/arch/x86_64/boot/compressed/head.S
+++ a/arch/x86_64/boot/compressed/head.S
@@ -195,6 +195,11 @@
 	movl	%eax, %ds
 	movl	%eax, %es
 	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
 	 * we were loaded at aligned to a 2M boundary. %rbp contains the
@@ -295,6 +300,8 @@
 	.quad	0x0000000000000000	/* NULL descriptor */
 	.quad	0x00af9a000000ffff	/* __KERNEL_CS */
 	.quad	0x00cf92000000ffff	/* __KERNEL_DS */
+	.quad	0x0080890000000000	/* TS descriptor */
+	.quad   0x0000000000000000	/* TS continued */
 gdt_end:
 	.bss
 /* Stack for uncompression */

[-- Attachment #3: Type: text/plain, Size: 315 bytes --]

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/

[-- Attachment #4: Type: text/plain, Size: 186 bytes --]

_______________________________________________
kvm-devel mailing list
kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/kvm-devel

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

* Re: 2.6.22 x86_64 : kernel initial decompression hangs on vmware
       [not found]     ` <46B4A7E4.4030907-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
@ 2007-08-04 17:18       ` Gabriel Barazer
  2007-08-09 20:57       ` Avi Kivity
  1 sibling, 0 replies; 5+ messages in thread
From: Gabriel Barazer @ 2007-08-04 17:18 UTC (permalink / raw)
  To: Zachary Amsden
  Cc: kvm-devel, Andi Kleen, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	Virtualization Mailing List, Jim Mattson

[-- Attachment #1: Type: text/plain, Size: 1792 bytes --]

On 08/04/2007 6:23:00 PM +0200, Zachary Amsden <zach-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org> wrote:
> Gabriel Barazer wrote:
>> Hi,
>>
>> After upgrading kernel to 2.6.22 on a Vmware workstation guest version 
>> 5.5 and 6 , the kernel decompression stage ("Decompressing Linux...") 
>> is hanging for a very long time (~5 minutes) before finally  
>> succeeding (displaying "done.\nBooting the kernel.\n"). During this 
>> time, the VM process is eating all the CPU time during the 
>> decompression, like an infinite loop.
>> Between these 2 strings is the gunzip() function at 
>> boot/compressed/misc.c which does the real job, and the problem seemed 
>> to appear since commit 1ab60e0f72f71ec54831e525a3e1154f1c092408. 
>> (2.6.22-rc1 hangs, 2.6.21.6 works). The problem occurs with or without 
>> CONFIG_RELOCATABLE enabled.
>>
>> What are the possible solutions to confirm where the problem is coming 
>> from ?
> 
> Since I was just involved in the boot decompressor for another bug, I 
> took a look at this.  2.6.22 switches it to be 64-bit code.  VT is very 
> picky about what state it can run in.  Not using VT on Intel 64-bit 
> hardware cripples performance, running at far below normal speed, and 
> taking minutes to decompress the kernel, which is nearly instantaneous 
> otherwise.
> 
> To get back into VT in this case, not only do we need to load FS and GS, 
> we also need to setup an initial LDT and task.  Can you try the attached 
> patch and see that it does the right thing?

It Works (tm) ! Tried compiling with and without the patch, with exactly 
the same config, just to be sure. Decompressing the kernel is now 
lightning fast.

Thanks !

> I've also cc'd the KVM developers, as the same problem will affect them, 
> and hopefully the same patch will fix it.

[-- Attachment #2: boot-decompress-vt-fix.patch --]
[-- Type: text/x-patch, Size: 1206 bytes --]

VT is very picky about when it can enter execution.
Get all segments setup and get LDT and TR into valid state to allow
VT execution under VMware and KVM (untested).

This makes the boot decompression run under VT, which makes it several
orders of magnitude faster on 64-bit Intel hardware.

Before, I was seeing times up to a minute or more to decompress a 1.3MB kernel
on a very fast box.

Signed-off-by: Zachary Amsden <zach-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>


===================================================================
--- a/arch/x86_64/boot/compressed/head.S
+++ a/arch/x86_64/boot/compressed/head.S
@@ -195,6 +195,11 @@
 	movl	%eax, %ds
 	movl	%eax, %es
 	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
 	 * we were loaded at aligned to a 2M boundary. %rbp contains the
@@ -295,6 +300,8 @@
 	.quad	0x0000000000000000	/* NULL descriptor */
 	.quad	0x00af9a000000ffff	/* __KERNEL_CS */
 	.quad	0x00cf92000000ffff	/* __KERNEL_DS */
+	.quad	0x0080890000000000	/* TS descriptor */
+	.quad   0x0000000000000000	/* TS continued */
 gdt_end:
 	.bss
 /* Stack for uncompression */

[-- Attachment #3: Type: text/plain, Size: 315 bytes --]

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/

[-- Attachment #4: Type: text/plain, Size: 186 bytes --]

_______________________________________________
kvm-devel mailing list
kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/kvm-devel

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

* Re: 2.6.22 x86_64 : kernel initial decompression hangs on vmware
       [not found]     ` <46B4A7E4.4030907-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
  2007-08-04 17:18       ` Gabriel Barazer
@ 2007-08-09 20:57       ` Avi Kivity
       [not found]         ` <46BB7FCC.4040509-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
  1 sibling, 1 reply; 5+ messages in thread
From: Avi Kivity @ 2007-08-09 20:57 UTC (permalink / raw)
  To: Zachary Amsden
  Cc: kvm-devel, linux-kernel-u79uwXL29TY76Z2rM5mHXA, Andi Kleen,
	Virtualization Mailing List, Jim Mattson, Gabriel Barazer

Zachary Amsden wrote:
>
> Since I was just involved in the boot decompressor for another bug, I 
> took a look at this.  2.6.22 switches it to be 64-bit code.  VT is 
> very picky about what state it can run in.  Not using VT on Intel 
> 64-bit hardware cripples performance, running at far below normal 
> speed, and taking minutes to decompress the kernel, which is nearly 
> instantaneous otherwise.
>
> To get back into VT in this case, not only do we need to load FS and 
> GS, we also need to setup an initial LDT and task.  Can you try the 
> attached patch and see that it does the right thing?
>
> I've also cc'd the KVM developers, as the same problem will affect 
> them, and hopefully the same patch will fix it.
>

We haven't seen any issue with the 2.6.22 boot decompressor.  Which of 
the four (fs, gs, ldt, or tr) were proving problematic and why?



-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/

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

* Re: 2.6.22 x86_64 : kernel initial decompression hangs on vmware
       [not found]         ` <46BB7FCC.4040509-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
@ 2007-08-09 23:28           ` Zachary Amsden
  2007-08-10  1:48             ` Avi Kivity
  0 siblings, 1 reply; 5+ messages in thread
From: Zachary Amsden @ 2007-08-09 23:28 UTC (permalink / raw)
  To: Avi Kivity
  Cc: kvm-devel, linux-kernel-u79uwXL29TY76Z2rM5mHXA, Andi Kleen,
	Virtualization Mailing List, Jim Mattson, Gabriel Barazer

Avi Kivity wrote:
>
> We haven't seen any issue with the 2.6.22 boot decompressor.  Which of 
> the four (fs, gs, ldt, or tr) were proving problematic and why?

It was tr that was affecting Workstation, since we boot through normal 
BIOS path, and only a 16-bit task was loaded at this point.

Just to make the state comprehensive, I opted to reload everything.

Zach

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/

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

* Re: 2.6.22 x86_64 : kernel initial decompression hangs on vmware
  2007-08-09 23:28           ` Zachary Amsden
@ 2007-08-10  1:48             ` Avi Kivity
  0 siblings, 0 replies; 5+ messages in thread
From: Avi Kivity @ 2007-08-10  1:48 UTC (permalink / raw)
  To: Zachary Amsden
  Cc: Gabriel Barazer, Andi Kleen, Jim Mattson, linux-kernel,
	Virtualization Mailing List, kvm-devel

Zachary Amsden wrote:
> Avi Kivity wrote:
>>
>> We haven't seen any issue with the 2.6.22 boot decompressor.  Which 
>> of the four (fs, gs, ldt, or tr) were proving problematic and why?
>
> It was tr that was affecting Workstation, since we boot through normal 
> BIOS path, and only a 16-bit task was loaded at this point.
>

Ah.  Maybe we didn't have an exit while we were in long mode with the 
16-bit tss, so VT didn't notice the illegal combination.

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

end of thread, other threads:[~2007-08-10  1:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <46A7E606.4030001@oxeva.fr>
     [not found] ` <46A7E606.4030001-KSe8qvLY914@public.gmane.org>
2007-08-04 16:23   ` 2.6.22 x86_64 : kernel initial decompression hangs on vmware Zachary Amsden
     [not found]     ` <46B4A7E4.4030907-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
2007-08-04 17:18       ` Gabriel Barazer
2007-08-09 20:57       ` Avi Kivity
     [not found]         ` <46BB7FCC.4040509-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-08-09 23:28           ` Zachary Amsden
2007-08-10  1:48             ` Avi Kivity

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