Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp5230969iob; Mon, 9 May 2022 11:29:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzivtOtzfwFNIs0wBY2LGqFG+11isMJFc2oT83c1KVDL+Sc2svwNu1HXxR5Ujl/vzbQ5j/n X-Received: by 2002:a05:6808:3098:b0:326:7275:73ec with SMTP id bl24-20020a056808309800b00326727573ecmr8057429oib.54.1652120954506; Mon, 09 May 2022 11:29:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652120954; cv=none; d=google.com; s=arc-20160816; b=T+h4dcTUNTo/8MdXlQ3NM83GVgVJr+G3a65T8O798l/1DVneoJrnNodJPl9TTG7xer cK18ZtDPc+6Vy81NlrfG34GJN6/NLPEEwIkUrXKJmLd/OwmiTorLsmbkawHUUIGtcoF6 X0ywnydmIAm1harRJojlJtDB86UxhOUHiwgL4eSLcehW5LL2UtDZFdA01Fs+NGzjwC+B 9emeWQK9T5uBgpcVE6s564I3vtqoBeXD+1cBaOv2/yhDsuiC2PxGFMzNcCjXfEVfMOku xaBNabVtzRQNynQ02xz2ivDPm8bHF8RDRzZHyVkD/bjfmxyjVIlTF67EMZeldCtnYlBU YNlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=mk60g806r7wbwboMu4KXTwmFYnLtdLf8CUwpBHG/Xuk=; b=Fi2mWJOFQwl1YaCbnAnhPTHwvf4tfahpec2p0IbVEBHPHZkEA6M+Z3ix1Ebr/MnP83 63Z9Q5ccd259F1z3dOw5XH99XHmuKMOkFPBeLS8CKFVapMhpqUuZl/GPbT2Z/34IHybD yTHNR3FR4bO4bvIly7ZwtzsBxoVtaCGwAd2t9trYYzUqU2SpM6qYrQ1qLhrWo+VwxzA2 RL61/pPtVBFXXggMoi/8AuVHjcs4Ww9my5eR0CH9v4LqwUQPJdJAC7dMbVH967h2Rrpy DGtIAq0Ix0PNoCX3RbFrT/xpIK6jIDr9C/Qq9eZwhvhX2xjGaXEEcuhn77J9DRwYyxDb d3oA== 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:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id li24-20020a056871421800b000ed9a93a174si9515525oab.138.2022.05.09.11.29.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 11:29:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1015874DE6; Mon, 9 May 2022 11:22:51 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240121AbiEIS0U (ORCPT + 99 others); Mon, 9 May 2022 14:26:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240214AbiEIS0F (ORCPT ); Mon, 9 May 2022 14:26:05 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62D2250E32 for ; Mon, 9 May 2022 11:22:09 -0700 (PDT) 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 ams.source.kernel.org (Postfix) with ESMTPS id 247D3B818E4 for ; Mon, 9 May 2022 18:22:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 92DCBC385B2; Mon, 9 May 2022 18:22:05 +0000 (UTC) Date: Mon, 9 May 2022 14:22:03 -0400 From: Steven Rostedt To: Masami Hiramatsu Cc: Mark Rutland , Wang ShaoBo , cj.chengjian@huawei.com, huawei.libin@huawei.com, xiexiuqi@huawei.com, liwei391@huawei.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com, will@kernel.org, zengshun.wu@outlook.com Subject: Re: [RFC PATCH -next v2 3/4] arm64/ftrace: support dynamically allocated trampolines Message-ID: <20220509142203.6c4f2913@gandalf.local.home> In-Reply-To: <20220505121538.04773ac98e2a8ba17f675d39@kernel.org> References: <20220421100639.03c0d123@gandalf.local.home> <20220421114201.21228eeb@gandalf.local.home> <20220421130648.56b21951@gandalf.local.home> <20220422114541.34d71ad9@gandalf.local.home> <20220426174749.b5372c5769af7bf901649a05@kernel.org> <20220505121538.04773ac98e2a8ba17f675d39@kernel.org> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Thu, 5 May 2022 12:15:38 +0900 Masami Hiramatsu wrote: > OK. But my interest is that the ftrace on arm64 can provide a limited > access to registers via pt_regs or not. I don't mind the contained values > so much because in the most case, 'users' will (most likely) access to the > ARGs via BPF or tracefs (and we can just warn users if they try to access > the registers which is not saved.) But if the arm64 ftrace only provides > a special data structure, arch-independent code must have 2 different access > code. That is inefficient. That is my concern. > IOW, I'm interested in interface abstraction. Note, ftrace now has a ftrace_regs structure that is passed to the callbacks for the function tracer. It then has an arch dependent helper function ftrace_get_regs(fregs), that returns a pt_regs from the fregs only if the fregs has a full pt_regs to return. If not, it returns NULL. This was suggested by both Peter Zijlstra and Thomas Gleixner when I introduced FTRACE_WITH_ARGS, where all functions can now get the arguments from fregs, but not the full pt_regs. If a ftrace_ops has the REGS flag set (using ftrace_regs_caller), the ftrace_get_regs(fregs) will return the pt_regs, or it will return NULL if ftrace_regs_caller was not used. This way the same parameter can provide full pt_regs or a subset, and have an generic interface to tell the difference. -- Steve