diff mbox

[RFC,1/4] powerpc: asm: introduce new macros for assembly globals

Message ID e4e5fb867e0190aea3f30591fb5025b55bb8f2c5.1479394571.git.naveen.n.rao@linux.vnet.ibm.com (mailing list archive)
State Changes Requested
Headers show

Commit Message

Naveen N. Rao Nov. 17, 2016, 3:08 p.m. UTC
- Introduce _GLOBAL_SYM() for global symbols in assembly. This helps
reduce verbosity of assembly files.
- Introduce NOKPROBE variants of _GLOBAL() and _GLOBAL_SYM(). These are
used subsequently to blacklist certain assembly functions and symbols
from kprobe.
- Fix a small typo in kprobe comment and re-format it, to make it
clearer.

Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
---
 arch/powerpc/include/asm/ppc_asm.h | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

Comments

Michael Ellerman Nov. 18, 2016, 9:41 a.m. UTC | #1
"Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> writes:

> - Introduce _GLOBAL_SYM() for global symbols in assembly. This helps
> reduce verbosity of assembly files.

Unfortunately you've walked into a bit of mine field here :)

In user space they use FUNC_START() to declare the start of a function,
and we should do the same. Anton added FUNC_START/END, but didn't quite
get around to converting everything, see 151f25112ff7 ("powerpc: define
FUNC_START/FUNC_END").

So what I'd like is all uses of _GLOBAL() to become FUNC_START(), and
then we can change _GLOBAL() to just define a global symbol.

We can probably decouple that from most of this series though, as I
mentioned in my other reply, just by using _ASM_NOKPROBE_SYMBOL().

cheers
Naveen N. Rao Nov. 18, 2016, 11:36 a.m. UTC | #2
On 2016/11/18 08:41PM, Michael Ellerman wrote:
> "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> writes:
> 
> > - Introduce _GLOBAL_SYM() for global symbols in assembly. This helps
> > reduce verbosity of assembly files.
> 
> Unfortunately you've walked into a bit of mine field here :)
> 
> In user space they use FUNC_START() to declare the start of a function,
> and we should do the same. Anton added FUNC_START/END, but didn't quite
> get around to converting everything, see 151f25112ff7 ("powerpc: define
> FUNC_START/FUNC_END").
> 
> So what I'd like is all uses of _GLOBAL() to become FUNC_START(), and
> then we can change _GLOBAL() to just define a global symbol.

Can't say I didn't get tempted to rename _GLOBAL() to _GLOBAL_FUNC() :D
I'll convert the files I touch.

> 
> We can probably decouple that from most of this series though, as I
> mentioned in my other reply, just by using _ASM_NOKPROBE_SYMBOL().

Sure.

Thanks!
- Naveen
diff mbox

Patch

diff --git a/arch/powerpc/include/asm/ppc_asm.h b/arch/powerpc/include/asm/ppc_asm.h
index 025833b..2443545 100644
--- a/arch/powerpc/include/asm/ppc_asm.h
+++ b/arch/powerpc/include/asm/ppc_asm.h
@@ -254,13 +254,19 @@  GLUE(.,name):
 
 #endif
 
+#define _GLOBAL_SYM(name)	\
+	.globl name;		\
+name:
+
 /*
  * __kprobes (the C annotation) puts the symbol into the .kprobes.text
  * section, which gets emitted at the end of regular text.
  *
  * _ASM_NOKPROBE_SYMBOL and NOKPROBE_SYMBOL just adds the symbol to
- * a blacklist. The former is for core kprobe functions/data, the
- * latter is for those that incdentially must be excluded from probing
+ * a blacklist.
+ *
+ * The former (__kprobes) is for core kprobe functions/data, the
+ * latter is for those that incidentally must be excluded from probing
  * and allows them to be linked at more optimal location within text.
  */
 #ifdef CONFIG_KPROBES
@@ -272,6 +278,15 @@  GLUE(.,name):
 #define _ASM_NOKPROBE_SYMBOL(entry)
 #endif
 
+#define _GLOBAL_NOKPROBE(name)				\
+	_GLOBAL(name);					\
+	_ASM_NOKPROBE_SYMBOL(name)
+
+#define _GLOBAL_SYM_NOKPROBE(name)			\
+	_GLOBAL_SYM(name);				\
+	_ASM_NOKPROBE_SYMBOL(name)
+
+
 #define FUNC_START(name)	_GLOBAL(name)
 #define FUNC_END(name)