Skip to contentSkip to conversation

ARM: Implement MODULE_PLT support in FTRACE

PATCH In review Alexander A Sverdlin 3 participants 13 messages Mar 30, 2021 – May 5, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v8 cover ARM: Implement MODULE_PLT support in FTRACE

From: Alexander Sverdlin <[email protected]>

FTRACE's function tracer currently doesn't always work on ARM with MODULE_PLT option enabled. If the module is loaded too far, FTRACE's code modifier cannot cope with introduced veneers and turns the function tracer off globally.

ARM64 already has a solution for the problem, refer to the following patches:

arm64: ftrace: emit ftrace-mod.o contents through code
arm64: module-plts: factor out PLT generation code for ftrace
arm64: ftrace: fix !CONFIG_ARM64_MODULE_PLTS kernels
arm64: ftrace: fix building without CONFIG_MODULES
arm64: ftrace: add support for far branches to dynamic ftrace
arm64: ftrace: don't validate branch via PLT in ftrace_make_nop()

But the presented ARM variant has just a half of the footprint in terms of the changed LoCs. It also retains the code validation-before-modification instead of switching it off.

Changelog:
v8:
* Add warn suppress parameter to arm_gen_branch_link()
v7:
* rebased
v6:
* rebased
v5:
* BUILD_BUG_ON() ensures fixed_plts[] always fits one PLT block
* use "for" loop instead of "while"
* scripts/recordmcount is filtering reloc types
v4:
* Fixed build without CONFIG_FUNCTION_TRACER
* Reorganized pre-allocated PLTs handling in get_module_plt(), now compiler eliminates the whole FTRACE-related handling code if ARRAY_SIZE(fixed_plts) == 0
v3:
* Only extend struct dyn_arch_ftrace when ARM_MODULE_PLTS is enabled v2:
* As suggested by Steven Rostedt, refrain from tree-wide API modification, save module pointer in struct dyn_arch_ftrace instead (PowerPC way)

Alexander Sverdlin (3):
ARM: PLT: Move struct plt_entries definition to header
ARM: Add warn suppress parameter to arm_gen_branch_link()
ARM: ftrace: Add MODULE_PLTS support

 arch/arm/include/asm/ftrace.h |  3 +++
 arch/arm/include/asm/insn.h   |  8 +++----
 arch/arm/include/asm/module.h | 10 +++++++++
 arch/arm/kernel/ftrace.c      | 46 +++++++++++++++++++++++++++++++++-------
 arch/arm/kernel/insn.c        | 19 +++++++++--------
 arch/arm/kernel/module-plts.c | 49 +++++++++++++++++++++++++++++++++----------
 6 files changed, 103 insertions(+), 32 deletions(-)
Signature · 1 line
2.10.2
#1 lore raw

PATCH v8 1/3 ARM: PLT: Move struct plt_entries definition to header

From: Alexander Sverdlin <[email protected]>

No functional change, later it will be re-used in several files.

---
 arch/arm/include/asm/module.h | 9 +++++++++
 arch/arm/kernel/module-plts.c | 9 ---------
 2 files changed, 9 insertions(+), 9 deletions(-)
arch/arm/include/asm/module.h +9 -0
index 4b0df09..09b9ad5 100644
@@ -19,6 +19,15 @@ enum {
 };
 #endif
 
+#define PLT_ENT_STRIDE		L1_CACHE_BYTES
+#define PLT_ENT_COUNT		(PLT_ENT_STRIDE / sizeof(u32))
+#define PLT_ENT_SIZE		(sizeof(struct plt_entries) / PLT_ENT_COUNT)
+
+struct plt_entries {
+	u32	ldr[PLT_ENT_COUNT];
+	u32	lit[PLT_ENT_COUNT];
+};
+
 struct mod_plt_sec {
 	struct elf32_shdr	*plt;
 	int			plt_count;
arch/arm/kernel/module-plts.c +0 -9
index 6e626ab..d330e9e 100644
@@ -12,10 +12,6 @@
 #include <asm/cache.h>
 #include <asm/opcodes.h>
 
-#define PLT_ENT_STRIDE		L1_CACHE_BYTES
-#define PLT_ENT_COUNT		(PLT_ENT_STRIDE / sizeof(u32))
-#define PLT_ENT_SIZE		(sizeof(struct plt_entries) / PLT_ENT_COUNT)
-
 #ifdef CONFIG_THUMB2_KERNEL
 #define PLT_ENT_LDR		__opcode_to_mem_thumb32(0xf8dff000 | \
 							(PLT_ENT_STRIDE - 4))
@@ -24,11 +20,6 @@
 						    (PLT_ENT_STRIDE - 8))
 #endif
 
-struct plt_entries {
-	u32	ldr[PLT_ENT_COUNT];
-	u32	lit[PLT_ENT_COUNT];
-};
-
 static bool in_init(const struct module *mod, unsigned long loc)
 {
 	return loc - (u32)mod->init_layout.base < mod->init_layout.size;
Signature · 1 line
2.10.2
#2 lore raw

PATCH v8 2/3 ARM: Add warn suppress parameter to arm_gen_branch_link()

In reply to Alexander A Sverdlin

From: Alexander Sverdlin <[email protected]>

Will be used in the following patch. No functional change.

---
 arch/arm/include/asm/insn.h |  8 ++++----
 arch/arm/kernel/ftrace.c    |  2 +-
 arch/arm/kernel/insn.c      | 19 ++++++++++---------
 3 files changed, 15 insertions(+), 14 deletions(-)
arch/arm/include/asm/insn.h +4 -4
index f20e08a..5475cbf 100644
@@ -13,18 +13,18 @@ arm_gen_nop(void)
 }
 
 unsigned long
-__arm_gen_branch(unsigned long pc, unsigned long addr, bool link);
+__arm_gen_branch(unsigned long pc, unsigned long addr, bool link, bool warn);
 
 static inline unsigned long
 arm_gen_branch(unsigned long pc, unsigned long addr)
 {
-	return __arm_gen_branch(pc, addr, false);
+	return __arm_gen_branch(pc, addr, false, true);
 }
 
 static inline unsigned long
-arm_gen_branch_link(unsigned long pc, unsigned long addr)
+arm_gen_branch_link(unsigned long pc, unsigned long addr, bool warn)
 {
-	return __arm_gen_branch(pc, addr, true);
+	return __arm_gen_branch(pc, addr, true, warn);
 }
 
 #endif
arch/arm/kernel/ftrace.c +1 -1
index 9a79ef6..61de817 100644
@@ -70,7 +70,7 @@ int ftrace_arch_code_modify_post_process(void)
 
 static unsigned long ftrace_call_replace(unsigned long pc, unsigned long addr)
 {
-	return arm_gen_branch_link(pc, addr);
+	return arm_gen_branch_link(pc, addr, true);
 }
 
 static int ftrace_modify_code(unsigned long pc, unsigned long old,
arch/arm/kernel/insn.c +10 -9
index 2e844b7..db0acbb 100644
@@ -3,8 +3,9 @@
 #include <linux/kernel.h>
 #include <asm/opcodes.h>
 
-static unsigned long
-__arm_gen_branch_thumb2(unsigned long pc, unsigned long addr, bool link)
+static unsigned long __arm_gen_branch_thumb2(unsigned long pc,
+					     unsigned long addr, bool link,
+					     bool warn)
 {
 	unsigned long s, j1, j2, i1, i2, imm10, imm11;
 	unsigned long first, second;
@@ -12,7 +13,7 @@ __arm_gen_branch_thumb2(unsigned long pc, unsigned long addr, bool link)
 
 	offset = (long)addr - (long)(pc + 4);
 	if (offset < -16777216 || offset > 16777214) {
-		WARN_ON_ONCE(1);
+		WARN_ON_ONCE(warn);
 		return 0;
 	}
 
@@ -33,8 +34,8 @@ __arm_gen_branch_thumb2(unsigned long pc, unsigned long addr, bool link)
 	return __opcode_thumb32_compose(first, second);
 }
 
-static unsigned long
-__arm_gen_branch_arm(unsigned long pc, unsigned long addr, bool link)
+static unsigned long __arm_gen_branch_arm(unsigned long pc, unsigned long addr,
+					  bool link, bool warn)
 {
 	unsigned long opcode = 0xea000000;
 	long offset;
@@ -44,7 +45,7 @@ __arm_gen_branch_arm(unsigned long pc, unsigned long addr, bool link)
 
 	offset = (long)addr - (long)(pc + 8);
 	if (unlikely(offset < -33554432 || offset > 33554428)) {
-		WARN_ON_ONCE(1);
+		WARN_ON_ONCE(warn);
 		return 0;
 	}
 
@@ -54,10 +55,10 @@ __arm_gen_branch_arm(unsigned long pc, unsigned long addr, bool link)
 }
 
 unsigned long
-__arm_gen_branch(unsigned long pc, unsigned long addr, bool link)
+__arm_gen_branch(unsigned long pc, unsigned long addr, bool link, bool warn)
 {
 	if (IS_ENABLED(CONFIG_THUMB2_KERNEL))
-		return __arm_gen_branch_thumb2(pc, addr, link);
+		return __arm_gen_branch_thumb2(pc, addr, link, warn);
 	else
-		return __arm_gen_branch_arm(pc, addr, link);
+		return __arm_gen_branch_arm(pc, addr, link, warn);
 }
Signature · 1 line
2.10.2
#3 lore raw

PATCH v8 3/3 ARM: ftrace: Add MODULE_PLTS support

In reply to Alexander A Sverdlin

From: Alexander Sverdlin <[email protected]>

Teach ftrace_make_call() and ftrace_make_nop() about PLTs. Teach PLT code about FTRACE and all its callbacks. Otherwise the following might happen:

------------[ cut here ]------------
WARNING: CPU: 14 PID: 2265 at .../arch/arm/kernel/insn.c:14 __arm_gen_branch+0x83/0x8c()
...
Hardware name: LSI Axxia AXM55XX
[<c0314a49>] (unwind_backtrace) from [<c03115e9>] (show_stack+0x11/0x14)
[<c03115e9>] (show_stack) from [<c0519f51>] (dump_stack+0x81/0xa8)
[<c0519f51>] (dump_stack) from [<c032185d>] (warn_slowpath_common+0x69/0x90)
[<c032185d>] (warn_slowpath_common) from [<c03218f3>] (warn_slowpath_null+0x17/0x1c)
[<c03218f3>] (warn_slowpath_null) from [<c03143cf>] (__arm_gen_branch+0x83/0x8c)
[<c03143cf>] (__arm_gen_branch) from [<c0314337>] (ftrace_make_nop+0xf/0x24)
[<c0314337>] (ftrace_make_nop) from [<c038ebcb>] (ftrace_process_locs+0x27b/0x3e8)
[<c038ebcb>] (ftrace_process_locs) from [<c0378d79>] (load_module+0x11e9/0x1a44)
[<c0378d79>] (load_module) from [<c037974d>] (SyS_finit_module+0x59/0x84)
[<c037974d>] (SyS_finit_module) from [<c030e981>] (ret_fast_syscall+0x1/0x18)
---[ end trace e1b64ced7a89adcc ]---
------------[ cut here ]------------
WARNING: CPU: 14 PID: 2265 at .../kernel/trace/ftrace.c:1979 ftrace_bug+0x1b1/0x234()
...
Hardware name: LSI Axxia AXM55XX
[<c0314a49>] (unwind_backtrace) from [<c03115e9>] (show_stack+0x11/0x14)
[<c03115e9>] (show_stack) from [<c0519f51>] (dump_stack+0x81/0xa8)
[<c0519f51>] (dump_stack) from [<c032185d>] (warn_slowpath_common+0x69/0x90)
[<c032185d>] (warn_slowpath_common) from [<c03218f3>] (warn_slowpath_null+0x17/0x1c)
[<c03218f3>] (warn_slowpath_null) from [<c038e87d>] (ftrace_bug+0x1b1/0x234)
[<c038e87d>] (ftrace_bug) from [<c038ebd5>] (ftrace_process_locs+0x285/0x3e8)
[<c038ebd5>] (ftrace_process_locs) from [<c0378d79>] (load_module+0x11e9/0x1a44)
[<c0378d79>] (load_module) from [<c037974d>] (SyS_finit_module+0x59/0x84)
[<c037974d>] (SyS_finit_module) from [<c030e981>] (ret_fast_syscall+0x1/0x18)
---[ end trace e1b64ced7a89adcd ]---

ftrace failed to modify [<e9ef7006>] 0xe9ef7006
actual: 02:f0:3b:fa
ftrace record flags: 0
(0) expected tramp: c0314265

---
 arch/arm/include/asm/ftrace.h |  3 +++
 arch/arm/include/asm/module.h |  1 +
 arch/arm/kernel/ftrace.c      | 46 +++++++++++++++++++++++++++++++++++--------
 arch/arm/kernel/module-plts.c | 44 +++++++++++++++++++++++++++++++++++++----
 4 files changed, 82 insertions(+), 12 deletions(-)
arch/arm/include/asm/ftrace.h +3 -0
index 48ec1d0..a4dbac0 100644
@@ -15,6 +15,9 @@ extern void __gnu_mcount_nc(void);
 
 #ifdef CONFIG_DYNAMIC_FTRACE
 struct dyn_arch_ftrace {
+#ifdef CONFIG_ARM_MODULE_PLTS
+	struct module *mod;
+#endif
 };
 
 static inline unsigned long ftrace_call_adjust(unsigned long addr)
arch/arm/include/asm/module.h +1 -0
index 09b9ad5..cfffae6 100644
@@ -30,6 +30,7 @@ struct plt_entries {
 
 struct mod_plt_sec {
 	struct elf32_shdr	*plt;
+	struct plt_entries	*plt_ent;
 	int			plt_count;
 };
 
arch/arm/kernel/ftrace.c +38 -8

92 lines not on this page · raw message

arch/arm/kernel/module-plts.c +40 -4

85 lines not on this page · raw message

Signature · 1 line
2.10.2
Tested-by on the v8 series
#4 lore raw
In reply to Alexander A Sverdlin
Quoted 43 lines · Alexander A Sverdlin

From: Alexander Sverdlin <[email protected]>

FTRACE's function tracer currently doesn't always work on ARM with MODULE_PLT option enabled. If the module is loaded too far, FTRACE's code modifier cannot cope with introduced veneers and turns the function tracer off globally.

ARM64 already has a solution for the problem, refer to the following patches:

arm64: ftrace: emit ftrace-mod.o contents through code
arm64: module-plts: factor out PLT generation code for ftrace
arm64: ftrace: fix !CONFIG_ARM64_MODULE_PLTS kernels
arm64: ftrace: fix building without CONFIG_MODULES
arm64: ftrace: add support for far branches to dynamic ftrace
arm64: ftrace: don't validate branch via PLT in ftrace_make_nop()

But the presented ARM variant has just a half of the footprint in terms of the changed LoCs. It also retains the code validation-before-modification instead of switching it off.

Changelog:
v8:
* Add warn suppress parameter to arm_gen_branch_link()
v7:
* rebased
v6:
* rebased
v5:
* BUILD_BUG_ON() ensures fixed_plts[] always fits one PLT block
* use "for" loop instead of "while"
* scripts/recordmcount is filtering reloc types
v4:
* Fixed build without CONFIG_FUNCTION_TRACER
* Reorganized pre-allocated PLTs handling in get_module_plt(), now compiler eliminates the whole FTRACE-related handling code if ARRAY_SIZE(fixed_plts) == 0
v3:
* Only extend struct dyn_arch_ftrace when ARM_MODULE_PLTS is enabled v2:
* As suggested by Steven Rostedt, refrain from tree-wide API modification, save module pointer in struct dyn_arch_ftrace instead (PowerPC way)

Quoted 4 lines

Alexander Sverdlin (3):
ARM: PLT: Move struct plt_entries definition to header
ARM: Add warn suppress parameter to arm_gen_branch_link()
ARM: ftrace: Add MODULE_PLTS support

Thanks a lot!

Signature · 1 line
Florian
#5 lore raw
In reply to Alexander A Sverdlin
Quoted 34 lines · Alexander A Sverdlin

From: Alexander Sverdlin <[email protected]>

FTRACE's function tracer currently doesn't always work on ARM with MODULE_PLT option enabled. If the module is loaded too far, FTRACE's code modifier cannot cope with introduced veneers and turns the function tracer off globally.

ARM64 already has a solution for the problem, refer to the following patches:

arm64: ftrace: emit ftrace-mod.o contents through code
arm64: module-plts: factor out PLT generation code for ftrace
arm64: ftrace: fix !CONFIG_ARM64_MODULE_PLTS kernels
arm64: ftrace: fix building without CONFIG_MODULES
arm64: ftrace: add support for far branches to dynamic ftrace
arm64: ftrace: don't validate branch via PLT in ftrace_make_nop()

But the presented ARM variant has just a half of the footprint in terms of the changed LoCs. It also retains the code validation-before-modification instead of switching it off.

Changelog:
v8:
* Add warn suppress parameter to arm_gen_branch_link() v7:
* rebased
v6:
* rebased
v5:
* BUILD_BUG_ON() ensures fixed_plts[] always fits one PLT block
* use "for" loop instead of "while"
* scripts/recordmcount is filtering reloc types
v4:
* Fixed build without CONFIG_FUNCTION_TRACER

Quoted 8 lines

* Reorganized pre-allocated PLTs handling in get_module_plt(), now compiler eliminates the whole FTRACE-related handling code if ARRAY_SIZE(fixed_plts) == 0
v3:
* Only extend struct dyn_arch_ftrace when ARM_MODULE_PLTS is enabled v2:
* As suggested by Steven Rostedt, refrain from tree-wide API modification, save module pointer in struct dyn_arch_ftrace instead (PowerPC way)

FWIW, ftracetest did not pick up new failures (nor were new tests fixed) with this patch series.

Signature · 1 line
Florian
Tested-by on the v8 series
#6 lore raw
In reply to Alexander A Sverdlin

Adding Linus Walleij back to CC

Quoted 17 lines · Alexander A Sverdlin

From: Alexander Sverdlin <[email protected]>

FTRACE's function tracer currently doesn't always work on ARM with MODULE_PLT option enabled. If the module is loaded too far, FTRACE's code modifier cannot cope with introduced veneers and turns the function tracer off globally.

ARM64 already has a solution for the problem, refer to the following patches:

arm64: ftrace: emit ftrace-mod.o contents through code
arm64: module-plts: factor out PLT generation code for ftrace
arm64: ftrace: fix !CONFIG_ARM64_MODULE_PLTS kernels
arm64: ftrace: fix building without CONFIG_MODULES
arm64: ftrace: add support for far branches to dynamic ftrace
arm64: ftrace: don't validate branch via PLT in ftrace_make_nop()

Quoted 7 lines

But the presented ARM variant has just a half of the footprint in terms of the changed LoCs. It also retains the code validation-before-modification instead of switching it off.

Changelog:
v8:
* Add warn suppress parameter to arm_gen_branch_link()

I still think the ifdefery in patch 3 is ugly. Any reason my suggestion didn't work out for you? I struggle to see how this is better and why it was hard to incorporate my suggestion.

For example

- old = ftrace_call_replace(ip, adjust_address(rec, addr));
+#ifdef CONFIG_ARM_MODULE_PLTS
+ /* mod is only supplied during module loading */
+ if (!mod)
+ mod = rec->arch.mod;
+ else
+ rec->arch.mod = mod;
+#endif
+
+ old = ftrace_call_replace(ip, aaddr,
+ !IS_ENABLED(CONFIG_ARM_MODULE_PLTS) || !mod);
+#ifdef CONFIG_ARM_MODULE_PLTS
+ if (!old && mod) {
+ aaddr = get_module_plt(mod, ip, aaddr);
+ old = ftrace_call_replace(ip, aaddr, true);
+ }
+#endif
+

There's an ifdef, followed by a code that embeds !IS_ENABLED(CONFIG_ARM_MODULE_PLTS) followed by another ifdef :-/

And there was no need to make the new warn arg visible all the way to ftrace_call_repalce() and all of its users.

FWIW

If this gets accepted as-is, I'll send a patch to improve on this.

Thanks

--
Qais Yousef

#7 lore raw

Hi!

Quoted 25 lines · Qais Yousef

I still think the ifdefery in patch 3 is ugly. Any reason my suggestion didn't work out for you? I struggle to see how this is better and why it was hard to incorporate my suggestion.

For example

- old = ftrace_call_replace(ip, adjust_address(rec, addr));
+#ifdef CONFIG_ARM_MODULE_PLTS
+ /* mod is only supplied during module loading */
+ if (!mod)
+ mod = rec->arch.mod;
+ else
+ rec->arch.mod = mod;
+#endif
+
+ old = ftrace_call_replace(ip, aaddr,
+ !IS_ENABLED(CONFIG_ARM_MODULE_PLTS) || !mod);
+#ifdef CONFIG_ARM_MODULE_PLTS
+ if (!old && mod) {
+ aaddr = get_module_plt(mod, ip, aaddr);
+ old = ftrace_call_replace(ip, aaddr, true);
+ }
+#endif
+

Quoted 2 lines

There's an ifdef, followed by a code that embeds !IS_ENABLED(CONFIG_ARM_MODULE_PLTS) followed by another ifdef :-/

No, it's actually two small ifdefed blocks added before and after an original call, which parameters have been modified as well. The issue with arch.mod was explained by Steven Rostedt, maybe you've missed his email.

Quoted 6 lines

And there was no need to make the new warn arg visible all the way to ftrace_call_repalce() and all of its users.

FWIW

Signature · 2 lines
Best regards,
Alexander Sverdlin.
#8 lore raw

Hi Alexander

Fixing Ard's email as the Linaro one keeps bouncing back. Please fix that in your future postings.

Quoted 28 lines · Alexander Sverdlin

Hi!

Quoted 25 lines · Qais Yousef

I still think the ifdefery in patch 3 is ugly. Any reason my suggestion didn't work out for you? I struggle to see how this is better and why it was hard to incorporate my suggestion.

For example

- old = ftrace_call_replace(ip, adjust_address(rec, addr));
+#ifdef CONFIG_ARM_MODULE_PLTS
+ /* mod is only supplied during module loading */
+ if (!mod)
+ mod = rec->arch.mod;
+ else
+ rec->arch.mod = mod;
+#endif
+
+ old = ftrace_call_replace(ip, aaddr,
+ !IS_ENABLED(CONFIG_ARM_MODULE_PLTS) || !mod);
+#ifdef CONFIG_ARM_MODULE_PLTS
+ if (!old && mod) {
+ aaddr = get_module_plt(mod, ip, aaddr);
+ old = ftrace_call_replace(ip, aaddr, true);
+ }
+#endif
+

Quoted 6 lines
Quoted 2 lines

There's an ifdef, followed by a code that embeds !IS_ENABLED(CONFIG_ARM_MODULE_PLTS) followed by another ifdef :-/

No, it's actually two small ifdefed blocks added before and after an original call, which parameters have been modified as well. The issue with arch.mod was explained by Steven Rostedt, maybe you've missed his email.

If you're referring to arch.mod having to be protected by the ifdef I did address that. Please look at my patch.

My comment here refers to the ugliness of this ifdefery. Introducing 2 simple wrapper functions would address that as I've demonstrated in my suggestion/patch.

Thanks

--
Qais Yousef

#9 lore raw
Quoted 41 lines · Qais Yousef

Hi Alexander

Fixing Ard's email as the Linaro one keeps bouncing back. Please fix that in your future postings.

Quoted 28 lines · Alexander Sverdlin

Hi!

Quoted 25 lines · Qais Yousef

I still think the ifdefery in patch 3 is ugly. Any reason my suggestion didn't work out for you? I struggle to see how this is better and why it was hard to incorporate my suggestion.

For example

- old = ftrace_call_replace(ip, adjust_address(rec, addr));
+#ifdef CONFIG_ARM_MODULE_PLTS
+ /* mod is only supplied during module loading */
+ if (!mod)
+ mod = rec->arch.mod;
+ else
+ rec->arch.mod = mod;
+#endif
+
+ old = ftrace_call_replace(ip, aaddr,
+ !IS_ENABLED(CONFIG_ARM_MODULE_PLTS) || !mod);
+#ifdef CONFIG_ARM_MODULE_PLTS
+ if (!old && mod) {
+ aaddr = get_module_plt(mod, ip, aaddr);
+ old = ftrace_call_replace(ip, aaddr, true);
+ }
+#endif
+

Quoted 6 lines
Quoted 2 lines

There's an ifdef, followed by a code that embeds !IS_ENABLED(CONFIG_ARM_MODULE_PLTS) followed by another ifdef :-/

No, it's actually two small ifdefed blocks added before and after an original call, which parameters have been modified as well. The issue with arch.mod was explained by Steven Rostedt, maybe you've missed his email.

Quoted 6 lines

If you're referring to arch.mod having to be protected by the ifdef I did address that. Please look at my patch.

My comment here refers to the ugliness of this ifdefery. Introducing 2 simple wrapper functions would address that as I've demonstrated in my suggestion/patch.

What is the plan to move forward with this patch series, should v8 be submitted into RMK's patch tracker and improved upon from there, or do you feel like your suggestion needs to be addressed right away?

Signature · 1 line
Florian
#10 lore raw
Quoted 47 lines · Florian Fainelli
Quoted 44 lines · Qais Yousef

Hi Alexander

Fixing Ard's email as the Linaro one keeps bouncing back. Please fix that in your future postings.

Quoted 28 lines · Alexander Sverdlin

Hi!

Quoted 25 lines · Qais Yousef

I still think the ifdefery in patch 3 is ugly. Any reason my suggestion didn't work out for you? I struggle to see how this is better and why it was hard to incorporate my suggestion.

For example

- old = ftrace_call_replace(ip, adjust_address(rec, addr));
+#ifdef CONFIG_ARM_MODULE_PLTS
+ /* mod is only supplied during module loading */
+ if (!mod)
+ mod = rec->arch.mod;
+ else
+ rec->arch.mod = mod;
+#endif
+
+ old = ftrace_call_replace(ip, aaddr,
+ !IS_ENABLED(CONFIG_ARM_MODULE_PLTS) || !mod);
+#ifdef CONFIG_ARM_MODULE_PLTS
+ if (!old && mod) {
+ aaddr = get_module_plt(mod, ip, aaddr);
+ old = ftrace_call_replace(ip, aaddr, true);
+ }
+#endif
+

Quoted 6 lines
Quoted 2 lines

There's an ifdef, followed by a code that embeds !IS_ENABLED(CONFIG_ARM_MODULE_PLTS) followed by another ifdef :-/

No, it's actually two small ifdefed blocks added before and after an original call, which parameters have been modified as well. The issue with arch.mod was explained by Steven Rostedt, maybe you've missed his email.

If you're referring to arch.mod having to be protected by the ifdef I did address that. Please look at my patch.

Quoted 7 lines
Quoted 3 lines

My comment here refers to the ugliness of this ifdefery. Introducing 2 simple wrapper functions would address that as I've demonstrated in my suggestion/patch.

What is the plan to move forward with this patch series, should v8 be submitted into RMK's patch tracker and improved upon from there, or do you feel like your suggestion needs to be addressed right away?

There's no objection from my side to submitting this and improve later.

Thanks

--
Qais Yousef

#11 lore raw
Quoted 52 lines · Qais Yousef
Quoted 51 lines · Florian Fainelli
Quoted 47 lines · Qais Yousef

Hi Alexander

Fixing Ard's email as the Linaro one keeps bouncing back. Please fix that in your future postings.

Quoted 28 lines · Alexander Sverdlin

Hi!

Quoted 25 lines · Qais Yousef

I still think the ifdefery in patch 3 is ugly. Any reason my suggestion didn't work out for you? I struggle to see how this is better and why it was hard to incorporate my suggestion.

For example

- old = ftrace_call_replace(ip, adjust_address(rec, addr));
+#ifdef CONFIG_ARM_MODULE_PLTS
+ /* mod is only supplied during module loading */
+ if (!mod)
+ mod = rec->arch.mod;
+ else
+ rec->arch.mod = mod;
+#endif
+
+ old = ftrace_call_replace(ip, aaddr,
+ !IS_ENABLED(CONFIG_ARM_MODULE_PLTS) || !mod);
+#ifdef CONFIG_ARM_MODULE_PLTS
+ if (!old && mod) {
+ aaddr = get_module_plt(mod, ip, aaddr);
+ old = ftrace_call_replace(ip, aaddr, true);
+ }
+#endif
+

Quoted 6 lines
Quoted 2 lines

There's an ifdef, followed by a code that embeds !IS_ENABLED(CONFIG_ARM_MODULE_PLTS) followed by another ifdef :-/

No, it's actually two small ifdefed blocks added before and after an original call, which parameters have been modified as well. The issue with arch.mod was explained by Steven Rostedt, maybe you've missed his email.

If you're referring to arch.mod having to be protected by the ifdef I did address that. Please look at my patch.

My comment here refers to the ugliness of this ifdefery. Introducing 2 simple wrapper functions would address that as I've demonstrated in my suggestion/patch.

Quoted 5 lines
Quoted 3 lines

What is the plan to move forward with this patch series, should v8 be submitted into RMK's patch tracker and improved upon from there, or do you feel like your suggestion needs to be addressed right away?

There's no objection from my side to submitting this and improve later.

OK, thanks! Alexander, do you mind sending these patches to RMK's patch
tracker: https://www.armlinux.org.uk/developer/patches/?

Thank you!

Signature · 1 line
Florian
#12 lore raw

Hi Florian!

Quoted 6 lines · Florian Fainelli
Quoted 4 lines
Quoted 3 lines

What is the plan to move forward with this patch series, should v8 be submitted into RMK's patch tracker and improved upon from there, or do you feel like your suggestion needs to be addressed right away?

There's no objection from my side to submitting this and improve later.

OK, thanks! Alexander, do you mind sending these patches to RMK's patch
tracker: https://www.armlinux.org.uk/developer/patches/?

Done!

Signature · 2 lines
Best regards,
Alexander Sverdlin.