From: "Pavel Dovgalyuk" <dovgaluk@ispras.ru>
To: 'Paolo Bonzini' <pbonzini@redhat.com>, qemu-devel@nongnu.org
Cc: "'Emilio G . Cota'" <cota@braap.org>
Subject: Re: [Qemu-devel] [3/4] cpus: protect TimerState writes with a spinlock
Date: Mon, 10 Sep 2018 08:36:57 +0300 [thread overview]
Message-ID: <000a01d448c8$4a55c0e0$df0142a0$@ru> (raw)
In-Reply-To: <5b9a85eb-cefd-925c-b24b-95b93bbbfce8@redhat.com>
> From: Paolo Bonzini [mailto:pbonzini@redhat.com]
> On 28/08/2018 09:23, Pavel Dovgalyuk wrote:
> > Hi, Paolo!
> >
> > Seems that this one breaks the record/replay.
>
> What are the symptoms?
Please look below.
> >> From: Paolo Bonzini [mailto:pbonzini@redhat.com]
> >> In the next patch, we will need to write cpu_ticks_offset from any
> >> thread, even outside the BQL. Currently, it is protected by the BQL
> >> just because cpu_enable_ticks and cpu_disable_ticks happen to hold it,
> >> but the critical sections are well delimited and it's easy to remove
> >> the BQL dependency.
> >>
> >> Add a spinlock that matches vm_clock_seqlock, and hold it when writing
> >> to the TimerState. This also lets us fix cpu_update_icount when 64-bit
> >> atomics are not available.
> >>
> >> Fields of TiemrState are reordered to avoid padding.
> >>
> >> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> >> ---
> >> cpus.c | 72 ++++++++++++++++++++++++++++++++++++++--------------------
> >> 1 file changed, 47 insertions(+), 25 deletions(-)
> >>
Here is the description:
> >> static void icount_adjust_rt(void *opaque)
> >> @@ -480,7 +494,8 @@ static void icount_warp_rt(void)
> >> return;
> >> }
> >>
> >> - seqlock_write_begin(&timers_state.vm_clock_seqlock);
> >> + seqlock_write_lock(&timers_state.vm_clock_seqlock,
> >> + &timers_state.vm_clock_lock);
> >
> > After locking here,
> >
> >> if (runstate_is_running()) {
> >> int64_t clock = REPLAY_CLOCK(REPLAY_CLOCK_VIRTUAL_RT,
> >> cpu_get_clock_locked());
> >
> > REPLAY_CLOCK can't request icount with cpu_get_icount_raw, because
> > it loops infinitely here:
> >
> > do {
> > start = seqlock_read_begin(&timers_state.vm_clock_seqlock);
> > icount = cpu_get_icount_raw_locked();
> > } while (seqlock_read_retry(&timers_state.vm_clock_seqlock, start));
> >
> >
Pavel Dovgalyuk
next prev parent reply other threads:[~2018-09-10 5:37 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-20 15:08 [Qemu-devel] [PATCH 0/4] cpus: improve seqlock usage for timers_state, allow cpu_get_ticks out of BQL Paolo Bonzini
2018-08-20 15:09 ` [Qemu-devel] [PATCH 1/4] cpus: protect all icount computation with seqlock Paolo Bonzini
2018-08-31 22:03 ` Emilio G. Cota
2018-08-20 15:09 ` [Qemu-devel] [PATCH 2/4] seqlock: add QemuLockable support Paolo Bonzini
2018-08-20 15:09 ` [Qemu-devel] [PATCH 3/4] cpus: protect TimerState writes with a spinlock Paolo Bonzini
2018-08-28 7:23 ` [Qemu-devel] [3/4] " Pavel Dovgalyuk
2018-09-09 23:39 ` Paolo Bonzini
2018-09-10 5:36 ` Pavel Dovgalyuk [this message]
2018-09-10 12:59 ` Paolo Bonzini
2018-09-11 6:00 ` Pavel Dovgalyuk
2018-09-11 9:31 ` Paolo Bonzini
2018-10-08 7:09 ` Pavel Dovgalyuk
2018-10-08 11:24 ` Paolo Bonzini
2018-08-31 22:07 ` [Qemu-devel] [PATCH 3/4] " Emilio G. Cota
2018-09-09 23:39 ` Paolo Bonzini
2018-08-20 15:09 ` [Qemu-devel] [PATCH 4/4] cpus: allow cpu_get_ticks out of BQL Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='000a01d448c8$4a55c0e0$df0142a0$@ru' \
--to=dovgaluk@ispras.ru \
--cc=cota@braap.org \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.