From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 8F0071E51E1; Sun, 14 Sep 2025 13:53:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757858003; cv=none; b=NLemZ1P4AK/a5LpRSLL9Yc84VX96XkkFqHzHZoXRI4mO2pJPEdI1y8sEz5+1a+HzpCqUzlhv/cIwviYxtAWm7/IJrGjn+3A0mxD9fj3UA5vVasi1AwI/0Cb6JkJdJrI+FwfQOp5vzAgrYx0GpFaDwwCiFgrhjuh3muGuPRs8eY0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757858003; c=relaxed/simple; bh=Up9Xu/CJoHEjUcchIJsyeiW2UaO4s1K1qCNgKItusWg=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=ArGxYsdjt1Tqky1DYtmRoWTBLxGKxtCQIGQDCunWVkOfpfGzjYwZP0vCN5KX8/U4HCc6KZog48VnHTetHCAfVmdUo44FKhwco4hZ2gnEQqcVcVTDOQmQZKmLgvj93e5kf/8QajtEHQp6LLywOZpoJ1yC9tNTx4Mu3ANwMJ/RANA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Hm3bsaZn; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Hm3bsaZn" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95F0FC4CEF0; Sun, 14 Sep 2025 13:53:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1757858000; bh=Up9Xu/CJoHEjUcchIJsyeiW2UaO4s1K1qCNgKItusWg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Hm3bsaZn2JvvJqxIY9S3ulwLpYVfges3Vprs9UKDgleuWKeb0EAYJrz6RKDtsItTD 2awMaKPZ+wOkswbhdv1+Wwe5OwP87TII+h6gIlFDrCBOG8/KpDgNBNgrqurUJrGwwj 1s28FU0H0CT4SdxvYS/av7lUhVE5zGQfFumGB0hGhZkHAtQeoLqiQd510v1PnFXFiK YqZukWPqiKIe+x6kKKokwvL0KeD8SzvtJl5oA+wult90ARlAMp2b1Z2jJJd07f11YD Vpe354oAqwdIWbmOkSkRqziYY5oO5Sho7Uc6n4G6FGbr0zo7SEsStdW68E/vgiMwDF FdRnhA7K5BHNA== Date: Sun, 14 Sep 2025 22:53:06 +0900 From: Masami Hiramatsu (Google) To: Jinchao Wang Cc: Andrew Morton , Peter Zijlstra , Mike Rapoport , Alexander Potapenko , Jonathan Corbet , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , "Liang, Kan" , David Hildenbrand , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Suren Baghdasaryan , Michal Hocko , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Kees Cook , Alice Ryhl , Sami Tolvanen , Miguel Ojeda , Masahiro Yamada , Rong Xu , Naveen N Rao , David Kaplan , Andrii Nakryiko , Jinjie Ruan , Nam Cao , workflows@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-mm@kvack.org, llvm@lists.linux.dev, Andrey Ryabinin , Andrey Konovalov , Dmitry Vyukov , Vincenzo Frascino , kasan-dev@googlegroups.com, "David S. Miller" , Mathieu Desnoyers , linux-trace-kernel@vger.kernel.org Subject: Re: [PATCH v4 02/21] x86/hw_breakpoint: Add arch_reinstall_hw_breakpoint Message-Id: <20250914225306.2185b79065e32f60a40ef54c@kernel.org> In-Reply-To: <20250912101145.465708-3-wangjinchao600@gmail.com> References: <20250912101145.465708-1-wangjinchao600@gmail.com> <20250912101145.465708-3-wangjinchao600@gmail.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: workflows@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Fri, 12 Sep 2025 18:11:12 +0800 Jinchao Wang wrote: > The new arch_reinstall_hw_breakpoint() function can be used in an > atomic context, unlike the more expensive free and re-allocation path. > This allows callers to efficiently re-establish an existing breakpoint. > Looks good to me. Reviewed-by: Masami Hiramatsu (Google) Thanks! > Signed-off-by: Jinchao Wang > --- > arch/x86/include/asm/hw_breakpoint.h | 2 ++ > arch/x86/kernel/hw_breakpoint.c | 9 +++++++++ > 2 files changed, 11 insertions(+) > > diff --git a/arch/x86/include/asm/hw_breakpoint.h b/arch/x86/include/asm/hw_breakpoint.h > index aa6adac6c3a2..c22cc4e87fc5 100644 > --- a/arch/x86/include/asm/hw_breakpoint.h > +++ b/arch/x86/include/asm/hw_breakpoint.h > @@ -21,6 +21,7 @@ struct arch_hw_breakpoint { > > enum bp_slot_action { > BP_SLOT_ACTION_INSTALL, > + BP_SLOT_ACTION_REINSTALL, > BP_SLOT_ACTION_UNINSTALL, > }; > > @@ -65,6 +66,7 @@ extern int hw_breakpoint_exceptions_notify(struct notifier_block *unused, > > > int arch_install_hw_breakpoint(struct perf_event *bp); > +int arch_reinstall_hw_breakpoint(struct perf_event *bp); > void arch_uninstall_hw_breakpoint(struct perf_event *bp); > void hw_breakpoint_pmu_read(struct perf_event *bp); > void hw_breakpoint_pmu_unthrottle(struct perf_event *bp); > diff --git a/arch/x86/kernel/hw_breakpoint.c b/arch/x86/kernel/hw_breakpoint.c > index 3658ace4bd8d..29c9369264d4 100644 > --- a/arch/x86/kernel/hw_breakpoint.c > +++ b/arch/x86/kernel/hw_breakpoint.c > @@ -99,6 +99,10 @@ static int manage_bp_slot(struct perf_event *bp, enum bp_slot_action action) > old_bp = NULL; > new_bp = bp; > break; > + case BP_SLOT_ACTION_REINSTALL: > + old_bp = bp; > + new_bp = bp; > + break; > case BP_SLOT_ACTION_UNINSTALL: > old_bp = bp; > new_bp = NULL; > @@ -187,6 +191,11 @@ int arch_install_hw_breakpoint(struct perf_event *bp) > return arch_manage_bp(bp, BP_SLOT_ACTION_INSTALL); > } > > +int arch_reinstall_hw_breakpoint(struct perf_event *bp) > +{ > + return arch_manage_bp(bp, BP_SLOT_ACTION_REINSTALL); > +} > + > void arch_uninstall_hw_breakpoint(struct perf_event *bp) > { > arch_manage_bp(bp, BP_SLOT_ACTION_UNINSTALL); > -- > 2.43.0 > > -- Masami Hiramatsu (Google)