From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Mark Burton <mark.burton@greensocs.com>
Cc: mttcg@greensocs.com, Peter Maydell <peter.maydell@linaro.org>,
Alexander Graf <agraf@suse.de>,
qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] Help on TLB Flush
Date: Thu, 12 Feb 2015 15:31:02 +0000 [thread overview]
Message-ID: <20150212153102.GB15127@work-vm> (raw)
In-Reply-To: <45883806-2296-486F-A0DC-D8A0A74F85B9@greensocs.com>
* Mark Burton (mark.burton@greensocs.com) wrote:
>
> > On 12 Feb 2015, at 16:01, Peter Maydell <peter.maydell@linaro.org> wrote:
> >
> > On 12 February 2015 at 14:45, Alexander Graf <agraf@suse.de> wrote:
> >>
> >>> On 12.02.2015, at 15:35, Mark Burton <mark.burton@greensocs.com> wrote:
> >>> We are proposing to implement this by signalling all other CPU???s
> >>> to exit (and requesting they flush before re-starting). In other
> >>> words, this would happen asynchronously.
> >>
> >> For global flushes, give them a pointer payload along with the flush
> >> request and tell all cpus to increment it atomically. In your main
> >> thread, wait until *ptr == nKickedCpus.
> >
> > I bet this will not be the only situation where you want to
> > do an "get all other CPUs to do $something and wait til they
> > have done so" kind of operation, so some lightweight but generic
> > infrastructure for doing that would not be a bad plan. (Similarly
> > "get all other CPUs to stop, then I can do $something and let
> > the others continue???.)
>
> We tried this - we ended up in knots.
> We had 2 CPU???s trying to flush at about the same time, both waiting for the other.
> We had CPU???s trying to get the global mutex to finish what they were doing, while being told to flush,
> We had CPU???s in the global mutex trying to do something that would cause a flush??? etc....
> We had spaghetti with extra Bolognese sauce???
This is the hard problem of multithreaded emulation.
You've always got to let CPUs get back to a point where you can
invalidate a mapping/page quickly.
Thus you've also got to be very careful about where any CPU might
get into a loop or take another lock that would stop another CPU
causing an invalidate. Either that or you need a way of somehow
breaking locks or recovering from the situation.
> We eventually concluded, yes - in an infinite universe everything is possible, but if we could simply do this ???asynchronously??? then our lives would be a LOT easier.
> e.g. - ask all CPU???s to ???exit and do something??? is easy - wait for them to do that is a whole other problem???
Which is why you've got to bound how long it might take
those CPUs to get back to you, and optimise out cases where
it's not really needed later.
> Our question is - do we need this ???sync??? (before the flush), or can we actually allow CPU???s to flush themselves asynchronously???.
Always assume the worst.
Dave
>
> Cheers
>
> Mark.
>
>
>
> >
> > -- PMM
>
>
> +44 (0)20 7100 3485 x 210
> +33 (0)5 33 52 01 77x 210
>
> +33 (0)603762104
> mark.burton
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
next prev parent reply other threads:[~2015-02-12 15:31 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-12 14:35 [Qemu-devel] Help on TLB Flush Mark Burton
2015-02-12 14:45 ` Alexander Graf
2015-02-12 14:58 ` Peter Maydell
2015-02-12 15:38 ` Alexander Graf
2015-02-12 16:02 ` Mark Burton
2015-02-12 22:10 ` Lluís Vilanova
2015-02-13 7:16 ` Mark Burton
2015-02-13 7:24 ` Peter Maydell
2015-02-13 7:37 ` Mark Burton
2015-02-13 13:30 ` Lluís Vilanova
2015-02-13 13:32 ` Mark Burton
2015-02-12 22:02 ` Peter Maydell
2015-02-12 15:01 ` Peter Maydell
2015-02-12 15:08 ` Mark Burton
2015-02-12 15:19 ` Alexander Graf
2015-02-12 21:57 ` Peter Maydell
2015-02-13 9:34 ` Paolo Bonzini
2015-02-13 9:37 ` Mark Burton
2015-02-13 9:49 ` Paolo Bonzini
2015-02-12 15:31 ` Dr. David Alan Gilbert [this message]
2015-02-12 18:44 ` Mark Burton
2015-02-12 15:11 ` Mark Burton
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=20150212153102.GB15127@work-vm \
--to=dgilbert@redhat.com \
--cc=agraf@suse.de \
--cc=mark.burton@greensocs.com \
--cc=mttcg@greensocs.com \
--cc=peter.maydell@linaro.org \
--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.