All of lore.kernel.org
 help / color / mirror / Atom feed
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, linux-kernel@vger.kernel.org,
	linux-trace-kernel@vger.kernel.org,
	linux-perf-users@vger.kernel.org
Subject: Re: [PATCH] uprobes: Improve scalability by reducing the contention on siglock
Date: Fri, 2 Aug 2024 11:24:06 +0200	[thread overview]
Message-ID: <20240802092406.GC12343@redhat.com> (raw)
In-Reply-To: <51a756b7-3c2f-9aeb-1418-b38b74108ee6@huawei.com>

On 08/02, Liao, Chang wrote:
>
>
> 在 2024/8/1 22:06, Oleg Nesterov 写道:
> > On 08/01, Liao Chang wrote:
> >>
> >> @@ -2276,22 +2277,25 @@ static void handle_singlestep(struct uprobe_task *utask, struct pt_regs *regs)
> >>  	int err = 0;
> >>
> >>  	uprobe = utask->active_uprobe;
> >> -	if (utask->state == UTASK_SSTEP_ACK)
> >> +	switch (utask->state) {
> >> +	case UTASK_SSTEP_ACK:
> >>  		err = arch_uprobe_post_xol(&uprobe->arch, regs);
> >> -	else if (utask->state == UTASK_SSTEP_TRAPPED)
> >> +		break;
> >> +	case UTASK_SSTEP_TRAPPED:
> >>  		arch_uprobe_abort_xol(&uprobe->arch, regs);
> >> -	else
> >> +		fallthrough;
> >> +	case UTASK_SSTEP_DENY_SIGNAL:
> >> +		set_tsk_thread_flag(current, TIF_SIGPENDING);
> >> +		break;
> >> +	default:
> >>  		WARN_ON_ONCE(1);
> >> +	}
> >
> > Liao, at first glance this change looks "obviously wrong" to me.
>
> Oleg. Did i overlook some thing obvious here?

OK, lets suppose uprobe_deny_signal() sets UTASK_SSTEP_DENY_SIGNAL.

In this case handle_singlestep() will only set TIF_SIGPENDING and
do nothing else. This is wrong, either _post_xol() or _abort_xol()
must be called.

But I think handle_singlestep() will never hit this case. In the
likely case uprobe_post_sstep_notifier() will replace _DENY_SIGNAL
with _ACK, and this means that handle_singlestep() won't restore
TIF_SIGPENDING cleared by uprobe_deny_signal().

Oleg.


  reply	other threads:[~2024-08-02  9:24 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-01  8:24 [PATCH] uprobes: Improve scalability by reducing the contention on siglock Liao Chang
2024-08-01 14:06 ` Oleg Nesterov
2024-08-02  1:38   ` Liao, Chang
2024-08-02  9:24     ` Oleg Nesterov [this message]
2024-08-06  3:06       ` Liao, Chang
2024-08-06 17:25         ` Oleg Nesterov
2024-08-07 10:17           ` Oleg Nesterov
2024-08-08  7:30             ` Liao, Chang
2024-08-08 10:28               ` Oleg Nesterov
2024-08-08 12:31                 ` Liao, Chang
2024-08-08 13:17                   ` Oleg Nesterov

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=20240802092406.GC12343@redhat.com \
    --to=oleg@redhat.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --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 \
    /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.