Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp383324rwd; Tue, 16 May 2023 02:20:55 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4BAAgYZEgvluCt2I+Ft63gYpKcpd2rKUWiz67WuN1ybs+sGG/WjamDmHJBXFPv6VFb1HPB X-Received: by 2002:a05:6a20:7488:b0:106:47d1:63bc with SMTP id p8-20020a056a20748800b0010647d163bcmr6715502pzd.36.1684228854727; Tue, 16 May 2023 02:20:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684228854; cv=none; d=google.com; s=arc-20160816; b=TLTchJaHOV3W9ne12UL1K4u9BbNPZjXlo+7DYvMauabuLb6rdL0saxUOOaTlvJ+Jyl vnkvBFgNcwVr2dYm5u/YkMgKYwcHnU/VgOBVZDlRV3Jb6K7AFL6ZN0xEJG+OxVMWLgc0 cLSIWo4mAXRRqq51BdErV/ctUOV+eXjtBSt8xU6XWLYBPSsRuSHC+Oyflf5OaRVs6u60 iRWlt9Ajly2xSAncKJACuwB7JW3+w3yZXXO635Kc0gfGe7pOXtNJoa/z/x/wy61pKQR4 K/VJxPBvf5Eee/JMuF8N3qy7xvyiPRGWEP0uRsfjI74NImtMspTj1EqE0WcUcNbBwT7+ VcEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=OBCPnu+BGgk3Cuo/WyqzF95R9vjNP+oDEXn6EOL1COY=; b=Z+RrfOTzcngYPAotpqz4XWa2Mvhn+OxmCfEeRQftRXfv4epT6IxiirYB8ohggV7/Qr BjSJFYEh02XgvEC3wRMugeJbc7hH1qir6n9PooaxsYh8772N6a3GVPajnwZp7CNK9aN5 h98pVHaCeV/jd/r+a3KvXoAwo8gxB1OZkVTQ1UhdRb9lx3sl90o+f0hM71S/Jrdp0WhC 5MW4Pc0hwIdghnJc3iOggJBKKlbLNyqzWVEXuvQMP99ewTkdTityd2zlM17dHUAPvu8/ 9nldHyjKCSsRGmbkvdUiR6pbpj4G6vXr3icSkwuWy2g6bp4+eJl1vwEYLDn/b9Pk/Hij T/1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=lcr10CU5; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 190-20020a6301c7000000b0052c66d4c255si13640554pgb.576.2023.05.16.02.20.42; Tue, 16 May 2023 02:20:54 -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=@infradead.org header.s=casper.20170209 header.b=lcr10CU5; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231722AbjEPJRy (ORCPT + 99 others); Tue, 16 May 2023 05:17:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232084AbjEPJRh (ORCPT ); Tue, 16 May 2023 05:17:37 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10DD25596; Tue, 16 May 2023 02:17:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=OBCPnu+BGgk3Cuo/WyqzF95R9vjNP+oDEXn6EOL1COY=; b=lcr10CU58+Jlc6aMR4VdoWQDzU gfmE+pQ0R2xS9GUIF3mYGcJolDhMlwgK+pyi4K47xEFvl8zzXP2LsKocJQRnvsUqEaBGg8DIJFtYe tB8AfT8e3/r1pfkeX77oiVWDWfTzLeYwA8mkfMpgo9FqvsEkKFutAaTP4C0iQym+AtcgP+uiP6aA4 RrlILmh7I5FHd203lw31XCkm+ljoMJb8uZh0ccyaTu42TaOPqNV09hU7GImexwdwEn4r2OQVnMbpm paN7hUtaAtOMbUyOkTaWhz64qNT4rzhooZIdDBINYUJbVklaZKGe/IdQZYtFGp2HAMDJTwG/rwt65 lhhGPQyA==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pyqmf-00482M-RS; Tue, 16 May 2023 09:15:53 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 63E8630008D; Tue, 16 May 2023 11:15:49 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id E722C20118D79; Tue, 16 May 2023 11:15:48 +0200 (CEST) Date: Tue, 16 May 2023 11:15:48 +0200 From: Peter Zijlstra To: Ze Gao Cc: Steven Rostedt , Masami Hiramatsu , Albert Ou , Alexander Gordeev , Alexei Starovoitov , Borislav Petkov , Christian Borntraeger , Dave Hansen , Heiko Carstens , "H. Peter Anvin" , Ingo Molnar , Palmer Dabbelt , Paul Walmsley , Sven Schnelle , Thomas Gleixner , Vasily Gorbik , x86@kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, bpf@vger.kernel.org, Conor Dooley , Jiri Olsa , Yonghong Song , Ze Gao Subject: Re: [PATCH v2 2/4] fprobe: make fprobe_kprobe_handler recursion free Message-ID: <20230516091548.GA2587705@hirez.programming.kicks-ass.net> References: <20230516071830.8190-1-zegao@tencent.com> <20230516071830.8190-3-zegao@tencent.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230516071830.8190-3-zegao@tencent.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 On Tue, May 16, 2023 at 03:18:28PM +0800, Ze Gao wrote: > +static void fprobe_handler(unsigned long ip, unsigned long parent_ip, > + struct ftrace_ops *ops, struct ftrace_regs *fregs) > +{ > + struct fprobe *fp; > + int bit; > + > + fp = container_of(ops, struct fprobe, ops); > + if (fprobe_disabled(fp)) > + return; > + > + /* recursion detection has to go before any traceable function and > + * all functions before this point should be marked as notrace > + */ > + bit = ftrace_test_recursion_trylock(ip, parent_ip); > + if (bit < 0) { > + fp->nmissed++; > + return; > + } > + __fprobe_handler(ip, parent_ip, ops, fregs); > ftrace_test_recursion_unlock(bit); > + > } > NOKPROBE_SYMBOL(fprobe_handler); > > static void fprobe_kprobe_handler(unsigned long ip, unsigned long parent_ip, > struct ftrace_ops *ops, struct ftrace_regs *fregs) > { > - struct fprobe *fp = container_of(ops, struct fprobe, ops); > + struct fprobe *fp; > + int bit; > + > + fp = container_of(ops, struct fprobe, ops); > + if (fprobe_disabled(fp)) > + return; > + > + /* recursion detection has to go before any traceable function and > + * all functions called before this point should be marked as notrace > + */ > + bit = ftrace_test_recursion_trylock(ip, parent_ip); > + if (bit < 0) { > + fp->nmissed++; > + return; > + } Please don't use this comment style; multi line comments go like: /* * Multi line comment ... * ... is symmetric. */ Same for your next patch.