Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp881142rwb; Thu, 18 Aug 2022 14:05:49 -0700 (PDT) X-Google-Smtp-Source: AA6agR5K0aDnQ/khkJkXqoUneEXStMt8p7wJZUtx0TsecJNpreen9/37jdwL9nqeSca5natoFuCm X-Received: by 2002:a17:907:7284:b0:731:82a3:16e3 with SMTP id dt4-20020a170907728400b0073182a316e3mr2984410ejc.30.1660856748994; Thu, 18 Aug 2022 14:05:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660856748; cv=none; d=google.com; s=arc-20160816; b=Yxz5ZViLtIDUn8HzlFj93XhGHZVAKwXGJwkMljk3FQIAsbEsNm9rImy/u9GNe4lP2l yfUyeSvQXr1zG4gyq/tRtIoOYxQTwBlKCnS0ozTA+cvhc0m7Cc1ozrreOZRo3SGb0AYn XqxUuWYBXCt9FIwZDzsal9a59lpbKWxEHNfPyAgN43FShYdynyZ0r94iVDwu0gOWHfRi NFE88SygW4allsgsZUkQRfWKexgCoP9n+MgGvDR+Fx4f0Zo5ZEAvzIMHW24/Z+H6/4uC b2UvlSVfeA5GbgGrm31Q0w+nZgRZdaZ04iZLVCJe8T1b5pgusa+FU2fQUZi+9m0QSMLF SR0A== 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=A32HPAP5Od3KT+F9QIsj7jmUdN0RqSZ7BrLG62V5DEQ=; b=k4CSil32oBWCckoVeb1NIuWxiHDfkzBWBAyaXTPt3cnNdVW0sMdAkuW4C31yW47L9m n4keyf0n2hjysfymCoBNxh2T/KNO19h0yulyJSeyEri64Ht1bsSsly8VRPIED7JJy7jG vUVMZ+qjv/0YQqUdyVClXipKncIiZSr0gFv2M+YG/ad7E8bxKbVx9rxO6ONgHtDCSx6d EGX6fNKH/Uy1AikAJ4W2qluhrf2Ou4quVYIWzhPkUyvkNORzKwPfGrc9jpQsSGwaRhUj o42cSJqKo1bdfkp98gbXvhTokUzE+GY8rZuquiGAxGIYoCo0B72+b/KxvuU7JBj1k1y8 PWZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="EiftZ2/V"; 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 go40-20020a1709070da800b0073314be476csi1621802ejc.525.2022.08.18.14.05.17; Thu, 18 Aug 2022 14:05:48 -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="EiftZ2/V"; 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 S1346459AbiHRVCT (ORCPT + 99 others); Thu, 18 Aug 2022 17:02:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346336AbiHRVA6 (ORCPT ); Thu, 18 Aug 2022 17:00:58 -0400 Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3ED1BD3ECE; Thu, 18 Aug 2022 14:00:34 -0700 (PDT) Received: by mail-ej1-x62e.google.com with SMTP id a7so5472747ejp.2; Thu, 18 Aug 2022 14:00:34 -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=A32HPAP5Od3KT+F9QIsj7jmUdN0RqSZ7BrLG62V5DEQ=; b=EiftZ2/VM3oMS8+3i8v5hmQJ7gd+jj9Nf4+FG1BUSy1bOtagUF0gdo7NXGpTDkTiV4 krvqNoexSpttqYfC2DiaUJbkZiavbyqRJWAwcwjAvcGuNBGgSlpQfJ96GtYq81176VNh zty2bVEkWJyGMMt6MxgqI4tJXq0/mkCnlHQlTnECgC5C0OHS4zbw7JE6BE2/HzkcKSRj oLKKYFMwEFlk1p2K9MQ7ebeEqci6tLIgJ3LgPDKDrUG1/82fMnvJ9TiEHgTs4DCvVoii /mLKKcEFlJhRRLEknCVTDHajSGUZJ58XWqj0GCdgTK3r9CmhEjrfVsupepMKXI+i6rW6 BFOQ== 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=A32HPAP5Od3KT+F9QIsj7jmUdN0RqSZ7BrLG62V5DEQ=; b=aTDtIBxeRSKRa7oa6Idj+1w+FMOgQ0sAS8+g9rQwEzMY0VRY2iqobB1jX/PAjcs+hM VBhDgq6RlYIy62BjuUsfSEO6/DAVJ3XWIn1seqzQyNK7n1qa9N49Zn4UqdWWVUAN6Wtq hdNWPGY8uFogtx0t8JtbvSeaAe53Oa2oho0p4l5v4TYojp4Ir4eZ9pm+PrEyl5/I+yIh gL1C7mxBT2eQHjpT3gz8m3dNOfbfMlSJGsvGIgTXhEBU//0cjJKX1LsNku3BvmYfaI86 AcyyC4Z88l7i6uQAK6kO53c2K0vbJ/B+BoxJc6ccFGg20YLij7TfZQ67NwMM7iiOuYXa OgYw== X-Gm-Message-State: ACgBeo3ip/55BczYjCnw1ik/8uHWb7k6zzDjsuONvXHW3HrULQfETVTJ X+LoQBlmr2jRVqoVDrU1rN45bZZAM1rQgL5pn+LooIrPy/k= X-Received: by 2002:a17:906:a089:b0:72f:826b:e084 with SMTP id q9-20020a170906a08900b0072f826be084mr3061943ejy.708.1660856432758; Thu, 18 Aug 2022 14:00:32 -0700 (PDT) MIME-Version: 1.0 References: <20220818165024.433f56fd@gandalf.local.home> In-Reply-To: <20220818165024.433f56fd@gandalf.local.home> From: Alexei Starovoitov Date: Thu, 18 Aug 2022 14:00:21 -0700 Message-ID: Subject: Re: [RFC] ftrace: Add support to keep some functions out of ftrace To: Steven Rostedt Cc: Jiri Olsa , Peter Zijlstra , 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 Thu, Aug 18, 2022 at 1:50 PM Steven Rostedt wrote: > > On Thu, 18 Aug 2022 22:27:07 +0200 > Jiri Olsa wrote: > > > ok, so the problem with __attribute__((patchable_function_entry(5))) is that > > it puts function address into __patchable_function_entries section, which is > > one of ftrace locations source: > > > > #define MCOUNT_REC() . = ALIGN(8); \ > > __start_mcount_loc = .; \ > > KEEP(*(__mcount_loc)) \ > > KEEP(*(__patchable_function_entries)) \ > > __stop_mcount_loc = .; \ > > ... > > > > > > it looks like __patchable_function_entries is used for other than x86 archs, > > so we perhaps we could have x86 specific MCOUNT_REC macro just with > > __mcount_loc section? > > So something like this: > > #ifdef CONFIG_X86 > # define NON_MCOUNT_PATCHABLE KEEP(*(__patchable_function_entries)) > # define MCOUNT_PATCHABLE > #else > # define NON_MCOUNT_PATCHABLE > # define MCOUNT_PATCHABLE KEEP(*(__patchable_function_entries)) > #endif > > #define MCOUNT_REC() . = ALIGN(8); \ > __start_mcount_loc = .; \ > KEEP(*(__mcount_loc)) \ > MCOUNT_PATCHABLE \ > __stop_mcount_loc = .; \ > NON_MCOUNT_PATCHABLE \ > ... > > ?? That's what more or less Peter's patch is doing: Here it is again for reference: https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git/commit/?id=8d075bdf11193f1d276bf19fa56b4b8dfe24df9e