Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2157616rwb; Wed, 30 Nov 2022 03:11:50 -0800 (PST) X-Google-Smtp-Source: AA0mqf6qOKJuca9lKSPBvs23ImC8vOD5bRZKdRSUhzXUrudHiFjTpFUNqLyvK5qyH/7hKUXcq8NH X-Received: by 2002:a17:90a:307:b0:213:dce7:e1fe with SMTP id 7-20020a17090a030700b00213dce7e1femr71579471pje.110.1669806710487; Wed, 30 Nov 2022 03:11:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669806710; cv=none; d=google.com; s=arc-20160816; b=Fk6leshCIbKOqyEYUZewFpxNojA75j8P4rzqD6sJ1TJxzEIZVu6Y8CvCS6OgxN09k4 9eik/qgn1FIY8O2bG9MY5tf8trc3oc8NDVyNvxMjiILAxQzmQgWzN6xJbCgIh+9nOXRY fHci1cl9xqMynFqvYSzGDsVqK8NnJyBaEUn7Wl3iVJZ0PeljlfIwyOB3JKw4KvIRwJ5h 6gr280SbO3gI0/kYpPE1Al8LwGMxh67je6Ns0H82D8CDeijsOsa4EzN5XzKUtRPrhOx+ gFk5Xgw6d/L3Ob4ay+Em12Sol/6XzlCabKfiFES+e+IZppqgfK7Tr+ukY8V+TIws0uH1 VSQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=4L/8V9Z4zkQbnF8MjpmuRIAwNugz8JfRxNtSF+fMsI4=; b=nuoSDSLv6crYbd9SlasvkgQVj7FPPaBYj9vMtdfwJ5X7DDmDjbIf2ndKO6Q6w0bXr9 Ghs161fhJoI+XwaEuqaEqwceiwMm27PsuzNfXjp4bSI+1ldMbll5S427CH7xV31hPDmy AS9RBNCw0IKIHWKnX2KOm4td95eizacBthKV/dj07/JOIf500Jbs9/WY2n0GM4IFBwA0 5xv+rc7hltecHGZdIkvegPZf/xJHZZhaMu/VCfoUEpsqVJ2r4pkya6Zu44V8JpKKgyB7 B2p7yy7+lgSMEcv+BeP2Xm1SzU2TlRnz9GIHse/cx5jyY2YxvEjI7ki7B88utevf2K9o kHCA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w19-20020a17090aaf9300b00218ca1ac741si1159815pjq.181.2022.11.30.03.11.40; Wed, 30 Nov 2022 03:11:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231968AbiK3KwE (ORCPT + 84 others); Wed, 30 Nov 2022 05:52:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233016AbiK3KwD (ORCPT ); Wed, 30 Nov 2022 05:52:03 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D0B673400; Wed, 30 Nov 2022 02:52:02 -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 02D7161AFE; Wed, 30 Nov 2022 10:52:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 869EAC433C1; Wed, 30 Nov 2022 10:51:59 +0000 (UTC) Date: Wed, 30 Nov 2022 10:51:56 +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: X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 28, 2022 at 11:59:37AM +0000, Tomislav Novak wrote: > On Tue, Nov 15, 2022 at 03:09:37PM +0000, Catalin Marinas 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. > > Thanks for reviewing! > > Given the changes in the arch-independent perf_event.h, I think merging it > as a single commit may be easiest (assuming rmk acks it). > > Alternatively I could move arm changes into a separate patch, keeping arm64 > and perf_event.h in this one (possibly splitting out the latter into its own > commit). One that's merged, the arm patch could be submitted to linux-arm. > What would you prefer? Actually, arch/arm*/kernel/hw_breakpoint.c come under the ARM PMU profiling, so no need to split the patch. It may need an ack from the generic perf maintainers for include/linux/perf.h. FWIW, Reviewed-by: Catalin Marinas