2007-11-27 00:15:41

by Christoph Lameter

[permalink] [raw]
Subject: [patch 04/14] ia64: Remove the __SMALL_ADDR_AREA attribute for per cpu access

The model(small) attribute is not supported by gcc 4.X. The tests
will always be negative today.

Cc: [email protected]
Cc: [email protected]
Signed-off-by: Christoph Lameter <[email protected]>

---
arch/ia64/scripts/check-model.c | 1 -
arch/ia64/scripts/toolchain-flags | 6 ------
include/asm-ia64/percpu.h | 12 +++---------
3 files changed, 3 insertions(+), 16 deletions(-)

Index: linux-2.6/include/asm-ia64/percpu.h
===================================================================
--- linux-2.6.orig/include/asm-ia64/percpu.h 2007-11-22 15:55:47.634454755 -0800
+++ linux-2.6/include/asm-ia64/percpu.h 2007-11-22 15:56:15.974704716 -0800
@@ -15,24 +15,18 @@

#include <linux/threads.h>

-#ifdef HAVE_MODEL_SMALL_ATTRIBUTE
-# define __SMALL_ADDR_AREA __attribute__((__model__ (__small__)))
-#else
-# define __SMALL_ADDR_AREA
-#endif
-
#define DECLARE_PER_CPU(type, name) \
- extern __SMALL_ADDR_AREA __typeof__(type) per_cpu__##name
+ extern __typeof__(type) per_cpu__##name

/* Separate out the type, so (int[3], foo) works. */
#define DEFINE_PER_CPU(type, name) \
__attribute__((__section__(".data.percpu"))) \
- __SMALL_ADDR_AREA __typeof__(type) per_cpu__##name
+ __typeof__(type) per_cpu__##name

#ifdef CONFIG_SMP
#define DEFINE_PER_CPU_SHARED_ALIGNED(type, name) \
__attribute__((__section__(".data.percpu.shared_aligned"))) \
- __SMALL_ADDR_AREA __typeof__(type) per_cpu__##name \
+ __typeof__(type) per_cpu__##name \
____cacheline_aligned_in_smp
#else
#define DEFINE_PER_CPU_SHARED_ALIGNED(type, name) \
Index: linux-2.6/arch/ia64/scripts/check-model.c
===================================================================
--- linux-2.6.orig/arch/ia64/scripts/check-model.c 2007-11-22 15:56:40.890455063 -0800
+++ /dev/null 1970-01-01 00:00:00.000000000 +0000
@@ -1 +0,0 @@
-int __attribute__ ((__model__ (__small__))) x;
Index: linux-2.6/arch/ia64/scripts/toolchain-flags
===================================================================
--- linux-2.6.orig/arch/ia64/scripts/toolchain-flags 2007-11-22 15:57:07.329204964 -0800
+++ linux-2.6/arch/ia64/scripts/toolchain-flags 2007-11-22 15:57:27.229018356 -0800
@@ -35,12 +35,6 @@ if [ $res -eq 0 ]; then
CPPFLAGS="$CPPFLAGS -DHAVE_WORKING_TEXT_ALIGN"
fi

-if ! $CC -c $dir/check-model.c -o $out 2>&1 | grep __model__ | grep -q attrib
-then
- CPPFLAGS="$CPPFLAGS -DHAVE_MODEL_SMALL_ATTRIBUTE"
-fi
-rm -f $out
-
# Check whether assembler supports .serialize.{data,instruction} directive.

$CC -c $dir/check-serialize.S -o $out 2>/dev/null

--


2007-11-27 05:20:28

by David Mosberger-Tang

[permalink] [raw]
Subject: Re: [patch 04/14] ia64: Remove the __SMALL_ADDR_AREA attribute for per cpu access

On 11/26/07, Christoph Lameter <[email protected]> wrote:
> The model(small) attribute is not supported by gcc 4.X. The tests
> will always be negative today.

What was the rationale for removing this attribute?

--david

2007-11-27 09:30:47

by Andreas Schwab

[permalink] [raw]
Subject: Re: [patch 04/14] ia64: Remove the __SMALL_ADDR_AREA attribute for per cpu access

Christoph Lameter <[email protected]> writes:

> The model(small) attribute is not supported by gcc 4.X.

Which gcc 4.X are you talking about?

Andreas.

--
Andreas Schwab, SuSE Labs, [email protected]
SuSE Linux Products GmbH, Maxfeldstra?e 5, 90409 N?rnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."

2007-11-27 18:15:39

by Christoph Lameter

[permalink] [raw]
Subject: Re: [patch 04/14] ia64: Remove the __SMALL_ADDR_AREA attribute for per cpu access

On Mon, 26 Nov 2007, David Mosberger-Tang wrote:

> On 11/26/07, Christoph Lameter <[email protected]> wrote:
> > The model(small) attribute is not supported by gcc 4.X. The tests
> > will always be negative today.
>
> What was the rationale for removing this attribute?

The code is then similar across all architectures and can be moved into
generic code.

2007-11-27 18:17:23

by Christoph Lameter

[permalink] [raw]
Subject: Re: [patch 04/14] ia64: Remove the __SMALL_ADDR_AREA attribute for per cpu access

On Tue, 27 Nov 2007, Andreas Schwab wrote:

> Christoph Lameter <[email protected]> writes:
>
> > The model(small) attribute is not supported by gcc 4.X.
>
> Which gcc 4.X are you talking about?

All. Last gcc that supported this was 3.4.

2007-11-27 21:10:37

by David Mosberger-Tang

[permalink] [raw]
Subject: Re: [patch 04/14] ia64: Remove the __SMALL_ADDR_AREA attribute for per cpu access

On 11/27/07, Christoph Lameter <[email protected]> wrote:
> On Mon, 26 Nov 2007, David Mosberger-Tang wrote:
>
> > On 11/26/07, Christoph Lameter <[email protected]> wrote:
> > > The model(small) attribute is not supported by gcc 4.X. The tests
> > > will always be negative today.
> >
> > What was the rationale for removing this attribute?
>
> The code is then similar across all architectures and can be moved into
> generic code.

Uniformity for the sake of uniformity? The small data addressing is
really elegant and I don't think it should be dropped just for the
sake of uniformity.

--david

2007-11-27 21:18:45

by Christoph Lameter

[permalink] [raw]
Subject: Re: [patch 04/14] ia64: Remove the __SMALL_ADDR_AREA attribute for per cpu access

On Tue, 27 Nov 2007, David Mosberger-Tang wrote:

> Uniformity for the sake of uniformity? The small data addressing is
> really elegant and I don't think it should be dropped just for the
> sake of uniformity.

Uniformity for the sake of code size reduction and easier maintenance.

Yes I think it would be great to have this feature on all arches if
possible. If someone could work with the gcc /linker folks to get this
done that would be great.

But the feature has been removed from gcc and so its not usable for IA64
with a current compiler anymore. This is basically removing useless code.


2007-11-27 21:24:45

by Andreas Schwab

[permalink] [raw]
Subject: Re: [patch 04/14] ia64: Remove the __SMALL_ADDR_AREA attribute for per cpu access

Christoph Lameter <[email protected]> writes:

> On Tue, 27 Nov 2007, Andreas Schwab wrote:
>
>> Christoph Lameter <[email protected]> writes:
>>
>> > The model(small) attribute is not supported by gcc 4.X.
>>
>> Which gcc 4.X are you talking about?
>
> All. Last gcc that supported this was 3.4.

Strange. Works fine here.

$ arch/ia64/scripts/toolchain-flags gcc objdump readelf
-DHAVE_WORKING_TEXT_ALIGN -DHAVE_MODEL_SMALL_ATTRIBUTE -DHAVE_SERIALIZE_DIRECTIVE
$ gcc --version | head -n 1
gcc (GCC) 4.2.1 (SUSE Linux)
$ grep ia64_handle_model_attribute config/ia64/*.c
config/ia64/ia64.c:static tree ia64_handle_model_attribute (tree *, tree, tree, int, bool *);
config/ia64/ia64.c: { "model", 1, 1, true, false, false, ia64_handle_model_attribute },
config/ia64/ia64.c:ia64_handle_model_attribute (tree *node, tree name, tree args,
$ grep small_addr_symbolic_operand config/ia64/*.md
config/ia64/constraints.md: (match_operand 0 "small_addr_symbolic_operand"))
config/ia64/predicates.md:(define_predicate "small_addr_symbolic_operand"

Andreas.

--
Andreas Schwab, SuSE Labs, [email protected]
SuSE Linux Products GmbH, Maxfeldstra?e 5, 90409 N?rnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."

2007-11-27 21:27:24

by David Mosberger-Tang

[permalink] [raw]
Subject: Re: [patch 04/14] ia64: Remove the __SMALL_ADDR_AREA attribute for per cpu access

On 11/27/07, Christoph Lameter <[email protected]> wrote:
> On Tue, 27 Nov 2007, David Mosberger-Tang wrote:
>
> > Uniformity for the sake of uniformity? The small data addressing is
> > really elegant and I don't think it should be dropped just for the
> > sake of uniformity.
>
> Uniformity for the sake of code size reduction and easier maintenance.

Code-size reduction? You must be talking *source* code size
reduction. Surely the small-data access-method decreases object code
size.

--david

2007-11-27 21:38:19

by Christoph Lameter

[permalink] [raw]
Subject: Re: [patch 04/14] ia64: Remove the __SMALL_ADDR_AREA attribute for per cpu access

On Tue, 27 Nov 2007, Andreas Schwab wrote:

> Strange. Works fine here.
>
> $ arch/ia64/scripts/toolchain-flags gcc objdump readelf
> -DHAVE_WORKING_TEXT_ALIGN -DHAVE_MODEL_SMALL_ATTRIBUTE -DHAVE_SERIALIZE_DIRECTIVE
> $ gcc --version | head -n 1
> gcc (GCC) 4.2.1 (SUSE Linux)
> $ grep ia64_handle_model_attribute config/ia64/*.c
> config/ia64/ia64.c:static tree ia64_handle_model_attribute (tree *, tree, tree, int, bool *);
> config/ia64/ia64.c: { "model", 1, 1, true, false, false, ia64_handle_model_attribute },
> config/ia64/ia64.c:ia64_handle_model_attribute (tree *node, tree name, tree args,
> $ grep small_addr_symbolic_operand config/ia64/*.md
> config/ia64/constraints.md: (match_operand 0 "small_addr_symbolic_operand"))
> config/ia64/predicates.md:(define_predicate "small_addr_symbolic_operand"

Hmmm...

http://www.ohse.de/uwe/articles/gcc-attributes.html

says:

model (MODEL-NAME)
Found in versions: 2.8-3.4

But true my compiler still takes it. Ok, I am going to add an option to
add attributes to percpu definitions.

2007-11-27 22:02:19

by Christoph Lameter

[permalink] [raw]
Subject: Re: [patch 04/14] ia64: Remove the __SMALL_ADDR_AREA attribute for per cpu access

On Tue, 27 Nov 2007, David Mosberger-Tang wrote:

> Code-size reduction? You must be talking *source* code size
> reduction. Surely the small-data access-method decreases object code
> size.

Yes source code reduction. I just added the attribute back but in such a
way that any arch can add attributes to per cpu definitions.

2007-11-27 22:15:23

by Adrian Bunk

[permalink] [raw]
Subject: Re: [patch 04/14] ia64: Remove the __SMALL_ADDR_AREA attribute for per cpu access

On Tue, Nov 27, 2007 at 01:38:02PM -0800, Christoph Lameter wrote:
>...
> Hmmm...
>
> http://www.ohse.de/uwe/articles/gcc-attributes.html
>
> says:
>
> model (MODEL-NAME)
> Found in versions: 2.8-3.4
>...

This site says at the top it used gcc versions up to 3.4, so it
obviously can't find anything in gcc >= 4.0 ...

cu
Adrian

--

"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed