From: Alexander Graf <agraf@suse.de>
To: Mark Burton <mark.burton@greensocs.com>
Cc: mttcg@listserver.greensocs.com,
"Peter Maydell" <peter.maydell@linaro.org>,
"QEMU Developers" <qemu-devel@nongnu.org>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Lluís Vilanova" <vilanova@ac.upc.edu>,
"KONRAD Frédéric" <fred.konrad@greensocs.com>
Subject: Re: [Qemu-devel] [RFC PATCH] target-arm: protect cpu_exclusive_*.
Date: Wed, 17 Dec 2014 12:18:02 +0100 [thread overview]
Message-ID: <5491666A.7060001@suse.de> (raw)
In-Reply-To: <8B6B4BF9-3400-4125-8571-F4EF9F12AA89@greensocs.com>
On 17.12.14 12:12, Mark Burton wrote:
>
>> On 17 Dec 2014, at 11:45, Alexander Graf <agraf@suse.de> wrote:
>>
>>
>>
>> On 17.12.14 11:31, Mark Burton wrote:
>>>
>>>> On 17 Dec 2014, at 11:28, Alexander Graf <agraf@suse.de> wrote:
>>>>
>>>>
>>>>
>>>> On 17.12.14 11:27, Frederic Konrad wrote:
>>>>> On 16/12/2014 17:37, Peter Maydell wrote:
>>>>>> On 16 December 2014 at 09:13, <fred.konrad@greensocs.com> wrote:
>>>>>>> From: KONRAD Frederic <fred.konrad@greensocs.com>
>>>>>>>
>>>>>>> This adds a lock to avoid multiple exclusive access at the same time
>>>>>>> in case of
>>>>>>> TCG multithread.
>>>>> Hi Peter,
>>>>>
>>>>>> This feels to me like it's not really possible to review on
>>>>>> its own, since you can't see how it fits into the design of
>>>>>> the rest of the multithreading support.
>>>>> true the only thing we observe is that it didn't change anything right now.
>>>>>
>>>>>> The other approach here rather than having a pile of mutexes
>>>>>> in the target-* code would be to have TCG IR support for
>>>>>> "begin critical section"/"end critical section". Then you
>>>>>> could have the main loop ensure that no other CPU is running
>>>>>> at the same time as the critical-section code. (linux-user
>>>>>> already has an ad-hoc implementation of this for the
>>>>>> exclusives.)
>>>>>>
>>>>>> -- PMM
>>>>>>
>>>>> What do you mean by TCG IR?
>>>>
>>>> TCP ops. The nice thing is that TCG could translate those into
>>>> transactions if the host supports them as well.
>>>>
>>>
>>> Hows that different in reality from what we have now?
>>> Cheers
>>> Mark.
>>
>> The current code can't optimize things in TCG. There's a good chance
>> your TCG host implementation can have an optimization pass that creates
>> host cmpxchg instructions or maybe even transaction blocks out of the
>> critical sections.
>>
>>
>
>
> Ok - I get it - I see the value - so long as it’s possible to do. It would solve a lot of problems...
>
> We were not (yet) trying to fix that, we were simply asking the question, if we add these mutex’s - do we have any detrimental impact on anything.
> Seems like the answer is that adding the mutex’s is fine - it doesn’t seem to have a performance impact or anything. Good.
>
> But - I see what you mean - if we implemented this as an op, then it would be much simpler to optimise/fix properly afterwards - and - that “fix” might not even need to deal with the whole memory chain issue - maybe…..
Yes, especially given that transactional memory is getting pretty common
these days (Haswell had it, POWER8 has it) I think it makes a lot of
sense to just base on its concept in the design here. It's the easiest
way to make parallel memory accesses fast without taking big locks all
the time.
So I think the best way to go forward would be to add transaction_start
and transaction_end opcodes to TCG and implement them as mutex locks
today. When you get the chance to get yourself a machine that supports
actual TM, try to replace them with transaction start/end blocks and
have the normal mutex code as fallback if the transaction fails.
Alex
next prev parent reply other threads:[~2014-12-17 11:18 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-16 9:13 [Qemu-devel] [RFC PATCH] target-arm: protect cpu_exclusive_* fred.konrad
2014-12-16 9:31 ` Paolo Bonzini
2014-12-16 9:36 ` Frederic Konrad
2014-12-16 9:49 ` Paolo Bonzini
2014-12-16 9:54 ` Frederic Konrad
2014-12-16 16:37 ` Peter Maydell
2014-12-17 10:27 ` Frederic Konrad
2014-12-17 10:28 ` Alexander Graf
2014-12-17 10:31 ` Mark Burton
2014-12-17 10:45 ` Alexander Graf
2014-12-17 11:12 ` Mark Burton
2014-12-17 11:18 ` Alexander Graf [this message]
2014-12-17 11:25 ` Paolo Bonzini
2014-12-17 11:36 ` Peter Maydell
2014-12-17 16:17 ` Mark Burton
2014-12-17 16:27 ` Peter Maydell
2014-12-17 16:29 ` Mark Burton
2014-12-17 16:39 ` Peter Maydell
2014-12-17 16:51 ` Peter Maydell
2014-12-18 9:12 ` Mark Burton
2014-12-18 12:24 ` Alexander Graf
2014-12-18 12:35 ` Dr. David Alan Gilbert
2014-12-18 13:28 ` Paolo Bonzini
2014-12-18 13:56 ` Mark Burton
2014-12-18 14:20 ` Mark Burton
2014-12-18 14:44 ` Alexander Graf
2014-12-18 14:51 ` Mark Burton
2014-12-18 15:05 ` Alexander Graf
2014-12-18 15:09 ` Mark Burton
2014-12-18 16:55 ` Paolo Bonzini
2014-12-17 15:52 ` Mark Burton
2014-12-17 16:20 ` Dr. David Alan Gilbert
2014-12-17 11:19 ` Peter Maydell
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=5491666A.7060001@suse.de \
--to=agraf@suse.de \
--cc=fred.konrad@greensocs.com \
--cc=mark.burton@greensocs.com \
--cc=mttcg@listserver.greensocs.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=vilanova@ac.upc.edu \
/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).