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 X-Spam-Level: X-Spam-Status: No, score=-8.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 48134C00A89 for ; Fri, 30 Oct 2020 16:07:05 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BF28E20724 for ; Fri, 30 Oct 2020 16:07:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="raniGQSB"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="vtKwocxN" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BF28E20724 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject: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=VBHYBFF6KgslRFZBCuoWTBXfCb7G87rCqOv1XWbnnRU=; b=raniGQSB02YGbhCehtQSy3aeZ qEicztcz9GC6Bg3tEzTdqWb0rRQvOkyS63pF4e5sS1Mo+mlgss5R1RfTjXwLxFPVNNFoXju4gd5/o Jyd68PPsd0yg3Hh7NSNUSduBgeaN9OOdvoCT5MFczX0ZSvjpnBBXtmQNzch13mWytzeiO+RsUptqD 6Cs+L/hKWhAedJrRXdjQEVGAdKbLUFC7tGm6jNbrCMVKeU/g2GaN7Ko4mx8M8/KeZVqtw/QScyg6v l0kjTg11yph8Z6Xhaptsp/uGXXFOTwW0sqhgQaXsNfLnow2MJRSX2tJM/BdCre1Xa+D32Gf/rcCju 3PNFxcupQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kYWvA-0007Tn-VB; Fri, 30 Oct 2020 16:06:32 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kYWv8-0007TD-KR for linux-arm-kernel@lists.infradead.org; Fri, 30 Oct 2020 16:06:31 +0000 Received: from willie-the-truck (236.31.169.217.in-addr.arpa [217.169.31.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CAE2220724; Fri, 30 Oct 2020 16:06:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604073988; bh=ZiZ14NuiB0it7KRdDq19rvqOZdlkUjxz9+1KRvNQeYA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=vtKwocxNyP/MLre90ZyzXO6rmfm3WPpFyQOQW0wBHqyyzVv/JmJdv5K4gW+/HJOoN vpEZEb6SGco1IwpeS3Fhw4VQCtV5mYztXLK1LozdgrYELnczFAu6cvAgn2rtAcdjaG B5JairHwKajmA+QuMdgdoKaV+IyCj8wUD3ex4o6I= Date: Fri, 30 Oct 2020 16:06:24 +0000 From: Will Deacon To: Jean-Philippe Brucker Subject: Re: [PATCH] arm64: kprobes: Use BRK instead of single-step when executing instructions out-of-line Message-ID: <20201030160623.GA32582@willie-the-truck> References: <20201029173440.117174-1-jean-philippe@linaro.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20201029173440.117174-1-jean-philippe@linaro.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201030_120630_769622_E8A828F9 X-CRM114-Status: GOOD ( 21.76 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: catalin.marinas@arm.com, mhiramat@kernel.org, linux-arm-kernel@lists.infradead.org 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 Thu, Oct 29, 2020 at 06:34:42PM +0100, Jean-Philippe Brucker wrote: > Commit 36dadef23fcc ("kprobes: Init kprobes in early_initcall") enabled > using kprobes from early_initcall. Unfortunately at this point the > hardware debug infrastructure is not operational. The OS lock may still > be locked, and the hardware watchpoints may have unknown values when > kprobe enables debug monitors to single-step instructions. > > Rather than using hardware single-step, append a BRK instruction after > the instruction to be executed out-of-line. > > Fixes: 36dadef23fcc ("kprobes: Init kprobes in early_initcall") > Suggested-by: Will Deacon > Signed-off-by: Jean-Philippe Brucker > --- > > An alternative to fix [1]. I haven't done uprobes yet since they don't > suffer the same problem, but could add it to the bottom of my list. > Lightly tested with kprobe smoke test and the BPF selftests. > Interestingly on Seattle when running the "overhead" BPF selftest, that > triggers a kprobe a bunch of times, I see a 20-30% improvement with this > patch. I'm guessing it's the cost of touching the debug sysregs? > > [1] https://lore.kernel.org/linux-arm-kernel/20201026172907.1468294-1-jean-philippe@linaro.org/ > --- > arch/arm64/include/asm/brk-imm.h | 2 + > arch/arm64/include/asm/debug-monitors.h | 1 + > arch/arm64/include/asm/kprobes.h | 2 +- > arch/arm64/kernel/probes/kprobes.c | 56 +++++++++---------------- > 4 files changed, 24 insertions(+), 37 deletions(-) Thanks! I'm about to send fixes for -rc2, but I'd like this to get a little bit of time in linux-next, so I aim to queue it next week for -rc3. Just wanted to make sure you don't think I'm ignored you. Cheers, Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel