Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2626287rwb; Mon, 15 Aug 2022 08:32:43 -0700 (PDT) X-Google-Smtp-Source: AA6agR5W9QlneMKQOnT+1KEf3i5OhTC276dbGDPM/wal6jOydbdQ9F4ai6cx5FOIbF4Hs1dHto3A X-Received: by 2002:a17:906:d0d0:b0:730:9352:7484 with SMTP id bq16-20020a170906d0d000b0073093527484mr10910921ejb.70.1660577563139; Mon, 15 Aug 2022 08:32:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660577563; cv=none; d=google.com; s=arc-20160816; b=jylPBi8MJn07sceilTMGsY2CSrhxWJsoAABNotnExwfcxvmLx0TnThEN1i7ncaQuwB jeXKOXM9ZGksw8T1fs8wlDo/8UeTawtWgAMExZpHvgrC1YGAQNyGXI1wAZLi/xqGu+dj 1RcRsfxxSi2z8EXBeIIGgi7U5+R5ViJHRqoqtl2cdV7zUX+27BRPqoDB0iuUJDP0Z3SJ dZMwv816Qpav0xhhT0X84Z1qC/lc0EhfWLGow1sIYV6naIASV9spY9zdmuP6lCVJGb92 LKEW6VaoCUtIcH5pVqruq+/nsS+C14UunfWbv6a2TjFgP821KYnZ8dGhxcgqMAEXNfq8 FcVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=ouVrghtSSuQOBBxR3odg7fAexnfue10H0ZICw3MXbrE=; b=QGkTsQ6jEIK1v9JCk25ji7vJqRRJ9dWBdahiRL/hYpNbwwg9KpPd1iXuDJsMjwbXGq kQYBCje9t+w1gdiUECH7y9NPTbtA4B/b2kxfKRU9xOH58c6jMcBVS3w/ptno4DVRFSgX T/peVTTdOFuIdX0JCV9picdZpmWrPmH1zH9xuGBWUS0U5scp9VZjmGDpb4cWCifMvlsu f1EOmHlFlhO2kCPIeG7sBgyzoQfWfrDfDTq6fQS4/PNhRhXR3Z0nZwtjUlXSrROUkEPj NNPsFC7ODSatJYo86W7cnLJm65JwQBVdxj4hnG4yEmNW6NPj65bmVGcel7wZWbDRSu29 Cqug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=KN69bJhO; 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 g15-20020a056402424f00b004396851005fsi9643744edb.100.2022.08.15.08.32.13; Mon, 15 Aug 2022 08:32:43 -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=KN69bJhO; 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 S240356AbiHOPSU (ORCPT + 99 others); Mon, 15 Aug 2022 11:18:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243220AbiHOPSF (ORCPT ); Mon, 15 Aug 2022 11:18:05 -0400 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CD2C26AF0; Mon, 15 Aug 2022 08:17:56 -0700 (PDT) Received: by mail-ed1-x52b.google.com with SMTP id o22so9955088edc.10; Mon, 15 Aug 2022 08:17:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=ouVrghtSSuQOBBxR3odg7fAexnfue10H0ZICw3MXbrE=; b=KN69bJhOi+4eHRQCQooNl+YS574QD0pXjZ97SDVn7Nphx/6UopnXXXT5nByoisxixB MNNKM3gDX4m6IhZgGUJM7AE4QKh8b9Xjyp6c/7f6Vcfqje8cnrP/Syq8PRM5+3/FHfh+ FWsX+F5JGlp3SGhZQwJ7CO5Z1/YGYxIgXZv6s6Xr894+6Elc88/bY8WMCQTH5D9iuGfl avohwPMX43VYi3nVS3+xiAaPBE8jYi1VqRnXckcJQK4ydb/HAT4yg1/J1skRLBbWfAaa HpsVbpk/G52c4k+v9bjstxDMWRy7uJmOXDc789s9Otg1iOoRrUz0vAvP3+q/iTFNM6ir 3WZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=ouVrghtSSuQOBBxR3odg7fAexnfue10H0ZICw3MXbrE=; b=bcJghvpptOtFLRua5J6k7BAPqg95Z3J/sPWHUP+8VQOcbHXUuG4bmoL6XStc49i/Wx 6nKEwvPaEcryLhkwnD1dTF+yeFe3Wc7ZukDYbBTLqemSTqwLYqNz4cB5g2asQ0Gyi9iN 7uWKCIqbFErkgI4qHZRMeZHsUI471mZQfA2atjlhsuduWRsuHxbl3ZARrViKZ2H7tN52 LyidJnggkjO8Ie9bBmFBk1E/j5PZwxhZJj+zNRoLn8b9c9s9ClALTBhYjwgM2OjAGF3H GVodRv/b4drNU1/D1KlJj0SW08oEJ3A8YQaOTgbdVHVMxjliNJBzrVCy2MLNSYJIO6Oz anWQ== X-Gm-Message-State: ACgBeo0nTTq+T8Vk6ZHXU68BlvPU7lsOkdcMqVfZzL2o2BF/u0rWxddC J1emUJ5Ua+UDoW/w8jYN7xoMwGf/RWPTgJVA+g0= X-Received: by 2002:a05:6402:3697:b0:443:1c6:acc3 with SMTP id ej23-20020a056402369700b0044301c6acc3mr15268812edb.421.1660576674799; Mon, 15 Aug 2022 08:17:54 -0700 (PDT) MIME-Version: 1.0 References: <20220722174120.688768a3@gandalf.local.home> <20220813150252.5aa63650@rorschach.local.home> In-Reply-To: From: Alexei Starovoitov Date: Mon, 15 Aug 2022 08:17:42 -0700 Message-ID: Subject: Re: [RFC] ftrace: Add support to keep some functions out of ftrace To: Peter Zijlstra Cc: Jiri Olsa , 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 Content-Type: text/plain; charset="UTF-8" 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 Mon, Aug 15, 2022 at 8:02 AM Peter Zijlstra wrote: > > On Mon, Aug 15, 2022 at 07:45:16AM -0700, Alexei Starovoitov wrote: > > On Mon, Aug 15, 2022 at 7:33 AM Peter Zijlstra wrote: > > > > It is in full control of the 'call __fentry__'. Absolute full NAK on you > > > trying to make it otherwise. > > > > Don't mix 'call fentry' generated by the compiler with nop5 inserted > > by macroses or JITs. > > Looking at: > > https://lore.kernel.org/all/20191211123017.13212-3-bjorn.topel@gmail.com/ > > this seems to want to prod at the __fentry__ sites. > > > > > Soon we will have nop5 in the middle of the function. > > > > ftrace must not touch it. > > > > > > How are you generating that NOP and what for? > > > > We're generating nop5-s in JITed code to further > > attach to. > > Ftrace doesn't know about those; so how can it break that? > > Likewise it doesn't know about the static_branch/static_call NOPs and > nothing is broken. > > Ftrace only knows about the __fentry__ sites, and it *does* own them. > Are you saying ftrace is writing to a code location not a __fentry__ > site? Let's keep it in one thread: > It wasn't long before. Yes it landed a few months prior to the > static_call work, but the whole static_call thing was in progress for a > long long time. > > Anyway, yes it is different. But it's still very much broken. You simply > cannot step on __fentry__ sites like that. Ask yourself: should static_call patching logic go through ftrace infra ? No. Right? static_call has nothing to do with ftrace (function tracing). Same thing here. bpf dispatching logic is nothing to do with function tracing. In this case bpf_dispatcher_xdp_func is a placeholder written C. If it was written in asm, fentry recording wouldn't have known about it. And that's more or less what Jiri patch is doing. 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.