[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210126235730.lgfa2uida5se5urn@treble>
Date: Tue, 26 Jan 2021 17:57:30 -0600
From: Josh Poimboeuf <jpoimboe@...hat.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Frederic Weisbecker <frederic@...nel.org>,
LKML <linux-kernel@...r.kernel.org>,
Mel Gorman <mgorman@...e.de>, Michal Hocko <mhocko@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
"Paul E . McKenney" <paulmck@...nel.org>,
Ingo Molnar <mingo@...hat.com>, Michal Hocko <mhocko@...e.com>,
rostedt@...dmis.org, jbaron@...mai.com, ardb@...nel.org
Subject: Re: [RFC PATCH 6/8] preempt/dynamic: Provide
preempt_schedule[_notrace]() static calls
On Fri, Jan 22, 2021 at 05:52:26PM +0100, Peter Zijlstra wrote:
> static int static_call_add_module(struct module *mod)
> {
> - return __static_call_init(mod, mod->static_call_sites,
> - mod->static_call_sites + mod->num_static_call_sites);
> + struct static_call_site *start = mod->static_call_sites;
> + struct static_call_site *stop = start + mod->num_static_call_sites;
> + struct static_call_site *site;
> +
> + for (site = start; site != stop; site++) {
> + unsigned long addr = (unsigned long)static_call_key(site);
> + struct static_call_ass *ass;
> +
> + /*
> + * Gotta fix up the keys that point to the trampoline.
> + */
> + if (!kernel_text_address(addr))
> + continue;
> +
> + ass = static_call_find_ass(addr);
> + if (!ass) {
> + pr_warn("Failed to fixup __raw_static_call() usage at: %ps\n",
> + static_call_addr(site));
> + return -EINVAL;
> + }
> + site->key = ((unsigned long)ass->key - (unsigned long)&site->key) |
> + (site->key & STATIC_CALL_SITE_FLAGS);
Well, I hate it, but I'm not sure I have any better ideas. It should be
possible to use kallsyms, instead of the rb-tree/register nonsense. Not
sure about the performance impact though. Might be a good reason to
speed up kallsyms!
Also I do have some naming suggestions ;-)
--
Josh
Powered by blists - more mailing lists