Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp429952rwd; Tue, 16 May 2023 03:08:24 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4yWDeICPddWcGvK7F+cGXpapiCMLVxcc/l6DojlC1Y++TEeO2U0m7CpcXYC3Z5BpDqC1bh X-Received: by 2002:a17:90a:d181:b0:252:caf2:c455 with SMTP id fu1-20020a17090ad18100b00252caf2c455mr11560660pjb.7.1684231703807; Tue, 16 May 2023 03:08:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684231703; cv=none; d=google.com; s=arc-20160816; b=tDdBgq0DGQQSeXIXJggao7J0BU47jdDOh4yFX3Yq0qDl3a+wgF0T7OxmUWw5tBpgix VMKAU7JguC/AsWzFM+I12Cy11LbrQo4NGDOvkLizZcTniF4+DJbpYvgo+FNJelKuATWm vqDkaGLN6bUsV5xzl6Ie9P90+LpcAm9flPajhziQxdO/IUUMvCyB5Z+MANXMDRZW7L/J grsdTeXBPMUmjD/5QlTHr1Ila+dlviyMt8L62mEAHUZajVwB6Ir0RVyi4htFIwAsj+89 jpZR5iRA0Pys/6j5P/2/tHbu028+S/clMQ+uNP+pNbob7DbAZRG7DRO7R8eM4mQYvTEP 5x7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=MOYuwaGvQzB6W1rRJXfWsnaF3BnBS5m8MDev8mfwpl4=; b=CjLhDyeJf64DwHfqLYBUcLYN2rfbiHjuFbbcjLYOjIasC7fICWVJ/30gxw0c2tmhwt WsnEdcDolPC1crLhKVlBRyu/UFtWMPtOMg5kIqPMLEUehyVNYFJCP/y9o9RJ/bcEnKBX cJTYJtXSW8uZd45TKG9fibA1sU+TyvYJvE7eLpXhvf+Ptj5gDbZUujf64OkeWX3rnrQy 73kIjMyUuaFY/HCxYLCitoYMOa8AgVYhzLbBF6ajwSmAZa1OI14fM6Mb680dLpXuK0M2 yxQ2d9VgdCz9lorb7lEFP99wtnsnZwaT99l+Bp6FafqTxCzL88kygB/3aJrhTMuLYPqL b/nA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=ZaH64Fzp; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b23-20020a637157000000b0050beec93e77si18000468pgn.609.2023.05.16.03.08.11; Tue, 16 May 2023 03:08:23 -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=@gmail.com header.s=20221208 header.b=ZaH64Fzp; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232034AbjEPJgH (ORCPT + 99 others); Tue, 16 May 2023 05:36:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231947AbjEPJgE (ORCPT ); Tue, 16 May 2023 05:36:04 -0400 Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C6B3E52; Tue, 16 May 2023 02:36:03 -0700 (PDT) Received: by mail-ed1-x52a.google.com with SMTP id 4fb4d7f45d1cf-50be17a1eceso25581094a12.2; Tue, 16 May 2023 02:36:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684229762; x=1686821762; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=MOYuwaGvQzB6W1rRJXfWsnaF3BnBS5m8MDev8mfwpl4=; b=ZaH64FzpUsamyNTy1bzxrK/9Vm1lyGjs2o2RRvLTujZ6vLXLHQIBdR3aev7k/gnamy hGo0+GakQd+1bNYbAo9jCS6xl8Rf68Ba1ZdpN5oXZT8Y6SyXg8Uo/Ez+Cggb6kageRT1 tcVMBuulkSRTW1PcKMR1q4EFNILYNPfAyeiMW2rgTj2WkRqLghUiPm+jdUPniKA8LbHQ qTxqOSsVftohC24wAtnZ3ZZ+1GfWs3XyPm2y+VkSZN2h5TVrP5diR5+fa28FetVHL14n 4em+bxnRBM9A6yYq1vj0MZ++tJcS0LwiBx2CZhqG6KTyj1i6fOxoSAd/Lg8r+Eh8PZA+ s2kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684229762; x=1686821762; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MOYuwaGvQzB6W1rRJXfWsnaF3BnBS5m8MDev8mfwpl4=; b=MYsE4wqgoXSuq1q9+BbRDsnTSYIT86q3+PwQcHLIJkbax5t9HMXfFFO8UWYINe/v7q CBxjYimy+G5yUo6jIImx70ZdPtzC+y4Xm264P9Y7k8TXJ5daN0b0Y4TgssDklrOsGIBw stzuRvsYp6Aqz/i0Yfzox7nNuQv8WiPgfgTZAlJ6vR6Yp3/OYRr5nfRldWxdX/Vx3bA0 ss4hG10FPdUAgelPlokx2WjllIOItzgBscKEge7IflOg35k9Gu2eR8XRnrNRp9K2JHnk 8W5oKmT2Ycj8Bw3WM7cASv4BepOfCgMxIWeUsU33MOa/2lzYXp1cOz28oMs+b5w/yG5R wYUA== X-Gm-Message-State: AC+VfDzzYs3kPkflx/SZYKUiw1gA2dDI0wqUVgArbZujqxJgPsl6+hxW 218NZVIaAdtd+VvcPdbLk4d2oxRmHLh4Nl4duuU= X-Received: by 2002:aa7:db90:0:b0:50d:9a30:f305 with SMTP id u16-20020aa7db90000000b0050d9a30f305mr21453968edt.24.1684229761619; Tue, 16 May 2023 02:36:01 -0700 (PDT) MIME-Version: 1.0 References: <20230516071830.8190-1-zegao@tencent.com> <20230516071830.8190-3-zegao@tencent.com> <20230516091548.GA2587705@hirez.programming.kicks-ass.net> In-Reply-To: <20230516091548.GA2587705@hirez.programming.kicks-ass.net> From: Ze Gao Date: Tue, 16 May 2023 17:35:50 +0800 Message-ID: Subject: Re: [PATCH v2 2/4] fprobe: make fprobe_kprobe_handler recursion free To: Peter Zijlstra 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,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 Thanks for pointing this out, I'll get it all fixed ASAP. Regards, Ze On Tue, May 16, 2023 at 5:16=E2=80=AFPM Peter Zijlstra wrote: > > 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 =3D container_of(ops, struct fprobe, ops); > > + if (fprobe_disabled(fp)) > > + return; > > + > > + /* recursion detection has to go before any traceable function an= d > > + * all functions before this point should be marked as notrace > > + */ > > + bit =3D 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 pare= nt_ip, > > struct ftrace_ops *ops, struct ftrace_r= egs *fregs) > > { > > - struct fprobe *fp =3D container_of(ops, struct fprobe, ops); > > + struct fprobe *fp; > > + int bit; > > + > > + fp =3D container_of(ops, struct fprobe, ops); > > + if (fprobe_disabled(fp)) > > + return; > > + > > + /* recursion detection has to go before any traceable function an= d > > + * all functions called before this point should be marked as not= race > > + */ > > + bit =3D 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.