Linux 4.10-rc1

Message ID 2a166af6-380d-3ce2-abd0-086041f14f05@huawei.com
State New
Headers show

Commit Message

Kefeng Wang Dec. 26, 2016, 9:05 a.m.
On 2016/12/26 16:38, Hanjun Guo wrote:
> Hi Linus,

> 

> On 2016/12/26 8:41, Linus Torvalds wrote:

>> It's Christmas Day, and it's two weeks since the merge window opened.

>> Thus, the merge window is now closed.

>>

>> I did a few final pulls today, but I also rejected a couple of pulls

>> that came in late in the window and looked dodgy. You know who you

>> are.

>>

>> On the whole, this wasn't all that big a release - nothing like 4.9.

>> Although it wasn't tiny either. I think 4.7 was smaller. 4.8 might

>> have been too. It's xmas day, and right now I can't be arsed to

>> actually do the statistics I'd normally do.

>>

>> Everything looks pretty normal, although we had an unusual amount of

>> tree-wide final cleanups in the last days of the merge window. But the

>> general statistics look fairly common: a bit over half is drivers,

>> maybe slightly less arch updates than normal, and a fair amount of

>> documentation updates due to the sphinx conversion. And then the usual

>> misc noise all over, although the perf tooling updates do stand out.

>>

>> The shortlog is much too big, as it always is during the merge window,

>> so as usual you just get the merge-log.

> 

> Kejian and I got massive compile error when cross-compile the kernel for ARM64, such as

> 

> ./include/asm-generic/atomic-long.h:23: Error: unknown mnemonic `typedef' -- `typedef atomic64_t atomic_long_t'

> ./include/asm-generic/atomic-long.h:44: Error: unknown mnemonic `static' -- `static inline long atomic_long_read(const atomic_long_t*l){atomic64_t*v=(atomic64_t*)l'

> ./include/asm-generic/atomic-long.h:44: Error: unknown mnemonic `return' -- `return (long)READ_ONCE((v)->counter)'

> ./include/asm-generic/atomic-long.h:44: Error: junk at end of line, first unrecognized character is `}'

> ./include/asm-generic/atomic-long.h:45: Error: unknown mnemonic `static' -- `static inline long atomic_long_read_acquire(const atomic_long_t*l){atomic64_t*v=(atomic64_t*)l'

> ./include/asm-generic/atomic-long.h:45: Error: unknown mnemonic `return' -- `return (long)smp_load_acquire(&(v)->counter)'

> ./include/asm-generic/atomic-long.h:45: Error: junk at end of line, first unrecognized character is `}'

> ./include/asm-generic/atomic-long.h:56: Error: unknown mnemonic `static' -- `static inline void atomic_long_set(atomic_long_t*l,long i){atomic64_t*v=(atomic64_t*)l'

> ./include/asm-generic/atomic-long.h:56: Error: unknown mnemonic `write_once' -- `write_once(((v)->counter), (i))'

> ./include/asm-generic/atomic-long.h:56: Error: junk at end of line, first unrecognized character is `}'

> ./include/asm-generic/atomic-long.h:57: Error: unknown mnemonic `static' -- `static inline void atomic_long_set_release(atomic_long_t*l,long i){atomic64_t*v=(atomic64_t*)l'

> ./include/asm-generic/atomic-long.h:57: Error: unknown mnemonic `smp_store_release' -- `smp_store_release(&(v)->counter, (i))'

> ./include/asm-generic/atomic-long.h:57: Error: junk at end of line, first unrecognized character is `}'

> ./include/asm-generic/atomic-long.h:69: Error: unknown mnemonic `static' -- `static inline long atomic_long_add_return(long i,atomic_long_t*l){atomic64_t*v=(atomic64_t*)l'

> ./include/asm-generic/atomic-long.h:69: Error: unknown mnemonic `return' -- `return (long)atomic64_add_return(i,v)'

> ./include/asm-generic/atomic-long.h:69: Error: junk at end of line, first unrecognized character is `}'

> ./include/asm-generic/atomic-long.h:70: Error: unknown mnemonic `static' -- `static inline long atomic_long_add_return_relaxed(long i,atomic_long_t*l){atomic64_t*v=(atomic64_t*)l'

> ./include/asm-generic/atomic-long.h:70: Error: unknown mnemonic `return' -- `return (long)atomic64_add_return_relaxed(i,v)'

> ./include/asm-generic/atomic-long.h:70: Error: junk at end of line, first unrecognized character is `}'

> ./include/asm-generic/atomic-long.h:71: Error: unknown mnemonic `static' -- `static inline long atomic_long_add_return_acquire(long i,atomic_long_t*l){atomic64_t*v=(atomic64_t*)l'

> ./include/asm-generic/atomic-long.h:71: Error: unknown mnemonic `return' -- `return (long)atomic64_add_return_acquire(i,v)'

> ./include/asm-generic/atomic-long.h:71: Error: junk at end of line, first unrecognized character is `}'

> ./include/asm-generic/atomic-long.h:72: Error: unknown mnemonic `static' -- `static inline long atomic_long_add_return_release(long i,atomic_long_t*l){atomic64_t*v=(atomic64_t*)l'

> ./include/asm-generic/atomic-long.h:72: Error: unknown mnemonic `return' -- `return (long)atomic64_add_return_release(i,v)'

> ./include/asm-generic/atomic-long.h:72: Error: junk at end of line, first unrecognized character is `}'

> ./include/asm-generic/atomic-long.h:73: Error: unknown mnemonic `static' -- `static inline long atomic_long_sub_return(long i,atomic_long_t*l){atomic64_t*v=(atomic64_t*)l'

> ./include/asm-generic/atomic-long.h:73: Error: unknown mnemonic `return' -- `return (long)atomic64_sub_return(i,v)'

> ./include/asm-generic/atomic-long.h:73: Error: junk at end of line, first unrecognized character is `}'

> ./include/asm-generic/atomic-long.h:74: Error: unknown mnemonic `static' -- `static inline long atomic_long_sub_return_relaxed(long i,atomic_long_t*l){atomic64_t*v=(atomic64_t*)l'

> ./include/asm-generic/atomic-long.h:74: Error: unknown mnemonic `return' -- `return (long)atomic64_sub_return_relaxed(i,v)'

> ./include/asm-generic/atomic-long.h:74: Error: junk at end of line, first unrecognized character is `}'

> ./include/asm-generic/atomic-long.h:75: Error: unknown mnemonic `static' -- `static inline long atomic_long_sub_return_acquire(long i,atomic_long_t*l){atomic64_t*v=(atomic64_t*)l'

> ./include/asm-generic/atomic-long.h:75: Error: unknown mnemonic `return' -- `return (long)atomic64_sub_return_acquire(i,v)'

> ./include/asm-generic/atomic-long.h:75: Error: junk at end of line, first unrecognized character is `}'

> ./include/asm-generic/atomic-long.h:76: Error: unknown mnemonic `static' -- `static inline long atomic_long_sub_return_release(long i,atomic_long_t*l){atomic64_t*v=(atomic64_t*)l'

> ./include/asm-generic/atomic-long.h:76: Error: unknown mnemonic `return' -- `return (long)atomic64_sub_return_release(i,v)'

> ./include/asm-generic/atomic-long.h:76: Error: junk at end of line, first unrecognized character is `}'

> ./include/asm-generic/atomic-long.h:101: Error: unknown mnemonic `static' -- `static inline void atomic_long_inc(atomic_long_t*l)'

> ./include/asm-generic/atomic-long.h:102: Error: junk at end of line, first unrecognized character is `{'

> ./include/asm-generic/atomic-long.h:103: Error: unknown mnemonic `atomic64_t' -- `atomic64_t *v=(atomic64_t*)l'

> ./include/asm-generic/atomic-long.h:105: Error: unknown mnemonic `atomic64_add' -- `atomic64_add(1, (v))'

> ./include/asm-generic/atomic-long.h:106: Error: junk at end of line, first unrecognized character is `}'

> ./include/asm-generic/atomic-long.h:108: Error: unknown mnemonic `static' -- `static inline void atomic_long_dec(atomic_long_t*l)'

> ./include/asm-generic/atomic-long.h:109: Error: junk at end of line, first unrecognized character is `{'

> ./include/asm-generic/atomic-long.h:110: Error: unknown mnemonic `atomic64_t' -- `atomic64_t *v=(atomic64_t*)l'

> ./include/asm-generic/atomic-long.h:112: Error: unknown mnemonic `atomic64_sub' -- `atomic64_sub(1, (v))'

> ./include/asm-generic/atomic-long.h:113: Error: junk at end of line, first unrecognized character is `}'

> 

> bisect to commit 7c0f6ba682b9c7632072ffbedf8d328c8f3c42ba

> 

> commit 7c0f6ba682b9c7632072ffbedf8d328c8f3c42ba

> Author: Linus Torvalds <torvalds@linux-foundation.org>

> Date:   Sat Dec 24 11:46:01 2016 -0800

> 

>     Replace <asm/uaccess.h> with <linux/uaccess.h> globally

>    

>     This was entirely automated, using the script by Al:

>    

>       PATT='^[[:blank:]]*#[[:blank:]]*include[[:blank:]]*<asm/uaccess.h>'

>       sed -i -e "s!$PATT!#include <linux/uaccess.h>!" \

>             $(git grep -l "$PATT"|grep -v ^include/linux/uaccess.h)

>    

>     to do the replacement at the end of the merge window.

>    

>     Requested-by: Al Viro <viro@zeniv.linux.org.uk>

>     Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

> 

> I reverted and things back to normal, report it now to see if anyone

> has clue.


It looks like we need revert the changes from assembly files.






> 

> Thanks

> Hanjun

> 

> _______________________________________________

> linuxarm mailing list

> linuxarm@huawei.com

> http://rnd-openeuler.huawei.com/mailman/listinfo/linuxarm

> 

> .

>

Comments

Hanjun Guo Dec. 26, 2016, 9:38 a.m. | #1
On 2016/12/26 17:18, Al Viro wrote:
> On Mon, Dec 26, 2016 at 05:05:37PM +0800, Kefeng Wang wrote:

>> It looks like we need revert the changes from assembly files.

> Better yet, split the damn thing in two and include the asm-only part.

>

>> diff --git a/arch/arm64/mm/cache.S b/arch/arm64/mm/cache.S

>> diff --git a/arch/arm64/xen/hypercall.S b/arch/arm64/xen/hypercall.S

> Missed those two...  OK, how about this?


It happens some where else,

./include/asm-generic/rwsem.h:48: Error: junk at end of line, first unrecognized character is `}'
./include/asm-generic/rwsem.h:49: Error: junk at end of line, first unrecognized character is `}'
./include/asm-generic/rwsem.h:50: Error: unknown mnemonic `return' -- `return 0'
./include/asm-generic/rwsem.h:51: Error: junk at end of line, first unrecognized character is `}'
./include/asm-generic/rwsem.h:56: Error: unknown mnemonic `static' -- `static inline void __down_write(struct rw_semaphore*sem)'
./include/asm-generic/rwsem.h:57: Error: junk at end of line, first unrecognized character is `{'
./include/asm-generic/rwsem.h:58: Error: unknown mnemonic `long' -- `long tmp'
./include/asm-generic/rwsem.h:60: Error: junk at end of line, first unrecognized character is `('
./include/asm-generic/rwsem.h:61: Error: junk at end of line, first unrecognized character is `('
./include/asm-generic/rwsem.h:62: Error: unknown mnemonic `if' -- `if (unlikely(tmp!=((-0xffffffffL-1)+0x00000001L)))'
./include/asm-generic/rwsem.h:63: Error: unknown mnemonic `rwsem_down_write_failed' -- `rwsem_down_write_failed(sem)'
./include/asm-generic/rwsem.h:64: Error: junk at end of line, first unrecognized character is `}'
./include/asm-generic/rwsem.h:66: Error: unknown mnemonic `static' -- `static inline int __down_write_killable(struct rw_semaphore*sem)'
./include/asm-generic/rwsem.h:67: Error: junk at end of line, first unrecognized character is `{'
./include/asm-generic/rwsem.h:68: Error: unknown mnemonic `long' -- `long tmp'
./include/asm-generic/rwsem.h:70: Error: junk at end of line, first unrecognized character is `('
./include/asm-generic/rwsem.h:71: Error: junk at end of line, first unrecognized character is `('
./include/asm-generic/rwsem.h:72: Error: unknown mnemonic `if' -- `if (unlikely(tmp!=((-0xffffffffL-1)+0x00000001L)))'
./include/asm-generic/rwsem.h:73: Error: unknown mnemonic `if' -- `if (IS_ERR(rwsem_down_write_failed_killable(sem)))'
./include/asm-generic/rwsem.h:74: Error: unknown mnemonic `return' -- `return -4'
./include/asm-generic/rwsem.h:75: Error: unknown mnemonic `return' -- `return 0'
./include/asm-generic/rwsem.h:76: Error: junk at end of line, first unrecognized character is `}'
./include/asm-generic/rwsem.h:78: Error: unknown mnemonic `static' -- `static inline int __down_write_trylock(struct rw_semaphore*sem)'
./include/asm-generic/rwsem.h:79: Error: junk at end of line, first unrecognized character is `{'

./include/linux/highuid.h:34: Error: unknown mnemonic `extern' -- `extern int overflowuid'
./include/linux/highuid.h:35: Error: unknown mnemonic `extern' -- `extern int overflowgid'
./include/linux/highuid.h:37: Error: unknown mnemonic `extern' -- `extern void __bad_uid(void)'

./include/linux/uidgid.h:21: Error: unknown mnemonic `uid_t' -- `uid_t val'
./include/linux/uidgid.h:22: Error: junk at end of line, first unrecognized character is `}'
./include/linux/uidgid.h:25: Error: unknown mnemonic `typedef' -- `typedef struct{'
./include/linux/uidgid.h:26: Error: unknown mnemonic `gid_t' -- `gid_t val'
./include/linux/uidgid.h:27: Error: junk at end of line, first unrecognized character is `}'

./include/uapi/linux/sysctl.h:34: Error: unknown mnemonic `struct' -- `struct __sysctl_args{'
./include/uapi/linux/sysctl.h:35: Error: unknown mnemonic `int' -- `int __user*name'
./include/uapi/linux/sysctl.h:36: Error: unknown mnemonic `int' -- `int nlen'
./include/uapi/linux/sysctl.h:37: Error: unknown mnemonic `void' -- `void __user*oldval'

Thanks
Hanjun

>

> arm64: don't pull uaccess.h into *.S

>

> Split asm-only parts of arm64 uaccess.h into a new header and use that

> from *.S.

>     

> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

>

> diff --git a/arch/arm64/include/asm/asm-uaccess.h b/arch/arm64/include/asm/asm-uaccess.h

> new file mode 100644

> index 000000000000..df411f3e083c

> --- /dev/null

> +++ b/arch/arm64/include/asm/asm-uaccess.h

> @@ -0,0 +1,65 @@

> +#ifndef __ASM_ASM_UACCESS_H

> +#define __ASM_ASM_UACCESS_H

> +

> +#include <asm/alternative.h>

> +#include <asm/kernel-pgtable.h>

> +#include <asm/sysreg.h>

> +#include <asm/assembler.h>

> +

> +/*

> + * User access enabling/disabling macros.

> + */

> +#ifdef CONFIG_ARM64_SW_TTBR0_PAN

> +	.macro	__uaccess_ttbr0_disable, tmp1

> +	mrs	\tmp1, ttbr1_el1		// swapper_pg_dir

> +	add	\tmp1, \tmp1, #SWAPPER_DIR_SIZE	// reserved_ttbr0 at the end of swapper_pg_dir

> +	msr	ttbr0_el1, \tmp1		// set reserved TTBR0_EL1

> +	isb

> +	.endm

> +

> +	.macro	__uaccess_ttbr0_enable, tmp1

> +	get_thread_info \tmp1

> +	ldr	\tmp1, [\tmp1, #TSK_TI_TTBR0]	// load saved TTBR0_EL1

> +	msr	ttbr0_el1, \tmp1		// set the non-PAN TTBR0_EL1

> +	isb

> +	.endm

> +

> +	.macro	uaccess_ttbr0_disable, tmp1

> +alternative_if_not ARM64_HAS_PAN

> +	__uaccess_ttbr0_disable \tmp1

> +alternative_else_nop_endif

> +	.endm

> +

> +	.macro	uaccess_ttbr0_enable, tmp1, tmp2

> +alternative_if_not ARM64_HAS_PAN

> +	save_and_disable_irq \tmp2		// avoid preemption

> +	__uaccess_ttbr0_enable \tmp1

> +	restore_irq \tmp2

> +alternative_else_nop_endif

> +	.endm

> +#else

> +	.macro	uaccess_ttbr0_disable, tmp1

> +	.endm

> +

> +	.macro	uaccess_ttbr0_enable, tmp1, tmp2

> +	.endm

> +#endif

> +

> +/*

> + * These macros are no-ops when UAO is present.

> + */

> +	.macro	uaccess_disable_not_uao, tmp1

> +	uaccess_ttbr0_disable \tmp1

> +alternative_if ARM64_ALT_PAN_NOT_UAO

> +	SET_PSTATE_PAN(1)

> +alternative_else_nop_endif

> +	.endm

> +

> +	.macro	uaccess_enable_not_uao, tmp1, tmp2

> +	uaccess_ttbr0_enable \tmp1, \tmp2

> +alternative_if ARM64_ALT_PAN_NOT_UAO

> +	SET_PSTATE_PAN(0)

> +alternative_else_nop_endif

> +	.endm

> +

> +#endif

> diff --git a/arch/arm64/include/asm/uaccess.h b/arch/arm64/include/asm/uaccess.h

> index d26750ca6e06..46da3ea638bb 100644

> --- a/arch/arm64/include/asm/uaccess.h

> +++ b/arch/arm64/include/asm/uaccess.h

> @@ -22,8 +22,6 @@

>  #include <asm/kernel-pgtable.h>

>  #include <asm/sysreg.h>

>  

> -#ifndef __ASSEMBLY__

> -

>  /*

>   * User space memory access functions

>   */

> @@ -424,66 +422,4 @@ extern long strncpy_from_user(char *dest, const char __user *src, long count);

>  extern __must_check long strlen_user(const char __user *str);

>  extern __must_check long strnlen_user(const char __user *str, long n);

>  

> -#else	/* __ASSEMBLY__ */

> -

> -#include <asm/assembler.h>

> -

> -/*

> - * User access enabling/disabling macros.

> - */

> -#ifdef CONFIG_ARM64_SW_TTBR0_PAN

> -	.macro	__uaccess_ttbr0_disable, tmp1

> -	mrs	\tmp1, ttbr1_el1		// swapper_pg_dir

> -	add	\tmp1, \tmp1, #SWAPPER_DIR_SIZE	// reserved_ttbr0 at the end of swapper_pg_dir

> -	msr	ttbr0_el1, \tmp1		// set reserved TTBR0_EL1

> -	isb

> -	.endm

> -

> -	.macro	__uaccess_ttbr0_enable, tmp1

> -	get_thread_info \tmp1

> -	ldr	\tmp1, [\tmp1, #TSK_TI_TTBR0]	// load saved TTBR0_EL1

> -	msr	ttbr0_el1, \tmp1		// set the non-PAN TTBR0_EL1

> -	isb

> -	.endm

> -

> -	.macro	uaccess_ttbr0_disable, tmp1

> -alternative_if_not ARM64_HAS_PAN

> -	__uaccess_ttbr0_disable \tmp1

> -alternative_else_nop_endif

> -	.endm

> -

> -	.macro	uaccess_ttbr0_enable, tmp1, tmp2

> -alternative_if_not ARM64_HAS_PAN

> -	save_and_disable_irq \tmp2		// avoid preemption

> -	__uaccess_ttbr0_enable \tmp1

> -	restore_irq \tmp2

> -alternative_else_nop_endif

> -	.endm

> -#else

> -	.macro	uaccess_ttbr0_disable, tmp1

> -	.endm

> -

> -	.macro	uaccess_ttbr0_enable, tmp1, tmp2

> -	.endm

> -#endif

> -

> -/*

> - * These macros are no-ops when UAO is present.

> - */

> -	.macro	uaccess_disable_not_uao, tmp1

> -	uaccess_ttbr0_disable \tmp1

> -alternative_if ARM64_ALT_PAN_NOT_UAO

> -	SET_PSTATE_PAN(1)

> -alternative_else_nop_endif

> -	.endm

> -

> -	.macro	uaccess_enable_not_uao, tmp1, tmp2

> -	uaccess_ttbr0_enable \tmp1, \tmp2

> -alternative_if ARM64_ALT_PAN_NOT_UAO

> -	SET_PSTATE_PAN(0)

> -alternative_else_nop_endif

> -	.endm

> -

> -#endif	/* __ASSEMBLY__ */

> -

>  #endif /* __ASM_UACCESS_H */

> diff --git a/arch/arm64/lib/clear_user.S b/arch/arm64/lib/clear_user.S

> index add4a1334085..e88fb99c1561 100644

> --- a/arch/arm64/lib/clear_user.S

> +++ b/arch/arm64/lib/clear_user.S

> @@ -17,7 +17,7 @@

>   */

>  #include <linux/linkage.h>

>  

> -#include <linux/uaccess.h>

> +#include <asm/asm-uaccess.h>

>  

>  	.text

>  

> diff --git a/arch/arm64/lib/copy_from_user.S b/arch/arm64/lib/copy_from_user.S

> index fd6cd05593f9..4b5d826895ff 100644

> --- a/arch/arm64/lib/copy_from_user.S

> +++ b/arch/arm64/lib/copy_from_user.S

> @@ -17,7 +17,7 @@

>  #include <linux/linkage.h>

>  

>  #include <asm/cache.h>

> -#include <linux/uaccess.h>

> +#include <asm/asm-uaccess.h>

>  

>  /*

>   * Copy from user space to a kernel buffer (alignment handled by the hardware)

> diff --git a/arch/arm64/lib/copy_in_user.S b/arch/arm64/lib/copy_in_user.S

> index d828540ded6f..47184c3a97da 100644

> --- a/arch/arm64/lib/copy_in_user.S

> +++ b/arch/arm64/lib/copy_in_user.S

> @@ -19,7 +19,7 @@

>  #include <linux/linkage.h>

>  

>  #include <asm/cache.h>

> -#include <linux/uaccess.h>

> +#include <asm/asm-uaccess.h>

>  

>  /*

>   * Copy from user space to user space (alignment handled by the hardware)

> diff --git a/arch/arm64/lib/copy_to_user.S b/arch/arm64/lib/copy_to_user.S

> index 3e6ae2663b82..351f0766f7a6 100644

> --- a/arch/arm64/lib/copy_to_user.S

> +++ b/arch/arm64/lib/copy_to_user.S

> @@ -17,7 +17,7 @@

>  #include <linux/linkage.h>

>  

>  #include <asm/cache.h>

> -#include <linux/uaccess.h>

> +#include <asm/asm-uaccess.h>

>  

>  /*

>   * Copy to user space from a kernel buffer (alignment handled by the hardware)

> diff --git a/arch/arm64/mm/cache.S b/arch/arm64/mm/cache.S

> index 17f422a4dc55..83c27b6e6dca 100644

> --- a/arch/arm64/mm/cache.S

> +++ b/arch/arm64/mm/cache.S

> @@ -23,7 +23,7 @@

>  #include <asm/assembler.h>

>  #include <asm/cpufeature.h>

>  #include <asm/alternative.h>

> -#include <linux/uaccess.h>

> +#include <asm/asm-uaccess.h>

>  

>  /*

>   *	flush_icache_range(start,end)

> diff --git a/arch/arm64/xen/hypercall.S b/arch/arm64/xen/hypercall.S

> index 47cf3f9d89ff..947830a459d2 100644

> --- a/arch/arm64/xen/hypercall.S

> +++ b/arch/arm64/xen/hypercall.S

> @@ -49,7 +49,7 @@

>  

>  #include <linux/linkage.h>

>  #include <asm/assembler.h>

> -#include <linux/uaccess.h>

> +#include <asm/asm-uaccess.h>

>  #include <xen/interface/xen.h>

>  

>  

>

> .

>
Hanjun Guo Dec. 26, 2016, 9:45 a.m. | #2
On 2016/12/26 17:18, Al Viro wrote:
> On Mon, Dec 26, 2016 at 05:05:37PM +0800, Kefeng Wang wrote:

>> It looks like we need revert the changes from assembly files.


I tested Kefeng's patch and works. more comments below.

> Better yet, split the damn thing in two and include the asm-only part.


split will cause other places for building errors, because there is no

-#ifndef __ASSEMBLY__

in the file.

>

>> diff --git a/arch/arm64/mm/cache.S b/arch/arm64/mm/cache.S

>> diff --git a/arch/arm64/xen/hypercall.S b/arch/arm64/xen/hypercall.S

> Missed those two...  OK, how about this?

>

> arm64: don't pull uaccess.h into *.S

>

> Split asm-only parts of arm64 uaccess.h into a new header and use that

> from *.S.

>     

> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

>

> diff --git a/arch/arm64/include/asm/asm-uaccess.h b/arch/arm64/include/asm/asm-uaccess.h

> new file mode 100644

> index 000000000000..df411f3e083c

> --- /dev/null

> +++ b/arch/arm64/include/asm/asm-uaccess.h

> @@ -0,0 +1,65 @@

> +#ifndef __ASM_ASM_UACCESS_H

> +#define __ASM_ASM_UACCESS_H

> +

> +#include <asm/alternative.h>

> +#include <asm/kernel-pgtable.h>

> +#include <asm/sysreg.h>

> +#include <asm/assembler.h>

> +

> +/*

> + * User access enabling/disabling macros.

> + */

> +#ifdef CONFIG_ARM64_SW_TTBR0_PAN

> +	.macro	__uaccess_ttbr0_disable, tmp1

> +	mrs	\tmp1, ttbr1_el1		// swapper_pg_dir

> +	add	\tmp1, \tmp1, #SWAPPER_DIR_SIZE	// reserved_ttbr0 at the end of swapper_pg_dir

> +	msr	ttbr0_el1, \tmp1		// set reserved TTBR0_EL1

> +	isb

> +	.endm

> +

> +	.macro	__uaccess_ttbr0_enable, tmp1

> +	get_thread_info \tmp1

> +	ldr	\tmp1, [\tmp1, #TSK_TI_TTBR0]	// load saved TTBR0_EL1

> +	msr	ttbr0_el1, \tmp1		// set the non-PAN TTBR0_EL1

> +	isb

> +	.endm

> +

> +	.macro	uaccess_ttbr0_disable, tmp1

> +alternative_if_not ARM64_HAS_PAN

> +	__uaccess_ttbr0_disable \tmp1

> +alternative_else_nop_endif

> +	.endm

> +

> +	.macro	uaccess_ttbr0_enable, tmp1, tmp2

> +alternative_if_not ARM64_HAS_PAN

> +	save_and_disable_irq \tmp2		// avoid preemption

> +	__uaccess_ttbr0_enable \tmp1

> +	restore_irq \tmp2

> +alternative_else_nop_endif

> +	.endm

> +#else

> +	.macro	uaccess_ttbr0_disable, tmp1

> +	.endm

> +

> +	.macro	uaccess_ttbr0_enable, tmp1, tmp2

> +	.endm

> +#endif

> +

> +/*

> + * These macros are no-ops when UAO is present.

> + */

> +	.macro	uaccess_disable_not_uao, tmp1

> +	uaccess_ttbr0_disable \tmp1

> +alternative_if ARM64_ALT_PAN_NOT_UAO

> +	SET_PSTATE_PAN(1)

> +alternative_else_nop_endif

> +	.endm

> +

> +	.macro	uaccess_enable_not_uao, tmp1, tmp2

> +	uaccess_ttbr0_enable \tmp1, \tmp2

> +alternative_if ARM64_ALT_PAN_NOT_UAO

> +	SET_PSTATE_PAN(0)

> +alternative_else_nop_endif

> +	.endm

> +

> +#endif

> diff --git a/arch/arm64/include/asm/uaccess.h b/arch/arm64/include/asm/uaccess.h

> index d26750ca6e06..46da3ea638bb 100644

> --- a/arch/arm64/include/asm/uaccess.h

> +++ b/arch/arm64/include/asm/uaccess.h

> @@ -22,8 +22,6 @@

>  #include <asm/kernel-pgtable.h>

>  #include <asm/sysreg.h>

>  

> -#ifndef __ASSEMBLY__

> -

>  /*

>   * User space memory access functions

>   */

> @@ -424,66 +422,4 @@ extern long strncpy_from_user(char *dest, const char __user *src, long count);

>  extern __must_check long strlen_user(const char __user *str);

>  extern __must_check long strnlen_user(const char __user *str, long n);

>  

> -#else	/* __ASSEMBLY__ */

> -

> -#include <asm/assembler.h>

> -

> -/*

> - * User access enabling/disabling macros.

> - */

> -#ifdef CONFIG_ARM64_SW_TTBR0_PAN

> -	.macro	__uaccess_ttbr0_disable, tmp1

> -	mrs	\tmp1, ttbr1_el1		// swapper_pg_dir

> -	add	\tmp1, \tmp1, #SWAPPER_DIR_SIZE	// reserved_ttbr0 at the end of swapper_pg_dir

> -	msr	ttbr0_el1, \tmp1		// set reserved TTBR0_EL1

> -	isb

> -	.endm

> -

> -	.macro	__uaccess_ttbr0_enable, tmp1

> -	get_thread_info \tmp1

> -	ldr	\tmp1, [\tmp1, #TSK_TI_TTBR0]	// load saved TTBR0_EL1

> -	msr	ttbr0_el1, \tmp1		// set the non-PAN TTBR0_EL1

> -	isb

> -	.endm

> -

> -	.macro	uaccess_ttbr0_disable, tmp1

> -alternative_if_not ARM64_HAS_PAN

> -	__uaccess_ttbr0_disable \tmp1

> -alternative_else_nop_endif

> -	.endm

> -

> -	.macro	uaccess_ttbr0_enable, tmp1, tmp2

> -alternative_if_not ARM64_HAS_PAN

> -	save_and_disable_irq \tmp2		// avoid preemption

> -	__uaccess_ttbr0_enable \tmp1

> -	restore_irq \tmp2

> -alternative_else_nop_endif

> -	.endm

> -#else

> -	.macro	uaccess_ttbr0_disable, tmp1

> -	.endm

> -

> -	.macro	uaccess_ttbr0_enable, tmp1, tmp2

> -	.endm

> -#endif

> -

> -/*

> - * These macros are no-ops when UAO is present.

> - */

> -	.macro	uaccess_disable_not_uao, tmp1

> -	uaccess_ttbr0_disable \tmp1

> -alternative_if ARM64_ALT_PAN_NOT_UAO

> -	SET_PSTATE_PAN(1)

> -alternative_else_nop_endif

> -	.endm

> -

> -	.macro	uaccess_enable_not_uao, tmp1, tmp2

> -	uaccess_ttbr0_enable \tmp1, \tmp2

> -alternative_if ARM64_ALT_PAN_NOT_UAO

> -	SET_PSTATE_PAN(0)

> -alternative_else_nop_endif

> -	.endm

> -

> -#endif	/* __ASSEMBLY__ */

> -

>  #endif /* __ASM_UACCESS_H */


I think we need to remove the split and keep it unchanged, just
add the change below.

Thanks
Hanjun

> diff --git a/arch/arm64/lib/clear_user.S b/arch/arm64/lib/clear_user.S

> index add4a1334085..e88fb99c1561 100644

> --- a/arch/arm64/lib/clear_user.S

> +++ b/arch/arm64/lib/clear_user.S

> @@ -17,7 +17,7 @@

>   */

>  #include <linux/linkage.h>

>  

> -#include <linux/uaccess.h>

> +#include <asm/asm-uaccess.h>

>  

>  	.text

>  

> diff --git a/arch/arm64/lib/copy_from_user.S b/arch/arm64/lib/copy_from_user.S

> index fd6cd05593f9..4b5d826895ff 100644

> --- a/arch/arm64/lib/copy_from_user.S

> +++ b/arch/arm64/lib/copy_from_user.S

> @@ -17,7 +17,7 @@

>  #include <linux/linkage.h>

>  

>  #include <asm/cache.h>

> -#include <linux/uaccess.h>

> +#include <asm/asm-uaccess.h>

>  

>  /*

>   * Copy from user space to a kernel buffer (alignment handled by the hardware)

> diff --git a/arch/arm64/lib/copy_in_user.S b/arch/arm64/lib/copy_in_user.S

> index d828540ded6f..47184c3a97da 100644

> --- a/arch/arm64/lib/copy_in_user.S

> +++ b/arch/arm64/lib/copy_in_user.S

> @@ -19,7 +19,7 @@

>  #include <linux/linkage.h>

>  

>  #include <asm/cache.h>

> -#include <linux/uaccess.h>

> +#include <asm/asm-uaccess.h>

>  

>  /*

>   * Copy from user space to user space (alignment handled by the hardware)

> diff --git a/arch/arm64/lib/copy_to_user.S b/arch/arm64/lib/copy_to_user.S

> index 3e6ae2663b82..351f0766f7a6 100644

> --- a/arch/arm64/lib/copy_to_user.S

> +++ b/arch/arm64/lib/copy_to_user.S

> @@ -17,7 +17,7 @@

>  #include <linux/linkage.h>

>  

>  #include <asm/cache.h>

> -#include <linux/uaccess.h>

> +#include <asm/asm-uaccess.h>

>  

>  /*

>   * Copy to user space from a kernel buffer (alignment handled by the hardware)

> diff --git a/arch/arm64/mm/cache.S b/arch/arm64/mm/cache.S

> index 17f422a4dc55..83c27b6e6dca 100644

> --- a/arch/arm64/mm/cache.S

> +++ b/arch/arm64/mm/cache.S

> @@ -23,7 +23,7 @@

>  #include <asm/assembler.h>

>  #include <asm/cpufeature.h>

>  #include <asm/alternative.h>

> -#include <linux/uaccess.h>

> +#include <asm/asm-uaccess.h>

>  

>  /*

>   *	flush_icache_range(start,end)

> diff --git a/arch/arm64/xen/hypercall.S b/arch/arm64/xen/hypercall.S

> index 47cf3f9d89ff..947830a459d2 100644

> --- a/arch/arm64/xen/hypercall.S

> +++ b/arch/arm64/xen/hypercall.S

> @@ -49,7 +49,7 @@

>  

>  #include <linux/linkage.h>

>  #include <asm/assembler.h>

> -#include <linux/uaccess.h>

> +#include <asm/asm-uaccess.h>

>  #include <xen/interface/xen.h>

>  

>  

>

> .

>
Al Viro Dec. 26, 2016, 2:23 p.m. | #3
On Mon, Dec 26, 2016 at 05:45:10PM +0800, Hanjun Guo wrote:
> On 2016/12/26 17:18, Al Viro wrote:

> > On Mon, Dec 26, 2016 at 05:05:37PM +0800, Kefeng Wang wrote:

> >> It looks like we need revert the changes from assembly files.

> 

> I tested Kefeng's patch and works. more comments below.

> 

> > Better yet, split the damn thing in two and include the asm-only part.

> 

> split will cause other places for building errors, because there is no

> 

> -#ifndef __ASSEMBLY__


Huh?  It's included only from assembler files, so what would use the other
parts?
Al Viro Dec. 26, 2016, 3:14 p.m. | #4
On Mon, Dec 26, 2016 at 02:23:43PM +0000, Al Viro wrote:
> On Mon, Dec 26, 2016 at 05:45:10PM +0800, Hanjun Guo wrote:

> > On 2016/12/26 17:18, Al Viro wrote:

> > > On Mon, Dec 26, 2016 at 05:05:37PM +0800, Kefeng Wang wrote:

> > >> It looks like we need revert the changes from assembly files.

> > 

> > I tested Kefeng's patch and works. more comments below.

> > 

> > > Better yet, split the damn thing in two and include the asm-only part.

> > 

> > split will cause other places for building errors, because there is no

> > 

> > -#ifndef __ASSEMBLY__

> 

> Huh?  It's included only from assembler files, so what would use the other

> parts?


FWIW, my arguments for splitting it are
	* asm and non-asm parts have almost no overlap - only
uaccess_{en,dis}able_not_uao (as asm macro and static inline
resp.), but that's it.  It's not as if there had been arseloads of
constants shared between C and assembler, etc.
	* having no asm/uaccess.h includes left allows to consolidate stuff
into linux/uaccess.h; sure, in this case the stuff getting moved there would be
under ifndef anyway, but "no includes outside of linux/uaccess.h" is easier
to verify than "no includes outside of linux/uaccess.h and arch/arm64/.../*.S"

I can live with reverting those several includes to asm/uaccess.h (all
interesting stuff is under that ifndef), but I think splitting the asm
part away would be cleaner.

PS: if that variant does cause any build errors, I would very much like to
see .config.  Hanjun, could you post one that is triggering those?

Patch hide | download patch | download mbox

diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S
index a7504f4..4f0d763 100644
--- a/arch/arm64/kernel/entry.S
+++ b/arch/arm64/kernel/entry.S
@@ -31,7 +31,7 @@ 
 #include <asm/memory.h>
 #include <asm/ptrace.h>
 #include <asm/thread_info.h>
-#include <linux/uaccess.h>
+#include <asm/uaccess.h>
 #include <asm/unistd.h>

 /*
diff --git a/arch/arm64/lib/clear_user.S b/arch/arm64/lib/clear_user.S
index add4a13..d7150e3 100644
--- a/arch/arm64/lib/clear_user.S
+++ b/arch/arm64/lib/clear_user.S
@@ -17,7 +17,7 @@ 
  */
 #include <linux/linkage.h>

-#include <linux/uaccess.h>
+#include <asm/uaccess.h>

        .text

diff --git a/arch/arm64/lib/copy_from_user.S b/arch/arm64/lib/copy_from_user.S
index fd6cd05..cfe1339 100644
--- a/arch/arm64/lib/copy_from_user.S
+++ b/arch/arm64/lib/copy_from_user.S
@@ -17,7 +17,7 @@ 
 #include <linux/linkage.h>

 #include <asm/cache.h>
-#include <linux/uaccess.h>
+#include <asm/uaccess.h>

 /*
  * Copy from user space to a kernel buffer (alignment handled by the hardware)
diff --git a/arch/arm64/lib/copy_in_user.S b/arch/arm64/lib/copy_in_user.S
index d828540..718b1c4 100644
--- a/arch/arm64/lib/copy_in_user.S
+++ b/arch/arm64/lib/copy_in_user.S
@@ -19,7 +19,7 @@ 
 #include <linux/linkage.h>

 #include <asm/cache.h>
-#include <linux/uaccess.h>
+#include <asm/uaccess.h>

 /*
  * Copy from user space to user space (alignment handled by the hardware)
diff --git a/arch/arm64/lib/copy_to_user.S b/arch/arm64/lib/copy_to_user.S
index 3e6ae26..e99e31c 100644
--- a/arch/arm64/lib/copy_to_user.S
+++ b/arch/arm64/lib/copy_to_user.S
@@ -17,7 +17,7 @@ 
 #include <linux/linkage.h>

 #include <asm/cache.h>
-#include <linux/uaccess.h>
+#include <asm/uaccess.h>

 /*
  * Copy to user space from a kernel buffer (alignment handled by the hardware)
diff --git a/arch/arm64/mm/cache.S b/arch/arm64/mm/cache.S
index 17f422a..da95769 100644
--- a/arch/arm64/mm/cache.S
+++ b/arch/arm64/mm/cache.S
@@ -23,7 +23,7 @@ 
 #include <asm/assembler.h>
 #include <asm/cpufeature.h>
 #include <asm/alternative.h>
-#include <linux/uaccess.h>
+#include <asm/uaccess.h>

 /*
  *     flush_icache_range(start,end)
diff --git a/arch/arm64/xen/hypercall.S b/arch/arm64/xen/hypercall.S
index 47cf3f9..b41aff2 100644
--- a/arch/arm64/xen/hypercall.S
+++ b/arch/arm64/xen/hypercall.S
@@ -49,7 +49,7 @@ 

 #include <linux/linkage.h>
 #include <asm/assembler.h>
-#include <linux/uaccess.h>
+#include <asm/uaccess.h>
 #include <xen/interface/xen.h>