[PATCH 1/3]use int64 when compare two time

2012-01-05 Thread Zhang, Yang Z
use int64 when compare two time int32 only represent only 136 years when comparing two times based on second. It would be better to use int64. Signed-off-by: Yang Zhang diff --git a/qemu-common.h b/qemu-common.h index b2de015..c14f506 100644 --- a/qemu-common.h +++ b/qemu-common.h @@ -116,8 +1

[PATCH 0/3] remove the periodic RTC update timer

2012-01-05 Thread Zhang, Yang Z
Recently, I did some work for power optimization w/ KVM and I found there was a periodic timer from qemu which stop the platform from staying deep C state for a long period. After looking into the qemu code, there was a periodic RTC update timer which is the culprit. In current RTC emula

[PATCH 2/3] use gettimeofday() instead of time()

2012-01-05 Thread Zhang, Yang Z
use gettimeofday() instead of time(). Please refer the patch zero for the description. Signed-off-by: Yang Zhang diff --git a/vl.c b/vl.c index 01c5a9d..9a51047 100644 --- a/vl.c +++ b/vl.c @@ -438,8 +438,11 @@ void qemu_get_timedate(struct tm *tm, int64_t offset) { time_t ti; struct

[PATCH 3/3] stop the periodic RTC update timer

2012-01-05 Thread Zhang, Yang Z
change the RTC update logic to use host time with offset to calculate RTC clock. There have no need to use two periodic timers to maintain an internal timer for RTC clock update and alarm check. Instead, we calculate the real RTC time by the host time with an offset. For alarm and updated

RE: [PATCH 3/3] stop the periodic RTC update timer

2012-01-08 Thread Zhang, Yang Z
> -Original Message- > From: Jan Kiszka [mailto:jan.kis...@web.de] > Sent: Saturday, January 07, 2012 1:27 AM > However, not having looked at details yet, two things jumped at me: > - You cannot simply change the vmstate format without caring about >migration from older qemu versions.

RE: [Qemu-devel] [PATCH 1/3]use int64 when compare two time

2012-01-09 Thread Zhang, Yang Z
> -Original Message- > From: Andreas Färber [mailto:afaer...@suse.de] > Sent: Saturday, January 07, 2012 1:44 AM > > use int64 when compare two time > > > > int32 only represent only 136 years when comparing two times based on > second. It would be better to use int64. > > int32 and int64

RE: [PATCH 3/3] stop the periodic RTC update timer

2012-01-09 Thread Zhang, Yang Z
> -Original Message- > From: Paolo Bonzini [mailto:paolo.bonz...@gmail.com] On Behalf Of Paolo > Bonzini > Sent: Monday, January 09, 2012 4:19 PM > To: Zhang, Yang Z > Cc: qemu-de...@nongnu.org; a...@redhat.com; aligu...@us.ibm.com; Zhang, > Xiantao; Shan, Haitao

RE: [PATCH 3/3] stop the periodic RTC update timer

2012-01-10 Thread Zhang, Yang Z
> -Original Message- > From: Paolo Bonzini [mailto:pbonz...@redhat.com] > Sent: Tuesday, January 10, 2012 5:25 PM > >> Also, I'm not sure if the update in progress flag still works. > >> Clients are supposed to wait for UIP=0 before reading the RTC, and an > >> update is supposed to be at l

RE: [PATCH 3/3] stop the periodic RTC update timer

2012-01-11 Thread Zhang, Yang Z
> -Original Message- > From: Marcelo Tosatti [mailto:mtosa...@redhat.com] > > Regarding the UIP bit, a guest could read it in a loop and wait for the value > to > change. But you can emulate it in cmos_ioport_read by reading the host time, > that is, return 1 during 244us, 0 for remaining

RE: [PATCH 3/3] stop the periodic RTC update timer

2012-01-11 Thread Zhang, Yang Z
> -Original Message- > From: Paolo Bonzini [mailto:paolo.bonz...@gmail.com] On Behalf Of Paolo > Bonzini > Because it's not in the spec because some engineer thought it was cool. It not cool. We need to do some optimizations to get Better Performance. > It's in the spec because it gives y

RE: [PATCH 3/3] stop the periodic RTC update timer

2012-01-12 Thread Zhang, Yang Z
> -Original Message- > From: Marcelo Tosatti [mailto:mtosa...@redhat.com] > Sent: Thursday, January 12, 2012 6:03 PM > To: Zhang, Yang Z > Cc: qemu-de...@nongnu.org; a...@redhat.com; aligu...@us.ibm.com; Zhang, > Xiantao; Shan, Haitao; kvm@vger.kernel.org > Subject:

[PATCH v2 0/4] RTC: New logic to emulate RTC

2012-02-19 Thread Zhang, Yang Z
Changes in v2: Add UIP check logic. Add logic that next second tick will occur in exactly 500ms later after setting the clock Current RTC emulation uses periodic timer(2 timers per second) to update RTC clock. And it will stop CPU staying at deep C-state for long period. Our experience shows th

[PATCH v2 1/4] RTC: Update the RTC clock only when reading it

2012-02-19 Thread Zhang, Yang Z
There has no need to use two periodic timer to update RTC time. In this patch, we only update it when guest reading it. Signed-off-by: Yang Zhang --- hw/mc146818rtc.c | 199 +++--- 1 files changed, 56 insertions(+), 143 deletions(-) diff --git a

[PATCH v2 3/4] RTC:Add alarm support

2012-02-19 Thread Zhang, Yang Z
Use timer to emulate alarm. The timer is enabled when AIE is setting Signed-off-by: Yang Zhang --- hw/mc146818rtc.c | 187 ++ 1 files changed, 187 insertions(+), 0 deletions(-) diff --git a/hw/mc146818rtc.c b/hw/mc146818rtc.c index bb1873b..

[PATCH v2 2/4] RTC:Add RTC update-ended interrupt logic

2012-02-19 Thread Zhang, Yang Z
Use timer to emulate RTC update-ended interrupt. The timer is enabled only when UIE is setting. Signed-off-by: Yang Zhang --- hw/mc146818rtc.c | 53 - 1 files changed, 48 insertions(+), 5 deletions(-) diff --git a/hw/mc146818rtc.c b/hw/mc14

[PATCH v2 4/4] RTC:Add UIP(update in progress) check logic

2012-02-19 Thread Zhang, Yang Z
The UIP(update in progress) is set when RTC is updating. We only consider the normal oscillator(32Khz) mode. When time base is 32kHz, the update cycle takes 1984us at the end of every second. And the update cycle begins 244us later after UIP is set. So the UIP is set in 2228us at end of every seco

RE: [PATCH v2 2/4] RTC:Add RTC update-ended interrupt logic

2012-02-20 Thread Zhang, Yang Z
> -Original Message- > From: Paolo Bonzini [mailto:paolo.bonz...@gmail.com] On Behalf Of Paolo > Bonzini > Sent: Monday, February 20, 2012 3:38 PM > To: Zhang, Yang Z > Cc: qemu-de...@nongnu.org; Jan Kiszka; kvm@vger.kernel.org; > aligu...@us.ibm.com; Marcelo Tosatti

RE: [PATCH v2 0/4] RTC: New logic to emulate RTC

2012-02-20 Thread Zhang, Yang Z
> -Original Message- > From: Paolo Bonzini [mailto:paolo.bonz...@gmail.com] On Behalf Of Paolo > Bonzini > Sent: Monday, February 20, 2012 3:41 PM > > On 02/20/2012 01:24 AM, Zhang, Yang Z wrote: > > Changes in v2: > > Add UIP check logic. > > Add logic

RE: [PATCH v2 0/4] RTC: New logic to emulate RTC

2012-02-22 Thread Zhang, Yang Z
> -Original Message- > From: Paolo Bonzini [mailto:pbonz...@redhat.com] > Sent: Wednesday, February 22, 2012 7:19 PM > > 0) My alarm tests failed quite badly. :( I attach a patch for kvm-unit-tests > (repository at git://git.kernel.org/pub/scm/virt/kvm/kvm-unit-tests.git). > The tests can

RE: [PATCH v2 0/4] RTC: New logic to emulate RTC

2012-02-23 Thread Zhang, Yang Z
> -Original Message- > From: Paolo Bonzini [mailto:pbonz...@redhat.com] > Sent: Wednesday, February 22, 2012 7:19 PM > 0) My alarm tests failed quite badly. :( I attach a patch for kvm-unit-tests > (repository at git://git.kernel.org/pub/scm/virt/kvm/kvm-unit-tests.git). > The tests can be

[PATCH v3 0/7] RTC: New logic to emulate RTC

2012-03-01 Thread Zhang, Yang Z
Changes in v3: Rebase to latest head. Remove the logic to update time format when DM bit changed. Allow to migrate from old version. Solve the async when reading UF and UIP Changes in v2: Add UIP check logic. Add logic that next second tick will occur in exactly 500ms later after reset divider C

[PATCH v3 1/7] RTC: Remove the logic to update time format when DM bit changed

2012-03-01 Thread Zhang, Yang Z
Change DM(date mode) and 24/12 control bit don't affect the internal registers. It only indicates what format is using for those registers. So we don't need to update time format when it is modified. Signed-off-by: Yang Zhang --- hw/mc146818rtc.c | 10 +- 1 files changed, 1 insertions(

[PATCH v3 2/7] RTC: Update the RTC clock only when reading it

2012-03-01 Thread Zhang, Yang Z
There has no need to use two periodic timer to update RTC time. In this patch, we only update it when guest reading it. Signed-off-by: Yang Zhang --- hw/mc146818rtc.c | 207 +- 1 files changed, 66 insertions(+), 141 deletions(-) diff --git a/

[PATCH v3 3/7] RTC: Add UIP(update in progress) check logic

2012-03-01 Thread Zhang, Yang Z
The UIP(update in progress) is set when RTC is updating. And the update cycle begins 244us later after UIP is set. And it is cleared when update end. . Signed-off-by: Yang Zhang --- hw/mc146818rtc.c | 18 ++ 1 files changed, 18 insertions(+), 0 deletions(-) diff --git a/hw/mc

[PATCH v3 5/7] RTC:Add RTC update-ended interrupt support

2012-03-01 Thread Zhang, Yang Z
Use a timer to emulate update cycle. When update cycle ended and UIE is setting, then raise an interrupt. The timer runs only when UF or AF is cleared. Signed-off-by: Yang Zhang --- hw/mc146818rtc.c | 86 ++ 1 files changed, 80 insertions(

[PATCH v3 4/7] RTC: Set internal millisecond register to 500ms when reset divider

2012-03-01 Thread Zhang, Yang Z
The first update cycle begins one - half seconds later when divider reset is removing. Signed-off-by: Yang Zhang --- hw/mc146818rtc.c | 38 +- 1 files changed, 33 insertions(+), 5 deletions(-) diff --git a/hw/mc146818rtc.c b/hw/mc146818rtc.c index 6ebb8f6..

[PATCH v3 6/7] RTC:Add alarm support

2012-03-01 Thread Zhang, Yang Z
Add the alarm check when update cycle ended. If alarm is fired, also AIE bit is setting, then raise a interrupt Signed-off-by: Yang Zhang --- hw/mc146818rtc.c | 48 ++-- 1 files changed, 46 insertions(+), 2 deletions(-) diff --git a/hw/mc146818rtc.c

[PATCH v3 7/7] RTC:Allow to migrate from old version

2012-03-01 Thread Zhang, Yang Z
The new logic is compatible with old. So it should not block to migrate from old version. But new version cannot migrate to old. Signed-off-by: Yang Zhang --- hw/mc146818rtc.c | 48 1 files changed, 44 insertions(+), 4 deletions(-) diff --git a

RE: can't restore a guest saved by an older qemu

2012-03-02 Thread Zhang, Yang Z
After restoring i8254, the f->buf_index points to a wrong place. It should be caused by loading i8254. best regards yang > -Original Message- > From: kvm-ow...@vger.kernel.org [mailto:kvm-ow...@vger.kernel.org] On > Behalf Of Jan Kiszka > Sent: Friday, March 02, 2012 4:48 PM > To: Ren,

RE: [PATCH v3 5/7] RTC:Add RTC update-ended interrupt support

2012-03-02 Thread Zhang, Yang Z
> -Original Message- > From: Paolo Bonzini [mailto:paolo.bonz...@gmail.com] On Behalf Of Paolo > Bonzini > Sent: Friday, March 02, 2012 8:14 PM > To: Zhang, Yang Z > Cc: qemu-de...@nongnu.org; Jan Kiszka; kvm@vger.kernel.org; > aligu...@us.ibm.com; Marcelo Tosatti >

RE: [PATCH v3 1/7] RTC: Remove the logic to update time format when DM bit changed

2012-03-08 Thread Zhang, Yang Z
> -Original Message- > From: Marcelo Tosatti [mailto:mtosa...@redhat.com] > Sent: Friday, March 09, 2012 9:36 AM > > --- > > hw/mc146818rtc.c | 10 +- > > 1 files changed, 1 insertions(+), 9 deletions(-) > > > > diff --git a/hw/mc146818rtc.c b/hw/mc146818rtc.c > > index a46fdfc..

RE: [PATCH v3 1/7] RTC: Remove the logic to update time format when DM bit changed

2012-03-08 Thread Zhang, Yang Z
I think the better fixing is to update the cmos before reading the RTC. And in my patch, it will do it. best regards yang > -Original Message- > From: Zhang, Yang Z > Sent: Friday, March 09, 2012 9:54 AM > To: Marcelo Tosatti > Cc: qemu-de...@nongnu.org; Jan Kiszka; kvm@

RE: [PATCH v3 0/7] RTC: New logic to emulate RTC

2012-03-13 Thread Zhang, Yang Z
Is there any comments with the version 3? best regards yang > -Original Message- > From: Zhang, Yang Z > Sent: Friday, March 02, 2012 2:59 PM > To: qemu-de...@nongnu.org > Cc: Jan Kiszka; kvm@vger.kernel.org; kvm@vger.kernel.org; aligu...@us.ibm.com; > Paolo Bonzin

RE: [PATCH v3 0/7] RTC: New logic to emulate RTC

2012-03-14 Thread Zhang, Yang Z
> -Original Message- > From: Paolo Bonzini [mailto:pbonz...@redhat.com] > Sent: Wednesday, March 14, 2012 4:35 PM > To: Zhang, Yang Z > Cc: qemu-de...@nongnu.org; Jan Kiszka; kvm@vger.kernel.org; > aligu...@us.ibm.com; Marcelo Tosatti > Subject: Re: [PATCH v3 0/7] RTC:

RE: [PATCH v3 0/7] RTC: New logic to emulate RTC

2012-03-14 Thread Zhang, Yang Z
> -Original Message- > From: Paolo Bonzini [mailto:pbonz...@redhat.com] > Sent: Wednesday, March 14, 2012 4:54 PM > To: Zhang, Yang Z > Cc: qemu-de...@nongnu.org; Jan Kiszka; kvm@vger.kernel.org; > aligu...@us.ibm.com; Marcelo Tosatti > Subject: Re: [PATCH v3 0/7] RTC:

[PATCH v4 0/7] RTC: New logic to emulate RTC

2012-03-18 Thread Zhang, Yang Z
Changes in v4: Rebase to latest head. Changing in patch 6: Set the timer to one second earlier before target alarm when AF bit is clear. In version 3, in order to solve the async between UF, AF and UIP, the timer will keep running when UF or AF are clear. This is a little ugly, especial

[PATCH v4 1/7] RTC: Remove the logic to update time format when DM bit changed

2012-03-18 Thread Zhang, Yang Z
Change DM(date mode) and 24/12 control bit don't affect the internal registers. It only indicates what format is using for those registers. So we don't need to update time format when it is modified. Signed-off-by: Yang Zhang --- hw/mc146818rtc.c | 10 +- 1 files changed, 1 insertion

[PATCH v4 2/7] RTC: Update the RTC clock only when reading it

2012-03-18 Thread Zhang, Yang Z
There has no need to use two periodic timer to update RTC time. In this patch, we only update it when guest reading it. Signed-off-by: Yang Zhang --- hw/mc146818rtc.c | 207 +- 1 files changed, 66 insertions(+), 141 deletions(-) diff --git a

[PATCH v4 3/7] RTC: Add UIP(update in progress) check logic

2012-03-18 Thread Zhang, Yang Z
The UIP(update in progress) is set when RTC is updating. And the update cycle begins 244us later after UIP is set. And it is cleared when update end. Signed-off-by: Yang Zhang --- hw/mc146818rtc.c | 18 ++ 1 files changed, 18 insertions(+), 0 deletions(-) diff --git a/hw/mc14

[PATCH v4 4/7] RTC: Set internal millisecond register to 500ms when reset divider

2012-03-18 Thread Zhang, Yang Z
The first update cycle begins one - half seconds later when divider reset is removing. Signed-off-by: Yang Zhang --- hw/mc146818rtc.c | 38 +- 1 files changed, 33 insertions(+), 5 deletions(-) diff --git a/hw/mc146818rtc.c b/hw/mc146818rtc.c index 6ebb8f6.

[PATCH v4 5/7] RTC:Add RTC update-ended interrupt support

2012-03-18 Thread Zhang, Yang Z
Use a timer to emulate update cycle. When update cycle ended and UIE is setting, then raise an interrupt. The timer runs only when UF or AF is cleared. Signed-off-by: Yang Zhang --- hw/mc146818rtc.c | 86 ++ 1 files changed, 80 insertions(+)

[PATCH v4 6/7] RTC:Add alarm support

2012-03-18 Thread Zhang, Yang Z
Changing in this patch: Set the timer to one second earlier before target alarm when AF bit is clear. In version 3, in order to solve the async between UF, AF and UIP, the timer will keep running when UF or AF are clear. This is a little ugly, especially when a userspace program is usin

[PATCH v4 7/7] RTC:Allow to migrate from old version

2012-03-18 Thread Zhang, Yang Z
The new logic is compatible with old. So it should not block migrate from old version. But new version cannot migrate to old. Signed-off-by: Yang Zhang --- hw/mc146818rtc.c | 48 1 files changed, 44 insertions(+), 4 deletions(-) diff --git a/h

RE: [Qemu-devel] [PATCH v4 1/7] RTC: Remove the logic to update time format when DM bit changed

2012-03-20 Thread Zhang, Yang Z
> -Original Message- > From: Stefano Stabellini [mailto:stefano.stabell...@eu.citrix.com] > Sent: Tuesday, March 20, 2012 10:05 PM > To: Zhang, Yang Z > Cc: qemu-de...@nongnu.org; Paolo Bonzini; aligu...@us.ibm.com; > kvm@vger.kernel.org > Subject: Re: [Qemu-deve

RE: [Qemu-devel] [PATCH v4 4/7] RTC: Set internal millisecond register to 500ms when reset divider

2012-03-21 Thread Zhang, Yang Z
> -Original Message- > From: Stefano Stabellini [mailto:stefano.stabell...@eu.citrix.com] > Sent: Wednesday, March 21, 2012 1:39 AM > To: Zhang, Yang Z > Cc: qemu-de...@nongnu.org; Paolo Bonzini; aligu...@us.ibm.com; > kvm@vger.kernel.org > Subject: Re: [Qemu-devel] [P

RE: [Qemu-devel] [PATCH v4 2/7] RTC: Update the RTC clock only when reading it

2012-03-21 Thread Zhang, Yang Z
> -Original Message- > From: Stefano Stabellini [mailto:stefano.stabell...@eu.citrix.com] > Sent: Tuesday, March 20, 2012 10:16 PM > To: Zhang, Yang Z > Cc: qemu-de...@nongnu.org; Paolo Bonzini; aligu...@us.ibm.com; > kvm@vger.kernel.org > Subject: Re: [Qemu-deve

RE: [Qemu-devel] [PATCH v4 5/7] RTC:Add RTC update-ended interrupt support

2012-03-21 Thread Zhang, Yang Z
> -Original Message- > From: Stefano Stabellini [mailto:stefano.stabell...@eu.citrix.com] > Sent: Wednesday, March 21, 2012 2:04 AM > > On Mon, 19 Mar 2012, Zhang, Yang Z wrote: > > Use a timer to emulate update cycle. When update cycle ended and UIE is > setting,

RE: [PATCH v4 0/7] RTC: New logic to emulate RTC

2012-03-21 Thread Zhang, Yang Z
> -Original Message- > From: Paolo Bonzini [mailto:pbonz...@redhat.com] > I attach a patch that fixes some problems with divider reset and in > general simplifies the logic. Even with the patch, however, I still see > failures in my test case unfortunately. Probably there are rounding > e

RE: [PATCH v4 0/7] RTC: New logic to emulate RTC

2012-03-21 Thread Zhang, Yang Z
-Original Message- > From: Paolo Bonzini [mailto:pbonz...@redhat.com] > > Il 22/03/2012 01:23, Zhang, Yang Z ha scritto: > > Actually, I also see some failures during testing. And most of them > > are fail to pass the 244us update cycle checking. Since we are in >

RE: [PATCH v4 0/7] RTC: New logic to emulate RTC

2012-03-21 Thread Zhang, Yang Z
> -Original Message- > From: Paolo Bonzini [mailto:pbonz...@redhat.com] > Sent: Thursday, March 22, 2012 11:05 AM > To: Zhang, Yang Z > Cc: qemu-de...@nongnu.org; aligu...@us.ibm.com; kvm@vger.kernel.org > Subject: Re: [PATCH v4 0/7] RTC: New logic to emulate RTC >

RE: [PATCH v3] KVM: VMX: enable acknowledge interupt on vmexit

2013-01-28 Thread Zhang, Yang Z
Gleb Natapov wrote on 2013-01-28: > On Mon, Jan 28, 2013 at 08:54:07AM +0800, Yang Zhang wrote: >> From: Yang Zhang >> >> The "acknowledge interrupt on exit" feature controls processor behavior >> for external interrupt acknowledgement. When this control is set, the >> processor acknowledges the

RE: [PATCH v3] KVM: VMX: enable acknowledge interupt on vmexit

2013-01-28 Thread Zhang, Yang Z
Gleb Natapov wrote on 2013-01-28: > On Mon, Jan 28, 2013 at 08:54:07AM +0800, Yang Zhang wrote: >> From: Yang Zhang >> >> The "acknowledge interrupt on exit" feature controls processor behavior >> for external interrupt acknowledgement. When this control is set, the >> processor acknowledges the

RE: [PATCH v4] KVM: VMX: enable acknowledge interupt on vmexit

2013-01-30 Thread Zhang, Yang Z
Gleb Natapov wrote on 2013-01-30: > On Wed, Jan 30, 2013 at 08:36:12PM +0800, Yang Zhang wrote: >> From: Yang Zhang >> >> The "acknowledge interrupt on exit" feature controls processor behavior >> for external interrupt acknowledgement. When this control is set, the >> processor acknowledges the

RE: [PATCH 2/2] x86, apicv: Add Posted Interrupt supporting

2013-02-04 Thread Zhang, Yang Z
Sorry for the late response. Marcelo Tosatti wrote on 2013-02-04: > On Thu, Jan 31, 2013 at 03:55:56PM +0200, Gleb Natapov wrote: >> On Thu, Jan 31, 2013 at 11:44:43AM -0200, Marcelo Tosatti wrote: >>> On Thu, Jan 31, 2013 at 03:38:37PM +0200, Gleb Natapov wrote: On Thu, Jan 31, 2013 at 11:32

RE: [PATCH 2/2] x86, apicv: Add Posted Interrupt supporting

2013-02-04 Thread Zhang, Yang Z
This patch is too old. Some issues you point out already fixed in v2 patch. Please review v2 patch and give some comments. Gleb Natapov wrote on 2013-01-31: > On Thu, Dec 13, 2012 at 03:29:40PM +0800, Yang Zhang wrote: >> From: Yang Zhang >> >> Posted Interrupt allows APIC interrupts to inject i

RE: [PATCH v2 2/2] KVM: VMX: Add Posted Interrupt supporting

2013-02-04 Thread Zhang, Yang Z
Gleb Natapov wrote on 2013-02-04: > On Mon, Feb 04, 2013 at 05:05:14PM +0800, Yang Zhang wrote: >> From: Yang Zhang >> >> Posted Interrupt allows APIC interrupts to inject into guest directly >> without any vmexit. >> >> - When delivering a interrupt to guest, if target vcpu is running, >> upd

RE: [PATCH 2/2] x86, apicv: Add Posted Interrupt supporting

2013-02-04 Thread Zhang, Yang Z
Marcelo Tosatti wrote on 2013-02-05: > On Mon, Feb 04, 2013 at 05:59:52PM -0200, Marcelo Tosatti wrote: >> On Mon, Feb 04, 2013 at 07:13:01PM +0200, Gleb Natapov wrote: >>> On Mon, Feb 04, 2013 at 12:43:45PM -0200, Marcelo Tosatti wrote: >> Any example how software relies on such > two-interrup

RE: [PATCH 2/2] x86, apicv: Add Posted Interrupt supporting

2013-02-05 Thread Zhang, Yang Z
Gleb Natapov wrote on 2013-02-05: > On Tue, Feb 05, 2013 at 05:57:14AM +0000, Zhang, Yang Z wrote: >> Marcelo Tosatti wrote on 2013-02-05: >>> On Mon, Feb 04, 2013 at 05:59:52PM -0200, Marcelo Tosatti wrote: >>>> On Mon, Feb 04, 2013 at 07:13:01PM +0200, Gleb Natap

RE: [PATCH 2/2] x86, apicv: Add Posted Interrupt supporting

2013-02-05 Thread Zhang, Yang Z
Gleb Natapov wrote on 2013-02-05: > On Tue, Feb 05, 2013 at 10:35:55AM +0000, Zhang, Yang Z wrote: >> Gleb Natapov wrote on 2013-02-05: >>> On Tue, Feb 05, 2013 at 05:57:14AM +0000, Zhang, Yang Z wrote: >>>> Marcelo Tosatti wrote on 2013-02-05: >>>>

RE: [PATCH 2/2] x86, apicv: Add Posted Interrupt supporting

2013-02-05 Thread Zhang, Yang Z
Gleb Natapov wrote on 2013-02-05: > On Tue, Feb 05, 2013 at 10:58:28AM +0000, Zhang, Yang Z wrote: >> Gleb Natapov wrote on 2013-02-05: >>> On Tue, Feb 05, 2013 at 10:35:55AM +0000, Zhang, Yang Z wrote: >>>> Gleb Natapov wrote on 2013-02-05: >>>>> On

RE: [PATCH 2/2] x86, apicv: Add Posted Interrupt supporting

2013-02-05 Thread Zhang, Yang Z
Gleb Natapov wrote on 2013-02-05: > On Tue, Feb 05, 2013 at 01:26:42PM +0000, Zhang, Yang Z wrote: >> Gleb Natapov wrote on 2013-02-05: >>> On Tue, Feb 05, 2013 at 10:58:28AM +0000, Zhang, Yang Z wrote: >>>> Gleb Natapov wrote on 2013-02-05: >>>>> On

RE: [PATCH v3 1/2] KVM: VMX: enable acknowledge interupt on vmexit

2013-02-19 Thread Zhang, Yang Z
Avi Kivity wrote on 2013-02-20: > On Tue, Feb 19, 2013 at 3:39 PM, Yang Zhang wrote: >> From: Yang Zhang >> >> The "acknowledge interrupt on exit" feature controls processor behavior >> for external interrupt acknowledgement. When this control is set, the >> processor acknowledges the interrupt

RE: [PATCH v3 1/2] KVM: VMX: enable acknowledge interupt on vmexit

2013-02-20 Thread Zhang, Yang Z
Gleb Natapov wrote on 2013-02-20: > On Wed, Feb 20, 2013 at 02:46:05AM +0000, Zhang, Yang Z wrote: >> Avi Kivity wrote on 2013-02-20: >>> On Tue, Feb 19, 2013 at 3:39 PM, Yang Zhang > wrote: >>>> From: Yang Zhang >>>> >>>> The "ackn

RE: [PATCH v3 1/2] KVM: VMX: enable acknowledge interupt on vmexit

2013-02-20 Thread Zhang, Yang Z
Avi Kivity wrote on 2013-02-20: > On Wed, Feb 20, 2013 at 4:46 AM, Zhang, Yang Z > wrote: >>>> >>>> +static void vmx_handle_external_intr(struct kvm_vcpu *vcpu) +{ + >>>> u32 exit_intr_info = vmcs_read32(VM_EXIT_INTR_INFO); + + /* + >>>&g

RE: [PATCH v3 2/2] KVM: VMX: Add Posted Interrupt supporting

2013-02-20 Thread Zhang, Yang Z
Hi Marcelo, Can you help to review this patch? Many thanks if you can review it quickly. Zhang, Yang Z wrote on 2013-02-19: > From: Yang Zhang > > Posted Interrupt allows APIC interrupts to inject into guest directly > without any vmexit. > > - When delivering a interrupt t

RE: [PATCH v3 1/2] KVM: VMX: enable acknowledge interupt on vmexit

2013-02-21 Thread Zhang, Yang Z
Eric Northup wrote on 2013-02-21: > On Tue, Feb 19, 2013 at 6:46 PM, Zhang, Yang Z wrote: >> >> Avi Kivity wrote on 2013-02-20: >>> On Tue, Feb 19, 2013 at 3:39 PM, Yang Zhang >>> wrote: >>>> From: Yang Zhang >>>> >>>> Th

RE: [PATCH v3 1/2] KVM: VMX: enable acknowledge interupt on vmexit

2013-02-21 Thread Zhang, Yang Z
Avi Kivity wrote on 2013-02-20: > On Wed, Feb 20, 2013 at 3:10 PM, Zhang, Yang Z > wrote: >>>>> >>>>> push %%cs >>>> "push %%cs" is invalid in x86_64. >>> >>> Oops. 'push[lq] $__KERNEL_CS' then. >> Is th

RE: [PATCH v3 1/2] KVM: VMX: enable acknowledge interupt on vmexit

2013-02-21 Thread Zhang, Yang Z
Avi Kivity wrote on 2013-02-21: > On Thu, Feb 21, 2013 at 10:58 AM, Zhang, Yang Z > wrote: >> Thanks. Here is code after changing, please review it: >> >> asm( >> "mov %0, %%" _ASM_DX " \n\t" #ifdef >>

RE: [PATCH v4 2/2] KVM: VMX: Add Posted Interrupt supporting

2013-02-23 Thread Zhang, Yang Z
Marcelo Tosatti wrote on 2013-02-23: > > On Fri, Feb 22, 2013 at 09:42:32PM +0800, Yang Zhang wrote: >> From: Yang Zhang >> >> Posted Interrupt allows APIC interrupts to inject into guest directly >> without any vmexit. >> >> - When delivering a interrupt to guest, if target vcpu is running, >>

RE: [PATCH v4 2/2] KVM: VMX: Add Posted Interrupt supporting

2013-02-23 Thread Zhang, Yang Z
Marcelo Tosatti wrote on 2013-02-23: > On Sat, Feb 23, 2013 at 02:05:28PM +0000, Zhang, Yang Z wrote: >> Marcelo Tosatti wrote on 2013-02-23: >>> >>> On Fri, Feb 22, 2013 at 09:42:32PM +0800, Yang Zhang wrote: >>>> From: Yang Zhang >>>> >

RE: [PATCH v4 2/2] KVM: VMX: Add Posted Interrupt supporting

2013-02-24 Thread Zhang, Yang Z
Marcelo Tosatti wrote on 2013-02-24: > On Sat, Feb 23, 2013 at 03:16:11PM +0000, Zhang, Yang Z wrote: >> Marcelo Tosatti wrote on 2013-02-23: >>> On Sat, Feb 23, 2013 at 02:05:28PM +0000, Zhang, Yang Z wrote: >>>> Marcelo Tosatti wrote on 2013-02-23: >>>>&

RE: [PATCH v4 2/2] KVM: VMX: Add Posted Interrupt supporting

2013-02-24 Thread Zhang, Yang Z
Gleb Natapov wrote on 2013-02-24: > On Sat, Feb 23, 2013 at 02:05:13PM -0300, Marcelo Tosatti wrote: >> On Sat, Feb 23, 2013 at 05:31:44PM +0200, Gleb Natapov wrote: >>> On Sat, Feb 23, 2013 at 11:48:54AM -0300, Marcelo Tosatti wrote: >>> 1. orig_irr = read irr from vapic page >>> 2. if (or

RE: [PATCH v4 2/2] KVM: VMX: Add Posted Interrupt supporting

2013-02-24 Thread Zhang, Yang Z
Gleb Natapov wrote on 2013-02-24: > On Sun, Feb 24, 2013 at 01:55:07PM +0000, Zhang, Yang Z wrote: >>> I do not think it fixes it. There is no guaranty that IPI will be >>> processed by remote cpu while sending cpu is still in locked section, so >>> the same race may

RE: [PATCH v4 2/2] KVM: VMX: Add Posted Interrupt supporting

2013-02-24 Thread Zhang, Yang Z
Marcelo Tosatti wrote on 2013-02-25: > On Sun, Feb 24, 2013 at 01:17:59PM +0000, Zhang, Yang Z wrote: >> Marcelo Tosatti wrote on 2013-02-24: >>> On Sat, Feb 23, 2013 at 03:16:11PM +0000, Zhang, Yang Z wrote: >>>> Marcelo Tosatti wrote on 2013-02-23: >>>>

RE: [PATCH v4 2/2] KVM: VMX: Add Posted Interrupt supporting

2013-02-24 Thread Zhang, Yang Z
Marcelo Tosatti wrote on 2013-02-25: > On Sun, Feb 24, 2013 at 01:55:07PM +0000, Zhang, Yang Z wrote: >>> contexts, but only two use locks. >> See following logic, I think the problem you mentioned will not >> happened with current logic. >> >> get lock >&

RE: [PATCH v4 2/2] KVM: VMX: Add Posted Interrupt supporting

2013-02-25 Thread Zhang, Yang Z
eb Natapov wrote: >>> On Sun, Feb 24, 2013 at 01:55:07PM +, Zhang, Yang Z wrote: >>>>> I do not think it fixes it. There is no guaranty that IPI will be >>>>> processed by remote cpu while sending cpu is still in locked section, so >>>>>

RE: [PATCH v4 2/2] KVM: VMX: Add Posted Interrupt supporting

2013-02-25 Thread Zhang, Yang Z
Gleb Natapov wrote on 2013-02-25: > On Mon, Feb 25, 2013 at 08:42:52AM +0000, Zhang, Yang Z wrote: >> Avi Kivity wrote on 2013-02-25: >>> I didn't really follow, but is the root cause the need to keep track >>> of interrupt coalescing? If so we can recommend that

RE: [PATCH v4 2/2] KVM: VMX: Add Posted Interrupt supporting

2013-02-25 Thread Zhang, Yang Z
Gleb Natapov wrote on 2013-02-25: > On Mon, Feb 25, 2013 at 11:04:25AM +0000, Zhang, Yang Z wrote: >> Gleb Natapov wrote on 2013-02-25: >>> On Mon, Feb 25, 2013 at 08:42:52AM +0000, Zhang, Yang Z wrote: >>>> Avi Kivity wrote on 2013-02-25: >>>>> I di

RE: [PATCH v4 2/2] KVM: VMX: Add Posted Interrupt supporting

2013-02-25 Thread Zhang, Yang Z
Marcelo Tosatti wrote on 2013-02-25: > On Mon, Feb 25, 2013 at 11:13:25AM +0000, Zhang, Yang Z wrote: >> Gleb Natapov wrote on 2013-02-25: >>> On Mon, Feb 25, 2013 at 11:04:25AM +0000, Zhang, Yang Z wrote: >>>> Gleb Natapov wrote on 2013-02-25: >>>>> On

RE: [PATCH v4 2/2] KVM: VMX: Add Posted Interrupt supporting

2013-02-25 Thread Zhang, Yang Z
Marcelo Tosatti wrote on 2013-02-25: > On Mon, Feb 25, 2013 at 06:55:58AM +0000, Zhang, Yang Z wrote: >>> >>> p1) >>> >>>>> cpu0 cpu1vcpu0 >>

RE: [PATCH] KVM: VMX: fix interrupt lost when enable virtual interrupt delivery

2013-02-26 Thread Zhang, Yang Z
Gleb Natapov wrote on 2013-02-26: > On Tue, Feb 26, 2013 at 08:34:16PM +0800, Yang Zhang wrote: >> From: Yang Zhang >> >> In the platform which supporing virtual interrupt delivery feature, >> hardware will clear vIRR atomatically when target vcpu is running. >> So software should not modify vIRR

RE: [Qemu-devel][PATCH 00/12] KVM Support for MIPS32 Processors

2013-03-03 Thread Zhang, Yang Z
Sanjay Lal wrote on 2013-03-02: > The following patchset implements KVM support for MIPS32 processors, > using Trap & Emulate, with basic runtime binary translation to improve > performance. > > In KVM mode, CPU virtualization is handled via the kvm kernel module, > while system and I/O virtualiza

RE: [PATCH v5 2/5] KVM: VMX: Register a new IPI for posted interrupt

2013-03-08 Thread Zhang, Yang Z
Ingo Molnar wrote on 2013-03-08: > > * Gleb Natapov wrote: > >> On Fri, Mar 08, 2013 at 02:26:25PM +0100, Ingo Molnar wrote: >>> >>> * Yang Zhang wrote: >>> diff --git a/arch/x86/kernel/irqinit.c b/arch/x86/kernel/irqinit.c index 6e03b0d..2329a54 100644 --- a/arch/x86/kernel/ir

RE: [PATCH v5 4/5] KVM: VMX: Add the algorithm of deliver posted interrupt

2013-03-08 Thread Zhang, Yang Z
Marcelo Tosatti wrote on 2013-03-09: > On Fri, Mar 08, 2013 at 09:23:20AM +0800, Yang Zhang wrote: >> From: Yang Zhang >> >> Only deliver the posted interrupt when target vcpu is running >> and there is no previous interrupt pending in pir. >> >> Signed-off-by: Yang Zhang >> >> +static bool vm

RE: [PATCH v5 5/5] KVM : VMX: Use posted interrupt to deliver virtual interrupt

2013-03-08 Thread Zhang, Yang Z
Marcelo Tosatti wrote on 2013-03-09: > On Fri, Mar 08, 2013 at 09:23:21AM +0800, Yang Zhang wrote: >> From: Yang Zhang >> >> If posted interrupt is avaliable, then uses it to inject virtual >> interrupt to guest. >> >> Signed-off-by: Yang Zhang >> --- >> arch/x86/kvm/irq.c |2 +- >> arch

RE: [PATCH v5 5/5] KVM : VMX: Use posted interrupt to deliver virtual interrupt

2013-03-11 Thread Zhang, Yang Z
Gleb Natapov wrote on 2013-03-11: > On Fri, Mar 08, 2013 at 09:23:21AM +0800, Yang Zhang wrote: >> From: Yang Zhang >> >> If posted interrupt is avaliable, then uses it to inject virtual >> interrupt to guest. >> >> Signed-off-by: Yang Zhang >> --- >> arch/x86/kvm/irq.c |2 +- >> arch/x8

RE: [PATCH v5 2/5] KVM: VMX: Register a new IPI for posted interrupt

2013-03-14 Thread Zhang, Yang Z
Ingo Molnar wrote on 2013-03-08: > > * Gleb Natapov wrote: > >> On Fri, Mar 08, 2013 at 03:05:45PM +0100, Ingo Molnar wrote: >>> >>> * Gleb Natapov wrote: >>> On Fri, Mar 08, 2013 at 02:26:25PM +0100, Ingo Molnar wrote: > > * Yang Zhang wrote: > >> diff --git a/arch/x8

RE: [PATCH 5/5] KVM: use eoi to track RTC interrupt delivery status

2013-03-17 Thread Zhang, Yang Z
Gleb Natapov wrote on 2013-03-17: > On Fri, Mar 15, 2013 at 04:05:00PM +0800, Yang Zhang wrote: >> From: Yang Zhang >> >> Current interrupt coalescing logci which only used by RTC has conflict >> with Posted Interrupt. >> This patch introduces a new mechinism to use eoi to track interrupt: >> Whe

RE: [PATCH v6 0/5] KVM: VMX: Add Posted Interrupt supporting

2013-03-17 Thread Zhang, Yang Z
Zhang, Yang Z wrote on 2013-03-15: > From: Yang Zhang > > The follwoing patches are adding the Posted Interrupt supporting to KVM: > The first patch enables the feature 'acknowledge interrupt on vmexit'.Since > it is required by Posted interrupt, we need to enable

RE: [PATCH v6 0/5] KVM: VMX: Add Posted Interrupt supporting

2013-03-18 Thread Zhang, Yang Z
Gleb Natapov wrote on 2013-03-18: > On Mon, Mar 18, 2013 at 02:49:25AM +0000, Zhang, Yang Z wrote: >> Zhang, Yang Z wrote on 2013-03-15: >>> From: Yang Zhang >>> >>> The follwoing patches are adding the Posted Interrupt supporting to KVM: >>> The

RE: [PATCH v2 4/8] KVM: Introduce struct rtc_status

2013-03-18 Thread Zhang, Yang Z
Gleb Natapov wrote on 2013-03-18: > On Mon, Mar 18, 2013 at 03:24:35PM +0800, Yang Zhang wrote: >> From: Yang Zhang >> >> Signed-off-by: Yang Zhang >> --- >> virt/kvm/ioapic.h |9 + >> 1 files changed, 9 insertions(+), 0 deletions(-) >> diff --git a/virt/kvm/ioapic.h b/virt/kvm/ioap

RE: [PATCH v2 5/8] KVM: Recalculate destination vcpu map

2013-03-18 Thread Zhang, Yang Z
Gleb Natapov wrote on 2013-03-18: > On Mon, Mar 18, 2013 at 03:24:36PM +0800, Yang Zhang wrote: >> From: Yang Zhang >> >> Update destination vcpu map when ioapic entry or apic(id, ldr, dfr) is >> changed >> >> Signed-off-by: Yang Zhang >> --- >> virt/kvm/ioapic.c | 38 ++

RE: [PATCH v2 8/8] KVM: Use eoi to track RTC interrupt delivery status

2013-03-18 Thread Zhang, Yang Z
Gleb Natapov wrote on 2013-03-18: > On Mon, Mar 18, 2013 at 03:24:39PM +0800, Yang Zhang wrote: >> From: Yang Zhang >> >> Current interrupt coalescing logci which only used by RTC has conflict >> with Posted Interrupt. >> This patch introduces a new mechinism to use eoi to track interrupt: >> Whe

RE: [PATCH v6 0/5] KVM: VMX: Add Posted Interrupt supporting

2013-03-18 Thread Zhang, Yang Z
Gleb Natapov wrote on 2013-03-18: > On Mon, Mar 18, 2013 at 10:43:16AM +0000, Zhang, Yang Z wrote: >>>> For TMR issue, since it has nothing to do with APICv, if we really need to > handle >>> it later, then we may need a separate patch to fix it. But currently, we ma

RE: [PATCH] KVM: Set TMR when programming ioapic entry

2013-03-18 Thread Zhang, Yang Z
Gleb Natapov wrote on 2013-03-18: > On Mon, Mar 18, 2013 at 07:42:22PM +0800, Yang Zhang wrote: >> From: Yang Zhang >> >> We already know the trigger mode of a given interrupt when programming >> the ioapice entry. So it's not necessary to set it in each interrupt >> delivery. >> > What this pat

RE: [PATCH] KVM: Set TMR when programming ioapic entry

2013-03-18 Thread Zhang, Yang Z
Gleb Natapov wrote on 2013-03-18: > On Mon, Mar 18, 2013 at 12:32:51PM +0000, Zhang, Yang Z wrote: >> Gleb Natapov wrote on 2013-03-18: >>> On Mon, Mar 18, 2013 at 07:42:22PM +0800, Yang Zhang wrote: >>>> From: Yang Zhang >>>> >>>> We a

RE: [PATCH v6 5/5] KVM : VMX: Use posted interrupt to deliver virtual interrupt

2013-03-19 Thread Zhang, Yang Z
Gleb Natapov wrote on 2013-03-19: > On Fri, Mar 15, 2013 at 09:31:11PM +0800, Yang Zhang wrote: >> From: Yang Zhang >> >> If posted interrupt is avaliable, then uses it to inject virtual >> interrupt to guest. >> >> Signed-off-by: Yang Zhang >> --- >> arch/x86/kvm/irq.c |3 ++- >> arch/x

RE: [PATCH v6 5/5] KVM : VMX: Use posted interrupt to deliver virtual interrupt

2013-03-19 Thread Zhang, Yang Z
Gleb Natapov wrote on 2013-03-19: > On Tue, Mar 19, 2013 at 12:11:47PM +0000, Zhang, Yang Z wrote: >> Gleb Natapov wrote on 2013-03-19: >>> On Fri, Mar 15, 2013 at 09:31:11PM +0800, Yang Zhang wrote: >>>> From: Yang Zhang >>>> >>>> If posted

RE: [PATCH v6 5/5] KVM : VMX: Use posted interrupt to deliver virtual interrupt

2013-03-19 Thread Zhang, Yang Z
Gleb Natapov wrote on 2013-03-19: > On Tue, Mar 19, 2013 at 12:42:01PM +0000, Zhang, Yang Z wrote: >>>>>> local_irq_disable(); >>>>>> +kvm_x86_ops->posted_intr_clear_on(vcpu); >>>>>> + >>>>> Why is this s

RE: [PATCH v2 6/8] KVM: Add reset/restore rtc_status support

2013-03-19 Thread Zhang, Yang Z
Marcelo Tosatti wrote on 2013-03-20: > On Mon, Mar 18, 2013 at 03:24:37PM +0800, Yang Zhang wrote: >> From: Yang Zhang >> >> reset/restore rtc_status when ioapic reset/restore. >> >> Signed-off-by: Yang Zhang >> --- >> arch/x86/kvm/lapic.c |8 >> arch/x86/kvm/lapic.h |1 + >>

  1   2   3   4   >