Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp202790pxb; Tue, 15 Feb 2022 11:22:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJwlzdk8iihk0+IlXNaJAzuCQ/mY0cafEZYrD10twk1w4UjS1XEfjzGDYOqhYp2YlVAHyLDo X-Received: by 2002:a05:6402:22b7:: with SMTP id cx23mr436515edb.91.1644952958520; Tue, 15 Feb 2022 11:22:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644952958; cv=none; d=google.com; s=arc-20160816; b=oDZ7qgV3iCBUHbNVsST4FQX82Hw7ilWyA1ZpTFe40gSttwggZLgeQmgyhZeC97wCVA AL4Y+cditEnjZ5wLdAvxhiAZCLgbDzbWW2+3xpbJZUD8JMEGRfnpVkx0kSA26NC3MNwZ ty6c226yMPR86ktfaHaQ2++l11WR/QxPeVoAbtNH6fqxYTIwyL0waQFhc8Dv+dTwMRAi 2oP7+w9pI221LwWxMY3x62mem524I6aYWepu7fEKDHSIDEL8iAhr8yge1DJeWb7381l/ 5dnpA7yP8ND9wzq9IU578/XTu2a1j7jMdJKNflOmngrlcCOOixSD4od/w4Q4UYYpRyBX qU6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:message-id:user-agent :mime-version:in-reply-to:references:cc:to:subject:from:date :dkim-signature; bh=yuJ33/IS3C8JmgqYKYRI7WGKiRlXun9JPd2/bJ+93WA=; b=HqWdMjbJxdEGnMzwTPKmmNkggYAo8PBnjQIN/DkBspNU0d3OCu5BJBjgXbGH0zgozv PfwVxyrulDGkoAp4ZtxGaipM1+InnGVyn1IxJhp6EAS40QXQKaTagvW8zzaLEPK/5/H4 Dtu+CiTE0HqzYPWHzmH3uqV9HGOTym8QlShf+cd/X50gLJaO3uuqRTvwFwrxNgGfWWO4 CxhWaZSvNgSyBip57sqA5AsURXoFdxmD8sQ6M30qRrodSLvWQXtfXjEqAY69JUKRZtHP YOwT3tgErhrkh/4qkDTu0D41/6z1LqLupjpTEJvRqtdNf0MbUROi031wEu+Ae9oe/MW2 rx+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=sOclZRJg; 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=ibm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f20si569926edf.175.2022.02.15.11.22.15; Tue, 15 Feb 2022 11:22:38 -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=@ibm.com header.s=pp1 header.b=sOclZRJg; 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=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241115AbiBOQ1r (ORCPT + 99 others); Tue, 15 Feb 2022 11:27:47 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:35876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241558AbiBOQ1n (ORCPT ); Tue, 15 Feb 2022 11:27:43 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6CE1A6C920; Tue, 15 Feb 2022 08:27:30 -0800 (PST) Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 21FGDE1F001119; Tue, 15 Feb 2022 16:27:07 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=date : from : subject : to : cc : references : in-reply-to : mime-version : message-id : content-type : content-transfer-encoding; s=pp1; bh=yuJ33/IS3C8JmgqYKYRI7WGKiRlXun9JPd2/bJ+93WA=; b=sOclZRJgd7NDzOsSb2uU840Kwry0jw4kCuTeWrNB5Rja9fkxfT64FGzeYCwe0RhJ5AKS ySmme8nLWrCxoVaavRnmZAvyrkH8BIIZ6QPr1vpF2KN3t2zKCJSCI0Gv5pJI5AqlzSvK boUuO9Ep8Od6htYVlFtEPAyi8Na79tE1k3svbEFDZHhtDlp+u11ovagr5coTOOOlnZkf HUDthA4wkeZ81x3TRFhzVEs4yjLhgJF0QgDkkfD8e4z7cDUYVNenb4dEidard4jMOURK hBEEmRQqhJ70xhwsRbPSQ/f5cbVAL1H+0Ji493n4Rk2io31tvRP3NnOjyGJB2LhFMOGf xw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3e8d9fvjff-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 15 Feb 2022 16:27:07 +0000 Received: from m0098396.ppops.net (m0098396.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 21FGDTLm009902; Tue, 15 Feb 2022 16:27:06 GMT Received: from ppma05fra.de.ibm.com (6c.4a.5195.ip4.static.sl-reverse.com [149.81.74.108]) by mx0a-001b2d01.pphosted.com with ESMTP id 3e8d9fvje5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 15 Feb 2022 16:27:06 +0000 Received: from pps.filterd (ppma05fra.de.ibm.com [127.0.0.1]) by ppma05fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 21FGC1EO007679; Tue, 15 Feb 2022 16:27:03 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma05fra.de.ibm.com with ESMTP id 3e64h9qrkj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 15 Feb 2022 16:27:03 +0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 21FGR1Tv24510740 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 15 Feb 2022 16:27:01 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 61D3EAE045; Tue, 15 Feb 2022 16:27:01 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EB164AE053; Tue, 15 Feb 2022 16:27:00 +0000 (GMT) Received: from localhost (unknown [9.43.98.51]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 15 Feb 2022 16:27:00 +0000 (GMT) Date: Tue, 15 Feb 2022 21:56:59 +0530 From: "Naveen N. Rao" Subject: Re: [PATCH v2 09/13] powerpc/ftrace: Implement CONFIG_DYNAMIC_FTRACE_WITH_ARGS To: Steven Rostedt Cc: Christophe Leroy , Jiri Kosina , Joe Lawrence , Josh Poimboeuf , "linux-kernel@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "live-patching@vger.kernel.org" , Miroslav Benes , Masami Hiramatsu , Ingo Molnar , Michael Ellerman , Petr Mladek References: <5831f711a778fcd6eb51eb5898f1faae4378b35b.1640017960.git.christophe.leroy@csgroup.eu> <1644852011.qg7ud9elo2.naveen@linux.ibm.com> <1b28f52a-f8b7-6b5c-e726-feac4123517d@csgroup.eu> <875ypgo0f3.fsf@mpe.ellerman.id.au> <1644930705.g64na2kgvd.naveen@linux.ibm.com> <20220215093849.556d5444@gandalf.local.home> In-Reply-To: <20220215093849.556d5444@gandalf.local.home> MIME-Version: 1.0 User-Agent: astroid/4d6b06ad (https://github.com/astroidmail/astroid) Message-Id: <1644942378.byz0qymic3.naveen@linux.ibm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: jrSZjNs8gbiYltKWnkGMOceFtwUtrkOd X-Proofpoint-GUID: BBeV6KJeqsMu-XQ3oul3qIPY_5o_K6oZ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-02-15_04,2022-02-14_04,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 spamscore=0 phishscore=0 bulkscore=0 priorityscore=1501 mlxscore=0 lowpriorityscore=0 suspectscore=0 adultscore=0 impostorscore=0 clxscore=1011 mlxlogscore=782 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2202150095 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 Steven Rostedt wrote: > On Tue, 15 Feb 2022 19:06:48 +0530 > "Naveen N. Rao" wrote: >=20 >> As I understand it, the reason ftrace_get_regs() was introduced was to=20 >> be able to only return the pt_regs, if _all_ registers were saved into=20 >> it, which we don't do when coming in through ftrace_caller(). See the=20 >> x86 implementation (commit 02a474ca266a47 ("ftrace/x86: Allow for=20 >> arguments to be passed in to ftrace_regs by default"), which returns=20 >> pt_regs conditionally. >=20 > I can give you the history of ftrace_caller and ftrace_regs_caller. >=20 > ftrace_caller saved just enough as was denoted for gcc mcount trampolines= . > The new fentry which happens at the start of the function, whereas mcount > happens after the stack frame is set up, may change the rules on some > architectures. >=20 > As for ftrace_regs_caller, that was created for kprobes. As the majority = of > kprobes were added at the start of the function, it made sense to hook in= to > ftrace as the ftrace trampoline call is much faster than taking a > breakpoint interrupt. But to keep compatibility with breakpoint > interrupts, we needed to fill in all the registers, and make it act just > like a breakpoint interrupt. >=20 > I've been wanting to record function parameters, and because the ftrace > trampoline must at a minimum save the function parameters before calling > the ftrace callbacks, all the information for those parameters were being > saved but were never exposed to the ftrace callbacks. I created the the > DYNAMIC_FTRACE_WITH_ARGS to expose them. I first just used pt_regs with > just the parameters filled in, but that was criticized as it could be > confusing where the non filled in pt_regs might be used and thinking they > are legitimate. So I created ftrace_regs that would give you just the > function arguments (if DYNAMIC_FTRACE_WITH_ARGS is defined), or it will > give you a full pt_regs, if the caller came from the ftrace_regs_caller. = If > not, it will give you a NULL pointer. >=20 > The first user to use the args was live kernel patching, as they only nee= d > that and the return pointer. Thanks, that helps. - Naveen