Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3265801pxk; Mon, 7 Sep 2020 07:59:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwcuw8V1pevZWIkD4UKPwCJX7AQYkZLG2AXau1C8xm1iY4FIMrltKNSiLRsOKn+5jl1rWL1 X-Received: by 2002:a50:fd0a:: with SMTP id i10mr3748645eds.277.1599490772287; Mon, 07 Sep 2020 07:59:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599490772; cv=none; d=google.com; s=arc-20160816; b=oluVxkg7XLaMBztYgyLWwVUVXFfIPG6jBwKTEGGvq/R+W1XmWyUL82pnmqSIzzOrEU abqgfI3XJkDwqWFOF8JXMYXZIOTCxqV4MTSJiWAXMZHETn/VCoQKNpoiKoc3UToLe74W 2XVc3N4a3mA4eemSQy9nxxLJMJ9kwc3kk2ylzUrDffoPHaEalas/8oumuE9X3y2qzYNE Nd8TGbBtTrjgTl/J37FiVdS2Fy+4S3DbimNJ5FCIiqDVbUcZhHZBlTrlno61OpELyyin uPXQ8cZBkwe0Xg+SMv5VKnSfuov+PY/lrZ9zi0YqfxAn6G56k90Lh8V6JxYPay2+BFU4 3ppg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=RI5HJvdwcSwfHau4/VgAZM3+uvLtjmXi7ORa2CbjMjk=; b=y502aN+4z1RoAr8Eam4v9G2tyWjHjJtA1obSA53h4L6JcFFd0UegXVrR2pTOzj4BwA z3jAA8QHWhzKnj7GPucFlTeowzF8LRjpCdNnvzarEPa4j/IYHTcbTRVffTon+jufC31Z l19vIyvOBUB/Ef+M8lEZI95ZajHrUbAKR8mJ/EB0bkLR+Pj3apn9rY5EVVkeuHi1IjbD FqoDBU2fIL7+QDxHL4lBPaP8pQLhroBOMKdwjuTdvgr9J1zp8tovxZKVV+2qnhWgVuFS Iv/rpQEKNQxJ5B1H4zxLdl3I3GgS9cUQ3VATutVQdH1JEJreAy+dp1IzcXHZxgZsxDu+ tH8g== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w23si7408227eju.558.2020.09.07.07.59.10; Mon, 07 Sep 2020 07:59:32 -0700 (PDT) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730084AbgIGO5V (ORCPT + 99 others); Mon, 7 Sep 2020 10:57:21 -0400 Received: from foss.arm.com ([217.140.110.172]:37686 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730037AbgIGOv7 (ORCPT ); Mon, 7 Sep 2020 10:51:59 -0400 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 15915106F; Mon, 7 Sep 2020 07:51:59 -0700 (PDT) Received: from e107158-lin.cambridge.arm.com (e107158-lin.cambridge.arm.com [10.1.195.21]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id EF8AA3F73C; Mon, 7 Sep 2020 07:51:57 -0700 (PDT) Date: Mon, 7 Sep 2020 15:51:55 +0100 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 Subject: Re: [PATCH v2] sched/debug: Add new tracepoint to track cpu_capacity Message-ID: <20200907145155.fsmeygi4fiypikzk@e107158-lin.cambridge.arm.com> 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> User-Agent: NeoMutt/20171215 Sender: linux-kernel-owner@vger.kernel.org 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 was thinking of having a function that allows a module to read member of struct rq (or any struct for that matters), but I think that's the harder (though neater) way around. Just compiled a kernel with CONFIG_DEBUG_INFO_BTF_INFO; and doing $ pahole rq struct rq { raw_spinlock_t lock; /* 0 4 */ unsigned int nr_running; /* 4 4 */ long unsigned int last_blocked_load_update_tick; /* 8 8 */ unsigned int has_blocked_load; /* 16 4 */ /* XXX 12 bytes hole, try to pack */ call_single_data_t nohz_csd; /* 32 32 */ /* --- cacheline 1 boundary (64 bytes) --- */ unsigned int nohz_tick_stopped; /* 64 4 */ atomic_t nohz_flags; /* 68 4 */ unsigned int ttwu_pending; /* 72 4 */ /* XXX 4 bytes hole, try to pack */ u64 nr_switches; /* 80 8 */ . . . } dumps the struct rq {...}; which means one can easily use that to autogenerate a header containing the structs they care about accessing for their running kernel. pahole automatically knows how to find /sys/kernel/btf/vmlinux to parse the debug info btw. The only caveat is that one has to recompile the module for each running kernel; but that's acceptable I think. Not sure how many allow loading a module that's not compiled for that particular kernel version anyway. Note to try this you'll need pahole v1.16 or newer. And compiling pahole on Ubuntu is a pain. I had to create a fedora docker image to compile it in. So I think we have this already solved. Though not sure how to document it.. Thanks -- Qais Yousef