qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v6 0/7] RTC: New logic to emulate RTC
@ 2012-05-17  2:28 Zhang, Yang Z
  2012-05-17 15:19 ` Paolo Bonzini
  0 siblings, 1 reply; 4+ messages in thread
From: Zhang, Yang Z @ 2012-05-17  2:28 UTC (permalink / raw)
  To: 'qemu-devel@nongnu.org'
  Cc: 'Paolo Bonzini', 'aliguori@us.ibm.com'

Changes in v6:
Rebase to latest QEMU
Fix a bug that fail to pass tests/rtc-test:
	In previous version, it uses host time as the base point to calculate guest RTC. It works when guest uses host based clock. But for vm and rt based clock, it's wrong. Because guest's clock may not synchronous with host. In current patch, it use rtc_clock as the reference point and successes to pass the testing.
Adapt paolo's suggestion to use more reasonable code for migration.

Changes in v5:
Rebase to latest head.
Add Checking of divider, because it also can stop the update.
Fixing some bugs.

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, especially when a userspace program is using the alarm and we cannot achieve any power saving. In this version, when the AF bit is cleared, we will set the timer to one second earlier before the alarm. With this changing, we can avoid the unnecessary timer and keep the sync between UF, AF and UIP. Please help to review the patch 6.

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

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 the Pkg C6 residency reduced 6% when running 64 idle guest.
The following patch stop the two periodic timer and only updating RTC clock when guest try to read it.
--- 
Yang Zhang (7):
	RTC: Remove the logic to update time format when DM bit changed
	RTC: Update the RTC clock only when reading it
	RTC: Add UIP(update in progress) check logic
	RTC: Set internal millisecond register to 500ms when reset divider
	RTC: Add RTC update-ended interrupt support
	RTC: Add alarm support
	RTC: Allow to migrate from old version

    hw/mc146818rtc.c |  617 ++++++++++++++++++++++++++++++++++++++++-------------
    1 files changed, 465 insertions(+), 152 deletions(-)

best regards
yang

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

* Re: [Qemu-devel] [PATCH v6 0/7] RTC: New logic to emulate RTC
  2012-05-17  2:28 [Qemu-devel] [PATCH v6 0/7] RTC: New logic to emulate RTC Zhang, Yang Z
@ 2012-05-17 15:19 ` Paolo Bonzini
  2012-05-17 23:59   ` Zhang, Yang Z
  0 siblings, 1 reply; 4+ messages in thread
From: Paolo Bonzini @ 2012-05-17 15:19 UTC (permalink / raw)
  To: Zhang, Yang Z
  Cc: 'aliguori@us.ibm.com', 'qemu-devel@nongnu.org'

Il 17/05/2012 04:28, Zhang, Yang Z ha scritto:
> Changes in v6:
> Rebase to latest QEMU
> Fix a bug that fail to pass tests/rtc-test:
> 	In previous version, it uses host time as the base point to calculate guest RTC. It works when guest uses host based clock. But for vm and rt based clock, it's wrong. Because guest's clock may not synchronous with host. In current patch, it use rtc_clock as the reference point and successes to pass the testing.
> Adapt paolo's suggestion to use more reasonable code for migration.

Nice work!

I've made my testcase even nastier and done the following changes:

* simplified the code to remove the double update timer.  The idea is
that if you can latch the update-in-progress flag 244us before the timer
expires in update_in_progress, instead of using a separate timer.

* improved bisectability by squashing some patches and separating others.

* changed the code to do all computation in nanoseconds

* simplified the handling of the offset (and I think also made it more
precise)

* added another corner case: the SET bit does not stop interrupts, while
divider reset does

The result is at git://github.com/bonzini/qemu.git in branch rtc-intel.
 You're welcome to give it a further shake, but IMO it's good to go for 1.2!

Paolo

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

* Re: [Qemu-devel] [PATCH v6 0/7] RTC: New logic to emulate RTC
  2012-05-17 15:19 ` Paolo Bonzini
@ 2012-05-17 23:59   ` Zhang, Yang Z
  2012-05-18  6:54     ` Paolo Bonzini
  0 siblings, 1 reply; 4+ messages in thread
From: Zhang, Yang Z @ 2012-05-17 23:59 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: 'aliguori@us.ibm.com', 'qemu-devel@nongnu.org'

> -----Original Message-----
> From: Paolo Bonzini [mailto:paolo.bonzini@gmail.com] On Behalf Of Paolo
> Bonzini
> Cc: 'qemu-devel@nongnu.org'; 'aliguori@us.ibm.com'
> Subject: Re: [PATCH v6 0/7] RTC: New logic to emulate RTC
> 
> Il 17/05/2012 04:28, Zhang, Yang Z ha scritto:
> > Changes in v6:
> > Rebase to latest QEMU
> > Fix a bug that fail to pass tests/rtc-test:
> > 	In previous version, it uses host time as the base point to calculate guest
> RTC. It works when guest uses host based clock. But for vm and rt based clock,
> it's wrong. Because guest's clock may not synchronous with host. In current
> patch, it use rtc_clock as the reference point and successes to pass the testing.
> > Adapt paolo's suggestion to use more reasonable code for migration.
> 
> Nice work!
> 
> I've made my testcase even nastier and done the following changes:
> 
> * simplified the code to remove the double update timer.  The idea is
> that if you can latch the update-in-progress flag 244us before the timer
> expires in update_in_progress, instead of using a separate timer.
> 
> * improved bisectability by squashing some patches and separating others.
> 
> * changed the code to do all computation in nanoseconds
> 
> * simplified the handling of the offset (and I think also made it more
> precise)
> 
> * added another corner case: the SET bit does not stop interrupts, while
> divider reset does
> 
> The result is at git://github.com/bonzini/qemu.git in branch rtc-intel.
>  You're welcome to give it a further shake, but IMO it's good to go for 1.2!

Thanks for reviewing it! It's ok for me. 
Will you pay effort to put it into 1.2? I will greatly appreciate it if you can do it.:)  

best regards
yang

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

* Re: [Qemu-devel] [PATCH v6 0/7] RTC: New logic to emulate RTC
  2012-05-17 23:59   ` Zhang, Yang Z
@ 2012-05-18  6:54     ` Paolo Bonzini
  0 siblings, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2012-05-18  6:54 UTC (permalink / raw)
  To: Zhang, Yang Z
  Cc: 'aliguori@us.ibm.com', 'qemu-devel@nongnu.org'

Il 18/05/2012 01:59, Zhang, Yang Z ha scritto:
> Thanks for reviewing it! It's ok for me. 
> Will you pay effort to put it into 1.2? I will greatly appreciate it if you can do it.:)  

Yes, I can do that.

Paolo

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

end of thread, other threads:[~2012-05-18  6:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-17  2:28 [Qemu-devel] [PATCH v6 0/7] RTC: New logic to emulate RTC Zhang, Yang Z
2012-05-17 15:19 ` Paolo Bonzini
2012-05-17 23:59   ` Zhang, Yang Z
2012-05-18  6:54     ` Paolo Bonzini

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