Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp2301268rwn; Fri, 9 Sep 2022 11:23:38 -0700 (PDT) X-Google-Smtp-Source: AA6agR6b72X3ywRQa7DoydZ+Ni1jcS1vS1FKWXLnoopCxq2Ib5uZ/aVNtaPS9qrTwNxCWtIXsma2 X-Received: by 2002:a17:90b:384b:b0:200:71b8:ae00 with SMTP id nl11-20020a17090b384b00b0020071b8ae00mr10791748pjb.125.1662747817958; Fri, 09 Sep 2022 11:23:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662747817; cv=none; d=google.com; s=arc-20160816; b=Aq8cO/XkvOJ2vUzYKp38O9NDodb+3fnxMw7iJagvnDhsRiHYNJXkqGB1H6ks1Emuzi uTYv1aQd9PbPLUjX0+FWUUHJwxnfDbeyRJ3xfaAamUmcRAwC1kKo9LXkp+yMQL86dmDR ZhmsISlbD3Dij6G0QeX5zTBN3i34tbtFh1XGMlF0jWvgPKaN13sPNRaLKjRqHl0TCPWy ihXOGeTDta/44iO391qYpOSt54c7p4HDPCz1MEvuhxn5qItYIYioDKwDL3+boGYtpa+a UtSr6TwLZgIYvuuq46W3QQDo2U4DjG6YT63mdgOsU00wSGHFwpcdAusmUArIAy2h4D2t aGGg== 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=TMGAj35IXe4Zm5sRpl1s3sEA34Iz+ttSZdHEflkb6FM=; b=Y6lsZJ0sP2rfi6IKLybdKDTxR4slDz7yGVh+qinYVrmfQkf/jozOfAes9QUQ+C5hoj fwiOKSfpsQ2UARyoUFQqyn4bJWU8bFCi/+17Irwcp/lAM0jybFL8tXSqHnpi1WUl6xCA bSEfGDaTHhg4HtUae3TUfpWhvATt8bb9P7GHAFIlb4V4NjUvhLogmWyP3W8COy7sC9Ex EwPhDMUEQ4Z3AVV8fj7ihnKkVfMMMtyH5P1Y2OWmO3rcPp3GhkEGh6Yb5abbYBLsy9pA /VAGfmVMO7AALG7OPk/cYGV5QTbnNO5kZvrgymbcmR+g853B1TJ0a0uvG4yx/lafg42D 3bTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b="m/nYtKLk"; 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 e5-20020a17090301c500b001749dafb822si1192635plh.507.2022.09.09.11.23.25; Fri, 09 Sep 2022 11:23:37 -0700 (PDT) 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="m/nYtKLk"; 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 S232014AbiIISOI (ORCPT + 99 others); Fri, 9 Sep 2022 14:14:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231903AbiIISOE (ORCPT ); Fri, 9 Sep 2022 14:14:04 -0400 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E403E3D50; Fri, 9 Sep 2022 11:14:03 -0700 (PDT) Received: from pps.filterd (m0127361.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 289HhM0W037006; Fri, 9 Sep 2022 18:13:47 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=TMGAj35IXe4Zm5sRpl1s3sEA34Iz+ttSZdHEflkb6FM=; b=m/nYtKLkPisCSi8h5i8EcG6koFE+HFt/w1wnzXJMArORHZByzBZ3l6IMnwRZfiQYcHAE /3WOa/hs5a7GjL7kizhFXmgfXVFsmFmHac/5mpRVFTFH+nEO79gufKipQOtIyDRutBJx Zw0I1BF4Pq1pKbuo0pqVK7UHhDKh7joWgGn8uHlgIUQasgI0GVL5vNQN5tZuz2CHg39Y BXKC6YicZMDZoaJSZP9Ibxt6aIR5nSRoZziJMUpF7KyyH9f7in7v3TsIYVnJQC/azzkP cr8OhVjDnfhbRI3tJI9ZVYE9Zon0P02TqCcwUababMzBlM06wqunb4vD7iAaCs+yvQOo gw== Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3jga4kruj5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 09 Sep 2022 18:13:46 +0000 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 289I5Pas013244; Fri, 9 Sep 2022 18:13:44 GMT Received: from b06avi18626390.portsmouth.uk.ibm.com (b06avi18626390.portsmouth.uk.ibm.com [9.149.26.192]) by ppma03fra.de.ibm.com with ESMTP id 3jbxj8x5q0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 09 Sep 2022 18:13:44 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 289IA7JL33620472 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 9 Sep 2022 18:10:07 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 681FF5204F; Fri, 9 Sep 2022 18:13:42 +0000 (GMT) Received: from localhost (unknown [9.43.41.127]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id A941E5204E; Fri, 9 Sep 2022 18:13:41 +0000 (GMT) Date: Fri, 09 Sep 2022 23:43:39 +0530 From: "Naveen N. Rao" Subject: Re: [PATCH v5 bpf-next 2/4] ftrace: Allow IPMODIFY and DIRECT ops on the same function To: Song Liu Cc: Kernel Team , bpf , "daniel@iogearbox.net" , "jolsa@kernel.org" , "linux-kernel@vger.kernel.org" , "live-patching@vger.kernel.org" , "rostedt@goodmis.org" , Song Liu References: <20220720002126.803253-1-song@kernel.org> <20220720002126.803253-3-song@kernel.org> <1662724350.8os86rhyxk.naveen@linux.ibm.com> In-Reply-To: MIME-Version: 1.0 User-Agent: astroid/4d6b06ad (https://github.com/astroidmail/astroid) Message-Id: <1662747146.nqpswjliso.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: QKcrZsRK9tV5Qztkv9R6r6KOhg2rw0Nt X-Proofpoint-ORIG-GUID: QKcrZsRK9tV5Qztkv9R6r6KOhg2rw0Nt X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-09_08,2022-09-09_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 clxscore=1015 malwarescore=0 suspectscore=0 spamscore=0 priorityscore=1501 adultscore=0 mlxscore=0 mlxlogscore=999 phishscore=0 bulkscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2207270000 definitions=main-2209090064 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, 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 Hi Song, Song Liu wrote: >=20 >=20 >> On Sep 9, 2022, at 4:58 AM, Naveen N. Rao w= rote: >>=20 >> Song Liu wrote: >=20 > [...] >=20 >>> + >>> /** >>> * register_ftrace_function - register a function for profiling >>> * @ops: ops structure that holds the function for profiling. >>> @@ -8018,14 +8206,15 @@ int register_ftrace_function(struct ftrace_ops = *ops) >>> { >>> int ret; >>> - ftrace_ops_init(ops); >>> - >>> - mutex_lock(&ftrace_lock); >>> - >>> - ret =3D ftrace_startup(ops, 0); >>> + lock_direct_mutex(); >>=20 >> Trying to enable ftrace direct on powerpc, this is resulting in a hung t= ask when testing samples/ftrace/ftrace-direct-modify.c >>=20 >> Essentially, the sample calls modify_ftrace_direct(), which grabs direct= _mutex before calling ftrace_modify_direct_caller()->register_ftrace_functi= on(). >>=20 >=20 > Thanks for the report. Would the following change fix the issue? >=20 > Song >=20 > diff --git i/kernel/trace/ftrace.c w/kernel/trace/ftrace.c > index bc921a3f7ea8..2f1e6cfa834e 100644 > --- i/kernel/trace/ftrace.c > +++ w/kernel/trace/ftrace.c > @@ -5496,7 +5496,7 @@ int __weak ftrace_modify_direct_caller(struct ftrac= e_func_entry *entry, > if (ret) > goto out_lock; >=20 > - ret =3D register_ftrace_function(&stub_ops); > + ret =3D register_ftrace_function_nolock(&stub_ops); > if (ret) { > ftrace_set_filter_ip(&stub_ops, ip, 1, 0); > goto out_lock; >=20 That fixes it for me. Reported-and-Tested-by: Naveen N. Rao Thanks! - Naveen