From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E81CC433FE for ; Tue, 15 Nov 2022 15:10:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230302AbiKOPKC (ORCPT ); Tue, 15 Nov 2022 10:10:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231314AbiKOPJt (ORCPT ); Tue, 15 Nov 2022 10:09:49 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5EFC317AB2; Tue, 15 Nov 2022 07:09:45 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EF22A61821; Tue, 15 Nov 2022 15:09:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4499BC433D6; Tue, 15 Nov 2022 15:09:42 +0000 (UTC) Date: Tue, 15 Nov 2022 15:09:37 +0000 From: Catalin Marinas To: Tomislav Novak Cc: Alexei Starovoitov , Will Deacon , bpf@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Samuel Gosselin , Mark Rutland , Russell King Subject: Re: [PATCH] hw_breakpoint: fix single-stepping when using bpf_overflow_handler Message-ID: References: <20220923203644.2731604-1-tnovak@fb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220923203644.2731604-1-tnovak@fb.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 23, 2022 at 01:36:45PM -0700, Tomislav Novak wrote: > On ARM platforms is_default_overflow_handler() is used to determine if > hw_breakpoint code should single-step over the watchpoint trigger or > let the custom handler deal with it. > > Attaching a BPF program to a watchpoint replaces the handler with > bpf_overflow_handler, which isn't recognized as a default handler so we > never step over the instruction triggering the data abort exception (the > watchpoint keeps firing): > > # bpftrace -e 'watchpoint:0x10000000:4:w { printf("hit\n"); }' ./wp_test > Attaching 1 probe... > hit > hit > hit > [...] > > (wp_test performs a single 4-byte store to address 0x10000000) > > This patch replaces the check with uses_default_overflow_handler(), which > accounts for the bpf_overflow_handler() case by also testing if the handler > invokes one of the perf_event_output functions via orig_default_handler. > > Signed-off-by: Tomislav Novak > Tested-by: Samuel Gosselin # arm64 > --- > arch/arm/kernel/hw_breakpoint.c | 8 ++++---- > arch/arm64/kernel/hw_breakpoint.c | 4 ++-- > include/linux/perf_event.h | 22 +++++++++++++++++++--- > 3 files changed, 25 insertions(+), 9 deletions(-) It looks like this slipped through the cracks. I'm fine with the patch but could you split the arm and arm64 parts in separate patches? Unless rmk acks it and we can take the patch through the arm64 (or perf) tree. -- Catalin From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 97269C433FE for ; Tue, 15 Nov 2022 15:11:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=71O8rrXJoNhemJ9QXaTWw6fP8tIWLBpPHhmEgV5tu1E=; b=FUsz4g7pwbBAEi BikB+ABX9W+0emSf+08qFQKgIIXtnppfKORPLfBIBdJ9p36MHSmIKoUYy1zfpUChURo1EvHBSDXDf FKUa3HBC++wPktdR6PKbQJNDlsKdImgnHMd+cBwux8U/7UETIoNXnH01jM2+XtN48/6Jon7dHD+14 c7gHg+DNOcCnkuxtFf1QLPqO0UQLAokBiLdV7ka2xpK5NDEfsuM2ZP/TtF20j4JyIccnMrFrM6Ebw GfCLjS3U6vi8d7xZlM00xdLo67/sd/Y+tJ49OHe7eFbAI4AZJ+6A//Kae5aDYlioYrbTz+tzMfjQj SsxAtwhPUtrunt6CebVw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ouxZN-00CBC3-L2; Tue, 15 Nov 2022 15:09:50 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ouxZJ-00CBAb-DC for linux-arm-kernel@lists.infradead.org; Tue, 15 Nov 2022 15:09:46 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E75A8617CF; Tue, 15 Nov 2022 15:09:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4499BC433D6; Tue, 15 Nov 2022 15:09:42 +0000 (UTC) Date: Tue, 15 Nov 2022 15:09:37 +0000 From: Catalin Marinas To: Tomislav Novak Cc: Alexei Starovoitov , Will Deacon , bpf@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Samuel Gosselin , Mark Rutland , Russell King Subject: Re: [PATCH] hw_breakpoint: fix single-stepping when using bpf_overflow_handler Message-ID: References: <20220923203644.2731604-1-tnovak@fb.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220923203644.2731604-1-tnovak@fb.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221115_070945_521690_D6DA0F3D X-CRM114-Status: GOOD ( 18.96 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Sep 23, 2022 at 01:36:45PM -0700, Tomislav Novak wrote: > On ARM platforms is_default_overflow_handler() is used to determine if > hw_breakpoint code should single-step over the watchpoint trigger or > let the custom handler deal with it. > > Attaching a BPF program to a watchpoint replaces the handler with > bpf_overflow_handler, which isn't recognized as a default handler so we > never step over the instruction triggering the data abort exception (the > watchpoint keeps firing): > > # bpftrace -e 'watchpoint:0x10000000:4:w { printf("hit\n"); }' ./wp_test > Attaching 1 probe... > hit > hit > hit > [...] > > (wp_test performs a single 4-byte store to address 0x10000000) > > This patch replaces the check with uses_default_overflow_handler(), which > accounts for the bpf_overflow_handler() case by also testing if the handler > invokes one of the perf_event_output functions via orig_default_handler. > > Signed-off-by: Tomislav Novak > Tested-by: Samuel Gosselin # arm64 > --- > arch/arm/kernel/hw_breakpoint.c | 8 ++++---- > arch/arm64/kernel/hw_breakpoint.c | 4 ++-- > include/linux/perf_event.h | 22 +++++++++++++++++++--- > 3 files changed, 25 insertions(+), 9 deletions(-) It looks like this slipped through the cracks. I'm fine with the patch but could you split the arm and arm64 parts in separate patches? Unless rmk acks it and we can take the patch through the arm64 (or perf) tree. -- Catalin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel