From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: linux-kernel@vger.kernel.org
Cc: Greentime Hu <green.hu@gmail.com>, Nick Hu <nickhu@andestech.com>,
Vincent Chen <deanbo422@gmail.com>,
Thomas Gleixner <tglx@linutronix.de>
Subject: nds32: Fails to compile/ not expected $r25 usage.
Date: Mon, 3 Jan 2022 13:12:04 +0100 [thread overview]
Message-ID: <YdLoFBEZIdkKOpwX@linutronix.de> (raw)
Hi,
I run into:
| CC arch/nds32/kernel/perf_event_cpu.o
|In file included from include/linux/sched.h:12,
| from include/linux/ptrace.h:6,
| from include/uapi/asm-generic/bpf_perf_event.h:4,
| from ./arch/nds32/include/generated/uapi/asm/bpf_perf_event.h:1,
| from include/uapi/linux/bpf_perf_event.h:11,
| from include/linux/perf_event.h:18,
| from arch/nds32/kernel/perf_event_cpu.c:9:
|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/include/asm/current.h:10:13: note: each undeclared identifier is reported only once for each function it appears in
| 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: warning: assignment to 'long unsigned int' from 'long unsigned int *' makes integer from pointer without a cast [-Wint-conversion]
| 1257 | frame->sp = ((unsigned long *)frame->sp) + 1;
| | ^
Using `current' instead of `tsk' works and might be the right thing to
do here.
I recommend to avoid using
| #define tsk $r25
since it will clash with its usage as a variable. I am actually
surprised that neither kernel/exit.c nor kernel/fork.c complain here and
according to gcc -E the compiler makes here:
| static void __exit_signal(struct task_struct *$r25)
| {
| struct signal_struct *sig = $r25->signal;
| bool group_dead = thread_group_leader($r25);
…
and it apparently treating $r25 as a variable name. The assembly appears
correct here:
| ! kernel/exit.c:100: sighand = rcu_dereference_check(tsk->sighand,
| lwi $r8, [$r0 + (928)] ! _39, $r25_36(D)->sighand
Since the rename here is not intended I would avoid it in case something
funny happens some day.
Sebastian
reply other threads:[~2022-01-03 12:12 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YdLoFBEZIdkKOpwX@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=deanbo422@gmail.com \
--cc=green.hu@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nickhu@andestech.com \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome