On 28/07/20 18:08, Alex Bennée wrote: > > Paolo Bonzini <pbonz...@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