Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp5187992rwb; Wed, 17 Aug 2022 12:42:53 -0700 (PDT) X-Google-Smtp-Source: AA6agR6XYhhDYtfz9zQNNxoE4PygBfxQD4Kz/J51SB4NTQYcuef8ihiik+S6UTgiNbCexr+vevTU X-Received: by 2002:a05:6402:4446:b0:43b:e1f4:8525 with SMTP id o6-20020a056402444600b0043be1f48525mr24669640edb.236.1660765372925; Wed, 17 Aug 2022 12:42:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660765372; cv=none; d=google.com; s=arc-20160816; b=D0hCY+ouPrLODoz/nhxeOVyDCCqs0oMltWf+PAJv9RzGoNHkMsu7hI5SCVtasm+69q 34+M0koKBaFewO5zwODUTiP+gSD6LXsCz0mLZzFxX4zLL+Y6x553ihR3lay9dNL6HOJi a0eWRBu+lW6DOcjgzn63lFNDg5d8wdL7/mRh843rS0RQUGD2kAhtqfnBJPfUsJvSP0BZ baHb9h1pIt1wS7KsYajeRKhTL9BmD/lDmY5LxIwZzjG1bK0KMcyXuFdspySFo1cHGJh0 ZII2w52YPpN7OMWGoG1QYQs9x5d+s7X3Zszzy4tYfBquZqoSAYhpsN+cdVLeP8e6KyaW 5psA== 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:date:from:dkim-signature; bh=EuNyPRJfq+eeFKDGgW9jPrQ9YAIsMyHr4aBhbhS+A4s=; b=ACulRsXmgBY5j4v6Yg7C+yIjgGg2vALW8zpbPjEckdqhCINFsSl4vGCHEVjsKJ+O7/ Ga9qTxZ+Gby3e5AzpBjCXcQ+vt30gOnRCT9dra2dldEyzhcLZruWEDOTBHg8SeUBBnOX Zk2v/CFMkj04Idnr6buSJrYgoQL2ps80EYUeX68IqjVFJf5oLGsd2dUKcV6p1ENlsX3x 9ReG7N/N0sTmaSVclNhjb2eXQnvd1PwWY3DyJUXQlL0Datrw4L2ueDZDqe+FoVxn+pc1 uinOTZQHnoBsHxHTX3qTKx1rDo9mGYNuqDWCUkKS9X/ftcAEFyhFoGLcrV8um3n8V9ea CsNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Q63m1Abp; 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 j14-20020a056402238e00b0043c30f0f4a6si12484472eda.107.2022.08.17.12.42.25; Wed, 17 Aug 2022 12:42:52 -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=20210112 header.b=Q63m1Abp; 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 S238545AbiHQTjw (ORCPT + 99 others); Wed, 17 Aug 2022 15:39:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238528AbiHQTjl (ORCPT ); Wed, 17 Aug 2022 15:39:41 -0400 Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD0DA98D3A; Wed, 17 Aug 2022 12:39:39 -0700 (PDT) Received: by mail-ej1-x632.google.com with SMTP id w19so26317144ejc.7; Wed, 17 Aug 2022 12:39:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:from:to:cc; bh=EuNyPRJfq+eeFKDGgW9jPrQ9YAIsMyHr4aBhbhS+A4s=; b=Q63m1AbpALxx+9Y4vjkVG40gDhEIjsP7Yo8Bu7O8/nYIF0bvVlaYqLFGBVFyAk6u2w byz+tISo/V2bL0RHknT3uc4aFIHPTTMu3mL5B86HHJcmKdmjBSbIODow4inSy2/P1QkT 2KkQtE1au7DQj/RPDzus9O8GqTmmuv/PNApctAxKuib3DnnZTl3LyYd9ACfp4KfoGfeq XZK0tBpnnIyHDaIJqGnz/b7tlfUDuWShBXqtlvwD437MnT7In5ArFGdQTqEvx8fxgzWC atic+bEJZ8sB3o2C1rWNL2Zpnw0sx8XG4wN8FPl0mFwd7coNKds37mbYcpHa53CqP+dL 75qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:x-gm-message-state:from:to:cc; bh=EuNyPRJfq+eeFKDGgW9jPrQ9YAIsMyHr4aBhbhS+A4s=; b=7lIUqXAfCLqtq1le331NYmuj8U++hMAK0Cjt3Lpvkp7pOtLcwfsOCLOvCPvo3fZg1H nZgL7VKVxM24bWlOjynSeYln6b9n6hnHcWiITq37BSnjAqufIbyc3lF6GE9klQqQQMMb ci8+L3OODLDt0bRZHO33Fg2kVQo0h+xBfuDyfE5vHRQRTVheDpIoYZT1hJ+1exMWYsfw BUMAYIeKvEzUMRgpzVfJMWms1+q8fa86bADi2BHLICYh2y5X5cs2nGz/0QrYI7b/du3B Vhvi+4mHx2slRfmZW+vXro3KixLchD080qZAQkBs1hgcK6GXT2/5iZrQd5cuuOXRlrqJ vc4w== X-Gm-Message-State: ACgBeo2f7qIgJL9GrvuwCO/Qg9jutqt5SYp0e02tudDRhMQWJkrrFtGf nkCSX8J33pOfntIYRtPEP28= X-Received: by 2002:a17:907:28d6:b0:731:100c:8999 with SMTP id en22-20020a17090728d600b00731100c8999mr17535301ejc.210.1660765178394; Wed, 17 Aug 2022 12:39:38 -0700 (PDT) Received: from krava ([83.240.62.131]) by smtp.gmail.com with ESMTPSA id cq10-20020a056402220a00b00445d85bd754sm2211227edb.79.2022.08.17.12.39.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Aug 2022 12:39:37 -0700 (PDT) From: Jiri Olsa X-Google-Original-From: Jiri Olsa Date: Wed, 17 Aug 2022 21:39:36 +0200 To: Alexei Starovoitov Cc: Jiri Olsa , Peter Zijlstra , Steven Rostedt , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Ingo Molnar , bpf , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , LKML , Josh Poimboeuf , =?iso-8859-1?Q?Bj=F6rn_T=F6pel?= Subject: Re: [RFC] ftrace: Add support to keep some functions out of ftrace Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 On Wed, Aug 17, 2022 at 09:57:45AM -0700, Alexei Starovoitov wrote: > On Wed, Aug 17, 2022 at 2:29 AM Jiri Olsa wrote: > > > > On Tue, Aug 16, 2022 at 08:56:33AM +0200, Jiri Olsa wrote: > > > On Mon, Aug 15, 2022 at 05:48:44PM +0200, Peter Zijlstra wrote: > > > > On Mon, Aug 15, 2022 at 08:35:53AM -0700, Alexei Starovoitov wrote: > > > > > On Mon, Aug 15, 2022 at 8:28 AM Peter Zijlstra wrote: > > > > > > > > > > > > On Mon, Aug 15, 2022 at 08:17:42AM -0700, Alexei Starovoitov wrote: > > > > > > > It's hiding a fake function from ftrace, since it's not a function > > > > > > > and ftrace infra shouldn't show it tracing logs. > > > > > > > In other words it's a _notrace_ function with nop5. > > > > > > > > > > > > Then make it a notrace function with a nop5 in it. That isn't hard. > > > > > > > > > > That's exactly what we're trying to do. > > > > > > > > All the while claiming ftrace is broken while it is not. > > > > > > > > > Jiri's patch is one way to achieve that. > > > > > > > > Fairly horrible way. > > > > > > > > > What is your suggestion? > > > > > > > > Mailed it already. > > > > > > > > > Move it from C to asm ? > > > > > > > > Would be much better than proposed IMO. > > > > > > nice, that would be independent of the compiler atributes > > > and config checking.. will check on this one ;-) > > > > how about something like below? > > > > dispatcher code is generated only for x86_64, so that will be covered > > by the assembly version (free of ftrace table) other archs stay same > > > > jirka > > > > > > ---- > > diff --git a/arch/x86/net/Makefile b/arch/x86/net/Makefile > > index 383c87300b0d..94964002eaae 100644 > > --- a/arch/x86/net/Makefile > > +++ b/arch/x86/net/Makefile > > @@ -7,4 +7,5 @@ ifeq ($(CONFIG_X86_32),y) > > obj-$(CONFIG_BPF_JIT) += bpf_jit_comp32.o > > else > > obj-$(CONFIG_BPF_JIT) += bpf_jit_comp.o > > + obj-$(CONFIG_BPF_JIT) += bpf_dispatcher.o > > endif > > diff --git a/arch/x86/net/bpf_dispatcher.S b/arch/x86/net/bpf_dispatcher.S > > new file mode 100644 > > index 000000000000..65790a1286e8 > > --- /dev/null > > +++ b/arch/x86/net/bpf_dispatcher.S > > @@ -0,0 +1,10 @@ > > +/* SPDX-License-Identifier: GPL-2.0 */ > > +#include > > +#include > > +#include > > + > > + .text > > +SYM_FUNC_START(bpf_dispatcher_xdp_func) > > + ASM_NOP5 > > + JMP_NOSPEC rdx > > +SYM_FUNC_END(bpf_dispatcher_xdp_func) > > Wait. Why asm ? Did you try Peter's suggestion: > __attribute__((__no_instrument_function__)) > __attribute__((patchable_function_entry(5))) ah so this suggestion came in the other thread after the asm one.. ok, will check jirka