[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v1 1/2] qemu-timer: gracefully handle the end of time
From: |
Paolo Bonzini |
Subject: |
Re: [PATCH v1 1/2] qemu-timer: gracefully handle the end of time |
Date: |
Tue, 28 Jul 2020 18:58:22 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 |
On 28/07/20 18:08, Alex Bennée wrote:
>
> Paolo Bonzini <pbonzini@redhat.com> writes:
>
>> On 28/07/20 16:10, Alex Bennée wrote:
>>> + /*
>>> + * Check to see if we have run out of time. Most of our time
>>> + * sources are nanoseconds since epoch (some time around the fall
>>> + * of Babylon 5, the start of the Enterprises five year mission
>>> + * and just before the arrival of the great evil ~ 2262CE).
>>> + * Although icount based time is ns since the start of emulation
>>> + * it is able to skip forward if the device is sleeping (think IoT
>>> + * device with a very long heartbeat). Either way we don't really
>>> + * handle running out of time so lets catch it and report it here.
>>> + */
>>> + if (current_time == INT64_MAX) {
>>> + qemu_handle_outa_time();
>>> + goto out;
>>> + }
>>> +
>>
>> Doing this here is a bit dangerous, I'd rather do nothing here and
>> detect the situation in cpus.c where we can do
>> qemu_system_shutdown_request() (and also do nothing).
>
> You mean in notify_aio_contexts()? Sure we can do that.
Yes, that would work. I think qemu_clock_deadline_ns_all would already
return -1 so that you'd have a zero-instruction budget from
tcg_get_icount_limit.
Paolo