All of lore.kernel.org
 help / color / mirror / Atom feed
* 32-bit FreeBSD under 64-bit KVM
@ 2007-02-27  1:10 Aurelien Jarno
       [not found] ` <45E38511.9000006-rXXEIb44qovR7s880joybQ@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Aurelien Jarno @ 2007-02-27  1:10 UTC (permalink / raw)
  To: kvm-devel

Hi all,

While I am able to run a 64-bit FreeBSD under a 64-bit KVM perfectly, I
am having problems with running a 32-bit FreeBSD under the same KVM:

INIT: version 2.86 booting
INIT: PANIC: segmentation violation! sleeping for 30 seconds.
pid 34 (init), uid 0: exited on signal 11
INIT: PANIC: segmentation violation! sleeping for 30 seconds.
INIT: PANIC: segmentation violation! sleeping for 30 seconds.
INIT: PANIC: segmentation violation! sleeping for 30 seconds.
INIT: PANIC: segmentation violation! sleeping for 30 seconds.
INIT: PANIC: segmentation violation! sleeping for 30 seconds.
INIT: PANIC: segmentation violation! sleeping for 30 seconds.
INIT: PANIC: segmentation violation! sleeping for 30 seconds.

Basically the kernel boots correctly, but then the userland fails to
work. I am using KVM-15 on an AMD64 CPU.

I am able to run the same OS with -no-kvm, also I am able to run a
32-bit Linux under a 64-bit KVM. It seems the 32-bit support is at least
not totally broken, though I haven't made extensive tests.

Does somebody is experiencing the same problems? Do you have a solution?

I will try to run the same guest under a 32-bit KVM, but I have to
install a 32-bit distribution first.

Thanks,
Aurelien

-- 
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   aurel32-8fiUuRrzOP0dnm+yROfE0A@public.gmane.org         | aurelien-rXXEIb44qovR7s880joybQ@public.gmane.org
   `-    people.debian.org/~aurel32 | www.aurel32.net

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

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

* Re: 32-bit FreeBSD under 64-bit KVM
       [not found] ` <45E38511.9000006-rXXEIb44qovR7s880joybQ@public.gmane.org>
@ 2007-02-27  7:08   ` Avi Kivity
       [not found]     ` <45E3D902.7000102-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Avi Kivity @ 2007-02-27  7:08 UTC (permalink / raw)
  To: Aurelien Jarno; +Cc: kvm-devel

Aurelien Jarno wrote:
> Hi all,
>
> While I am able to run a 64-bit FreeBSD under a 64-bit KVM perfectly, I
> am having problems with running a 32-bit FreeBSD under the same KVM:
>
> INIT: version 2.86 booting
> INIT: PANIC: segmentation violation! sleeping for 30 seconds.
> pid 34 (init), uid 0: exited on signal 11
> INIT: PANIC: segmentation violation! sleeping for 30 seconds.
> INIT: PANIC: segmentation violation! sleeping for 30 seconds.
> INIT: PANIC: segmentation violation! sleeping for 30 seconds.
> INIT: PANIC: segmentation violation! sleeping for 30 seconds.
> INIT: PANIC: segmentation violation! sleeping for 30 seconds.
> INIT: PANIC: segmentation violation! sleeping for 30 seconds.
> INIT: PANIC: segmentation violation! sleeping for 30 seconds.
>
> Basically the kernel boots correctly, but then the userland fails to
> work. I am using KVM-15 on an AMD64 CPU.
>
> I am able to run the same OS with -no-kvm, also I am able to run a
> 32-bit Linux under a 64-bit KVM. It seems the 32-bit support is at least
> not totally broken, though I haven't made extensive tests.
>
> Does somebody is experiencing the same problems? Do you have a solution?
>
>   

Can you try turning the '#undef AUDIT' to '#define AUDIT' in mmu.c?  
Also, change 'int dbg = 1' to 'int dbg = 0' in the same file.  Note kvm 
will be very slower after this.  dmesg will show any issues (issue a 
'echo 9 > /proc/sysrq-trigger' to make sure all messages are shown)



-- 
Do not meddle in the internals of kernels, for they are subtle and quick to panic.


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

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

* Re: 32-bit FreeBSD under 64-bit KVM
       [not found]     ` <45E3D902.7000102-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
@ 2007-03-01 21:48       ` Aurelien Jarno
       [not found]         ` <20070301214843.GA28822-pck4HO7xIi+4mUWUGf39/V6hYfS7NtTn@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Aurelien Jarno @ 2007-03-01 21:48 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm-devel

On Tue, Feb 27, 2007 at 09:08:50AM +0200, Avi Kivity wrote:
> Aurelien Jarno wrote:
> >Hi all,
> >
> >While I am able to run a 64-bit FreeBSD under a 64-bit KVM perfectly, I
> >am having problems with running a 32-bit FreeBSD under the same KVM:
> >
> >INIT: version 2.86 booting
> >INIT: PANIC: segmentation violation! sleeping for 30 seconds.
> >pid 34 (init), uid 0: exited on signal 11
> >INIT: PANIC: segmentation violation! sleeping for 30 seconds.
> >INIT: PANIC: segmentation violation! sleeping for 30 seconds.
> >INIT: PANIC: segmentation violation! sleeping for 30 seconds.
> >INIT: PANIC: segmentation violation! sleeping for 30 seconds.
> >INIT: PANIC: segmentation violation! sleeping for 30 seconds.
> >INIT: PANIC: segmentation violation! sleeping for 30 seconds.
> >INIT: PANIC: segmentation violation! sleeping for 30 seconds.
> >
> >Basically the kernel boots correctly, but then the userland fails to
> >work. I am using KVM-15 on an AMD64 CPU.
> >
> >I am able to run the same OS with -no-kvm, also I am able to run a
> >32-bit Linux under a 64-bit KVM. It seems the 32-bit support is at least
> >not totally broken, though I haven't made extensive tests.
> >
> >Does somebody is experiencing the same problems? Do you have a solution?
> >
> >  
> 
> Can you try turning the '#undef AUDIT' to '#define AUDIT' in mmu.c?  
> Also, change 'int dbg = 1' to 'int dbg = 0' in the same file.  Note kvm 
> will be very slower after this.  dmesg will show any issues (issue a 
> 'echo 9 > /proc/sysrq-trigger' to make sure all messages are shown)
> 

Yep I confirm it is very slow, especially when your tty0 device is
actually a serial port running at 9600 bauds!

I also got some problems, as it seems logging so much data slowed down
the machine, including the emulated machine. The segmentation violation
message disappeared, but the OS was like in an endless loop. So the
problem _may_ be due to a race condition.

After a lot of tries, I found that I was able to get the segmentation
violation by sending the kernel log to another machine. The full log is
available on http://temp.aurel32.net/kvm-gnu_kfreebsd32.log.bz2. But I
don't know what to look for in a such big log.

Bye,
Aurelien

-- 
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   aurel32-8fiUuRrzOP0dnm+yROfE0A@public.gmane.org         | aurelien-rXXEIb44qovR7s880joybQ@public.gmane.org
   `-    people.debian.org/~aurel32 | www.aurel32.net

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

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

* Re: 32-bit FreeBSD under 64-bit KVM
       [not found]         ` <20070301214843.GA28822-pck4HO7xIi+4mUWUGf39/V6hYfS7NtTn@public.gmane.org>
@ 2007-03-03  8:01           ` Avi Kivity
       [not found]             ` <45E92B4D.8030501-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Avi Kivity @ 2007-03-03  8:01 UTC (permalink / raw)
  To: Aurelien Jarno; +Cc: kvm-devel

Aurelien Jarno wrote:
>> Can you try turning the '#undef AUDIT' to '#define AUDIT' in mmu.c?  
>> Also, change 'int dbg = 1' to 'int dbg = 0' in the same file.  Note kvm 
>> will be very slower after this.  dmesg will show any issues (issue a 
>> 'echo 9 > /proc/sysrq-trigger' to make sure all messages are shown)
>>
>>     
>
> Yep I confirm it is very slow, especially when your tty0 device is
> actually a serial port running at 9600 bauds!
>
> I also got some problems, as it seems logging so much data slowed down
> the machine, including the emulated machine. The segmentation violation
> message disappeared, but the OS was like in an endless loop. So the
> problem _may_ be due to a race condition.
>
> After a lot of tries, I found that I was able to get the segmentation
> violation by sending the kernel log to another machine. The full log is
> available on http://temp.aurel32.net/kvm-gnu_kfreebsd32.log.bz2. But I
> don't know what to look for in a such big log.
>   

Are you sure you set 'dbg = 0'?  There aren't supposed to be any logs, 
except if an error is found during audit (that's what the '#define 
AUDIT' is for).


-- 
Do not meddle in the internals of kernels, for they are subtle and quick to panic.


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

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

* Re: 32-bit FreeBSD under 64-bit KVM
       [not found]             ` <45E92B4D.8030501-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
@ 2007-03-07 14:33               ` Aurelien Jarno
       [not found]                 ` <45EECD2D.20209-rXXEIb44qovR7s880joybQ@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Aurelien Jarno @ 2007-03-07 14:33 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm-devel

Avi Kivity a écrit :
> Aurelien Jarno wrote:
>>> Can you try turning the '#undef AUDIT' to '#define AUDIT' in mmu.c?  
>>> Also, change 'int dbg = 1' to 'int dbg = 0' in the same file.  Note kvm 
>>> will be very slower after this.  dmesg will show any issues (issue a 
>>> 'echo 9 > /proc/sysrq-trigger' to make sure all messages are shown)
>>>
>>>     
>> Yep I confirm it is very slow, especially when your tty0 device is
>> actually a serial port running at 9600 bauds!
>>
>> I also got some problems, as it seems logging so much data slowed down
>> the machine, including the emulated machine. The segmentation violation
>> message disappeared, but the OS was like in an endless loop. So the
>> problem _may_ be due to a race condition.
>>
>> After a lot of tries, I found that I was able to get the segmentation
>> violation by sending the kernel log to another machine. The full log is
>> available on http://temp.aurel32.net/kvm-gnu_kfreebsd32.log.bz2. But I
>> don't know what to look for in a such big log.
>>   
> 
> Are you sure you set 'dbg = 0'?  There aren't supposed to be any logs, 
> except if an error is found during audit (that's what the '#define 
> AUDIT' is for).
> 

Oh sorry, I did that wrong.

I have tried with dbg = = 0 and #define AUDIT, and it is indeed far less
verbose.

However I experienced the same problem as with DEBUG, ie when the guest
is running slower (in that case due to AUDIT), the problem get away and
the guest is running correctly, but very slowly.

I guess it will be difficult to debug such a thing, so I think I will
have to wait until another way to trigger the bug is found.

Anyway, thanks for your help.

Bye,
Aurelien

-- 
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   aurel32-8fiUuRrzOP0dnm+yROfE0A@public.gmane.org         | aurelien-rXXEIb44qovR7s880joybQ@public.gmane.org
   `-    people.debian.org/~aurel32 | www.aurel32.net

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

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

* Re: 32-bit FreeBSD under 64-bit KVM
       [not found]                 ` <45EECD2D.20209-rXXEIb44qovR7s880joybQ@public.gmane.org>
@ 2007-03-07 14:34                   ` Avi Kivity
       [not found]                     ` <45EECD5A.5090801-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Avi Kivity @ 2007-03-07 14:34 UTC (permalink / raw)
  To: Aurelien Jarno; +Cc: kvm-devel

Aurelien Jarno wrote:
>>>   
>>>       
>> Are you sure you set 'dbg = 0'?  There aren't supposed to be any logs, 
>> except if an error is found during audit (that's what the '#define 
>> AUDIT' is for).
>>
>>     
>
> Oh sorry, I did that wrong.
>
> I have tried with dbg = = 0 and #define AUDIT, and it is indeed far less
> verbose.
>
> However I experienced the same problem as with DEBUG, ie when the guest
> is running slower (in that case due to AUDIT), the problem get away and
> the guest is running correctly, but very slowly.
>
> I guess it will be difficult to debug such a thing, so I think I will
> have to wait until another way to trigger the bug is found.
>   

It shouldn't say anything under audit unless something is wrong.  Can 
you post your dmesg?


-- 
error compiling committee.c: too many arguments to function


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

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

* Re: 32-bit FreeBSD under 64-bit KVM
       [not found]                     ` <45EECD5A.5090801-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
@ 2007-03-07 17:47                       ` Aurelien Jarno
       [not found]                         ` <20070307174737.GA8340-WMRsAYcELcC4mUWUGf39/V6hYfS7NtTn@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Aurelien Jarno @ 2007-03-07 17:47 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm-devel

On Wed, Mar 07, 2007 at 04:34:02PM +0200, Avi Kivity wrote:
> Aurelien Jarno wrote:
> >>>  
> >>>      
> >>Are you sure you set 'dbg = 0'?  There aren't supposed to be any logs, 
> >>except if an error is found during audit (that's what the '#define 
> >>AUDIT' is for).
> >>
> >>    
> >
> >Oh sorry, I did that wrong.
> >
> >I have tried with dbg = = 0 and #define AUDIT, and it is indeed far less
> >verbose.
> >
> >However I experienced the same problem as with DEBUG, ie when the guest
> >is running slower (in that case due to AUDIT), the problem get away and
> >the guest is running correctly, but very slowly.
> >
> >I guess it will be difficult to debug such a thing, so I think I will
> >have to wait until another way to trigger the bug is found.
> >  
> 
> It shouldn't say anything under audit unless something is wrong.  Can 
> you post your dmesg?


Yep. Here are what I get in my dmesg. The lines below are output when
the kernel is started (just after the bootloader):

Mar  3 16:50:35 joule kernel: assertion failed /usr/local/src/kvm-15/kernel/mmu.c:722: (gpa & HPA_ERR_MASK) == 0
Mar  3 16:50:35 joule kernel: audit error: (pre page fault) levels 2 gva 444000 gpa ffffffffffffffff hpa ffffffffffffffff ent 3e369021
Mar  3 16:50:36 joule kernel: assertion failed /usr/local/src/kvm-15/kernel/mmu.c:722: (gpa & HPA_ERR_MASK) == 0
Mar  3 16:50:36 joule kernel: audit error: (post page fault (fixed)) levels 2 gva 444000 gpa ffffffffffffffff hpa ffffffffffffffff ent 3e369021 


Then the kernel takes a huge time to boot, and at then end of the kernel boot, or maybe when
trying to start init, the following lines are printed hundred thousand of time:

Mar  3 18:40:30 joule kernel: audit error: (pre page fault) levels 2 gva ffffffffbfbfe000 gpa 1e81e000 hpa 4749c000 ent 564ca825
Mar  3 18:40:30 joule kernel: audit error: (post page fault (fixed)) levels 2 gva ffffffffbfbfe000 gpa 1e81e000 hpa 4749c000 ent 564ca825



-- 
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   aurel32-8fiUuRrzOP0dnm+yROfE0A@public.gmane.org         | aurelien-rXXEIb44qovR7s880joybQ@public.gmane.org
   `-    people.debian.org/~aurel32 | www.aurel32.net

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

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

* Re: 32-bit FreeBSD under 64-bit KVM
       [not found]                         ` <20070307174737.GA8340-WMRsAYcELcC4mUWUGf39/V6hYfS7NtTn@public.gmane.org>
@ 2007-03-07 18:04                           ` Avi Kivity
       [not found]                             ` <45EEFEB3.1090809-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Avi Kivity @ 2007-03-07 18:04 UTC (permalink / raw)
  To: Aurelien Jarno; +Cc: kvm-devel

Aurelien Jarno wrote:
> Yep. Here are what I get in my dmesg. The lines below are output when
> the kernel is started (just after the bootloader):
>
> Mar  3 16:50:35 joule kernel: assertion failed /usr/local/src/kvm-15/kernel/mmu.c:722: (gpa & HPA_ERR_MASK) == 0
> Mar  3 16:50:35 joule kernel: audit error: (pre page fault) levels 2 gva 444000 gpa ffffffffffffffff hpa ffffffffffffffff ent 3e369021
> Mar  3 16:50:36 joule kernel: assertion failed /usr/local/src/kvm-15/kernel/mmu.c:722: (gpa & HPA_ERR_MASK) == 0
> Mar  3 16:50:36 joule kernel: audit error: (post page fault (fixed)) levels 2 gva 444000 gpa ffffffffffffffff hpa ffffffffffffffff ent 3e369021 
>
>
> Then the kernel takes a huge time to boot, and at then end of the kernel boot, or maybe when
> trying to start init, the following lines are printed hundred thousand of time:
>
> Mar  3 18:40:30 joule kernel: audit error: (pre page fault) levels 2 gva ffffffffbfbfe000 gpa 1e81e000 hpa 4749c000 ent 564ca825
> Mar  3 18:40:30 joule kernel: audit error: (post page fault (fixed)) levels 2 gva ffffffffbfbfe000 gpa 1e81e000 hpa 4749c000 ent 564ca825
>   

Okay, an mmu bug.  Been a while since we've seen one.

Please post a URL for the .iso so I can take a look, along with exact 
instructions for reproducing the bug.

-- 
Do not meddle in the internals of kernels, for they are subtle and quick to panic.


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

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

* Re: 32-bit FreeBSD under 64-bit KVM
       [not found]                             ` <45EEFEB3.1090809-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
@ 2007-03-07 23:52                               ` Aurelien Jarno
       [not found]                                 ` <45EF5039.4010907-rXXEIb44qovR7s880joybQ@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Aurelien Jarno @ 2007-03-07 23:52 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm-devel

Avi Kivity a écrit :
> Aurelien Jarno wrote:
>> Yep. Here are what I get in my dmesg. The lines below are output when
>> the kernel is started (just after the bootloader):
>>
>> Mar  3 16:50:35 joule kernel: assertion failed /usr/local/src/kvm-15/kernel/mmu.c:722: (gpa & HPA_ERR_MASK) == 0
>> Mar  3 16:50:35 joule kernel: audit error: (pre page fault) levels 2 gva 444000 gpa ffffffffffffffff hpa ffffffffffffffff ent 3e369021
>> Mar  3 16:50:36 joule kernel: assertion failed /usr/local/src/kvm-15/kernel/mmu.c:722: (gpa & HPA_ERR_MASK) == 0
>> Mar  3 16:50:36 joule kernel: audit error: (post page fault (fixed)) levels 2 gva 444000 gpa ffffffffffffffff hpa ffffffffffffffff ent 3e369021 
>>
>>
>> Then the kernel takes a huge time to boot, and at then end of the kernel boot, or maybe when
>> trying to start init, the following lines are printed hundred thousand of time:
>>
>> Mar  3 18:40:30 joule kernel: audit error: (pre page fault) levels 2 gva ffffffffbfbfe000 gpa 1e81e000 hpa 4749c000 ent 564ca825
>> Mar  3 18:40:30 joule kernel: audit error: (post page fault (fixed)) levels 2 gva ffffffffbfbfe000 gpa 1e81e000 hpa 4749c000 ent 564ca825
>>   
> 
> Okay, an mmu bug.  Been a while since we've seen one.
> 
> Please post a URL for the .iso so I can take a look, along with exact 
> instructions for reproducing the bug.

I have put a qcow image on http://aurel32.free.fr . You have to bunzip2
the image and then run:

  qemu-system-x86_64 -hda gnu_kfreebsd.qcow

Then wait for the system to boot and look at the boot process. The
kernel should boot fine, but when INIT is started, you will get a
"SEGMENTATION VIOLATION" from the kernel.

At least is what I observe here on two different computers, both with
AMD CPU (Turion 64 X2 and Athlon 64 X2), for kvm versions 14 (maybe also
before) through 16. Note also that the problem is not always
reproducible if the system load is high (for example running cpuburn on
both cores).

Thanks for your help.

Bye,
Aurelien

-- 
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   aurel32-8fiUuRrzOP0dnm+yROfE0A@public.gmane.org         | aurelien-rXXEIb44qovR7s880joybQ@public.gmane.org
   `-    people.debian.org/~aurel32 | www.aurel32.net

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

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

* Re: 32-bit FreeBSD under 64-bit KVM
       [not found]                                 ` <45EF5039.4010907-rXXEIb44qovR7s880joybQ@public.gmane.org>
@ 2007-03-08 15:12                                   ` Avi Kivity
       [not found]                                     ` <45F027D8.9070001-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Avi Kivity @ 2007-03-08 15:12 UTC (permalink / raw)
  To: Aurelien Jarno; +Cc: kvm-devel

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

Aurelien Jarno wrote:
>> Okay, an mmu bug.  Been a while since we've seen one.
>>
>> Please post a URL for the .iso so I can take a look, along with exact 
>> instructions for reproducing the bug.
>>     
>
> I have put a qcow image on http://aurel32.free.fr . You have to bunzip2
> the image and then run:
>
>   qemu-system-x86_64 -hda gnu_kfreebsd.qcow
>
> Then wait for the system to boot and look at the boot process. The
> kernel should boot fine, but when INIT is started, you will get a
> "SEGMENTATION VIOLATION" from the kernel.
>
> At least is what I observe here on two different computers, both with
> AMD CPU (Turion 64 X2 and Athlon 64 X2), for kvm versions 14 (maybe also
> before) through 16. Note also that the problem is not always
> reproducible if the system load is high (for example running cpuburn on
> both cores).
>   

The attached patch should fix it.  If you're using the external module, 
you'll need to apply with 'patch -p3' in the kernel/ subdirectory.


-- 
error compiling committee.c: too many arguments to function


[-- Attachment #2: kvm-fix-nonpae-pde-writes.patch --]
[-- Type: text/x-patch, Size: 3117 bytes --]

commit 6ee9853b015f8807f497ffad39b142ddc1403aa9
Author: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
Date:   Thu Mar 8 17:13:32 2007 +0200

    KVM: MMU: Fix guest writes to nonpae pde
    
    KVM shadow page tables are always in pae mode, regardless of the guest
    setting.  This means that a guest pde (mapping 4MB of memory) is mapped
    to two shadow pdes (mapping 2MB each).
    
    When the guest writes to a pte or pde, we intercept the write and emulate it.
    We also remove any shadowed mappings corresponding to the write.  Since the
    mmu did not account for the doubling in the number of pdes, it removed the
    wrong entry, resulting in a mismatch between shadow page tables and guest
    page tables, followed shortly by guest memory corruption.
    
    This patch fixes the problem by detecting the special case of writing to
    a non-pae pde and adjusting the address and number of shadow pdes zapped
    accordingly.
    
    Signed-off-by: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>

diff --git a/drivers/kvm/mmu.c b/drivers/kvm/mmu.c
index a7b3e2a..f5d45b0 100644
--- a/drivers/kvm/mmu.c
+++ b/drivers/kvm/mmu.c
@@ -1093,22 +1093,40 @@ out:
 	return r;
 }
 
+static void mmu_pre_write_zap_pte(struct kvm_vcpu *vcpu,
+				  struct kvm_mmu_page *page,
+				  u64 *spte)
+{
+	u64 pte;
+	struct kvm_mmu_page *child;
+				  
+	pte = *spte;
+	if (is_present_pte(pte)) {
+		if (page->role.level == PT_PAGE_TABLE_LEVEL)
+			rmap_remove(vcpu, spte);
+		else {
+			child = page_header(pte & PT64_BASE_ADDR_MASK);
+			mmu_page_remove_parent_pte(vcpu, child, spte);
+		}
+	}
+	*spte = 0;
+}
+
 void kvm_mmu_pre_write(struct kvm_vcpu *vcpu, gpa_t gpa, int bytes)
 {
 	gfn_t gfn = gpa >> PAGE_SHIFT;
 	struct kvm_mmu_page *page;
-	struct kvm_mmu_page *child;
 	struct hlist_node *node, *n;
 	struct hlist_head *bucket;
 	unsigned index;
 	u64 *spte;
-	u64 pte;
 	unsigned offset = offset_in_page(gpa);
 	unsigned pte_size;
 	unsigned page_offset;
 	unsigned misaligned;
 	int level;
 	int flooded = 0;
+	int npte;
 
 	pgprintk("%s: gpa %llx bytes %d\n", __FUNCTION__, gpa, bytes);
 	if (gfn == vcpu->last_pt_write_gfn) {
@@ -1144,22 +1162,26 @@ void kvm_mmu_pre_write(struct kvm_vcpu *vcpu, gpa_t gpa, int bytes)
 		}
 		page_offset = offset;
 		level = page->role.level;
+		npte = 1;
 		if (page->role.glevels == PT32_ROOT_LEVEL) {
 			page_offset <<= 1;          /* 32->64 */
+			/*
+			 * A 32-bit pde maps 4MB while the shadow pdes map
+			 * only 2MB.  So we need to double the offset again
+			 * and zap two pdes instead of one.
+			 */
+			if (level == PT32_ROOT_LEVEL) {
+				page_offset <<= 1;
+				npte = 2;
+			}
 			page_offset &= ~PAGE_MASK;
 		}
 		spte = __va(page->page_hpa);
 		spte += page_offset / sizeof(*spte);
-		pte = *spte;
-		if (is_present_pte(pte)) {
-			if (level == PT_PAGE_TABLE_LEVEL)
-				rmap_remove(vcpu, spte);
-			else {
-				child = page_header(pte & PT64_BASE_ADDR_MASK);
-				mmu_page_remove_parent_pte(vcpu, child, spte);
-			}
+		while (npte--) {
+			mmu_pre_write_zap_pte(vcpu, page, spte);
+			++spte;
 		}
-		*spte = 0;
 	}
 }
 

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

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

[-- 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 related	[flat|nested] 13+ messages in thread

* Re: 32-bit FreeBSD under 64-bit KVM
       [not found]                                     ` <45F027D8.9070001-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
@ 2007-03-08 17:32                                       ` Aurelien Jarno
       [not found]                                         ` <45F048C8.6060406-rXXEIb44qovR7s880joybQ@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Aurelien Jarno @ 2007-03-08 17:32 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm-devel

Avi Kivity a écrit :
> The attached patch should fix it.  If you're using the external module, 
> you'll need to apply with 'patch -p3' in the kernel/ subdirectory.

Thanks a lot, with this patch it's works very well. It boots correctly,
and everything seems to work correctly, even with high load. I will do
more intensive tests later today.

Plain FreeBSD also works correctly.

I have also updated the status page on the wiki.

Thanks,
Aurelien

-- 
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   aurel32-8fiUuRrzOP0dnm+yROfE0A@public.gmane.org         | aurelien-rXXEIb44qovR7s880joybQ@public.gmane.org
   `-    people.debian.org/~aurel32 | www.aurel32.net

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

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

* Re: 32-bit FreeBSD under 64-bit KVM
       [not found]                                         ` <45F048C8.6060406-rXXEIb44qovR7s880joybQ@public.gmane.org>
@ 2007-03-08 17:35                                           ` Avi Kivity
       [not found]                                             ` <45F04966.7030307-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Avi Kivity @ 2007-03-08 17:35 UTC (permalink / raw)
  To: Aurelien Jarno; +Cc: kvm-devel

Aurelien Jarno wrote:
> Avi Kivity a écrit :
>   
>> The attached patch should fix it.  If you're using the external module, 
>> you'll need to apply with 'patch -p3' in the kernel/ subdirectory.
>>     
>
> Thanks a lot, with this patch it's works very well. It boots correctly,
> and everything seems to work correctly, even with high load. I will do
> more intensive tests later today.
>
> Plain FreeBSD also works correctly.
>
>   

Great.  Thanks for the testing and reporting.


> I have also updated the status page on the wiki.
>   

Good to see the trophy collection growing :)


-- 
error compiling committee.c: too many arguments to function


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

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

* Re: 32-bit FreeBSD under 64-bit KVM
       [not found]                                             ` <45F04966.7030307-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
@ 2007-03-08 19:39                                               ` Aurelien Jarno
  0 siblings, 0 replies; 13+ messages in thread
From: Aurelien Jarno @ 2007-03-08 19:39 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm-devel

Avi Kivity a écrit :
> Aurelien Jarno wrote:
>> Avi Kivity a écrit :
>>   
>>> The attached patch should fix it.  If you're using the external module, 
>>> you'll need to apply with 'patch -p3' in the kernel/ subdirectory.
>>>     
>> Thanks a lot, with this patch it's works very well. It boots correctly,
>> and everything seems to work correctly, even with high load. I will do
>> more intensive tests later today.
>>
>> Plain FreeBSD also works correctly.
>>
>>   
> 
> Great.  Thanks for the testing and reporting.
> 
> 
>> I have also updated the status page on the wiki.
>>   
> 
> Good to see the trophy collection growing :)
> 

FYI, this also fixed OpenBSD.


-- 
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   aurel32-8fiUuRrzOP0dnm+yROfE0A@public.gmane.org         | aurelien-rXXEIb44qovR7s880joybQ@public.gmane.org
   `-    people.debian.org/~aurel32 | www.aurel32.net

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

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

end of thread, other threads:[~2007-03-08 19:39 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-27  1:10 32-bit FreeBSD under 64-bit KVM Aurelien Jarno
     [not found] ` <45E38511.9000006-rXXEIb44qovR7s880joybQ@public.gmane.org>
2007-02-27  7:08   ` Avi Kivity
     [not found]     ` <45E3D902.7000102-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-03-01 21:48       ` Aurelien Jarno
     [not found]         ` <20070301214843.GA28822-pck4HO7xIi+4mUWUGf39/V6hYfS7NtTn@public.gmane.org>
2007-03-03  8:01           ` Avi Kivity
     [not found]             ` <45E92B4D.8030501-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-03-07 14:33               ` Aurelien Jarno
     [not found]                 ` <45EECD2D.20209-rXXEIb44qovR7s880joybQ@public.gmane.org>
2007-03-07 14:34                   ` Avi Kivity
     [not found]                     ` <45EECD5A.5090801-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-03-07 17:47                       ` Aurelien Jarno
     [not found]                         ` <20070307174737.GA8340-WMRsAYcELcC4mUWUGf39/V6hYfS7NtTn@public.gmane.org>
2007-03-07 18:04                           ` Avi Kivity
     [not found]                             ` <45EEFEB3.1090809-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-03-07 23:52                               ` Aurelien Jarno
     [not found]                                 ` <45EF5039.4010907-rXXEIb44qovR7s880joybQ@public.gmane.org>
2007-03-08 15:12                                   ` Avi Kivity
     [not found]                                     ` <45F027D8.9070001-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-03-08 17:32                                       ` Aurelien Jarno
     [not found]                                         ` <45F048C8.6060406-rXXEIb44qovR7s880joybQ@public.gmane.org>
2007-03-08 17:35                                           ` Avi Kivity
     [not found]                                             ` <45F04966.7030307-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-03-08 19:39                                               ` Aurelien Jarno

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.