Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 0/2] arch: allow passing compile flags (branch yem/arc-atomic)
@ 2019-06-01 20:33 Yann E. MORIN
  2019-06-01 20:33 ` [Buildroot] [PATCH 1/2] toolchain: allow architectures to enforce compilation flags Yann E. MORIN
  2019-06-01 20:33 ` [Buildroot] [PATCH 2/2] arch/arc: arc7x0 always needs -matomic Yann E. MORIN
  0 siblings, 2 replies; 7+ messages in thread
From: Yann E. MORIN @ 2019-06-01 20:33 UTC (permalink / raw)
  To: buildroot

Hello All!

This series makes it so that architectures can set compilation flags,
passed down via the wrapper.

This is then used by arc to enforce -matomic for those cores that need
it, namely arc7x0, as reported by Alexey:

    https://patchwork.ozlabs.org/patch/1087480/
    https://patchwork.ozlabs.org/patch/1087471/


Regards,
Yann E. MORIN.


The following changes since commit a28c727bb77ce83a0c5c6b0d87d4e46374200371

  package/network-manager: drop unrecognized --without-docs (2019-06-01 15:10:30 +0200)


are available in the git repository at:

  git://git.buildroot.org/~ymorin/git/buildroot.git

for you to fetch changes up to 16241cb355b045ba585ba806f0f4c829f5aea9f8

  arch/arc: arc7x0 always needs -matomic (2019-06-01 22:28:19 +0200)


----------------------------------------------------------------
Yann E. MORIN (2):
      toolchain: allow architectures to enforce compilation flags
      arch/arc: arc7x0 always needs -matomic

 arch/arch.mk.arc               | 4 ++++
 toolchain/toolchain-wrapper.mk | 1 +
 2 files changed, 5 insertions(+)
 create mode 100644 arch/arch.mk.arc

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 1/2] toolchain: allow architectures to enforce compilation flags
  2019-06-01 20:33 [Buildroot] [PATCH 0/2] arch: allow passing compile flags (branch yem/arc-atomic) Yann E. MORIN
@ 2019-06-01 20:33 ` Yann E. MORIN
  2019-06-01 20:33 ` [Buildroot] [PATCH 2/2] arch/arc: arc7x0 always needs -matomic Yann E. MORIN
  1 sibling, 0 replies; 7+ messages in thread
From: Yann E. MORIN @ 2019-06-01 20:33 UTC (permalink / raw)
  To: buildroot

Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Cc: Arnout Vandecappelle <arnout@mind.be>
---
 toolchain/toolchain-wrapper.mk | 1 +
 1 file changed, 1 insertion(+)

diff --git a/toolchain/toolchain-wrapper.mk b/toolchain/toolchain-wrapper.mk
index ca66fa7ba4..8f872506ec 100644
--- a/toolchain/toolchain-wrapper.mk
+++ b/toolchain/toolchain-wrapper.mk
@@ -17,6 +17,7 @@ TOOLCHAIN_WRAPPER_ARGS = $($(PKG)_TOOLCHAIN_WRAPPER_ARGS)
 TOOLCHAIN_WRAPPER_ARGS += -DBR_SYSROOT='"$(STAGING_SUBDIR)"'
 
 TOOLCHAIN_WRAPPER_OPTS = \
+	$(ARCH_TOOLCHAIN_WRAPPER_OPTS) \
 	$(call qstrip,$(BR2_SSP_OPTION)) \
 	$(call qstrip,$(BR2_TARGET_OPTIMIZATION))
 
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 2/2] arch/arc: arc7x0 always needs -matomic
  2019-06-01 20:33 [Buildroot] [PATCH 0/2] arch: allow passing compile flags (branch yem/arc-atomic) Yann E. MORIN
  2019-06-01 20:33 ` [Buildroot] [PATCH 1/2] toolchain: allow architectures to enforce compilation flags Yann E. MORIN
@ 2019-06-01 20:33 ` Yann E. MORIN
  2019-06-01 20:37   ` Thomas Petazzoni
  1 sibling, 1 reply; 7+ messages in thread
From: Yann E. MORIN @ 2019-06-01 20:33 UTC (permalink / raw)
  To: buildroot

As reported by Alexey:
    https://patchwork.ozlabs.org/patch/1087480/
    https://patchwork.ozlabs.org/patch/1087471/

Reported-by: Alexey Brodkin <Alexey.Brodkin@synopsys.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Cc: Alexey Brodkin <Alexey.Brodkin@synopsys.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Cc: Arnout Vandecappelle <arnout@mind.be>
---
 arch/arch.mk.arc | 4 ++++
 1 file changed, 4 insertions(+)
 create mode 100644 arch/arch.mk.arc

diff --git a/arch/arch.mk.arc b/arch/arch.mk.arc
new file mode 100644
index 0000000000..d324e5c1e1
--- /dev/null
+++ b/arch/arch.mk.arc
@@ -0,0 +1,4 @@
+# ARC7x0 needs -matomic, always
+ifeq ($(BR2_arc750d)$(BR2_arc770d),y)
+ARCH_TOOLCHAIN_WRAPPER_OPTS = -matomic
+endif
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 2/2] arch/arc: arc7x0 always needs -matomic
  2019-06-01 20:33 ` [Buildroot] [PATCH 2/2] arch/arc: arc7x0 always needs -matomic Yann E. MORIN
@ 2019-06-01 20:37   ` Thomas Petazzoni
  2019-06-01 20:50     ` Yann E. MORIN
  0 siblings, 1 reply; 7+ messages in thread
From: Thomas Petazzoni @ 2019-06-01 20:37 UTC (permalink / raw)
  To: buildroot

On Sat,  1 Jun 2019 22:33:51 +0200
"Yann E. MORIN" <yann.morin.1998@free.fr> wrote:

> diff --git a/arch/arch.mk.arc b/arch/arch.mk.arc
> new file mode 100644
> index 0000000000..d324e5c1e1
> --- /dev/null
> +++ b/arch/arch.mk.arc
> @@ -0,0 +1,4 @@
> +# ARC7x0 needs -matomic, always
> +ifeq ($(BR2_arc750d)$(BR2_arc770d),y)
> +ARCH_TOOLCHAIN_WRAPPER_OPTS = -matomic
> +endif

So can we drop 

TARGET_ABI += -matomic

from package/Makefile.in ?

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 2/2] arch/arc: arc7x0 always needs -matomic
  2019-06-01 20:37   ` Thomas Petazzoni
@ 2019-06-01 20:50     ` Yann E. MORIN
  2019-06-03  5:42       ` Alexey Brodkin
  0 siblings, 1 reply; 7+ messages in thread
From: Yann E. MORIN @ 2019-06-01 20:50 UTC (permalink / raw)
  To: buildroot

Thomas, All,

On 2019-06-01 22:37 +0200, Thomas Petazzoni spake thusly:
> On Sat,  1 Jun 2019 22:33:51 +0200
> "Yann E. MORIN" <yann.morin.1998@free.fr> wrote:
> > diff --git a/arch/arch.mk.arc b/arch/arch.mk.arc
> > new file mode 100644
> > index 0000000000..d324e5c1e1
> > --- /dev/null
> > +++ b/arch/arch.mk.arc
> > @@ -0,0 +1,4 @@
> > +# ARC7x0 needs -matomic, always
> > +ifeq ($(BR2_arc750d)$(BR2_arc770d),y)
> > +ARCH_TOOLCHAIN_WRAPPER_OPTS = -matomic
> > +endif
> So can we drop 
> TARGET_ABI += -matomic
> from package/Makefile.in ?

Ah, I see that the condition there is not the same as the one I wrote.

Alexey, last time I asked [0], you did not reply, so here goes again: what
variants of ARC really require -matomic, as you reported on [2] [3].

From [1], I understood that only arc700 was impacted, but the existing
condition to add -matomic for arc [4] is not the same.

So, quid?

[0] https://patchwork.ozlabs.org/comment/2169504/
[1] https://patchwork.ozlabs.org/comment/2159927/
[2] https://patchwork.ozlabs.org/patch/1087471/
[3] https://patchwork.ozlabs.org/patch/1087480/
[4] https://git.buildroot.org/buildroot/tree/package/Makefile.in#n106

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 2/2] arch/arc: arc7x0 always needs -matomic
  2019-06-01 20:50     ` Yann E. MORIN
@ 2019-06-03  5:42       ` Alexey Brodkin
  2019-07-14 14:21         ` Yann E. MORIN
  0 siblings, 1 reply; 7+ messages in thread
From: Alexey Brodkin @ 2019-06-03  5:42 UTC (permalink / raw)
  To: buildroot

Hi Yann, Thomas, all,

> -----Original Message-----
> From: Yann E. MORIN <yann.morin.1998@free.fr>
> Sent: Saturday, June 1, 2019 11:51 PM
> To: Thomas Petazzoni <thomas.petazzoni@bootlin.com>; Alexey Brodkin <abrodkin@synopsys.com>
> Cc: Arnout Vandecappelle <arnout@mind.be>; buildroot at buildroot.org
> Subject: Re: [PATCH 2/2] arch/arc: arc7x0 always needs -matomic
> 
> Thomas, All,
> 
> On 2019-06-01 22:37 +0200, Thomas Petazzoni spake thusly:
> > On Sat,  1 Jun 2019 22:33:51 +0200
> > "Yann E. MORIN" <yann.morin.1998@free.fr> wrote:
> > > diff --git a/arch/arch.mk.arc b/arch/arch.mk.arc
> > > new file mode 100644
> > > index 0000000000..d324e5c1e1
> > > --- /dev/null
> > > +++ b/arch/arch.mk.arc
> > > @@ -0,0 +1,4 @@
> > > +# ARC7x0 needs -matomic, always
> > > +ifeq ($(BR2_arc750d)$(BR2_arc770d),y)
> > > +ARCH_TOOLCHAIN_WRAPPER_OPTS = -matomic
> > > +endif
> > So can we drop
> > TARGET_ABI += -matomic
> > from package/Makefile.in ?
> 
> Ah, I see that the condition there is not the same as the one I wrote.
> 
> Alexey, last time I asked [0], you did not reply, so here goes again: what
> variants of ARC really require -matomic, as you reported on [2] [3].
> 
> From [1], I understood that only arc700 was impacted, but the existing
> condition to add -matomic for arc [4] is not the same.
> 
> So, quid?

That's indeed not super straight-forward.

As of today we have 2 families of cores capable of running full-scale OS,
i.e. with MMU at least. These are ARC700 [1] and ARC HS [2].

And while all ARC HS cores have support of atomic instructions in their
base configurations in case of ARC700 they were not included in base configs
(I guess because back in the day in absence of SMP everybody was happy with
compare-exchange). What's worse those atomic-less configurations really exist
and that's why I'd still prefer to support them.

Speaking about atomics support in the toolchain we keep "-matomic" disabled
for "-mcpu=arc700" and have it enabled for all ARC HS varieties
(hs, hs38, hs38_linux etc), see:

| # arc-linux-gcc -mcpu=arc700 -Q --help=target | grep matomic
|   -matomic                              [disabled]
| #?arc-linux-gcc -mcpu=archs -Q --help=target | grep matomic
|   -matomic                              [enabled]

I.e. passing "-matomic" for ARC HS makes not much sense - it's enabled already
implicitly due to either "-mcpu" on GCC invocation or "--with-cpu" on GCC
configuration.

Now answering your and Tomas' questions:
1. In theory ARC750 is exactly that legacy configuration w/o atomics so we
   may just depend on "BR2_arc750d".
2. In practice given atomics might be disabled (or enabled) during core
   configuration [while designing the chip based on ARC700 family] it
   might still be a better option to rely on "BR2_ARC_ATOMIC_EXT" which:
     a) Gets pre-set of !BR2_arc750d
     b) Might be changed by a user

That said I don't have a firm preference here.

If you feel that dropping BR2_ARC_ATOMIC_EXT and relying on "BR2_arc750d"
for disabling atomics makes BR code cleaner let's go that way.

[1] https://www.synopsys.com/designware-ip/processor-solutions/arc-processors/arc-700-family.html
[2] https://www.synopsys.com/designware-ip/processor-solutions/arc-processors/arc-hs-family.html

-Alexey

P.S. BTW is there a chance to get our changes which add more flavors of ARC HS cores
     reviewed?

[3] https://patchwork.ozlabs.org/patch/995220/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 2/2] arch/arc: arc7x0 always needs -matomic
  2019-06-03  5:42       ` Alexey Brodkin
@ 2019-07-14 14:21         ` Yann E. MORIN
  0 siblings, 0 replies; 7+ messages in thread
From: Yann E. MORIN @ 2019-07-14 14:21 UTC (permalink / raw)
  To: buildroot

Alexey, All,

On 2019-06-03 05:42 +0000, Alexey Brodkin spake thusly:
> > Alexey, last time I asked [0], you did not reply, so here goes again: what
> > variants of ARC really require -matomic, as you reported on [2] [3].
> > 
> > From [1], I understood that only arc700 was impacted, but the existing
> > condition to add -matomic for arc [4] is not the same.
> > 
> > So, quid?
> 
> That's indeed not super straight-forward.
> 
> As of today we have 2 families of cores capable of running full-scale OS,
> i.e. with MMU at least. These are ARC700 [1] and ARC HS [2].
> 
> And while all ARC HS cores have support of atomic instructions in their
> base configurations in case of ARC700 they were not included in base configs
> (I guess because back in the day in absence of SMP everybody was happy with
> compare-exchange). What's worse those atomic-less configurations really exist
> and that's why I'd still prefer to support them.
> 
> Speaking about atomics support in the toolchain we keep "-matomic" disabled
> for "-mcpu=arc700" and have it enabled for all ARC HS varieties
> (hs, hs38, hs38_linux etc), see:
> 
> | # arc-linux-gcc -mcpu=arc700 -Q --help=target | grep matomic
> |   -matomic                              [disabled]
> | #?arc-linux-gcc -mcpu=archs -Q --help=target | grep matomic
> |   -matomic                              [enabled]
> 
> I.e. passing "-matomic" for ARC HS makes not much sense - it's enabled already
> implicitly due to either "-mcpu" on GCC invocation or "--with-cpu" on GCC
> configuration.
> 
> Now answering your and Tomas' questions:
> 1. In theory ARC750 is exactly that legacy configuration w/o atomics so we
>    may just depend on "BR2_arc750d".
> 2. In practice given atomics might be disabled (or enabled) during core
>    configuration [while designing the chip based on ARC700 family] it
>    might still be a better option to rely on "BR2_ARC_ATOMIC_EXT" which:
>      a) Gets pre-set of !BR2_arc750d
>      b) Might be changed by a user
> 
> That said I don't have a firm preference here.
> 
> If you feel that dropping BR2_ARC_ATOMIC_EXT and relying on "BR2_arc750d"
> for disabling atomics makes BR code cleaner let's go that way.

Thank you very much for these detailed explanations.

However, I am still unsure what to do, and under which conditions we
want to force -matomic...

So, I'll respin this series with what I think I have understood. If I
still messed things up, then you'll have to grab the patches and fix
them.

Thanks again! :-)

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-07-14 14:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-01 20:33 [Buildroot] [PATCH 0/2] arch: allow passing compile flags (branch yem/arc-atomic) Yann E. MORIN
2019-06-01 20:33 ` [Buildroot] [PATCH 1/2] toolchain: allow architectures to enforce compilation flags Yann E. MORIN
2019-06-01 20:33 ` [Buildroot] [PATCH 2/2] arch/arc: arc7x0 always needs -matomic Yann E. MORIN
2019-06-01 20:37   ` Thomas Petazzoni
2019-06-01 20:50     ` Yann E. MORIN
2019-06-03  5:42       ` Alexey Brodkin
2019-07-14 14:21         ` Yann E. MORIN

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox