Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp7083616rwb; Tue, 15 Nov 2022 07:30:06 -0800 (PST) X-Google-Smtp-Source: AA0mqf6EMJHP1vNO35KNfSeXjN8oOe9yVTDxVh7a4LSUS/M7nMw0zDcUMwbA5r8Bs9TRAe+uFt82 X-Received: by 2002:a17:90a:5d06:b0:213:d1d5:d661 with SMTP id s6-20020a17090a5d0600b00213d1d5d661mr1143021pji.43.1668526206130; Tue, 15 Nov 2022 07:30:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668526206; cv=none; d=google.com; s=arc-20160816; b=FEWi11Eb68whbwh/ilMWzLtIFk50QhphhiP2fnlGd8VpYiyoQzse6ZbhMUilIiJk5c aFoFOp2veHThKhlFSRk0QpKwYxXROZ+DXSNF3mpA2f01y681TLzY/u7oW3nItCyQrtPZ bhbHoxFWRUUWCiybTH90TTC/mstVV3tcHX0VnzYFNQCXCj3IWhJ7e1fe6pB2eWJPaSWs i6cixcvzT1T+r+jfmkS0iq3A1EZVMFXsTfrlLeW6hvwyXBroZTpFR6UEuolu/X+zn0GW /SUT3LfQ6PEV1pMPyXLrDUxCTx6AByfSan+BbhftQ7iCvu0Ekw1bU0Aq6DFPR0whw8Fe ocBA== 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=eT28tBltt81YU7ZioX1MpsBW2Gp/Ztob1mKQ9N2/d5k=; b=De2NfDa4JxbNnlY0k+tpcN2nHAknMbHPFhnM9BDmwG8q5cl02qr7PS0ZDC/wUt8i7O h6JKV66m7N4rjNWazevZSfky8K1JoP0sVxjVVJ4g2JKu9LRpsRyPSwqU0//xjF8GmnfC zPJGH5C4Z+fQgb3ZU1X6+EO48TW2GxMfgZwN+RB7F/o30cUzMsgMoczWNDLxA0wecUx2 nDWR4i8Imn5gim/3ySSl2uVFo4az7vUzcCd7Hr5PwkqNOud2PvVTXFUWupisC2X3RXMt STHUiW/kqAQWnSgxFYLY5NV1iyFk6hi9S5rAWoailqO9tiqBgi+mAEB7JxIYW3s0/a5m vc1Q== 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 w8-20020a63fb48000000b004600f27528fsi11856863pgj.175.2022.11.15.07.29.53; Tue, 15 Nov 2022 07:30:06 -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 S230231AbiKOPKB (ORCPT + 90 others); Tue, 15 Nov 2022 10:10:01 -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> 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 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