From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1C27C25B0E for ; Thu, 18 Aug 2022 21:02:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346435AbiHRVCD (ORCPT ); Thu, 18 Aug 2022 17:02:03 -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-Google-Smtp-Source: AA6agR7aQiGzTiYfENEZTzgyWjIg+8U1NkzkYo7M9PDX9EYfCqoeF8HY7s/XnhGCss7xqrObq8l/Ir8cbgHuZaJKfDk= 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" Precedence: bulk List-ID: X-Mailing-List: bpf@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