Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp5986541pxb; Mon, 14 Feb 2022 12:25:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJwNNmRNEA+kSgxQi5Da+SpR+n2hQCO3NS7XsZm18ZqMLrLvoqPuSyF0EZjtuiPSETZFtZr4 X-Received: by 2002:a17:902:9b8f:: with SMTP id y15mr728045plp.61.1644870318820; Mon, 14 Feb 2022 12:25:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644870318; cv=none; d=google.com; s=arc-20160816; b=UocLe/U0L2cWv4dBe0R4Z9187CzNwldVZvV6xgJqjge4efLjvxL8ZuhwIZR6XiHuYR Xh1XAv9Kd47Nd/rukVT6NTd0LDOvJAKR8Yh2VwrJ87loUk3JBLaZUEA4INQ5SltHdKaL UrItiUMqFDL00Cj3EiSZuRYPhkzT1KWtARSLbNbpiQO5CC/Y8YzJGoX/R5QjskdL1tOi hQ9hbNI8S2wDxkbEnMWhykDHT1pbosF8+1GP/653Tm52cFzlNALrJcYrP0deQnAxuT4D xf47wpg/lHVZ2CZSIlV/xz6g2MO4DFOtXxeW68NaWkILNNA7vWkHwVwdJpaJ0ZMtL02f fJmg== 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=2ATdRhGIdt3IikCuBoJzIIS6QUQpdSLFv9+n8HIFUAA=; b=K5Qi80aGY9fl6/jkFhRBlPcX2glBB+ls1HtG5Kj59swyyCxx+T2F2ZZ7croLx3Ekrn M7X9jM4JeWzd5whDaCmBhHjJagvGVsgMFuFwv+eKXlJB5POyyQCuduM2lBZN+f88JN27 xUu/IRrBcnx8pvWcCLZWUGu3mbd+lseOt2RlkBFF5ndZ/zojynC+4wdAo42Qgum0UfGz V7ZnxwNd+15v7jpkOutynFFz/1YC75MNG06vDZ7Xq+z4JPBDjmonTDAAVDfn0jceULH/ ZsdC133VEaUslG/3dBtMezhuUKyUtV71ltp3dCm9+5ZtEOv+3hDVETg96zG3QWXu3U98 dXhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=fa5I1wVY; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id az23si12089946pjb.54.2022.02.14.12.25.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Feb 2022 12:25:18 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=fa5I1wVY; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 74E3D139818; Mon, 14 Feb 2022 11:57:54 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357050AbiBNRZb (ORCPT + 99 others); Mon, 14 Feb 2022 12:25:31 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:52000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357057AbiBNRZ0 (ORCPT ); Mon, 14 Feb 2022 12:25:26 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76A4A652F8; Mon, 14 Feb 2022 09:25:13 -0800 (PST) Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 21EGSjSN003835; Mon, 14 Feb 2022 17:24:35 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=2ATdRhGIdt3IikCuBoJzIIS6QUQpdSLFv9+n8HIFUAA=; b=fa5I1wVY2XE1eDlODAl+hPLSC1oAKu+Uze9HfmB2pHJuuwl/5A/EDUrXVA2sP9Mj9P7r 2s6OcWwkjI1+Gs7TbLjqY+cA7Sx3CFgSEHRycrKLbBQWcbAnCKG4L8yDWjms8m34emjo h4QWeeF+S6O7zfSd7a4eEsbYv9eMLoOtBPS5wcjgxd3oKsdrJJNrdY5PzUMYM3PzlqKm GVJVJO8bkdlL8ypNle/o+mSxri8Mjqss60khsdI6fKSr1nQdAZ5YoML/wDZ0yKFIRDD0 YYC4r+nNGGwftKR/jin82s/KlvE77TNuN+Z6dxn3ideewRUJt2EiXepnXlTvi1Ste6z7 HQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3e6rt1bw5b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 14 Feb 2022 17:24:35 +0000 Received: from m0098410.ppops.net (m0098410.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 21EFm37V023200; Mon, 14 Feb 2022 17:24:34 GMT Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0a-001b2d01.pphosted.com with ESMTP id 3e6rt1bw3n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 14 Feb 2022 17:24:34 +0000 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 21EHDxpS020374; Mon, 14 Feb 2022 17:24:28 GMT Received: from b06avi18626390.portsmouth.uk.ibm.com (b06avi18626390.portsmouth.uk.ibm.com [9.149.26.192]) by ppma06ams.nl.ibm.com with ESMTP id 3e645jfqyy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 14 Feb 2022 17:24:28 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 21EHE6N039846210 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 14 Feb 2022 17:14:06 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8DC2611C04A; Mon, 14 Feb 2022 17:24:25 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4FDD611C058; Mon, 14 Feb 2022 17:24:25 +0000 (GMT) Received: from localhost (unknown [9.43.124.167]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 14 Feb 2022 17:24:25 +0000 (GMT) Date: Mon, 14 Feb 2022 22:54:23 +0530 From: "Naveen N. Rao" Subject: Re: [PATCH v2 11/13] powerpc/ftrace: directly call of function graph tracer by ftrace caller To: Christophe Leroy , Jiri Kosina , Joe Lawrence , Josh Poimboeuf , Miroslav Benes , Ingo Molnar , Petr Mladek , Steven Rostedt Cc: "linux-kernel@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "live-patching@vger.kernel.org" References: <04d196585ff81bde06a000bd9c633a33a5b21130.1640017960.git.christophe.leroy@csgroup.eu> In-Reply-To: <04d196585ff81bde06a000bd9c633a33a5b21130.1640017960.git.christophe.leroy@csgroup.eu> MIME-Version: 1.0 User-Agent: astroid/4d6b06ad (https://github.com/astroidmail/astroid) Message-Id: <1644859156.qdgqumennn.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-GUID: bTui_nuOsmI9W12M2-4XlB8dlhf2liOJ X-Proofpoint-ORIG-GUID: gDpM-TUpELCV1vUCWRDB_CC3w726px2M 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-14_07,2022-02-14_03,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 impostorscore=0 suspectscore=0 priorityscore=1501 phishscore=0 clxscore=1015 mlxscore=0 lowpriorityscore=0 adultscore=0 spamscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2202140102 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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 Christophe Leroy wrote: > Modify function graph tracer to be handled directly by the standard > ftrace caller. >=20 > This is made possible as powerpc now supports > CONFIG_DYNAMIC_FTRACE_WITH_ARGS. >=20 > This change simplifies the call of function graph ftrace. >=20 > Signed-off-by: Christophe Leroy > --- > arch/powerpc/include/asm/ftrace.h | 6 ++ > arch/powerpc/kernel/trace/ftrace.c | 11 ++++ > arch/powerpc/kernel/trace/ftrace_32.S | 53 +-------------- > .../powerpc/kernel/trace/ftrace_64_mprofile.S | 64 +------------------ > 4 files changed, 20 insertions(+), 114 deletions(-) >=20 > diff --git a/arch/powerpc/include/asm/ftrace.h b/arch/powerpc/include/asm= /ftrace.h > index 45c3d6f11daa..70b457097098 100644 > --- a/arch/powerpc/include/asm/ftrace.h > +++ b/arch/powerpc/include/asm/ftrace.h > @@ -38,6 +38,12 @@ static __always_inline void ftrace_instruction_pointer= _set(struct ftrace_regs *f > { > regs_set_return_ip(&fregs->regs, ip); > } > + > +struct ftrace_ops; > + > +#define ftrace_graph_func ftrace_graph_func > +void ftrace_graph_func(unsigned long ip, unsigned long parent_ip, > + struct ftrace_ops *op, struct ftrace_regs *fregs); > #endif > #endif /* __ASSEMBLY__ */ > =20 > diff --git a/arch/powerpc/kernel/trace/ftrace.c b/arch/powerpc/kernel/tra= ce/ftrace.c > index ce673764cb69..74a176e394ef 100644 > --- a/arch/powerpc/kernel/trace/ftrace.c > +++ b/arch/powerpc/kernel/trace/ftrace.c > @@ -917,6 +917,9 @@ static int ftrace_modify_ftrace_graph_caller(bool ena= ble) > unsigned long stub =3D (unsigned long)(&ftrace_graph_stub); > ppc_inst_t old, new; > =20 > + if (IS_ENABLED(CONFIG_DYNAMIC_FTRACE_WITH_ARGS)) > + return 0; > + > old =3D ftrace_call_replace(ip, enable ? stub : addr, 0); > new =3D ftrace_call_replace(ip, enable ? addr : stub, 0); > =20 > @@ -955,6 +958,14 @@ unsigned long prepare_ftrace_return(unsigned long pa= rent, unsigned long ip, > out: > return parent; > } For x86, commit 0c0593b45c9b4e ("x86/ftrace: Make function graph use=20 ftrace directly") also adds recursion check before the call to=20 function_graph_enter() in prepare_ftrace_return(). Do we need that on powerpc as well? - Naveen