Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2002371rwb; Mon, 7 Nov 2022 08:06:02 -0800 (PST) X-Google-Smtp-Source: AMsMyM60LmcwFVTTp3Fs88uVY6oeEWBkyjkj+1V5+agt4xfmwTQv/0TapcBGMCFckak2yFp0U/h/ X-Received: by 2002:a05:6a00:3699:b0:56c:80f6:bee with SMTP id dw25-20020a056a00369900b0056c80f60beemr51939561pfb.13.1667837161911; Mon, 07 Nov 2022 08:06:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667837161; cv=none; d=google.com; s=arc-20160816; b=VTkGfWD4AzP2Byz1kEMeVzvdPdcDGcnTVAPHnjHqNHrNm3c8fKlmHirkjh3CueDr1Z AESYjRct54LrD2pmiyWpbx//zKnlpQ22B7MJUylC9JYEOpGvKvzTmZ41wa9hfXunVt1a GhEIRkEvP97RkOpBpTbIBpoenf0Yr1VP3ILwzOQDCDDAXf33tHEpEyE3ZZdg4bp2MaTn fknLM04p0Jrn/KWcociBXxcWdDx0MndSqAi/fwWeO3D7Ao6u71gWrjR77FzkWP8M01ew N4qWDXQja+RRGOe9rBKqorZXwZnUVZ6s4KVJ3Oa6PaS8tWViTItvQGBJ6rI9amaAt0M9 iP4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=3s936He+T506jgExZT60js4hp2m3uJW8su1YAPdgAC8=; b=ExlYB99Z9WpNhBXP6BeK69c+5cVFVmudebrGwcBRu3+hAxxajbw4+bk32R40vYp7fE V+68m82/1O6DzJLZUzF4nB6JZEewj5Ezd5UyvUatagovk36KSkcIwi0CNYpYoDbsfKpf WbGdMDlnGOUeeSgFpENjxj/PWExvE4FugvF0DEKpNXC8vRkUimLX52sDzynLgq7s5ze2 fnKYwONyQopg1d8I0KYRXYsJ9qJzstX3JXdGelfyNHOvP2B616LTavd8+Fj+TmJnrK8f vghYbRa19jeQ/pk149+HrrZGDzlZXtuMvz360R1S/6BC7gaQ3jsEMjodqPHLlXRBh4pZ Y6+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FWGGMUUe; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bd33-20020a056a0027a100b0054252c63d75si11178189pfb.98.2022.11.07.08.05.43; Mon, 07 Nov 2022 08:06:01 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FWGGMUUe; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232070AbiKGOtl (ORCPT + 93 others); Mon, 7 Nov 2022 09:49:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231355AbiKGOtk (ORCPT ); Mon, 7 Nov 2022 09:49:40 -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 843861BEB8; Mon, 7 Nov 2022 06:49:39 -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 155D561143; Mon, 7 Nov 2022 14:49:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9F677C433D6; Mon, 7 Nov 2022 14:49:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1667832578; bh=3WK9Jq/Qe/BgudIXrjjalPxMr2bjl68Gs+psLSmfhcc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=FWGGMUUeRPCsiDwZofNcQpiJuk6DroMw24HvO46ZQ5KbOwVn2En6Ex4K/E/3Ny3ZS Rmt1UCF4RMrQst0hl4lW2S89wcz1bOzLlOkLDbRTu4SqJ05E+qXrTndRkKW1CiHpyP mK6eRUMpIwGo5r73WpfyjC4+Vxo7NoC/yMr5bOUi0Gmg/d63Quw54+O3dLndMC4OUK ruFvx0YL33X4+GDxk0dpoOUaebskl1oCl+LhOjs6W2fQv9FQZe9VLD0tuWab3tE5O3 4zxX7XmeN3tVXT1JlgjRf+xaE4rVtWC3Sn35j+hsWnc6VjGBYbobr4jwQqHwfOaWT2 UKkOIZXwaGuZQ== Date: Mon, 7 Nov 2022 14:49:31 +0000 From: Will Deacon To: Jianlin Lv Cc: corbet@lwn.net, catalin.marinas@arm.com, rostedt@goodmis.org, mingo@redhat.com, naveen.n.rao@linux.ibm.com, anil.s.keshavamurthy@intel.com, davem@davemloft.net, mhiramat@kernel.org, arnd@arndb.de, zhengzengkai@huawei.com, jianlv@ebay.com, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, mark.rutland@arm.com Subject: Re: [PATCH] arm64/kprobes: Add support for KPROBES_ON_FTRACE Message-ID: <20221107144931.GA20793@willie-the-truck> References: <20220728020250.1699-1-iecedge@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220728020250.1699-1-iecedge@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 [+Mark R] On Thu, Jul 28, 2022 at 02:02:50AM +0000, Jianlin Lv wrote: > This is the arm64 version of ftrace-based kprobes to avoid the overhead > with regular kprobes, by using the ftrace infrastructure. > > Signed-off-by: Jianlin Lv > --- > .../debug/kprobes-on-ftrace/arch-support.txt | 2 +- > arch/arm64/Kconfig | 1 + > arch/arm64/kernel/probes/Makefile | 1 + > arch/arm64/kernel/probes/kprobes-ftrace.c | 81 +++++++++++++++++++ > include/linux/kprobes.h | 2 + > kernel/kprobes.c | 4 +- > 6 files changed, 88 insertions(+), 3 deletions(-) > create mode 100644 arch/arm64/kernel/probes/kprobes-ftrace.c Sorry for the slow reply on this, but I think this deserved to be split into two patches: the first one reworking the core check_ftrace_location() logic to work properly with branch-and-link style architectures, and the second one adding support for arm64. I'd also prefer that we don't just punt the whole of check_ftrace_location() to the arch code using weak symbols. I'd have thought it would be cleaner for architectures to specify the offset which needs to be applied to the PC instead. Having said that, how do architectures such as PowerPC and Risc-V handle this today without changing the core code? Will