Bug 877930
| Summary: | Windows server 2012 guest system does not auto adjust time after resume from paused status | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 6 | Reporter: | Qunfang Zhang <qzhang> | ||||||||
| Component: | qemu-kvm | Assignee: | Gleb Natapov <gleb> | ||||||||
| Status: | CLOSED NOTABUG | QA Contact: | Virtualization Bugs <virt-bugs> | ||||||||
| Severity: | medium | Docs Contact: | |||||||||
| Priority: | medium | ||||||||||
| Version: | 6.4 | CC: | acathrow, areis, bsarathy, dyasny, fyang, gleb, juzhang, knoel, michen, mkenneth, mtosatti, virt-maint, xwei | ||||||||
| Target Milestone: | rc | ||||||||||
| Target Release: | --- | ||||||||||
| Hardware: | Unspecified | ||||||||||
| OS: | Unspecified | ||||||||||
| Whiteboard: | |||||||||||
| Fixed In Version: | Doc Type: | Bug Fix | |||||||||
| Doc Text: | Story Points: | --- | |||||||||
| Clone Of: | Environment: | ||||||||||
| Last Closed: | 2013-06-05 12:09:12 UTC | Type: | Bug | ||||||||
| Regression: | --- | Mount Type: | --- | ||||||||
| Documentation: | --- | CRM: | |||||||||
| Verified Versions: | Category: | --- | |||||||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||||||
| Embargoed: | |||||||||||
| Attachments: |
|
||||||||||
|
Description
Qunfang Zhang
2012-11-19 09:28:11 UTC
I suppose Win2k8-r2 is synchronizing the time via w32time. Can you check by 1. Enabling w32time logging with w32tm /debug /enable /file:C:logstimelog.txt /size:100000 /entries:0-300 2. stop wait 5 minutes 3. cont Then checking logstimelog.txt (attach it please) ? CCing Gleb. For a guarantee of proper time sync (without possibility of an application reading stale time), interaction with the guest is required (such as S3-suspend-before-stop and S3-resume-before-cont). (In reply to comment #2) > I suppose Win2k8-r2 is synchronizing the time via w32time. Can you check by > > 1. Enabling w32time logging with > > w32tm /debug /enable /file:C:logstimelog.txt /size:100000 /entries:0-300 > > 2. stop > wait 5 minutes > 3. cont > > Then checking logstimelog.txt (attach it please) ? > > CCing Gleb. > > For a guarantee of proper time sync (without possibility of an application > reading stale time), interaction with the guest is required (such as > S3-suspend-before-stop and S3-resume-before-cont). Hi, Marcelo I test with your step 1-3, but after that, the log file logstimelog.txt is empty, do you know what's the reason? I will check it as well. Thanks. (In reply to comment #2) > For a guarantee of proper time sync (without possibility of an application > reading stale time), interaction with the guest is required (such as > S3-suspend-before-stop and S3-resume-before-cont). With the given command line qemu supposed to reinject missed RTC interrupts untill time in a guest will catch up. Can you run ftrace just before cont? Created attachment 651742 [details]
ftrace log before cont
Created attachment 651759 [details]
ftrace just before cont guest
(In reply to comment #4) > (In reply to comment #2) > > For a guarantee of proper time sync (without possibility of an application > > reading stale time), interaction with the guest is required (such as > > S3-suspend-before-stop and S3-resume-before-cont). > > With the given command line qemu supposed to reinject missed RTC interrupts > untill time in a guest will catch up. Can you run ftrace just before cont? Hi, Gleb Please check the second log I upload in comment 6. I collect the log just before cont guest. The fist log is collected during the guest always stops. (In reply to comment #7) > (In reply to comment #4) > > (In reply to comment #2) > > > For a guarantee of proper time sync (without possibility of an application > > > reading stale time), interaction with the guest is required (such as > > > S3-suspend-before-stop and S3-resume-before-cont). > > > > With the given command line qemu supposed to reinject missed RTC interrupts > > untill time in a guest will catch up. Can you run ftrace just before cont? > > Hi, Gleb > Please check the second log I upload in comment 6. I collect the log just > before cont guest. The fist log is collected during the guest always stops. You should have traced KVM events "trace-cmd record -e kvm". Created attachment 651858 [details]
ftrace collected with trace-cmd
Does this happen with -smp 1? (In reply to comment #10) > Does this happen with -smp 1? Yup, this happens with -smp 1 as well. (In reply to comment #4) > (In reply to comment #2) > > For a guarantee of proper time sync (without possibility of an application > > reading stale time), interaction with the guest is required (such as > > S3-suspend-before-stop and S3-resume-before-cont). > > With the given command line qemu supposed to reinject missed RTC interrupts > untill time in a guest will catch up. Can you run ftrace just before cont? There's a limit on the number of reinjections per interrupt period. So reinjection is a "best attempt" kind of solution. There is no guarantee app will not see stale time. (In reply to comment #12) > (In reply to comment #4) > > (In reply to comment #2) > > > For a guarantee of proper time sync (without possibility of an application > > > reading stale time), interaction with the guest is required (such as > > > S3-suspend-before-stop and S3-resume-before-cont). > > > > With the given command line qemu supposed to reinject missed RTC interrupts > > untill time in a guest will catch up. Can you run ftrace just before cont? > > There's a limit on the number of reinjections per interrupt period. So > reinjection > is a "best attempt" kind of solution. There is no guarantee app will not see > stale time. The limit exists, but if not all interrupts are re-injected injection rate is increased, so eventually all lost ticks should be reinjected. And of course while reinjection happens guest will see incorrect time. Qunfang how long do you wait after continue and before checking time inside the guest? Is time in the guest still incorrect 1min after cont? 5min? (In reply to comment #13) > (In reply to comment #12) > > (In reply to comment #4) > > > (In reply to comment #2) > > > > For a guarantee of proper time sync (without possibility of an application > > > > reading stale time), interaction with the guest is required (such as > > > > S3-suspend-before-stop and S3-resume-before-cont). > > > > > > With the given command line qemu supposed to reinject missed RTC interrupts > > > untill time in a guest will catch up. Can you run ftrace just before cont? > > > > There's a limit on the number of reinjections per interrupt period. So > > reinjection > > is a "best attempt" kind of solution. There is no guarantee app will not see > > stale time. > > The limit exists, but if not all interrupts are re-injected injection rate > is increased, so eventually all lost ticks should be reinjected. And of > course while > reinjection happens guest will see incorrect time. Qunfang how long do you > wait > after continue and before checking time inside the guest? Is time in the > guest still incorrect 1min after cont? 5min? Gleb I checked again to cont guest after 1min, 3min and 5min, all can reproduce the issue. Moving to 6.5 as its not a customer report (also, assigned to Gleb). So starting from Windows2012 Windows no longer relies on number of injected RTC interrupts for time keeping. It reads PM timer on each time interrupt instead (hopefully it uses faster method if Hyper-V is available). This is actually more virtualization friendly. We can drop stupid RTC interrupt reinjections for Windows2012. The time drift is seen because "stop" monitor command also stops PM timer. We are not going to fix that since this is unsupported scenario. What I noticed though is that Windows2012 is not able to fix time drift if PM timer overflows while vcpu is not running. Currently QEMU emulates 24bit PM timer and it overflows every 4.6 seconds, we should fix it to be 32bit to make the problem impossible to hit on practice. |