From: "Emilio G. Cota" <cota@braap.org>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org,
Aleksandar Markovic <amarkovic@wavecomp.com>,
Alexander Graf <agraf@suse.de>,
Alistair Francis <alistair23@gmail.com>,
Andrzej Zaborowski <balrogg@gmail.com>,
Anthony Green <green@moxielogic.com>,
Artyom Tarasenko <atar4qemu@gmail.com>,
Aurelien Jarno <aurelien@aurel32.net>,
Bastian Koppelmann <kbastian@mail.uni-paderborn.de>,
Christian Borntraeger <borntraeger@de.ibm.com>,
Chris Wulff <crwulff@gmail.com>,
Cornelia Huck <cohuck@redhat.com>,
David Gibson <david@gibson.dropbear.id.au>,
David Hildenbrand <david@redhat.com>,
"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
Eduardo Habkost <ehabkost@redhat.com>,
Fabien Chouteau <chouteau@adacore.com>,
Guan Xuetao <gxt@mprc.pku.edu.cn>,
James Hogan <jhogan@kernel.org>,
Laurent Vivier <laurent@vivier.eu>, Marek Vasut <marex@denx.de>,
Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>,
Max Filippov <jcmvbkbc@gmail.com>, Michael Clark <mjc@sifive.com>,
Michael Walle <michael@walle.cc>,
Palmer Dabbelt <palmer@sifive.com>,
Pavel Dovgalyuk <dovgaluk@ispras.ru>,
Peter Crosthwaite <crosthwaite.peter@gmail.com>,
Peter Maydell <peter.maydell@linaro.org>,
qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-s390x@nongnu.org,
Richard Henderson <rth@twiddle.net>,
Sagar Karandikar <sagark@eecs.berkeley.edu>,
Stafford Horne <shorne@gmail.com>
Subject: Re: [Qemu-devel] [RFC v3 0/56] per-CPU locks
Date: Fri, 19 Oct 2018 15:29:32 -0400 [thread overview]
Message-ID: <20181019192932.GA17761@flamenco> (raw)
In-Reply-To: <6190036c-cd1f-4549-9b7e-9e7913c972d4@redhat.com>
On Fri, Oct 19, 2018 at 18:01:18 +0200, Paolo Bonzini wrote:
> On 19/10/2018 16:50, Emilio G. Cota wrote:
> > On Fri, Oct 19, 2018 at 08:59:24 +0200, Paolo Bonzini wrote:
> >> On 19/10/2018 03:05, Emilio G. Cota wrote:
> >>> I'm calling this series a v3 because it supersedes the two series
> >>> I previously sent about using atomics for interrupt_request:
> >>> https://lists.gnu.org/archive/html/qemu-devel/2018-09/msg02013.html
> >>> The approach in that series cannot work reliably; using (locked) atomics
> >>> to set interrupt_request but not using (locked) atomics to read it
> >>> can lead to missed updates.
> >>
> >> The idea here was that changes to protected fields are all followed by
> >> kick. That may not have been the case, granted, but I wonder if the
> >> plan is unworkable.
> >
> > I suspect that the cpu->interrupt_request+kick mechanism is not the issue,
> > otherwise master should not work--we do atomic_read(cpu->interrupt_request)
> > and only if that read != 0 we take the BQL.
> >
> > My guess is that the problem is with other reads of cpu->interrupt_request,
> > e.g. those in cpu_has_work. Currently those reads happen with the
> > BQL held, and updates to cpu->interrupt_request take the BQL. If we drop
> > the BQL from the setters to instead use locked atomics (like in the
> > aforementioned series), those BQL-protected readers might miss updates.
>
> cpu_has_work is only needed to handle the processor's halted state (or
> is it?). If it is, OR+kick should work.
>
> > Given that we need a per-CPU lock anyway to remove the BQL from the
> > CPU loop, extending this lock to protect cpu->interrupt_request is
> > a simple solution that keeps the current logic and allows for
> > greater scalability.
>
> Sure, I was just curious what the problem was. KVM uses OR+kick with no
> problems.
I never found exactly where things break. The hangs happen
pretty early when booting a large (-smp > 16) x86_64 Ubuntu guest.
Booting never completes (ssh unresponsive) if I don't have the
console output (I suspect the console output slows things down
enough to hide some races). I only see a few threads busy:
a couple of vCPU threads, and the I/O thread.
I didn't have time to debug any further, so I moved on
to an alternative approach.
So it is possible that it was my implementation, and not the approach,
what was at fault :-)
Thanks,
E.
next prev parent reply other threads:[~2018-10-19 19:29 UTC|newest]
Thread overview: 118+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-19 1:05 [Qemu-devel] [RFC v3 0/56] per-CPU locks Emilio G. Cota
2018-10-19 1:05 ` [Qemu-devel] [RFC v3 01/56] cpu: convert queued work to a QSIMPLEQ Emilio G. Cota
2018-10-19 6:26 ` Richard Henderson
2018-10-19 1:05 ` [Qemu-devel] [RFC v3 02/56] cpu: rename cpu->work_mutex to cpu->lock Emilio G. Cota
2018-10-19 6:26 ` Richard Henderson
2018-10-19 1:05 ` [Qemu-devel] [RFC v3 03/56] cpu: introduce cpu_mutex_lock/unlock Emilio G. Cota
2018-10-19 1:05 ` [Qemu-devel] [RFC v3 04/56] cpu: make qemu_work_cond per-cpu Emilio G. Cota
2018-10-19 1:05 ` [Qemu-devel] [RFC v3 05/56] cpu: move run_on_cpu to cpus-common Emilio G. Cota
2018-10-19 6:39 ` Richard Henderson
2018-10-19 1:05 ` [Qemu-devel] [RFC v3 06/56] cpu: introduce process_queued_cpu_work_locked Emilio G. Cota
2018-10-19 6:41 ` Richard Henderson
2018-10-19 1:05 ` [Qemu-devel] [RFC v3 07/56] target/m68k: rename cpu_halted to cpu_halt Emilio G. Cota
2018-10-21 12:53 ` Richard Henderson
2018-10-21 13:38 ` Richard Henderson
2018-10-22 22:58 ` Emilio G. Cota
2018-10-19 1:05 ` [Qemu-devel] [RFC v3 08/56] cpu: define cpu_halted helpers Emilio G. Cota
2018-10-21 12:54 ` Richard Henderson
2018-10-19 1:05 ` [Qemu-devel] [RFC v3 09/56] arm: convert to cpu_halted Emilio G. Cota
2018-10-21 12:55 ` Richard Henderson
2018-10-19 1:05 ` [Qemu-devel] [RFC v3 10/56] ppc: " Emilio G. Cota
2018-10-21 12:56 ` Richard Henderson
2018-10-22 21:12 ` Emilio G. Cota
2018-10-19 1:05 ` [Qemu-devel] [RFC v3 11/56] sh4: " Emilio G. Cota
2018-10-21 12:57 ` Richard Henderson
2018-10-19 1:05 ` [Qemu-devel] [RFC v3 12/56] i386: " Emilio G. Cota
2018-10-21 12:59 ` Richard Henderson
2018-10-19 1:05 ` [Qemu-devel] [RFC v3 13/56] lm32: " Emilio G. Cota
2018-10-21 13:00 ` Richard Henderson
2018-10-19 1:05 ` [Qemu-devel] [RFC v3 14/56] m68k: " Emilio G. Cota
2018-10-21 13:01 ` Richard Henderson
2018-10-19 1:05 ` [Qemu-devel] [RFC v3 15/56] mips: " Emilio G. Cota
2018-10-21 13:02 ` Richard Henderson
2018-10-19 1:05 ` [Qemu-devel] [RFC v3 16/56] riscv: " Emilio G. Cota
2018-10-19 17:24 ` Palmer Dabbelt
2018-10-19 1:05 ` [Qemu-devel] [RFC v3 17/56] s390x: " Emilio G. Cota
2018-10-21 13:04 ` Richard Henderson
2018-10-19 1:05 ` [Qemu-devel] [RFC v3 18/56] sparc: " Emilio G. Cota
2018-10-21 13:04 ` Richard Henderson
2018-10-19 1:05 ` [Qemu-devel] [RFC v3 19/56] xtensa: " Emilio G. Cota
2018-10-21 13:10 ` Richard Henderson
2018-10-19 1:05 ` [Qemu-devel] [RFC v3 20/56] gdbstub: " Emilio G. Cota
2018-10-21 13:10 ` Richard Henderson
2018-10-19 1:05 ` [Qemu-devel] [RFC v3 21/56] openrisc: " Emilio G. Cota
2018-10-21 13:11 ` Richard Henderson
2018-10-19 1:05 ` [Qemu-devel] [RFC v3 22/56] cpu-exec: " Emilio G. Cota
2018-10-19 1:05 ` [Qemu-devel] [RFC v3 23/56] cpu: define cpu_interrupt_request helpers Emilio G. Cota
2018-10-21 13:15 ` Richard Henderson
2018-10-19 1:05 ` [Qemu-devel] [RFC v3 24/56] ppc: use cpu_reset_interrupt Emilio G. Cota
2018-10-21 13:15 ` Richard Henderson
2018-10-19 1:05 ` [Qemu-devel] [RFC v3 25/56] exec: " Emilio G. Cota
2018-10-21 13:17 ` Richard Henderson
2018-10-22 23:28 ` Emilio G. Cota
2018-10-19 1:05 ` [Qemu-devel] [RFC v3 26/56] i386: " Emilio G. Cota
2018-10-21 13:18 ` Richard Henderson
2018-10-19 1:05 ` [Qemu-devel] [RFC v3 27/56] s390x: " Emilio G. Cota
2018-10-21 13:18 ` Richard Henderson
2018-10-19 1:05 ` [Qemu-devel] [RFC v3 28/56] openrisc: " Emilio G. Cota
2018-10-21 13:18 ` Richard Henderson
2018-10-19 1:05 ` [Qemu-devel] [RFC v3 29/56] arm: convert to cpu_interrupt_request Emilio G. Cota
2018-10-21 13:21 ` Richard Henderson
2018-10-19 1:05 ` [Qemu-devel] [RFC v3 30/56] i386: " Emilio G. Cota
2018-10-21 13:27 ` Richard Henderson
2018-10-23 20:28 ` Emilio G. Cota
2018-10-19 1:06 ` [Qemu-devel] [RFC v3 31/56] ppc: " Emilio G. Cota
2018-10-19 1:06 ` [Qemu-devel] [RFC v3 32/56] sh4: " Emilio G. Cota
2018-10-21 13:28 ` Richard Henderson
2018-10-19 1:06 ` [Qemu-devel] [RFC v3 33/56] cris: " Emilio G. Cota
2018-10-21 13:29 ` Richard Henderson
2018-10-19 1:06 ` [Qemu-devel] [RFC v3 34/56] hppa: " Emilio G. Cota
2018-10-21 13:29 ` Richard Henderson
2018-10-19 1:06 ` [Qemu-devel] [RFC v3 35/56] lm32: " Emilio G. Cota
2018-10-21 13:29 ` Richard Henderson
2018-10-19 1:06 ` [Qemu-devel] [RFC v3 36/56] m68k: " Emilio G. Cota
2018-10-21 13:29 ` Richard Henderson
2018-10-19 1:06 ` [Qemu-devel] [RFC v3 37/56] mips: " Emilio G. Cota
2018-10-21 13:30 ` Richard Henderson
2018-10-22 23:38 ` Emilio G. Cota
2018-10-19 1:06 ` [Qemu-devel] [RFC v3 38/56] nios: " Emilio G. Cota
2018-10-21 13:30 ` Richard Henderson
2018-10-19 1:06 ` [Qemu-devel] [RFC v3 39/56] s390x: " Emilio G. Cota
2018-10-21 13:30 ` Richard Henderson
2018-10-19 1:06 ` [Qemu-devel] [RFC v3 40/56] alpha: " Emilio G. Cota
2018-10-21 13:31 ` Richard Henderson
2018-10-19 1:06 ` [Qemu-devel] [RFC v3 41/56] moxie: " Emilio G. Cota
2018-10-21 13:31 ` Richard Henderson
2018-10-19 1:06 ` [Qemu-devel] [RFC v3 42/56] sparc: " Emilio G. Cota
2018-10-21 13:32 ` Richard Henderson
2018-10-19 1:06 ` [Qemu-devel] [RFC v3 43/56] openrisc: " Emilio G. Cota
2018-10-21 13:32 ` Richard Henderson
2018-10-19 1:06 ` [Qemu-devel] [RFC v3 44/56] unicore32: " Emilio G. Cota
2018-10-21 13:33 ` Richard Henderson
2018-10-19 1:06 ` [Qemu-devel] [RFC v3 45/56] microblaze: " Emilio G. Cota
2018-10-21 13:33 ` Richard Henderson
2018-10-19 1:06 ` [Qemu-devel] [RFC v3 46/56] accel/tcg: " Emilio G. Cota
2018-10-21 13:34 ` Richard Henderson
2018-10-22 23:50 ` Emilio G. Cota
2018-10-23 2:17 ` Richard Henderson
2018-10-23 20:21 ` Emilio G. Cota
2018-10-19 1:06 ` [Qemu-devel] [RFC v3 47/56] cpu: call .cpu_has_work with the CPU lock held Emilio G. Cota
2018-10-19 1:06 ` [Qemu-devel] [RFC v3 48/56] ppc: acquire the BQL in cpu_has_work Emilio G. Cota
2018-10-19 6:58 ` Paolo Bonzini
2018-10-20 16:31 ` Emilio G. Cota
2018-10-21 13:42 ` Richard Henderson
2018-10-19 1:06 ` [Qemu-devel] [RFC v3 49/56] mips: " Emilio G. Cota
2018-10-19 1:06 ` [Qemu-devel] [RFC v3 50/56] s390: " Emilio G. Cota
2018-10-19 1:06 ` [Qemu-devel] [RFC v3 51/56] riscv: " Emilio G. Cota
2018-10-19 17:24 ` Palmer Dabbelt
2018-10-19 1:06 ` [Qemu-devel] [RFC v3 52/56] sparc: " Emilio G. Cota
2018-10-19 1:06 ` [Qemu-devel] [RFC v3 53/56] xtensa: " Emilio G. Cota
2018-10-19 1:06 ` [Qemu-devel] [RFC v3 54/56] cpu: protect most CPU state with cpu->lock Emilio G. Cota
2018-10-19 1:06 ` [Qemu-devel] [RFC v3 55/56] cpu: add async_run_on_cpu_no_bql Emilio G. Cota
2018-10-19 1:06 ` [Qemu-devel] [RFC v3 56/56] cputlb: queue async flush jobs without the BQL Emilio G. Cota
2018-10-19 6:59 ` [Qemu-devel] [RFC v3 0/56] per-CPU locks Paolo Bonzini
2018-10-19 14:50 ` Emilio G. Cota
2018-10-19 16:01 ` Paolo Bonzini
2018-10-19 19:29 ` Emilio G. Cota [this message]
2018-10-19 23:46 ` Emilio G. Cota
2018-10-22 15:30 ` 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=20181019192932.GA17761@flamenco \
--to=cota@braap.org \
--cc=agraf@suse.de \
--cc=alistair23@gmail.com \
--cc=amarkovic@wavecomp.com \
--cc=atar4qemu@gmail.com \
--cc=aurelien@aurel32.net \
--cc=balrogg@gmail.com \
--cc=borntraeger@de.ibm.com \
--cc=chouteau@adacore.com \
--cc=cohuck@redhat.com \
--cc=crosthwaite.peter@gmail.com \
--cc=crwulff@gmail.com \
--cc=david@gibson.dropbear.id.au \
--cc=david@redhat.com \
--cc=dovgaluk@ispras.ru \
--cc=edgar.iglesias@gmail.com \
--cc=ehabkost@redhat.com \
--cc=green@moxielogic.com \
--cc=gxt@mprc.pku.edu.cn \
--cc=jcmvbkbc@gmail.com \
--cc=jhogan@kernel.org \
--cc=kbastian@mail.uni-paderborn.de \
--cc=laurent@vivier.eu \
--cc=marex@denx.de \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=michael@walle.cc \
--cc=mjc@sifive.com \
--cc=palmer@sifive.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=rth@twiddle.net \
--cc=sagark@eecs.berkeley.edu \
--cc=shorne@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).