[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH]MC146818 RTC: Get correct guest time when irq co
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH]MC146818 RTC: Get correct guest time when irq coalesced |
Date: |
Mon, 26 Sep 2016 09:14:09 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 |
On 26/09/2016 06:37, address@hidden wrote:
> Hi, Paolo
> This is another patch arround RTC. Would you please have a review.
>
> ------------------separation-------------------------------------------------
>
> MC146818 RTC: Get correct guest time when irq coalesced
>
> When irq coalesce occurred, irq_coalesced actually store the seconds
> that the time sawn in guest lags behind real guest virtual time.
> At this time , if guest read cmos for virtual time, it shouldn't see
> those delayed seconds, so we must substract irq_coalesced from guest
> virtual time. Otherwise, after seconds queued in irq_coalesced applied
> to guest, time in guest will go ahead of time it should be.
No, it's not seconds. It depends on the interval of the periodic interrupt.
In any case this approach is not acceptable, unfortunately; it causes
the time to go backwards for the guest as soon as an interrupt is coalesced.
What is the guest that you're seeing issues with?
Thanks,
Paolo
> ---
> hw/timer/mc146818rtc.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/hw/timer/mc146818rtc.c b/hw/timer/mc146818rtc.c
> index 1df17af..4cb8e5e 100644
> --- a/hw/timer/mc146818rtc.c
> +++ b/hw/timer/mc146818rtc.c
> @@ -549,6 +549,8 @@ static void rtc_set_time(RTCState *s)
> rtc_get_time(s, &tm);
> s->base_rtc = mktimegm(&tm);
> s->last_update = qemu_clock_get_ns(rtc_clock);
> + s->irq_coalesced = 0;
> + s->irq_reinject_on_ack_count = 0;
>
> qapi_event_send_rtc_change(qemu_timedate_diff(&tm), &error_abort);
> }
> @@ -585,6 +587,7 @@ static void rtc_update_time(RTCState *s)
>
> guest_nsec = get_guest_rtc_ns(s);
> guest_sec = guest_nsec / NANOSECONDS_PER_SECOND;
> + guest_sec -= s->irq_coalesced;
> gmtime_r(&guest_sec, &ret);
>
> /* Is SET flag of Register B disabled? */
>
- Re: [Qemu-devel] [PATCH]MC146818 RTC: coordinate guest clock base to destination host after migration, (continued)
- Re: [Qemu-devel] [PATCH]MC146818 RTC: coordinate guest clock base to destination host after migration, address@hidden, 2016/09/21
- Re: [Qemu-devel] [PATCH]MC146818 RTC: coordinate guest clock base to destination host after migration, Paolo Bonzini, 2016/09/21
- Re: [Qemu-devel] [PATCH]MC146818 RTC: coordinate guest clock base to destination host after migration, address@hidden, 2016/09/22
- [Qemu-devel] [PATCH v2]MC146818 RTC: coordinate guest clock base to destination host after migration, address@hidden, 2016/09/25
- Re: [Qemu-devel] [PATCH v2]MC146818 RTC: coordinate guest clock base to destination host after migration, Paolo Bonzini, 2016/09/26
- [Qemu-devel] [PATCH v3]MC146818 RTC: coordinate guest clock base to destination host after migration, address@hidden, 2016/09/26
- Re: [Qemu-devel] [PATCH v3]MC146818 RTC: coordinate guest clock base to destination host after migration, Paolo Bonzini, 2016/09/26
- [Qemu-devel] [PATCH v4]MC146818 RTC: coordinate guest clock base to destination host after migration, address@hidden, 2016/09/26
- Re: [Qemu-devel] [PATCH v4]MC146818 RTC: coordinate guest clock base to destination host after migration, Paolo Bonzini, 2016/09/26
- [Qemu-devel] [PATCH]MC146818 RTC: Get correct guest time when irq coalesced, address@hidden, 2016/09/26
- Re: [Qemu-devel] [PATCH]MC146818 RTC: Get correct guest time when irq coalesced,
Paolo Bonzini <=
- Re: [Qemu-devel] [PATCH]MC146818 RTC: Get correct guest time when irq coalesced, address@hidden, 2016/09/26