Skip to contentSkip to conversation

tile: include: asm: missing "feedback.h" file.

Suggestion Superseded Chen Gang 3 participants 9 messages Jun 26, 2013 – Jul 18, 2013 Generic include/asm header files

lore
Share & tools
lore

Chen Gang

author
#0 lore raw

Hello Maintainers:

The compilation failed by "make ARCH=tile tilegx_defconfig", and "make ARCH=tile CROSS_COMPILE=tile-linux-gnu-" for upstream next-20130625.

The related error:

CC kernel/bounds.s
In file included from include/linux/linkage.h:7:0,
from include/linux/kernel.h:6,
from include/asm-generic/bug.h:13,
from arch/tile/include/generated/asm/bug.h:1,
from include/linux/bug.h:4,
from include/linux/page-flags.h:9,
from kernel/bounds.c:9:
/root/linux-next/arch/tile/include/asm/linkage.h:18:22: fatal error: feedback.h: No such file or directory

We really need "feedback.h"

arch/tile/kernel/entry.S: Assembler messages:
arch/tile/kernel/entry.S:26: Error: Unknown opcode feedback_enter(current_text_addr)'. arch/tile/kernel/entry.S:46: Error: Unknown opcode feedback_enter(dump_stack)'. arch/tile/kernel/entry.S:53: Error: Unknown opcode feedback_enter(KBacktraceIterator_init_current)'. arch/tile/kernel/entry.S:61: Error: Unknown opcode feedback_enter(smp_nap)'. arch/tile/kernel/entry.S:76: Error: Unknown opcode `feedback_enter(_cpu_idle)'.

Welcome any suggestions and completions.

Thanks.

Signature · 3 lines
Chen Gang

Asianux Corporation
#1 lore raw
Quoted 19 lines · Chen Gang

Hello Maintainers:

The compilation failed by "make ARCH=tile tilegx_defconfig", and "make ARCH=tile CROSS_COMPILE=tile-linux-gnu-" for upstream next-20130625.

The related error:

CC kernel/bounds.s
In file included from include/linux/linkage.h:7:0,
from include/linux/kernel.h:6,
from include/asm-generic/bug.h:13,
from arch/tile/include/generated/asm/bug.h:1,
from include/linux/bug.h:4,
from include/linux/page-flags.h:9,
from kernel/bounds.c:9:
/root/linux-next/arch/tile/include/asm/linkage.h:18:22: fatal error: feedback.h: No such file or directory

We really need "feedback.h"

Quoted 8 lines

arch/tile/kernel/entry.S: Assembler messages:
arch/tile/kernel/entry.S:26: Error: Unknown opcode feedback_enter(current_text_addr)'. arch/tile/kernel/entry.S:46: Error: Unknown opcode feedback_enter(dump_stack)'. arch/tile/kernel/entry.S:53: Error: Unknown opcode feedback_enter(KBacktraceIterator_init_current)'. arch/tile/kernel/entry.S:61: Error: Unknown opcode feedback_enter(smp_nap)'. arch/tile/kernel/entry.S:76: Error: Unknown opcode `feedback_enter(_cpu_idle)'.

Welcome any suggestions and completions.

This is fixed in gcc 4.7.2 or later. For the workaround, see:

http://www.tilera.com/scm/source.html#feedback_h

Essentially, you just have to create a dummy <feedback.h> header, e.g. for 4.7.1:

  cat > $install/lib/gcc/tilegx-unknown-linux-gnu/4.7.1/include/feedback.h
  #define FEEDBACK_ENTER_EXPLICIT(FUNCNAME, SECNAME, SIZE)
  #define FEEDBACK_ENTER(FUNCNAME)
  #define FEEDBACK_REENTER(FUNCNAME)
  #define FEEDBACK_ENTRY(FUNCNAME, SECNAME, SIZE)
  ^D
Signature · 2 lines
Chris Metcalf, Tilera Corp.
http://www.tilera.com
author
#2 lore raw
Quoted 27 lines · Chris Metcalf
Quoted 26 lines · Chen Gang
Quoted 26 lines

Hello Maintainers:

The compilation failed by "make ARCH=tile tilegx_defconfig", and "make ARCH=tile CROSS_COMPILE=tile-linux-gnu-" for upstream next-20130625.

The related error:

CC kernel/bounds.s
In file included from include/linux/linkage.h:7:0,
from include/linux/kernel.h:6,
from include/asm-generic/bug.h:13,
from arch/tile/include/generated/asm/bug.h:1,
from include/linux/bug.h:4,
from include/linux/page-flags.h:9,
from kernel/bounds.c:9:
/root/linux-next/arch/tile/include/asm/linkage.h:18:22: fatal error: feedback.h: No such file or directory

We really need "feedback.h"

arch/tile/kernel/entry.S: Assembler messages:
arch/tile/kernel/entry.S:26: Error: Unknown opcode feedback_enter(current_text_addr)'. arch/tile/kernel/entry.S:46: Error: Unknown opcode feedback_enter(dump_stack)'. arch/tile/kernel/entry.S:53: Error: Unknown opcode feedback_enter(KBacktraceIterator_init_current)'. arch/tile/kernel/entry.S:61: Error: Unknown opcode feedback_enter(smp_nap)'. arch/tile/kernel/entry.S:76: Error: Unknown opcode `feedback_enter(_cpu_idle)'.

Quoted 5 lines
Quoted 1 line
Quoted 1 line

Welcome any suggestions and completions.

This is fixed in gcc 4.7.2 or later. For the workaround, see:

http://www.tilera.com/scm/source.html#feedback_h

Thank you very much.

Quoted 8 lines

Essentially, you just have to create a dummy <feedback.h> header, e.g. for 4.7.1:

  cat > $install/lib/gcc/tilegx-unknown-linux-gnu/4.7.1/include/feedback.h
  #define FEEDBACK_ENTER_EXPLICIT(FUNCNAME, SECNAME, SIZE)
  #define FEEDBACK_ENTER(FUNCNAME)
  #define FEEDBACK_REENTER(FUNCNAME)
  #define FEEDBACK_ENTRY(FUNCNAME, SECNAME, SIZE)
  ^D

I should try as soon as possible.

Thanks again.

Signature · 1 line
Chen Gang
author
#3 lore raw

PATCH 1/1 arch: tile: include: asm: add cmpxchg64() definition

Need add cmpxchg64(), or will cause compiling issue.

Just define it as cmpxchg(), since cmpxchg() can support 8 bytes.

The related error (with allmodconfig):

drivers/block/blockconsole.c: In function ‘bcon_advance_console_bytes’:
drivers/block/blockconsole.c:164:2: error: implicit declaration of function ‘cmpxchg64’ [-Werror=implicit-function-declaration]

---
 arch/tile/include/asm/cmpxchg.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
arch/tile/include/asm/cmpxchg.h +2 -0
index 276f067..7688c28 100644
@@ -68,6 +68,8 @@ extern unsigned long __cmpxchg_called_with_bad_pointer(void);
 
 #define tas(ptr) (xchg((ptr), 1))
 
+#define cmpxchg64(ptr, o, n)		cmpxchg((ptr), (o), (n))
+
 #endif /* __ASSEMBLY__ */
 
 #endif /* _ASM_TILE_CMPXCHG_H */
Signature · 1 line
1.7.7.6
#4 lore raw

Re: [PATCH] arch: tile: include: asm: add cmpxchg64() definition

Quoted 19 lines · Chen Gang

Need add cmpxchg64(), or will cause compiling issue.

Just define it as cmpxchg(), since cmpxchg() can support 8 bytes.

The related error (with allmodconfig):

drivers/block/blockconsole.c: In function ‘bcon_advance_console_bytes’:
drivers/block/blockconsole.c:164:2: error: implicit declaration of function ‘cmpxchg64’ [-Werror=implicit-function-declaration]

---
 arch/tile/include/asm/cmpxchg.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
arch/tile/include/asm/cmpxchg.h +0 -0
index 276f067..7688c28 100644

arch/tile/include/asm/cmpxchg.h extern unsigned long __cmpxchg_called_with_bad_pointer(void); · line 71

Quoted 4 lines
arch/tile/include/asm/cmpxchg.h +1 -0
@@ -68,6 +68,8 @@ extern unsigned long __cmpxchg_called_with_bad_pointer(void);
 
 #define tas(ptr) (xchg((ptr), 1))
 
+#define cmpxchg64(ptr, o, n)		cmpxchg((ptr), (o), (n))

that's broken. cmpxchg64 is suposed to work on 64 bit operands ONLY. This definition (used by MIPS and Alpha) will work properly:

#define cmpxchg64(ptr, o, n) \

({                                                                      \
	BUILD_BUG_ON(sizeof(*(ptr)) != 8);                              \
	cmpxchg((ptr), (o), (n));                                       \
})

This should cure blockconsole on Tile but not on MIPS.

struct blockconsole {
...

           u64 console_bytes;

...
};

static void bcon_advance_console_bytes(struct blockconsole *bc, int bytes)

{
	u64 old, new;
	...
	} while (cmpxchg64(&bc->console_bytes, old, new) != old);
}

So it's using cmpxchg64() to operate on 64 bit objects - but that's not going to work on every architecture. Many 32 bit architectures only provide atomic operations that operate on 32 bit quantities.

Ralf

author
#5 lore raw

Re: [PATCH] arch: tile: include: asm: add cmpxchg64() definition

Firstly thank you very much for replying quickly with details.

Quoted 22 lines · Ralf Baechle
Quoted 20 lines · Chen Gang

Need add cmpxchg64(), or will cause compiling issue.

Just define it as cmpxchg(), since cmpxchg() can support 8 bytes.

The related error (with allmodconfig):

drivers/block/blockconsole.c: In function ‘bcon_advance_console_bytes’:
drivers/block/blockconsole.c:164:2: error: implicit declaration of function ‘cmpxchg64’ [-Werror=implicit-function-declaration]

---
 arch/tile/include/asm/cmpxchg.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
arch/tile/include/asm/cmpxchg.h +0 -0
index 276f067..7688c28 100644
@@ -68,6 +68,8 @@ extern unsigned long __cmpxchg_called_with_bad_pointer(void);
 
Quoted 7 lines

arch/tile/include/asm/cmpxchg.h extern unsigned long __cmpxchg_called_with_bad_pointer(void); · line 71

Quoted 3 lines
arch/tile/include/asm/cmpxchg.h +1 -0
 #define tas(ptr) (xchg((ptr), 1))
 
+#define cmpxchg64(ptr, o, n)		cmpxchg((ptr), (o), (n))

that's broken. cmpxchg64 is suposed to work on 64 bit operands ONLY. This definition (used by MIPS and Alpha) will work properly:

Oh, really it is. thanks.

Quoted 6 lines

#define cmpxchg64(ptr, o, n) \

({                                                                      \
	BUILD_BUG_ON(sizeof(*(ptr)) != 8);                              \
	cmpxchg((ptr), (o), (n));                                       \
})

I should follow it to send patch v2, thanks.

Quoted 15 lines

This should cure blockconsole on Tile but not on MIPS.

struct blockconsole {
..

           u64 console_bytes;

..
};

static void bcon_advance_console_bytes(struct blockconsole *bc, int bytes)

{
	u64 old, new;
	...
	} while (cmpxchg64(&bc->console_bytes, old, new) != old);
}
Quoted 4 lines

So it's using cmpxchg64() to operate on 64 bit objects - but that's not going to work on every architecture. Many 32 bit architectures only provide atomic operations that operate on 32 bit quantities.

I guess your meaning is:

cmpxchg64() should be an atomic operation.
but on some of 32-bit architectures, they don't implement it as atomic
(no lock protected, at least).
it may cause issue on these 32-bit architectures.

Is it correct ?

If it is correct, I should continue to try to fix it.

Thanks.

Signature · 1 line
Chen Gang
author
#6 lore raw

PATCH v2 1/1 arch: tile: include: asm: add cmpxchg64() definition

Need add cmpxchg64(), or will cause compiling issue.

Need define it as cmpxchg() only for 64-bit operation, since cmpxchg() can support 8 bytes.

The related error (with allmodconfig):

drivers/block/blockconsole.c: In function ‘bcon_advance_console_bytes’:
drivers/block/blockconsole.c:164:2: error: implicit declaration of function ‘cmpxchg64’ [-Werror=implicit-function-declaration]

---
 arch/tile/include/asm/cmpxchg.h |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
arch/tile/include/asm/cmpxchg.h +6 -0
index 276f067..1da5bfb 100644
@@ -68,6 +68,12 @@ extern unsigned long __cmpxchg_called_with_bad_pointer(void);
 
 #define tas(ptr) (xchg((ptr), 1))
 
+#define cmpxchg64(ptr, o, n)						\
+({									\
+	BUILD_BUG_ON(sizeof(*(ptr)) != 8);				\
+	cmpxchg((ptr), (o), (n));					\
+})
+
 #endif /* __ASSEMBLY__ */
 
 #endif /* _ASM_TILE_CMPXCHG_H */
Signature · 1 line
1.7.7.6
#7 lore raw

Re: [PATCH v2] arch: tile: include: asm: add cmpxchg64() definition

Quoted 11 lines · Chen Gang

Need add cmpxchg64(), or will cause compiling issue.

Need define it as cmpxchg() only for 64-bit operation, since cmpxchg() can support 8 bytes.

The related error (with allmodconfig):

drivers/block/blockconsole.c: In function ‘bcon_advance_console_bytes’:
drivers/block/blockconsole.c:164:2: error: implicit declaration of function ‘cmpxchg64’ [-Werror=implicit-function-declaration]

Thanks, taken into the tile tree.

Signature · 2 lines
Chris Metcalf, Tilera Corp.
http://www.tilera.com
author
#8 lore raw

Re: [PATCH v2] arch: tile: include: asm: add cmpxchg64() definition

Quoted 6 lines · Chris Metcalf
Quoted 5 lines · Chen Gang

Need add cmpxchg64(), or will cause compiling issue.

Need define it as cmpxchg() only for 64-bit operation, since cmpxchg() can support 8 bytes.

Quoted 9 lines
Quoted 6 lines

The related error (with allmodconfig):

drivers/block/blockconsole.c: In function ‘bcon_advance_console_bytes’:
drivers/block/blockconsole.c:164:2: error: implicit declaration of function ‘cmpxchg64’ [-Werror=implicit-function-declaration]

Thanks, taken into the tile tree.

Thank you too.

:-)

Signature · 1 line
Chen Gang