[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0e96ac37-d5c5-86b6-833c-0de01ba18f0d@solarflare.com>
Date: Fri, 7 Dec 2018 16:06:32 +0000
From: Edward Cree <ecree@...arflare.com>
To: Josh Poimboeuf <jpoimboe@...hat.com>
CC: <linux-kernel@...r.kernel.org>, <x86@...nel.org>,
Paolo Abeni <pabeni@...hat.com>
Subject: Re: [PATCH v2 0/4] Static calls
Sorry if this has been pointed out before (it's a very long thread), but
in the out-of-line implementation, it appears that static_call_update()
never alters key->func. Am I right in thinking that this should be
fixed by adding 'WRITE_ONCE(key->func, func);' just after the call to
arch_static_call_transform() on line 159 of include/linux/static_call.h?
Some background (why does key->func matter for the
CONFIG_HAVE_STATIC_CALL_OUTLINE case?): I am experimenting with
combining these static calls with the 'indirect call wrappers' notion
that Paolo Abeni has been working on [1], using runtime instrumentation
to determine a list of potential callees. (This allows us to cope with
cases where the callees are in modules, or where different workloads may
use different sets of callees for a given call site, neither of which is
handled by Paolo's approach).
The core of my design looks something like:
static int dynamic_call_xyz(int (*func)(some_args), some_args)
{
if (func == dynamic_call_xyz_1.func)
return static_call(dynamic_call_xyz_1, some_args);
if (func == dynamic_call_xyz_2.func)
return static_call(dynamic_call_xyz_2, some_args);
return (*func)(some_args);
}
albeit with a bunch of extra (and currently rather ugly) stuff to collect
the statistics needed to decide what to put in the static call keys, and
mechanisms (RCU in my current case) to ensure that the static call isn't
changed between checking its .func and actually calling it.
-Ed
PS: not on list, please keep me in CC.
[1] https://lwn.net/Articles/773985/
Powered by blists - more mailing lists