Skip to contentSkip to conversation

NDS32: perf_event_cpu: fix 2 build errors

PATCH In review Randy Dunlap 2 participants 3 messages Sep 26, 2021 – Feb 17, 2022 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 NDS32: perf_event_cpu: fix 2 build errors

../arch/nds32/kernel/perf_event_cpu.c: In function 'unwind_frame_kernel':
../arch/nds32/include/asm/current.h:10:13: error: '$r25' undeclared (first use in this function)
10 | #define tsk $r25
../arch/nds32/kernel/perf_event_cpu.c:1255:50: note: in expansion of macro 'tsk'
1255 | (tsk, &graph, frame->lp, NULL);

../arch/nds32/kernel/perf_event_cpu.c:1257:27: error: assignment to 'long unsigned int' from 'long unsigned int *' makes integer from pointer without a cast [-Werror=int-conversion]
1257 | frame->sp = ((unsigned long *)frame->sp) + 1;

For $r25, use the register function for current() instead.

Fixes c8b34461705e ("nds32: Add perf call-graph support.")
Cc Nickhu <[email protected]>
Cc Greentime Hu <[email protected]>
Cc Vincent Chen <[email protected]>

---
Please check the frame->sp cast/arithmetic.

 arch/nds32/kernel/perf_event_cpu.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/nds32/kernel/perf_event_cpu.c +2 -2
@@ -1252,9 +1252,9 @@ static int unwind_frame_kernel(struct st
 		 */
 		if (__kernel_text_address(frame->lp))
 			frame->lp = ftrace_graph_ret_addr
-						(tsk, &graph, frame->lp, NULL);
+					(current, &graph, frame->lp, NULL);
 
-		frame->sp = ((unsigned long *)frame->sp) + 1;
+		frame->sp = (unsigned long)(((unsigned long *)frame->sp)) + 1;
 
 		return 0;
 	} else {
#1 lore raw

Randy Dunlap <[email protected]> 於 2021年9月26日 週日 下午1:58寫道:

Quoted 27 lines

../arch/nds32/kernel/perf_event_cpu.c: In function 'unwind_frame_kernel':
../arch/nds32/include/asm/current.h:10:13: error: '$r25' undeclared (first use in this function)
10 | #define tsk $r25
../arch/nds32/kernel/perf_event_cpu.c:1255:50: note: in expansion of macro 'tsk'
1255 | (tsk, &graph, frame->lp, NULL);

../arch/nds32/kernel/perf_event_cpu.c:1257:27: error: assignment to 'long unsigned int' from 'long unsigned int *' makes integer from pointer without a cast [-Werror=int-conversion]
1257 | frame->sp = ((unsigned long *)frame->sp) + 1;

For $r25, use the register function for current() instead.

Fixes c8b34461705e ("nds32: Add perf call-graph support.")
Cc Nickhu <[email protected]>
Cc Greentime Hu <[email protected]>
Cc Vincent Chen <[email protected]>

---
Please check the frame->sp cast/arithmetic.

 arch/nds32/kernel/perf_event_cpu.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/nds32/kernel/perf_event_cpu.c +0 -0
@@ -1252,9 +1252,9 @@ static int unwind_frame_kernel(struct st
                 */

arch/nds32/kernel/perf_event_cpu.c static int unwind_frame_kernel(struct st · line 1260

Quoted 10 lines
arch/nds32/kernel/perf_event_cpu.c +2 -2
                if (__kernel_text_address(frame->lp))
                        frame->lp = ftrace_graph_ret_addr
-                                               (tsk, &graph, frame->lp, NULL);
+                                       (current, &graph, frame->lp, NULL);
 
-               frame->sp = ((unsigned long *)frame->sp) + 1;
+               frame->sp = (unsigned long)(((unsigned long *)frame->sp)) + 1;
 
                return 0;
        } else {

Loop in Alan and KC.

#2 lore raw

Hi--

Quoted 33 lines · Greentime Hu

Randy Dunlap <[email protected]> 於 2021年9月26日 週日 下午1:58寫道:

Quoted 32 lines

../arch/nds32/kernel/perf_event_cpu.c: In function 'unwind_frame_kernel':
../arch/nds32/include/asm/current.h:10:13: error: '$r25' undeclared (first use in this function)
10 | #define tsk $r25
../arch/nds32/kernel/perf_event_cpu.c:1255:50: note: in expansion of macro 'tsk'
1255 | (tsk, &graph, frame->lp, NULL);

../arch/nds32/kernel/perf_event_cpu.c:1257:27: error: assignment to 'long unsigned int' from 'long unsigned int *' makes integer from pointer without a cast [-Werror=int-conversion]
1257 | frame->sp = ((unsigned long *)frame->sp) + 1;

For $r25, use the register function for current() instead.

Fixes c8b34461705e ("nds32: Add perf call-graph support.")
Cc Nickhu <[email protected]>
Cc Greentime Hu <[email protected]>
Cc Vincent Chen <[email protected]>

---
Please check the frame->sp cast/arithmetic.

 arch/nds32/kernel/perf_event_cpu.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/nds32/kernel/perf_event_cpu.c +1 -1
@@ -1252,9 +1252,9 @@ static int unwind_frame_kernel(struct st
                 */
                if (__kernel_text_address(frame->lp))
                        frame->lp = ftrace_graph_ret_addr
-                                               (tsk, &graph, frame->lp, NULL);
+                                       (current, &graph, frame->lp, NULL);
 
Quoted 7 lines

arch/nds32/kernel/perf_event_cpu.c static int unwind_frame_kernel(struct st · line 1260

Quoted 5 lines
arch/nds32/kernel/perf_event_cpu.c +1 -1
-               frame->sp = ((unsigned long *)frame->sp) + 1;
+               frame->sp = (unsigned long)(((unsigned long *)frame->sp)) + 1;
 
                return 0;
        } else {

Loop in Alan and KC.

Ping. Does anybody care?

Signature · 1 line
~Randy