Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp13894744pxu; Mon, 4 Jan 2021 07:20:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJzqcvWOx1d5lQrVbps4lTN6FVhPL+V975tQtdd6hPpf3cJi/EgIgv7tKrsTz9/OxXHtKTbB X-Received: by 2002:a17:906:4985:: with SMTP id p5mr58384927eju.513.1609773650160; Mon, 04 Jan 2021 07:20:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609773650; cv=none; d=google.com; s=arc-20160816; b=UG4ev5aPndhYES8CklPdlAi0fWJotbJWpqe4aBiEJXdDGZp+i4SpqRzIhax8WPl5Bc Dy3tgJgZ6pMTY7qDNJ9LzkJGW/3cralTUNtodCgkfQw3eNucNHtRyQGpeKHbHtA3TDPY Z1lE8zOpKrZvsjZmiE0BZQHeWT35mZcEDgm0sL2g7FVz9BcP6mu4eSLI+/ZoJZOTCHsU yEpowwj1PXzpZmWTEV/+whY/FBQk97e64atr7XqmkFV+SWtm601WWyx1UNVXUftpadex syioSSm7eLOYSowN2BaH+tQVQfT2RD4BBfNxPnZbNbP6Pp+uQAyDEhqRoLRacoSmCg8h iICQ== 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:from:date; bh=GCRAIiOXB3acl5SATtPvKKLDDOiZYnVSVp5gGLEEDbk=; b=VJ2zRB2g/k9G/+wgCae3JD5I/X5lNtA7rroAkOkwGyQFyjrS3qmNtaYEF9FQSVnJEc VpyZSvGoGQs1U5dR+XjMXOs/UMidn9unTfL2x+y+X3ygItY5SVygkH+EXxR4riMYby5p d12DrRMtvSW+SWGU3XKhjOeiJ6yRaI9dYrXovkW+02GRf5UdZYXg7lfURZnlB1lxhbKM jXcpzXriRAtoSqXpRbus3u2cdlVrAoDBT6fZKJTDapPDSxrh+I9v6Gp5pMGGMR3c1JkJ xrRQhvsUlpB8Fhdv4xxCmNRsc8UcJGhkdXtsBtLuYKYiSEIEWhZ6zXDIyOyMlj6d/Z/3 nnIA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m22si32156201edr.514.2021.01.04.07.20.26; Mon, 04 Jan 2021 07:20:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727217AbhADPTp (ORCPT + 99 others); Mon, 4 Jan 2021 10:19:45 -0500 Received: from foss.arm.com ([217.140.110.172]:38176 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726333AbhADPTp (ORCPT ); Mon, 4 Jan 2021 10:19:45 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 282BE101E; Mon, 4 Jan 2021 07:18:59 -0800 (PST) Received: from e107158-lin (e107158-lin.cambridge.arm.com [10.1.194.78]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E6A8D3F719; Mon, 4 Jan 2021 07:18:57 -0800 (PST) Date: Mon, 4 Jan 2021 15:18:55 +0000 From: Qais Yousef To: peterz@infradead.org Cc: Dietmar Eggemann , vincent.donnefort@arm.com, mingo@redhat.com, vincent.guittot@linaro.org, linux-kernel@vger.kernel.org, valentin.schneider@arm.com, Phil Auld , Arnaldo Carvalho de Melo Subject: Re: [PATCH v2] sched/debug: Add new tracepoint to track cpu_capacity Message-ID: <20210104151855.cx4w4ptkpzi3k6ld@e107158-lin> References: <1598605249-72651-1-git-send-email-vincent.donnefort@arm.com> <20200828102724.wmng7p6je2pkc33n@e107158-lin.cambridge.arm.com> <1e806d48-fd54-fd86-5b3a-372d9876f360@arm.com> <20200828172658.dxygk7j672gho4ax@e107158-lin.cambridge.arm.com> <58f5d2e8-493b-7ce1-6abd-57705e5ab437@arm.com> <20200907104845.6rust2lf2o3d5gmq@e107158-lin.cambridge.arm.com> <20200907111320.GP2674@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200907111320.GP2674@hirez.programming.kicks-ass.net> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/07/20 13:13, peterz@infradead.org wrote: > On Mon, Sep 07, 2020 at 11:48:45AM +0100, Qais Yousef wrote: > > IMHO the above is a hack. Out-of-tree modules should rely on public headers and > > exported functions only. What you propose means that people who want to use > > these tracepoints in meaningful way must have a prebuilt kernel handy. Which is > > maybe true for us who work in the embedded world. But users who run normal > > distro kernels (desktop/servers) will fail to build against > > But this isn't really aimed at regular users. We're aiming this at > developers (IIUC) so I dont really see this as a problem. > > > FWIW, I did raise this concern with Peter in 2019 OSPM and he was okay with the > > exports as it's still not a contract and they can disappear anytime we want. > > Migrating to using BTF is the right way forward IMO. I don't think what we have > > here is out-of-control yet. Though I agree they're annoying. > > Right, we're hiding behind the explicit lack of ABI for modules. > > Anyway, CTF/BTF/random other crap that isn't DWARFs should work fine to > replace all this muck. Just no idea what the state of any of that is. So I have updated my reference module to remove the dependency on those functions: https://github.com/qais-yousef/tracepoints-helpers/tree/pelt-tps-v3-create-events/sched_tp When building against a prebuilt kernel tree, I use pahole + vmlinux to generate vmlinux.h with all the internal struct we depend on. The kernel must be compiled with CONFIG_DEBUG_INFO for pahole to work. When building against a running kernel (ie: exported headers only available), we try to use /sys/kernel/btf/vmlinux to generate vmlinux.h. One outstanding issue is that pahole + BTF don't generate alignment info so while the module compiles but I get a crash when I load the module and enable one of the tracepoints. bpftool generates alignment info with BTF, but it dumps everything which leads to another set of problems. Barring fixing the BTF issue which I'm talking with Arnaldo about, I think we should be in good position to remove these exported functions soon. In the module we have to maintain helper functions (see sched_tp_helpers.h) but I think that's much easier than maintaining out of tree copy of the structs. It also enabled me to add uclamp trace events which had dependency on internal details that I wasn't keen on exporting in mainline. Is this a good/better compromise? Thanks -- Qais Yousef