Subject: linux-next: manual merge of the powerpc tree with the powerpc-fixes tree

From: Stephen Rothwell <[email-masked]>
Date: Thu, 10 May 2018 10:17:03 +1000

Hi all,

Today's linux-next merge of the powerpc tree got a conflict in:

  arch/powerpc/include/asm/ftrace.h

between commit:

  edf6a2dfe388 ("powerpc/trace/syscalls: Update syscall name matching logic to account for ppc_ prefix")

from the powerpc-fixes tree and commit:

  c3e59d778403 ("powerpc64/ftrace: Rearrange #ifdef sections in ftrace.h")

from the powerpc tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

Michael, I think the version in your merge branch is not quite right ...
-- 
Cheers,
Stephen Rothwell

diff --cc arch/powerpc/include/asm/ftrace.h
index b2dabd06659d,fc3a2203c566..000000000000
--- a/arch/powerpc/include/asm/ftrace.h
+++ b/arch/powerpc/include/asm/ftrace.h
@@@ -66,35 -62,39 +62,54 @@@ struct dyn_arch_ftrace 
  #ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
  #define ARCH_SUPPORTS_FTRACE_OPS 1
  #endif
- #endif
+ #endif /* CONFIG_FUNCTION_TRACER */
  
- #if defined(CONFIG_FTRACE_SYSCALLS) && !defined(__ASSEMBLY__)
+ #ifndef __ASSEMBLY__
 -#if defined(CONFIG_FTRACE_SYSCALLS) && defined(PPC64_ELF_ABI_v1)
++#if defined(CONFIG_FTRACE_SYSCALLS)
 +/*
 + * Some syscall entry functions on powerpc start with "ppc_" (fork and clone,
 + * for instance) or ppc32_/ppc64_. We should also match the sys_ variant with
 + * those.
 + */
  #define ARCH_HAS_SYSCALL_MATCH_SYM_NAME
 +#ifdef PPC64_ELF_ABI_v1
  static inline bool arch_syscall_match_sym_name(const char *sym, const char *name)
  {
 -	/*
 -	 * Compare the symbol name with the system call name. Skip the .sys or .SyS
 -	 * prefix from the symbol name and the sys prefix from the system call name and
 -	 * just match the rest. This is only needed on ppc64 since symbol names on
 -	 * 32bit do not start with a period so the generic function will work.
 -	 */
 -	return !strcmp(sym + 4, name + 3);
 +	/* We need to skip past the initial dot, and the __se_sys alias */
 +	return !strcmp(sym + 1, name) ||
 +		(!strncmp(sym, ".__se_sys", 9) && !strcmp(sym + 6, name)) ||
 +		(!strncmp(sym, ".ppc_", 5) && !strcmp(sym + 5, name + 4)) ||
 +		(!strncmp(sym, ".ppc32_", 7) && !strcmp(sym + 7, name + 4)) ||
 +		(!strncmp(sym, ".ppc64_", 7) && !strcmp(sym + 7, name + 4));
  }
 -#endif /* CONFIG_FTRACE_SYSCALLS && PPC64_ELF_ABI_v1 */
 +#else
 +static inline bool arch_syscall_match_sym_name(const char *sym, const char *name)
 +{
 +	return !strcmp(sym, name) ||
 +		(!strncmp(sym, "__se_sys", 8) && !strcmp(sym + 5, name)) ||
 +		(!strncmp(sym, "ppc_", 4) && !strcmp(sym + 4, name + 4)) ||
 +		(!strncmp(sym, "ppc32_", 6) && !strcmp(sym + 6, name + 4)) ||
 +		(!strncmp(sym, "ppc64_", 6) && !strcmp(sym + 6, name + 4));
 +}
- #endif
- #endif /* CONFIG_FTRACE_SYSCALLS && !__ASSEMBLY__ */
++#endif /* PPC64_ELF_ABI_v1 */
++#endif /* CONFIG_FTRACE_SYSCALLS */
+ 
+ #ifdef CONFIG_PPC64
+ #include <asm/paca.h>
+ 
+ static inline void this_cpu_disable_ftrace(void)
+ {
+ 	get_paca()->ftrace_enabled = 0;
+ }
+ 
+ static inline void this_cpu_enable_ftrace(void)
+ {
+ 	get_paca()->ftrace_enabled = 1;
+ }
+ #else /* CONFIG_PPC64 */
+ static inline void this_cpu_disable_ftrace(void) { }
+ static inline void this_cpu_enable_ftrace(void) { }
+ #endif /* CONFIG_PPC64 */
+ #endif /* !__ASSEMBLY__ */
  
  #endif /* _ASM_POWERPC_FTRACE */