[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] replay: notify the main loop when there are no instructions
From: |
Paolo Bonzini |
Subject: |
Re: [PATCH] replay: notify the main loop when there are no instructions |
Date: |
Mon, 1 Jun 2020 16:01:14 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 |
On 01/06/20 12:35, Pavel Dovgalyuk wrote:
> ping
>
> On 22.05.2020 09:47, Pavel Dovgalyuk wrote:
>> When QEMU is executed in console mode without any external event sources,
>> main loop may sleep for a very long time. But in case of replay
>> there is another event source - event log.
>> This patch adds main loop notification when the vCPU loop has nothing
>> to do and main loop should process the inputs from the event log.
>>
>> Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>
It's a long weekend here today but I should get a QEMU pull request
submitted on Wednesday.
Paolo
>> 0 files changed
>>
>> diff --git a/cpus.c b/cpus.c
>> index 7ce0d569b3..b4d0d9f21b 100644
>> --- a/cpus.c
>> +++ b/cpus.c
>> @@ -1362,6 +1362,13 @@ static int64_t tcg_get_icount_limit(void)
>> }
>> }
>> +static void notify_aio_contexts(void)
>> +{
>> + /* Wake up other AioContexts. */
>> + qemu_clock_notify(QEMU_CLOCK_VIRTUAL);
>> + qemu_clock_run_timers(QEMU_CLOCK_VIRTUAL);
>> +}
>> +
>> static void handle_icount_deadline(void)
>> {
>> assert(qemu_in_vcpu_thread());
>> @@ -1370,9 +1377,7 @@ static void handle_icount_deadline(void)
>>
>> QEMU_TIMER_ATTR_ALL);
>> if (deadline == 0) {
>> - /* Wake up other AioContexts. */
>> - qemu_clock_notify(QEMU_CLOCK_VIRTUAL);
>> - qemu_clock_run_timers(QEMU_CLOCK_VIRTUAL);
>> + notify_aio_contexts();
>> }
>> }
>> }
>> @@ -1395,6 +1400,10 @@ static void prepare_icount_for_run(CPUState *cpu)
>> cpu->icount_extra = cpu->icount_budget - insns_left;
>> replay_mutex_lock();
>> +
>> + if (cpu->icount_budget == 0 && replay_has_checkpoint()) {
>> + notify_aio_contexts();
>> + }
>> }
>> }
>>
>