Re: [SeaBIOS] [Qemu-devel][PATCH] SeaBios: Fix reset procedure reentrancy problem on qemu-kvm platform

2015-11-03 Thread Gonglei
Ccing Seabios community. On 2015/11/3 14:58, Xulei (Stone, Euler) wrote: > On qemu-kvm platform, when I reset a VM through "virsh reset", and > coincidently > the VM is in process of internal rebooting at the same time. Then the VM will > not be successfully reseted any more due to the reset reen

Re: [SeaBIOS] [Qemu-devel] [PATCH] SeaBios: Fix reset procedure reentrancy problem on qemu-kvm platform

2015-11-04 Thread Kevin O'Connor
On Wed, Nov 04, 2015 at 08:48:20AM +0800, Gonglei wrote: > On 2015/11/3 14:58, Xulei (Stone, Euler) wrote: > > On qemu-kvm platform, when I reset a VM through "virsh reset", and > > coincidently > > the VM is in process of internal rebooting at the same time. Then the VM > > will > > not be succe

Re: [SeaBIOS] [Qemu-devel] [PATCH] SeaBios: Fix reset procedure reentrancy problem on qemu-kvm platform

2015-11-06 Thread Xulei (Stone)
>On Wed, Nov 04, 2015 at 08:48:20AM +0800, Gonglei wrote: >> On 2015/11/3 14:58, Xulei (Stone, Euler) wrote: >> > On qemu-kvm platform, when I reset a VM through "virsh reset", and >> > coincidently >> > the VM is in process of internal rebooting at the same time. Then the VM >> > will >> > not

Re: [SeaBIOS] [Qemu-devel] [PATCH] SeaBios: Fix reset procedure reentrancy problem on qemu-kvm platform

2015-11-09 Thread Kevin O'Connor
On Fri, Nov 06, 2015 at 09:12:34AM +, Xulei (Stone) wrote: > > >On Wed, Nov 04, 2015 at 08:48:20AM +0800, Gonglei wrote: > >> On 2015/11/3 14:58, Xulei (Stone, Euler) wrote: > >> > On qemu-kvm platform, when I reset a VM through "virsh reset", and > >> > coincidently > >> > the VM is in proce

Re: [SeaBIOS] [Qemu-devel] [PATCH] SeaBios: Fix reset procedure reentrancy problem on qemu-kvm platform

2015-11-09 Thread Kevin O'Connor
On Mon, Nov 09, 2015 at 08:32:53AM -0500, Kevin O'Connor wrote: > On Fri, Nov 06, 2015 at 09:12:34AM +, Xulei (Stone) wrote: > > >On Wed, Nov 04, 2015 at 08:48:20AM +0800, Gonglei wrote: > > >I'm surprised you would see the above on a recent qemu/kvm though - as > > >on a newer KVM I think the

Re: [SeaBIOS] [Qemu-devel] [PATCH] SeaBios: Fix reset procedure reentrancy problem on qemu-kvm platform

2015-11-09 Thread Kevin O'Connor
On Mon, Nov 09, 2015 at 03:06:18PM -0500, Kevin O'Connor wrote: > On Mon, Nov 09, 2015 at 08:32:53AM -0500, Kevin O'Connor wrote: > > On Fri, Nov 06, 2015 at 09:12:34AM +, Xulei (Stone) wrote: > > > >On Wed, Nov 04, 2015 at 08:48:20AM +0800, Gonglei wrote: > > > >I'm surprised you would see the

Re: [SeaBIOS] [Qemu-devel] [PATCH] SeaBios: Fix reset procedure reentrancy problem on qemu-kvm platform

2015-11-18 Thread Xulei (Stone)
Dear Kevin, Sorry for delayed replying. This patch works for me well. Thanks a lot! Recently, I found another odd thing. A qemu-kvm VM is stuck at the SeaBIOS after self-rebooting many times. Analyzing the SeaBIOS log attached below, I think there maybe someting wrong from this block of code: /

Re: [SeaBIOS] [Qemu-devel] [PATCH] SeaBios: Fix reset procedure reentrancy problem on qemu-kvm platform

2015-11-19 Thread Xulei (Stone)
Kevin, After deeply analyzing, i think there may be 3 possible reasons: 1)wrong CountCPUs value. It seems CountCPUs++ in handle_smp() has no lock to protect. So, sometimes, 2 or more vcpu may get the same current value of CountCPUs. Then we'll get a single incrementation instead of 2 or more and

Re: [SeaBIOS] [Qemu-devel] [PATCH] SeaBios: Fix reset procedure reentrancy problem on qemu-kvm platform

2015-11-19 Thread Kevin O'Connor
On Thu, Nov 19, 2015 at 12:42:50PM +, Xulei (Stone) wrote: > Kevin, > > After deeply analyzing, i think there may be 3 possible reasons: > 1)wrong CountCPUs value. It seems CountCPUs++ in handle_smp() has no > lock to protect. So, sometimes, 2 or more vcpu may get the same > current value of

Re: [SeaBIOS] [Qemu-devel] [PATCH] SeaBios: Fix reset procedure reentrancy problem on qemu-kvm platform

2015-11-19 Thread Xulei (Stone)
>On Thu, Nov 19, 2015 at 12:42:50PM +, Xulei (Stone) wrote: >> Kevin, >> >> After deeply analyzing, i think there may be 3 possible reasons: >> 1)wrong CountCPUs value. It seems CountCPUs++ in handle_smp() has no >> lock to protect. So, sometimes, 2 or more vcpu may get the same >> current

Re: [SeaBIOS] [Qemu-devel] [PATCH] SeaBios: Fix reset procedure reentrancy problem on qemu-kvm platform

2015-12-18 Thread Kevin O'Connor
On Fri, Dec 18, 2015 at 03:04:58AM +, Gonglei (Arei) wrote: > Hi Kevin & Paolo, > > Luckily, I reproduced this problem last night. And I got the below log when > SeaBIOS is stuck. [...] > [2015-12-18 10:38:10] gonglei: finish while [...] > <...>-31509 [035] 154753.180077: kvm_exit: reason

Re: [SeaBIOS] [Qemu-devel] [PATCH] SeaBios: Fix reset procedure reentrancy problem on qemu-kvm platform

2015-12-18 Thread Gonglei (Arei)
Hi Kevin & Paolo, Luckily, I reproduced this problem last night. And I got the below log when SeaBIOS is stuck. [BTW, the whole SeaBIOS log attached] [2015-12-18 10:38:10] >gonglei: enter smp_setup()... [2015-12-18 10:38:10] >gonglei: begine to enable local APIC... [2015-12-18 10:38:10]

Re: [SeaBIOS] [Qemu-devel] [PATCH] SeaBios: Fix reset procedure reentrancy problem on qemu-kvm platform

2015-12-18 Thread Gonglei (Arei)
> > From: Kevin O'Connor [mailto:ke...@koconnor.net] > Sent: Saturday, December 19, 2015 7:13 AM > To: Gonglei (Arei) > Cc: Xulei (Stone); Paolo Bonzini; qemu-devel; seabios@seabios.org; > Huangweidong (C); k...@vger.kernel.org > Subject: Re: [Qemu-devel] [PATCH] SeaBios: Fix reset procedure reentr

Re: [SeaBIOS] [Qemu-devel] [PATCH] SeaBios: Fix reset procedure reentrancy problem on qemu-kvm platform

2015-12-19 Thread Gonglei (Arei)
Hi Kevin, > -Original Message- > From: Kevin O'Connor [mailto:ke...@koconnor.net] > > On Fri, Dec 18, 2015 at 03:04:58AM +, Gonglei (Arei) wrote: > > Hi Kevin & Paolo, > > > > Luckily, I reproduced this problem last night. And I got the below log when > SeaBIOS is stuck. > [...] > >

Re: [SeaBIOS] [Qemu-devel] [PATCH] SeaBios: Fix reset procedure reentrancy problem on qemu-kvm platform

2015-12-19 Thread Kevin O'Connor
On Sat, Dec 19, 2015 at 12:03:15PM +, Gonglei (Arei) wrote: > Maybe the root cause is not NMI but INTR, so yield() can open hardware > interrupt, > And then execute interrupt handler, but the interrupt handler make the SeaBIOS > stack broken, so that the BSP can't execute the instruction and o

Re: [SeaBIOS] [Qemu-devel] [PATCH] SeaBios: Fix reset procedure reentrancy problem on qemu-kvm platform

2015-12-20 Thread Gonglei (Arei)
> -Original Message- > From: Kevin O'Connor [mailto:ke...@koconnor.net] > Sent: Saturday, December 19, 2015 11:12 PM > On Sat, Dec 19, 2015 at 12:03:15PM +, Gonglei (Arei) wrote: > > Maybe the root cause is not NMI but INTR, so yield() can open hardware > interrupt, > > And then execut

Re: [SeaBIOS] [Qemu-devel] [PATCH] SeaBios: Fix reset procedure reentrancy problem on qemu-kvm platform

2015-12-20 Thread Kevin O'Connor
On Sun, Dec 20, 2015 at 09:49:54AM +, Gonglei (Arei) wrote: > > From: Kevin O'Connor [mailto:ke...@koconnor.net] > > Sent: Saturday, December 19, 2015 11:12 PM > > On Sat, Dec 19, 2015 at 12:03:15PM +, Gonglei (Arei) wrote: > > > Maybe the root cause is not NMI but INTR, so yield() can open

Re: [SeaBIOS] [Qemu-devel] [PATCH] SeaBios: Fix reset procedure reentrancy problem on qemu-kvm platform

2015-12-21 Thread Gonglei (Arei)
Dear Kevin, > -Original Message- > From: Kevin O'Connor [mailto:ke...@koconnor.net] > Sent: Sunday, December 20, 2015 10:33 PM > To: Gonglei (Arei) > Cc: Xulei (Stone); Paolo Bonzini; qemu-devel; seabios@seabios.org; > Huangweidong (C); k...@vger.kernel.org; Radim Krcmar > Subject: Re: [Qe

Re: [SeaBIOS] [Qemu-devel] [PATCH] SeaBios: Fix reset procedure reentrancy problem on qemu-kvm platform

2015-12-21 Thread Kevin O'Connor
On Mon, Dec 21, 2015 at 09:41:32AM +, Gonglei (Arei) wrote: > When the gurb of OS is booting, then the softirq and C function send_disk_op() > may use extra stack of SeaBIOS. If we inject a NMI, romlayout.S: > irqentry_extrastack > is invoked, and the extra stack will be used again. And the st

Re: [SeaBIOS] [Qemu-devel] [PATCH] SeaBios: Fix reset procedure reentrancy problem on qemu-kvm platform

2015-12-21 Thread Gonglei (Arei)
> -Original Message- > From: Kevin O'Connor [mailto:ke...@koconnor.net] > Sent: Tuesday, December 22, 2015 2:47 AM > To: Gonglei (Arei) > Cc: Xulei (Stone); Paolo Bonzini; qemu-devel; seabios@seabios.org; > Huangweidong (C); k...@vger.kernel.org; Radim Krcmar > Subject: Re: [Qemu-devel] [PA

Re: [SeaBIOS] [Qemu-devel] [PATCH] SeaBios: Fix reset procedure reentrancy problem on qemu-kvm platform

2015-12-21 Thread Xulei (Stone)
Hi, Kevin, Can you tell how to reset/reboot this VM, if it goes to the handle_hwpic1() on its booting procedure? I mean, usually, SeaBIOS would not go to handle_hwpic routine. But in my test case, SeaBIOS calls handle_hwpic when KVM injects a #UD expcetion (not irq) and SeaBIOS will loop to handl

Re: [SeaBIOS] [Qemu-devel] [PATCH] SeaBios: Fix reset procedure reentrancy problem on qemu-kvm platform

2015-12-22 Thread Kevin O'Connor
On Tue, Dec 22, 2015 at 03:15:26AM +, Xulei (Stone) wrote: > Hi, Kevin, > Can you tell how to reset/reboot this VM, if it goes to the handle_hwpic1() > on its booting procedure? I mean, usually, SeaBIOS would not go to > handle_hwpic routine. But in my test case, SeaBIOS calls handle_hwpic whe

Re: [SeaBIOS] [Qemu-devel] [PATCH] SeaBios: Fix reset procedure reentrancy problem on qemu-kvm platform

2015-12-22 Thread Kevin O'Connor
On Tue, Dec 22, 2015 at 02:14:12AM +, Gonglei (Arei) wrote: > > From: Kevin O'Connor [mailto:ke...@koconnor.net] > > Sent: Tuesday, December 22, 2015 2:47 AM > > To: Gonglei (Arei) > > Cc: Xulei (Stone); Paolo Bonzini; qemu-devel; seabios@seabios.org; > > Huangweidong (C); k...@vger.kernel.org;

Re: [SeaBIOS] [Qemu-devel] [PATCH] SeaBios: Fix reset procedure reentrancy problem on qemu-kvm platform

2015-12-22 Thread Gonglei (Arei)
> -Original Message- > From: Kevin O'Connor [mailto:ke...@koconnor.net] > Sent: Tuesday, December 22, 2015 11:51 PM > To: Gonglei (Arei) > Cc: Xulei (Stone); Paolo Bonzini; qemu-devel; seabios@seabios.org; > Huangweidong (C); k...@vger.kernel.org; Radim Krcmar > Subject: Re: [Qemu-devel] [P

Re: [SeaBIOS] [Qemu-devel] [PATCH] SeaBios: Fix reset procedure reentrancy problem on qemu-kvm platform

2015-12-23 Thread Kevin O'Connor
On Wed, Dec 23, 2015 at 06:40:12AM +, Gonglei (Arei) wrote: > > From: Kevin O'Connor [mailto:ke...@koconnor.net] > > On Tue, Dec 22, 2015 at 02:14:12AM +, Gonglei (Arei) wrote: > > > Sorry, it doesn't work. What's worse is we cannot stop SeaBIOS stuck by > > > Setting "CONFIG_ENTRY_EXTRASTA

Re: [SeaBIOS] [Qemu-devel] [PATCH] SeaBios: Fix reset procedure reentrancy problem on qemu-kvm platform

2015-12-23 Thread Peter Stuge
Kevin O'Connor wrote: > SeaBIOS is careful to always disable IRQs while running C code to > prevent this issue, but disabling normal IRQs does not disable NMIs. > So, I believe this issue is specific to the nature of NMIs. Would a dedicated NMI handler stack be a good solution? //Peter

Re: [SeaBIOS] [Qemu-devel] [PATCH] SeaBios: Fix reset procedure reentrancy problem on qemu-kvm platform

2015-12-23 Thread Kevin O'Connor
On Wed, Dec 23, 2015 at 09:27:25PM +0100, Peter Stuge wrote: > Kevin O'Connor wrote: > > SeaBIOS is careful to always disable IRQs while running C code to > > prevent this issue, but disabling normal IRQs does not disable NMIs. > > So, I believe this issue is specific to the nature of NMIs. > > Wo