From: Marc Zyngier <marc.zyngier@arm.com>
To: openrisc@lists.librecores.org
Subject: [OpenRISC] [PATCH v2 06/14] irqchip: add initial support for ompic
Date: Thu, 14 Sep 2017 19:31:46 +0100 [thread overview]
Message-ID: <86vaklqgh9.fsf@arm.com> (raw)
In-Reply-To: <20170914065402.GU2609@lianli.shorne-pla.net> (Stafford Horne's message of "Thu, 14 Sep 2017 15:54:02 +0900")
On Thu, Sep 14 2017 at 3:54:02 pm BST, Stafford Horne <shorne@gmail.com> wrote:
> On Wed, Sep 13, 2017 at 06:21:39PM +0100, Marc Zyngier wrote:
[...]
>> > +{
>> > + unsigned int dst_cpu;
>> > + unsigned int src_cpu = smp_processor_id();
>> > +
>> > + for_each_cpu(dst_cpu, mask) {
>> > + set_bit(ipi_msg, &per_cpu(ops, dst_cpu));
>> > +
>> > + /*
>> > + * On OpenRISC the atomic set_bit() call implies a memory
>> > + * barrier. Otherwise we would need: smp_wmb(); paired
>> > + * with the read in ompic_ipi_handler.
>> > + */
>>
>> One last question on this, because the architecture document is terribly
>> unclear: If you have CPU0 doing an atomic operation A0, CPU1 seeing A0
>> and doeing another atomic A1 (the set_bit above) followed by an IPI to
>> CPU2, is CPU2 *guaranteed* to observe both A0 *and* A1? Because that's
>> required by the IPI semantics, and you wouldn't see that kind of issue
>> with only two CPUs.
>
> Could you suggest an architecture document that makes this case clear?
>
> I believe this will not be a problem, but:
> 1. If this needs to be clear in the architecture document I can propose
> changes.
> 2. To be clear is this the scenario you mean..
>
> CASE1 - A0 and A1 are to different locations?
> A0 - writes to some unrelated global location?
>
> CPU0 CPU1 CPU2
> A0:atomic store (global)
> A1:set_bit (ops[CPU2])
> IPI
> read (A0,A1)
>
>
> OR
>
> CASE2 - A0 and A1 are to the same location.
> A0 - writes to the same location as A1
>
> CPU0 CPU1 CPU2
> A0:set_bit (ops[CPU2])
> A1:set_bit (ops[CPU2])
> IPI
> read (A0,A1)
> IPI
I think this covers both cases I had in mind.
>
>
> OR - something else?
>
> In both cases CPU2 would be able to see the results of both atomic
> operations. All, cpus in the OpenRISC system snoop for memory writes to
> enable cash coherency, so each CPU would see each write once it is synced
> to memory (there is a single memory bus). This is not limited to atomic
> operations, but the atomic operations provide a syncrhonization point
> accross all CPUs.
OK. It would be good if the architecture document had something about
transitivity of writes on SMP (maybe it has, I only went through it
pretty quickly). But overall, the above will work correctly.
> ps: Frank Zappa rocks :)
His music certainly does! ;-)
Thanks,
M.
--
Jazz is not dead. It just smells funny.
WARNING: multiple messages have this Message-ID (diff)
From: Marc Zyngier <marc.zyngier@arm.com>
To: Stafford Horne <shorne@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
Openrisc <openrisc@lists.librecores.org>,
Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>,
Thomas Gleixner <tglx@linutronix.de>,
Jason Cooper <jason@lakedaemon.net>,
Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Jonas Bonn <jonas@southpole.se>,
devicetree@vger.kernel.org
Subject: Re: [PATCH v2 06/14] irqchip: add initial support for ompic
Date: Thu, 14 Sep 2017 19:31:46 +0100 [thread overview]
Message-ID: <86vaklqgh9.fsf@arm.com> (raw)
In-Reply-To: <20170914065402.GU2609@lianli.shorne-pla.net> (Stafford Horne's message of "Thu, 14 Sep 2017 15:54:02 +0900")
On Thu, Sep 14 2017 at 3:54:02 pm BST, Stafford Horne <shorne@gmail.com> wrote:
> On Wed, Sep 13, 2017 at 06:21:39PM +0100, Marc Zyngier wrote:
[...]
>> > +{
>> > + unsigned int dst_cpu;
>> > + unsigned int src_cpu = smp_processor_id();
>> > +
>> > + for_each_cpu(dst_cpu, mask) {
>> > + set_bit(ipi_msg, &per_cpu(ops, dst_cpu));
>> > +
>> > + /*
>> > + * On OpenRISC the atomic set_bit() call implies a memory
>> > + * barrier. Otherwise we would need: smp_wmb(); paired
>> > + * with the read in ompic_ipi_handler.
>> > + */
>>
>> One last question on this, because the architecture document is terribly
>> unclear: If you have CPU0 doing an atomic operation A0, CPU1 seeing A0
>> and doeing another atomic A1 (the set_bit above) followed by an IPI to
>> CPU2, is CPU2 *guaranteed* to observe both A0 *and* A1? Because that's
>> required by the IPI semantics, and you wouldn't see that kind of issue
>> with only two CPUs.
>
> Could you suggest an architecture document that makes this case clear?
>
> I believe this will not be a problem, but:
> 1. If this needs to be clear in the architecture document I can propose
> changes.
> 2. To be clear is this the scenario you mean..
>
> CASE1 - A0 and A1 are to different locations?
> A0 - writes to some unrelated global location?
>
> CPU0 CPU1 CPU2
> A0:atomic store (global)
> A1:set_bit (ops[CPU2])
> IPI
> read (A0,A1)
>
>
> OR
>
> CASE2 - A0 and A1 are to the same location.
> A0 - writes to the same location as A1
>
> CPU0 CPU1 CPU2
> A0:set_bit (ops[CPU2])
> A1:set_bit (ops[CPU2])
> IPI
> read (A0,A1)
> IPI
I think this covers both cases I had in mind.
>
>
> OR - something else?
>
> In both cases CPU2 would be able to see the results of both atomic
> operations. All, cpus in the OpenRISC system snoop for memory writes to
> enable cash coherency, so each CPU would see each write once it is synced
> to memory (there is a single memory bus). This is not limited to atomic
> operations, but the atomic operations provide a syncrhonization point
> accross all CPUs.
OK. It would be good if the architecture document had something about
transitivity of writes on SMP (maybe it has, I only went through it
pretty quickly). But overall, the above will work correctly.
> ps: Frank Zappa rocks :)
His music certainly does! ;-)
Thanks,
M.
--
Jazz is not dead. It just smells funny.
next prev parent reply other threads:[~2017-09-14 18:31 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-10 6:49 [OpenRISC] [PATCH v2 00/14] OpenRISC SMP Support Stafford Horne
2017-09-10 6:49 ` Stafford Horne
2017-09-10 6:49 ` [OpenRISC] [PATCH v2 01/14] openrisc: use shadow registers to save regs on exception Stafford Horne
2017-09-10 6:49 ` Stafford Horne
2017-09-10 6:49 ` [OpenRISC] [PATCH v2 02/14] openrisc: define CPU_BIG_ENDIAN as true Stafford Horne
2017-09-10 6:49 ` Stafford Horne
2017-09-10 6:49 ` [OpenRISC] [PATCH v2 03/14] openrisc: add 1 and 2 byte cmpxchg support Stafford Horne
2017-09-10 6:49 ` Stafford Horne
2017-09-10 6:49 ` [OpenRISC] [PATCH v2 04/14] openrisc: use qspinlocks and qrwlocks Stafford Horne
2017-09-10 6:49 ` Stafford Horne
2017-09-10 6:49 ` [OpenRISC] [PATCH v2 05/14] dt-bindings: add openrisc to vendor prefixes list Stafford Horne
2017-09-10 6:49 ` Stafford Horne
2017-09-10 6:49 ` Stafford Horne
2017-09-10 11:13 ` [OpenRISC] " Andreas =?unknown-8bit?q?F=C3=A4rber?=
2017-09-10 11:13 ` Andreas Färber
2017-09-18 20:39 ` [OpenRISC] " Rob Herring
2017-09-18 20:39 ` Rob Herring
2017-09-10 6:49 ` [OpenRISC] [PATCH v2 06/14] irqchip: add initial support for ompic Stafford Horne
2017-09-10 6:49 ` Stafford Horne
2017-09-10 6:49 ` Stafford Horne
2017-09-13 17:21 ` [OpenRISC] " Marc Zyngier
2017-09-13 17:21 ` Marc Zyngier
2017-09-13 17:21 ` Marc Zyngier
2017-09-14 6:54 ` [OpenRISC] " Stafford Horne
2017-09-14 6:54 ` Stafford Horne
2017-09-14 6:54 ` Stafford Horne
2017-09-14 18:31 ` Marc Zyngier [this message]
2017-09-14 18:31 ` Marc Zyngier
2017-09-18 20:29 ` [OpenRISC] " Rob Herring
2017-09-18 20:29 ` Rob Herring
2017-09-18 20:29 ` Rob Herring
2017-09-19 12:14 ` [OpenRISC] " Stafford Horne
2017-09-19 12:14 ` Stafford Horne
2017-09-18 20:43 ` [OpenRISC] " Rob Herring
2017-09-18 20:43 ` Rob Herring
2017-09-19 12:10 ` [OpenRISC] " Stafford Horne
2017-09-19 12:10 ` Stafford Horne
2017-09-19 12:10 ` Stafford Horne
2017-09-10 6:49 ` [OpenRISC] [PATCH v2 07/14] openrisc: initial SMP support Stafford Horne
2017-09-10 6:49 ` Stafford Horne
2017-09-10 6:49 ` [OpenRISC] [PATCH v2 08/14] openrisc: fix initial preempt state for secondary cpu tasks Stafford Horne
2017-09-10 6:49 ` Stafford Horne
2017-09-10 6:49 ` [OpenRISC] [PATCH v2 09/14] openrisc: sleep instead of spin on secondary wait Stafford Horne
2017-09-10 6:49 ` Stafford Horne
2017-09-10 6:49 ` [OpenRISC] [PATCH v2 10/14] openrisc: add cacheflush support to fix icache aliasing Stafford Horne
2017-09-10 6:49 ` Stafford Horne
2017-09-10 6:49 ` [OpenRISC] [PATCH v2 11/14] openrisc: add simple_smp dts and defconfig for simulators Stafford Horne
2017-09-10 6:49 ` Stafford Horne
2017-09-10 6:49 ` [OpenRISC] [PATCH v2 12/14] openrisc: support framepointers and STACKTRACE_SUPPORT Stafford Horne
2017-09-10 6:49 ` Stafford Horne
2017-09-10 6:49 ` [OpenRISC] [PATCH v2 13/14] openrisc: enable LOCKDEP_SUPPORT and irqflags tracing Stafford Horne
2017-09-10 6:49 ` Stafford Horne
2017-09-10 6:49 ` [OpenRISC] [PATCH v2 14/14] openrisc: add tick timer multicore sync logic Stafford Horne
2017-09-10 6:49 ` Stafford Horne
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=86vaklqgh9.fsf@arm.com \
--to=marc.zyngier@arm.com \
--cc=openrisc@lists.librecores.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.