All of lore.kernel.org
 help / color / mirror / Atom feed
* [Suggestion] tile: include: asm: missing "feedback.h" file.
@ 2013-06-26  4:25 Chen Gang
  2013-06-27 14:16 ` Chris Metcalf
  0 siblings, 1 reply; 9+ messages in thread
From: Chen Gang @ 2013-06-26  4:25 UTC (permalink / raw)
  To: cmetcalf, linux-kernel

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.
-- 
Chen Gang

Asianux Corporation

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

* Re: [Suggestion] tile: include: asm: missing "feedback.h" file.
  2013-06-26  4:25 [Suggestion] tile: include: asm: missing "feedback.h" file Chen Gang
@ 2013-06-27 14:16 ` Chris Metcalf
  2013-06-28  0:28   ` Chen Gang
  0 siblings, 1 reply; 9+ messages in thread
From: Chris Metcalf @ 2013-06-27 14:16 UTC (permalink / raw)
  To: Chen Gang; +Cc: linux-kernel

On 6/26/2013 12:25 AM, Chen Gang wrote:
> 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.

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

-- 
Chris Metcalf, Tilera Corp.
http://www.tilera.com


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

* Re: [Suggestion] tile: include: asm: missing "feedback.h" file.
  2013-06-27 14:16 ` Chris Metcalf
@ 2013-06-28  0:28   ` Chen Gang
  2013-06-28  1:51     ` [PATCH] arch: tile: include: asm: add cmpxchg64() definition Chen Gang
  0 siblings, 1 reply; 9+ messages in thread
From: Chen Gang @ 2013-06-28  0:28 UTC (permalink / raw)
  To: Chris Metcalf; +Cc: linux-kernel

On 06/27/2013 10:16 PM, Chris Metcalf wrote:
> On 6/26/2013 12:25 AM, Chen Gang wrote:
>> > 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.
> 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.

> 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.
-- 
Chen Gang

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

* [PATCH] arch: tile: include: asm: add cmpxchg64() definition
  2013-06-28  0:28   ` Chen Gang
@ 2013-06-28  1:51     ` Chen Gang
  2013-06-28 15:09       ` Ralf Baechle
  0 siblings, 1 reply; 9+ messages in thread
From: Chen Gang @ 2013-06-28  1:51 UTC (permalink / raw)
  To: Chris Metcalf; +Cc: linux-kernel, Linux-Arch

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]

Signed-off-by: Chen Gang <gang.chen@asianux.com>
---
 arch/tile/include/asm/cmpxchg.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/tile/include/asm/cmpxchg.h b/arch/tile/include/asm/cmpxchg.h
index 276f067..7688c28 100644
--- a/arch/tile/include/asm/cmpxchg.h
+++ b/arch/tile/include/asm/cmpxchg.h
@@ -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 */
-- 
1.7.7.6

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

* Re: [PATCH] arch: tile: include: asm: add cmpxchg64() definition
  2013-06-28  1:51     ` [PATCH] arch: tile: include: asm: add cmpxchg64() definition Chen Gang
@ 2013-06-28 15:09       ` Ralf Baechle
  2013-07-01  2:08         ` Chen Gang
  0 siblings, 1 reply; 9+ messages in thread
From: Ralf Baechle @ 2013-06-28 15:09 UTC (permalink / raw)
  To: Chen Gang, Jörn Engel
  Cc: Chris Metcalf, linux-kernel, Linux-Arch, Paul Gortmaker

On Fri, Jun 28, 2013 at 09:51:35AM +0800, Chen Gang wrote:

> 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]
> 
> Signed-off-by: Chen Gang <gang.chen@asianux.com>
> ---
>  arch/tile/include/asm/cmpxchg.h |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/tile/include/asm/cmpxchg.h b/arch/tile/include/asm/cmpxchg.h
> index 276f067..7688c28 100644
> --- a/arch/tile/include/asm/cmpxchg.h
> +++ b/arch/tile/include/asm/cmpxchg.h
> @@ -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

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

* Re: [PATCH] arch: tile: include: asm: add cmpxchg64() definition
  2013-06-28 15:09       ` Ralf Baechle
@ 2013-07-01  2:08         ` Chen Gang
  2013-07-01  2:21           ` [PATCH v2] " Chen Gang
  0 siblings, 1 reply; 9+ messages in thread
From: Chen Gang @ 2013-07-01  2:08 UTC (permalink / raw)
  To: Ralf Baechle
  Cc: Jörn Engel, Chris Metcalf, linux-kernel, Linux-Arch, Paul Gortmaker


Firstly thank you very much for replying quickly with details.

On 06/28/2013 11:09 PM, Ralf Baechle wrote:
> On Fri, Jun 28, 2013 at 09:51:35AM +0800, Chen Gang wrote:
> 
>> 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]
>>
>> Signed-off-by: Chen Gang <gang.chen@asianux.com>
>> ---
>>  arch/tile/include/asm/cmpxchg.h |    2 ++
>>  1 files changed, 2 insertions(+), 0 deletions(-)
>>
>> diff --git a/arch/tile/include/asm/cmpxchg.h b/arch/tile/include/asm/cmpxchg.h
>> index 276f067..7688c28 100644
>> --- a/arch/tile/include/asm/cmpxchg.h
>> +++ b/arch/tile/include/asm/cmpxchg.h
>> @@ -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:
> 

Oh, really it is. thanks.

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

I should follow it to send patch v2, thanks.

> 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.
> 

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.
-- 
Chen Gang

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

* [PATCH v2] arch: tile: include: asm: add cmpxchg64() definition
  2013-07-01  2:08         ` Chen Gang
@ 2013-07-01  2:21           ` Chen Gang
  2013-07-17 16:46             ` Chris Metcalf
  0 siblings, 1 reply; 9+ messages in thread
From: Chen Gang @ 2013-07-01  2:21 UTC (permalink / raw)
  To: Ralf Baechle
  Cc: Jörn Engel, Chris Metcalf, linux-kernel, Linux-Arch, Paul Gortmaker

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]

Signed-off-by: Chen Gang <gang.chen@asianux.com>
---
 arch/tile/include/asm/cmpxchg.h |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/arch/tile/include/asm/cmpxchg.h b/arch/tile/include/asm/cmpxchg.h
index 276f067..1da5bfb 100644
--- a/arch/tile/include/asm/cmpxchg.h
+++ b/arch/tile/include/asm/cmpxchg.h
@@ -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 */
-- 
1.7.7.6

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

* Re: [PATCH v2] arch: tile: include: asm: add cmpxchg64() definition
  2013-07-01  2:21           ` [PATCH v2] " Chen Gang
@ 2013-07-17 16:46             ` Chris Metcalf
  2013-07-18  0:02               ` Chen Gang
  0 siblings, 1 reply; 9+ messages in thread
From: Chris Metcalf @ 2013-07-17 16:46 UTC (permalink / raw)
  To: Chen Gang
  Cc: Ralf Baechle, Jörn Engel, linux-kernel, Linux-Arch, Paul Gortmaker

On 6/30/2013 10:21 PM, Chen Gang wrote:
> 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]
>
> Signed-off-by: Chen Gang <gang.chen@asianux.com>

Thanks, taken into the tile tree.

-- 
Chris Metcalf, Tilera Corp.
http://www.tilera.com


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

* Re: [PATCH v2] arch: tile: include: asm: add cmpxchg64() definition
  2013-07-17 16:46             ` Chris Metcalf
@ 2013-07-18  0:02               ` Chen Gang
  0 siblings, 0 replies; 9+ messages in thread
From: Chen Gang @ 2013-07-18  0:02 UTC (permalink / raw)
  To: Chris Metcalf
  Cc: Ralf Baechle, Jörn Engel, linux-kernel, Linux-Arch, Paul Gortmaker

On 07/18/2013 12:46 AM, Chris Metcalf wrote:
> On 6/30/2013 10:21 PM, Chen Gang wrote:
>> 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]
>>
>> Signed-off-by: Chen Gang <gang.chen@asianux.com>
> 
> Thanks, taken into the tile tree.
> 

Thank you too.

:-)

-- 
Chen Gang

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

end of thread, other threads:[~2013-07-18  0:03 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-26  4:25 [Suggestion] tile: include: asm: missing "feedback.h" file Chen Gang
2013-06-27 14:16 ` Chris Metcalf
2013-06-28  0:28   ` Chen Gang
2013-06-28  1:51     ` [PATCH] arch: tile: include: asm: add cmpxchg64() definition Chen Gang
2013-06-28 15:09       ` Ralf Baechle
2013-07-01  2:08         ` Chen Gang
2013-07-01  2:21           ` [PATCH v2] " Chen Gang
2013-07-17 16:46             ` Chris Metcalf
2013-07-18  0:02               ` Chen Gang

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.