[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC PATCH v1 8/9] cpus: don't credit executed instruct
From: |
Pavel Dovgalyuk |
Subject: |
Re: [Qemu-devel] [RFC PATCH v1 8/9] cpus: don't credit executed instructions before they have run |
Date: |
Fri, 7 Apr 2017 14:27:07 +0300 |
> From: address@hidden [mailto:address@hidden
> On 04/04/2017 07:37, Pavel Dovgalyuk wrote:
> >> - icount -= (cpu->icount_decr.u16.low + cpu->icount_extra);
> >> + /* Take into account what has run */
> >> + icount += cpu_get_icount_executed(cpu);
> >> }
> >> return icount;
> > As far, as I understand, this one will return the same value in iothread
> > until vCPU thread finishes cpu_exec?
> > This value will not jump forward and backward, but still will not allow
> > making execution deterministic.
> >
> > Consider the following scenarios:
> >
> > First:
> > vCPU iothread
> > access HW ----
> > ... access HW in timer
> >
> > Second:
> > vCPU iothread
> > ... access HW in timer
> > access HW ----
> >
> > These scenarios will generate the same order of events in the log.
> > Synchronization checkpoint in iothread will try to write already
> > executed instructions, but it does not have access to current_cpu
> > and the icount value will point to the "past" - it will have less
> > instructions than already executed.
>
> The actual access should be covered by a lock, but I think you're right
> that the two threads can be nondeterministically off by one instruction,
> even if we make gen_io_start update timers_state.qemu_icount atomically.
Yes. The actual problem is that icount is updated once for the whole TB.
But TB execution is not atomic and machine state is different in different
parts of TB.
Therefore iothread may expose different behavior depending on moment
when it is activated.
Pavel Dovgalyuk
- Re: [Qemu-devel] [RFC PATCH v1 7/9] cpus: move icount preparation out of tcg_exec_cpu, (continued)
[Qemu-devel] [RFC PATCH v1 6/9] cpus: check cpu->running in cpu_get_icount_raw(), Alex Bennée, 2017/04/03
[Qemu-devel] [RFC PATCH v1 8/9] cpus: don't credit executed instructions before they have run, Alex Bennée, 2017/04/03
Re: [Qemu-devel] [RFC PATCH v1 8/9] cpus: don't credit executed instructions before they have run, Paolo Bonzini, 2017/04/04
[Qemu-devel] [RFC PATCH v1 9/9] replay: gracefully handle backward time events, Alex Bennée, 2017/04/03
[Qemu-devel] [RFC PATCH v1 4/9] target/i386/misc_helper: wrap BQL around another IRQ generator, Alex Bennée, 2017/04/03
[Qemu-devel] [RFC PATCH v1 3/9] scripts/replay-dump.py: replay log dumper, Alex Bennée, 2017/04/03
Re: [Qemu-devel] [RFC PATCH v1 0/9] MTTCG and record/replay fixes for rc3, Paolo Bonzini, 2017/04/03