From patchwork Fri May 26 11:12:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pratyush Anand X-Patchwork-Id: 9750377 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A0C7260209 for ; Fri, 26 May 2017 11:13:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 971F21FFAE for ; Fri, 26 May 2017 11:13:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8902B269DA; Fri, 26 May 2017 11:13:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id EF3B41FFAE for ; Fri, 26 May 2017 11:13:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Date:Message-ID:To:Subject:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=DcxWABVHnwBJNs0cCockQLdtd/thwzWXf9+luQdB10Y=; b=lC7IcGfcI4vnvzS8ZqEDWNqYrQ Q3VE/01fNAw6TDhhoGB1hewrZ3a4jdEmYlphGNSvSUSd/8FFxh2EXB+VXqswnfhbZlytpTNSWGPyn HUGdALUfwNVgWIpwMsJQANcH7Bvw8Ulu8TV61TcYjmPXYobq2E23oYYiCX9/VfN3ESt+8otgBRj0b U0n5X6p+YVvR05sNXoZEM2geIKrgD5Gc3W98zEr4oMAkZEN6WJcLYSotKI5XpvxEASXDDnCJ19auS 7qR8XmNJNij4UEgw47EbHM9MtPWgAi1uX51VVWFroqMB6v1b7wXtxth1EMKDVQxLIJWU8qKwV6ada DMPsbZ1A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dEDBQ-0005dF-HJ; Fri, 26 May 2017 11:13:28 +0000 Received: from mail-pf0-f174.google.com ([209.85.192.174]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dEDAx-0005ZX-6K for linux-arm-kernel@lists.infradead.org; Fri, 26 May 2017 11:13:04 +0000 Received: by mail-pf0-f174.google.com with SMTP id e193so9016615pfh.0 for ; Fri, 26 May 2017 04:12:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:cc:message-id:date:user-agent :mime-version:content-transfer-encoding; bh=d5rlfIRY5fnZNu1M5zmWyhM8k/5HELJXGK5FHjI2L8w=; b=nXjY25V6cW+zfalE/09qhmKOjn9RzEAG+oSu85xsOsoji19ghUSMgZiaOqHJKBYBtZ vpjW4Taknme0lsBIUWN8lvjq+Ls+7ZDq/bNuSyAIdGW+hcKcULWZCCsZ+5bo62lFmss0 /IQq4rbTpAyFkIWYjgZqyOujDOcB6y9f1wtIBJWjCzq5nrVW625Na6hbS+DzKqkC2VNx zYnBnF4OFCEEkRtl5H9Z18MO8TxI3tcA0Uc/luC7Tqru3C4Rbx/FuAMOb355ql30Axsx Z/4FE7f0hANdDYDNqTB6Ks5p4PJGzyDu0c7wlneQRwyC3m6pmKhMifXLPfaoVqbQPCDa l7Qw== X-Gm-Message-State: AODbwcD5CgDx9Ip6SfaeSmKLWNuh7DyylvdlNJbdHul6anrDhAPI405L QQ4JkBW9wrcgkGGF X-Received: by 10.84.212.137 with SMTP id e9mr57931141pli.115.1495797157051; Fri, 26 May 2017 04:12:37 -0700 (PDT) Received: from localhost.localdomain ([122.162.132.203]) by smtp.gmail.com with ESMTPSA id e24sm1954306pgn.1.2017.05.26.04.12.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 May 2017 04:12:36 -0700 (PDT) From: Pratyush Anand Subject: Query: arm64: hwbreakpoint: single stepping in case of custom overflow_handler To: Will Deacon Message-ID: Date: Fri, 26 May 2017 16:42:33 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170526_041301_633819_5EF7DB8D X-CRM114-Status: GOOD ( 13.61 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Smith , linux-arm-kernel Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Hi Will, When we run test from samples/hw_breakpoint/data_breakpoint.c, it triggers continuous watchpoint exception handler. Reproducer: # insmod data_breakpoint.ko ksym=__sysrq_enabled # cat /proc/sys/kernel/sysrq So, wanted to understand that why do we not allow single stepping in case overflow_handler is a customized one and not from perf infrastructure? Patch [1] allows to work with a custom overflow_handler, but I am not sure if that could be an acceptable choice. There are issues with samples/hw_breakpoint/data_breakpoint.c, even when using patch [1],because overflow_handler of test calls dump_stack(). I am not yet sure,what happened here..my guess is that dump_stack() triggered a SW BRK exception somewhere. Anyway,thats a secondary problem,I can look into if patch [1] makes sense. ~Pratyush [1] rcu_read_unlock(); @@ -789,7 +789,7 @@ static int watchpoint_handler(unsigned long addr, unsigned int esr, perf_bp_event(wp, regs); /* Do we need to handle the stepping? */ - if (is_default_overflow_handler(wp)) + if (wp->overflow_handler) step = 1; } if (min_dist > 0 && min_dist != -1) { @@ -800,7 +800,7 @@ static int watchpoint_handler(unsigned long addr, unsigned int esr, perf_bp_event(wp, regs); /* Do we need to handle the stepping? */ - if (is_default_overflow_handler(wp)) + if (wp->overflow_handler) step = 1; } rcu_read_unlock(); diff --git a/arch/arm64/kernel/hw_breakpoint.c b/arch/arm64/kernel/hw_breakpoint.c index 749f81779420..ea8ab0656dd0 100644 --- a/arch/arm64/kernel/hw_breakpoint.c +++ b/arch/arm64/kernel/hw_breakpoint.c @@ -661,7 +661,7 @@ static int breakpoint_handler(unsigned long unused, unsigned int esr, perf_bp_event(bp, regs); /* Do we need to handle the stepping? */ - if (is_default_overflow_handler(bp)) + if (bp->overflow_handler) step = 1; unlock: