Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp550652imw; Thu, 14 Jul 2022 06:32:40 -0700 (PDT) X-Google-Smtp-Source: AGRyM1ty8hPDbtYFenY8bF08CG3IFIiQuK+qzmaRbCBTJswBfmZ3WHHANooNOTvsO57wym1na959 X-Received: by 2002:a05:6402:5202:b0:43a:a238:61c with SMTP id s2-20020a056402520200b0043aa238061cmr12472941edd.186.1657805559920; Thu, 14 Jul 2022 06:32:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657805559; cv=none; d=google.com; s=arc-20160816; b=ORRSxnQsV5UbTv9pQFGZLeGi2N0/H5L2yj6TbdE3ETgJKDNdvmPHGNzLQjs9Lr+1Uv kMhWtRMVHovzaoqY9ArppUoom+USineSf0lUjKI6IUHVtDPHKZhUi0lyQOCx7RrQQ8WA jizNYtrmdqFrsaq3aUpbrzgVkJO0HabFjkkPIxOJkc4JcQ8gfyf/cpzGsaP9QkbZyBJQ 35ia0ngnPxPC44s83D81sTcFlsO9JnVh0BehpuKUzbvfbYZFhzVQ+Cxli07RqSG2mX3b 5W1p1q6Oewp7o6I7IlpeEGRro/z+pyRRaYJaiT74SeUaF6BPrQtXUuFBgiKglRbmUBzR hyeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=SPDKtty+dCL2So9fYOOspQ5+09VbU/+qbOE61iyM9YA=; b=HK8cFq9kEthVPcCV1Vi/EzZnG5vi2236/sApkwOOwOvKvlPcBpiPHFgl7XcB3/n/XN 4vt8TiiodxX4jlDbIhD89KeOW+zefUzxy7zpjtL4cz33p1H7XYnV9nRJrvx4e8F47YU2 bnhWxwepHMW8mU2R4RH/YEC2D4FGqYMeRYVJg9IkG2Z9oRzZykf+ti65XynvYOOHGetu u7zI2Nm3Cg6hr/FDAf46gtqZ3WxXj7145i+HSzhoUthkjlWenfmlmtzWXgUV3bEbB+JV Vp6y/78g+oxfPr7lGsC0kEyITuk0NiwC2pdKl/7o9ThE7LvZ3ETHmsiREv+FInW2JcrI 21mg== ARC-Authentication-Results: i=1; mx.google.com; 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 w12-20020a05640234cc00b00435847d45c0si2542854edc.575.2022.07.14.06.32.14; Thu, 14 Jul 2022 06:32:39 -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; 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 S239817AbiGNNXJ (ORCPT + 99 others); Thu, 14 Jul 2022 09:23:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239760AbiGNNWs (ORCPT ); Thu, 14 Jul 2022 09:22:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0840C61D5E; Thu, 14 Jul 2022 06:22:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 30D8362063; Thu, 14 Jul 2022 13:22:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74BF2C34114; Thu, 14 Jul 2022 13:22:17 +0000 (UTC) Date: Thu, 14 Jul 2022 09:22:15 -0400 From: Steven Rostedt To: Song Liu Cc: Song Liu , "netdev@vger.kernel.org" , "bpf@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "ast@kernel.org" , "daniel@iogearbox.net" , "andrii@kernel.org" , Kernel Team , "jolsa@kernel.org" , "mhiramat@kernel.org" Subject: Re: [PATCH v2 bpf-next 1/5] ftrace: allow customized flags for ftrace_direct_multi ftrace_ops Message-ID: <20220714092215.149d4823@gandalf.local.home> In-Reply-To: References: <20220602193706.2607681-1-song@kernel.org> <20220602193706.2607681-2-song@kernel.org> <20220713191846.18b05b43@gandalf.local.home> <0029EF24-6508-4011-B365-3E2175F9FEAB@fb.com> <20220713203841.76d66245@rorschach.local.home> <20220713225511.70d03fc6@gandalf.local.home> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,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 On Thu, 14 Jul 2022 04:37:43 +0000 Song Liu wrote: > > > >> > >> non-direct ops without IPMODIFY can already share with IPMODIFY ops. > > > > It can? ftrace sets IPMODIFY for all DIRECT callers to prevent that. Except > > for this patch that removes that restriction (which I believe is broken). > > I mean "non-direct" ftrace ops, not direct ftrace ops. Ah, sorry misunderstood that. > > Let me start from the beginning. > > I got your point now. We replace the flag on direct trampoline with a > callback check. So yes, this works. I'm glad we are on the same page :-) > > 9. ftrace sees the lkp IPMODIFY ops has SHARED_IPMODIFY on it, and knows > > that there's a direct call here too. It removes the IPMODIFY ops, and > > then calls the direct ops->ops_func(STOP_SHARE_WITH_IPMODIFY) to let the > > direct code know that it is no longer sharing with an IPMODIFY such that > > it can change to call the function directly and not use the stack. > > I wonder whether we still need this flag. Alternatively, we can always > find direct calls on the function and calls ops_func(STOP_SHARE_WITH_IPMODIFY). Actually we don't need the new flag and we don't need to always search. When a direct is attached to the function then the rec->flags will have FTRACE_FL_DIRECT attached to it. Then if an IPMODIFY is being removed and the rec->flags has FTRACE_FL_DIRECT set, then we know to search the ops for the one that has a DIRECT flag attached and we can call the ops_func() on that one. We should also add a FTRACE_WARN_ON() if a direct is not found but the flag was set. > > What do you think about this? > I think this works. Also, on the patch that implements this in the next version, please add to the change log: Link: https://lore.kernel.org/all/20220602193706.2607681-2-song@kernel.org/ so that we have a link to this discussion. Thanks, -- Steve