[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230516091548.GA2587705@hirez.programming.kicks-ass.net>
Date: Tue, 16 May 2023 11:15:48 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Ze Gao <zegao2021@...il.com>
Cc: Steven Rostedt <rostedt@...dmis.org>,
Masami Hiramatsu <mhiramat@...nel.org>,
Albert Ou <aou@...s.berkeley.edu>,
Alexander Gordeev <agordeev@...ux.ibm.com>,
Alexei Starovoitov <ast@...nel.org>,
Borislav Petkov <bp@...en8.de>,
Christian Borntraeger <borntraeger@...ux.ibm.com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Heiko Carstens <hca@...ux.ibm.com>,
"H. Peter Anvin" <hpa@...or.com>, Ingo Molnar <mingo@...hat.com>,
Palmer Dabbelt <palmer@...belt.com>,
Paul Walmsley <paul.walmsley@...ive.com>,
Sven Schnelle <svens@...ux.ibm.com>,
Thomas Gleixner <tglx@...utronix.de>,
Vasily Gorbik <gor@...ux.ibm.com>, x86@...nel.org,
linux-kernel@...r.kernel.org, linux-riscv@...ts.infradead.org,
linux-s390@...r.kernel.org, linux-trace-kernel@...r.kernel.org,
bpf@...r.kernel.org, Conor Dooley <conor@...nel.org>,
Jiri Olsa <jolsa@...nel.org>, Yonghong Song <yhs@...com>,
Ze Gao <zegao@...cent.com>
Subject: Re: [PATCH v2 2/4] fprobe: make fprobe_kprobe_handler recursion free
On Tue, May 16, 2023 at 03:18:28PM +0800, Ze Gao wrote:
> +static void fprobe_handler(unsigned long ip, unsigned long parent_ip,
> + struct ftrace_ops *ops, struct ftrace_regs *fregs)
> +{
> + struct fprobe *fp;
> + int bit;
> +
> + fp = container_of(ops, struct fprobe, ops);
> + if (fprobe_disabled(fp))
> + return;
> +
> + /* recursion detection has to go before any traceable function and
> + * all functions before this point should be marked as notrace
> + */
> + bit = ftrace_test_recursion_trylock(ip, parent_ip);
> + if (bit < 0) {
> + fp->nmissed++;
> + return;
> + }
> + __fprobe_handler(ip, parent_ip, ops, fregs);
> ftrace_test_recursion_unlock(bit);
> +
> }
> NOKPROBE_SYMBOL(fprobe_handler);
>
> static void fprobe_kprobe_handler(unsigned long ip, unsigned long parent_ip,
> struct ftrace_ops *ops, struct ftrace_regs *fregs)
> {
> - struct fprobe *fp = container_of(ops, struct fprobe, ops);
> + struct fprobe *fp;
> + int bit;
> +
> + fp = container_of(ops, struct fprobe, ops);
> + if (fprobe_disabled(fp))
> + return;
> +
> + /* recursion detection has to go before any traceable function and
> + * all functions called before this point should be marked as notrace
> + */
> + bit = ftrace_test_recursion_trylock(ip, parent_ip);
> + if (bit < 0) {
> + fp->nmissed++;
> + return;
> + }
Please don't use this comment style; multi line comments go like:
/*
* Multi line comment ...
* ... is symmetric.
*/
Same for your next patch.
Powered by blists - more mailing lists