perf, x86: Don't use clock function pointer to determine clock
Subsystems (2)
Alexander Shishkin
reviewerPATCH 1/1 perf, x86: Don't use clock function pointer to determine clock
Now that local_clock() is explicitly inlined in sched.h, taking its pointer would uninline it in the compilation unit where it's done, making (among other things) comparing pointers to this function produce different results in different compilation units.
Case in point, x86 perf core's user page updating function compares event's clock against &local_clock to see if it needs to set zero time offset related bits in the page.
This patch fixes the latter by looking at the "use_clockid" event attribute instead, to determine whether local clock is used. Fixing the uninlined local_clock() in perf core is left as an exercise for the author of the prior work.
--- arch/x86/events/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/events/core.c +1 -1
@@ -2177,7 +2177,7 @@ void arch_perf_update_userpage(struct perf_event *event,* cap_user_time_zero doesn't make sense when we're using a different * time base for the records. */ -if (event->clock == &local_clock) { +if (!event->attr.use_clockid) { userpg->cap_user_time_zero =1 ; userpg->time_zero = data->cyc2ns_offset; }
Signature · 1 line
2.8.0.rc3
tip-bot for Alexander Shishkin
merge bot[tip:sched/core] perf/core, sched: Don't use clock function pointer to determine clock
perf/core, sched: Don't use clock function pointer to determine clock
Commit-ID: f454bfddf6ba557381d8bf5df50eff778602ff23 Gitweb: http://git.kernel.org/tip/f454bfddf6ba557381d8bf5df50eff778602ff23 Author: Alexander Shishkin <[email protected]> AuthorDate: Thu, 14 Apr 2016 14:59:49 +0300 Committer: Ingo Molnar <[email protected]> CommitDate: Tue, 19 Apr 2016 10:55:29 +0200
perf/core, sched: Don't use clock function pointer to determine clock
Now that local_clock() is explicitly inlined in sched.h, taking its pointer would uninline it in the compilation unit where it's done, making (among other things) comparing pointers to this function produce different results in different compilation units.
Case in point, x86 perf core's user page updating function compares event's clock against &local_clock to see if it needs to set zero time offset related bits in the page.
This patch fixes the latter by looking at the "use_clockid" event attribute instead, to determine whether local clock is used. Fixing the uninlined local_clock() in perf core is left as an exercise for the author of the prior work.
--- arch/x86/events/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/events/core.c +1 -1
@@ -2177,7 +2177,7 @@ void arch_perf_update_userpage(struct perf_event *event,* cap_user_time_zero doesn't make sense when we're using a different * time base for the records. */ -if (event->clock == &local_clock) { +if (!event->attr.use_clockid) { userpg->cap_user_time_zero =1 ; userpg->time_zero = data->cyc2ns_offset; }
Re: [tip:sched/core] perf/core, sched: Don't use clock function pointer to determine clock
Quoted 14 lines · tip-bot for Alexander Shishkin
Commit-ID: f454bfddf6ba557381d8bf5df50eff778602ff23 Gitweb: http://git.kernel.org/tip/f454bfddf6ba557381d8bf5df50eff778602ff23 Author: Alexander Shishkin <[email protected]> AuthorDate: Thu, 14 Apr 2016 14:59:49 +0300 Committer: Ingo Molnar <[email protected]> CommitDate: Tue, 19 Apr 2016 10:55:29 +0200perf/core, sched: Don't use clock function pointer to determine clock
Now that
local_clock()is explicitly inlined insched.h, taking its pointer would uninline it in the compilation unit where it's done, making (among other things) comparing pointers to this function produce different results in different compilation units.
Quoted 8 lines
Case in point, x86 perf core's user page updating function compares event's clock against
&local_clockto see if it needs to set zero time offset related bits in the page.This patch fixes the latter by looking at the "
use_clockid" event attribute instead, to determine whether local clock is used. Fixing the uninlinedlocal_clock()in perf core is left as an exercise for the author of the prior work.
Ouch! Good exercise :)