From: Oleg Nesterov <oleg@redhat.com>
To: Liao Chang <liaochang1@huawei.com>
Cc: mhiramat@kernel.org, peterz@infradead.org, mingo@redhat.com,
acme@kernel.org, namhyung@kernel.org, mark.rutland@arm.com,
alexander.shishkin@linux.intel.com, jolsa@kernel.org,
irogers@google.com, adrian.hunter@intel.com,
kan.liang@linux.intel.com, andrii@kernel.org,
rostedt@goodmis.org, linux-kernel@vger.kernel.org,
linux-trace-kernel@vger.kernel.org,
linux-perf-users@vger.kernel.org, bpf@vger.kernel.org
Subject: Re: [PATCH v2 2/2] uprobes: Remove the spinlock within handle_singlestep()
Date: Mon, 12 Aug 2024 13:29:29 +0200 [thread overview]
Message-ID: <20240812112929.GB11656@redhat.com> (raw)
In-Reply-To: <20240809061004.2112369-3-liaochang1@huawei.com>
On 08/09, Liao Chang wrote:
>
> --- a/include/linux/uprobes.h
> +++ b/include/linux/uprobes.h
> @@ -75,6 +75,7 @@ struct uprobe_task {
>
> struct uprobe *active_uprobe;
> unsigned long xol_vaddr;
> + bool deny_signal;
Ack, but... I can't believe I am arguing with the naming ;)
Can we have a better name for this flag?
utask->signal_denied ?
utask->restore_sigpending ?
or just
utask->sigpending ?
utask->deny_signal looks as if handle_singlestep/whatever should
"deny" the pending signal cleared by uprobe_deny_signal(), while
it fact it should restore TIF_SIGPENDING.
Oleg.
>
> struct return_instance *return_instances;
> unsigned int depth;
> diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
> index 76a51a1f51e2..77934fbd1370 100644
> --- a/kernel/events/uprobes.c
> +++ b/kernel/events/uprobes.c
> @@ -1979,6 +1979,7 @@ bool uprobe_deny_signal(void)
> WARN_ON_ONCE(utask->state != UTASK_SSTEP);
>
> if (task_sigpending(t)) {
> + utask->deny_signal = true;
> clear_tsk_thread_flag(t, TIF_SIGPENDING);
>
> if (__fatal_signal_pending(t) || arch_uprobe_xol_was_trapped(t)) {
> @@ -2288,9 +2289,10 @@ static void handle_singlestep(struct uprobe_task *utask, struct pt_regs *regs)
> utask->state = UTASK_RUNNING;
> xol_free_insn_slot(current);
>
> - spin_lock_irq(¤t->sighand->siglock);
> - recalc_sigpending(); /* see uprobe_deny_signal() */
> - spin_unlock_irq(¤t->sighand->siglock);
> + if (utask->deny_signal) {
> + set_thread_flag(TIF_SIGPENDING);
> + utask->deny_signal = false;
> + }
>
> if (unlikely(err)) {
> uprobe_warn(current, "execute the probed insn, sending SIGILL.");
> --
> 2.34.1
>
next prev parent reply other threads:[~2024-08-12 11:29 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-09 6:10 [PATCH v2 0/2] uprobes: Improve scalability by reducing the contention on siglock Liao Chang
2024-08-09 6:10 ` [PATCH v2 1/2] uprobes: Remove redundant spinlock in uprobe_deny_signal() Liao Chang
2024-08-12 12:07 ` Oleg Nesterov
2024-08-13 12:30 ` Liao, Chang
2024-08-13 12:47 ` Oleg Nesterov
2024-09-05 20:53 ` Andrii Nakryiko
2024-08-09 6:10 ` [PATCH v2 2/2] uprobes: Remove the spinlock within handle_singlestep() Liao Chang
2024-08-12 11:29 ` Oleg Nesterov [this message]
2024-08-13 12:30 ` Liao, Chang
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=20240812112929.GB11656@redhat.com \
--to=oleg@redhat.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=andrii@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=kan.liang@linux.intel.com \
--cc=liaochang1@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mhiramat@kernel.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.