From nobody Wed Dec 17 14:13:44 2025 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DE4A730FC3A; Tue, 14 Oct 2025 08:42:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760431346; cv=none; b=XYXcE32RlcO7zTG2W9LVNobfF5jiGUlGxI0tHXia3G2HKXsj8MYJagUkTg0JSJD7DEgPgIFXZb9xEoTwa1NjptPP8KahMNX78JjuLGYDrA6LlJVpefabbZC3eA21sr/oXrXRncQYgnniZeXiZ7SLcntMCBgWJNRgQFhF8lZ3peo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760431346; c=relaxed/simple; bh=Y4WKRCy1le6eD5rF/jjqoQ7qUyjPL0ertBEJ/6yplX8=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=DylEq6fxj7Nb58rFLvLCCq67WNHsOf6uVIm9qris0Fl8Mjx/+F+9ttwf33wRjqKFe40STMxhmxDAytUVZkSF36x2QMWobRmvuWFp4kitSfY/YQ72hj+om0TtMB/4TQA0/gP6YMciiHmedOgqH9PYh2uW5Xj1qzN0xeuJ/wTYUSQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=iRnnjCkz; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=nN4O7qc3; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="iRnnjCkz"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="nN4O7qc3" Date: Tue, 14 Oct 2025 08:42:21 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1760431342; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bIaZ6Rp9/Ohao0EAOOvMzpcZsuafuitBB8hp3XEwhxc=; b=iRnnjCkzWP+dHMdOx9p4DX5Ci6bC+U0bPbrJSE0BCt3cpe7xu1QHoygTbM9YJdrqtAxS9B 4zPV+SEZf/Elz/TxUUY9HQ7lnOlAMuubFjijKX1ewGurtnVRjT/hG+BgHbdrrHRG/WEVXM QbkB4SO/X9c5+B6xbhaBHodV2DfNGXWhqXkp4D9+kQ0Wcy2cZ/0U0g8eQEKCvExKUdasTI 9LINuTqThfU5fnfxxaG1RJUdjXOHD34XhvbGvzYk669d2vLSkE75Ipwr9RY/1Y1EJm0wCB yu/YDkkRYEnnMAULLryzekESKa0pyTVmRPOSvTPMEmPlMYQ944yfrwNOekMXLg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1760431342; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bIaZ6Rp9/Ohao0EAOOvMzpcZsuafuitBB8hp3XEwhxc=; b=nN4O7qc3XW5A9VVYmuKGCkCl0ekeUXIuGk1GEByPYVgs2cyOyShYIwRUmBfG++6cNT0UBu 1VmZQwZNORGsqxCQ== From: "tip-bot2 for Jiri Olsa" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: perf/urgent] uprobe: Move arch_uprobe_optimize right after handlers execution Cc: Linus Torvalds , Jiri Olsa , "Peter Zijlstra (Intel)" , "Masami Hiramatsu (Google)" , Andrii Nakryiko , Oleg Nesterov , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20251001132449.178759-1-jolsa@kernel.org> References: <20251001132449.178759-1-jolsa@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <176043134107.709179.3423388679418556938.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the perf/urgent branch of tip: Commit-ID: 62685ab071de7c39499212bff19f1b5bc0148bc7 Gitweb: https://git.kernel.org/tip/62685ab071de7c39499212bff19f1b5bc= 0148bc7 Author: Jiri Olsa AuthorDate: Wed, 01 Oct 2025 15:24:49 +02:00 Committer: Peter Zijlstra CommitterDate: Tue, 14 Oct 2025 10:38:09 +02:00 uprobe: Move arch_uprobe_optimize right after handlers execution It's less confusing to optimize uprobe right after handlers execution and before we do the check for changed ip register to avoid situations where changed ip register would skip uprobe optimization. Suggested-by: Linus Torvalds Signed-off-by: Jiri Olsa Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Masami Hiramatsu (Google) Acked-by: Andrii Nakryiko Acked-by: Oleg Nesterov --- kernel/events/uprobes.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c index 8709c69..f11ceb8 100644 --- a/kernel/events/uprobes.c +++ b/kernel/events/uprobes.c @@ -2765,6 +2765,9 @@ static void handle_swbp(struct pt_regs *regs) =20 handler_chain(uprobe, regs); =20 + /* Try to optimize after first hit. */ + arch_uprobe_optimize(&uprobe->arch, bp_vaddr); + /* * If user decided to take execution elsewhere, it makes little sense * to execute the original instruction, so let's skip it. @@ -2772,9 +2775,6 @@ static void handle_swbp(struct pt_regs *regs) if (instruction_pointer(regs) !=3D bp_vaddr) goto out; =20 - /* Try to optimize after first hit. */ - arch_uprobe_optimize(&uprobe->arch, bp_vaddr); - if (arch_uprobe_skip_sstep(&uprobe->arch, regs)) goto out; =20