lkml.org 
[lkml]   [2015]   [Apr]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH V2 6/6] perf/x86/intel/uncore: do not implicitly set uncore event cpu
On Wed, Apr 15, 2015 at 08:56:16AM +0100, Kan Liang wrote:
> From: Kan Liang <kan.liang@intel.com>
>
> There is cpumask exposed to the uncore pmu sysfs directory. User should
> set the cpu according to the cpumask. Kernel should not implicitly
> change the event->cpu.
>
> Signed-off-by: Kan Liang <kan.liang@intel.com>
> ---
> arch/x86/kernel/cpu/perf_event_intel_uncore.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.c b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
> index c635b8b..cd80731 100644
> --- a/arch/x86/kernel/cpu/perf_event_intel_uncore.c
> +++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
> @@ -621,9 +621,8 @@ static int uncore_pmu_event_init(struct perf_event *event)
> if (event->cpu < 0)
> return -EINVAL;
> box = uncore_pmu_to_box(pmu, event->cpu);
> - if (!box || box->cpu < 0)
> + if (!box || box->cpu < 0 || (box->cpu != event->cpu))
> return -EINVAL;
> - event->cpu = box->cpu;

There are no existing users relying on this behaviour?

If hotplug occurs between userspace reading the mask and trying to open
the event, it will get -EINVAL back, for no apparent reason, where
previously it would have been silently fixed up. Given the event
migration logic, the old behaviour was more consistent in allowing the
user to not care about hotplug.

Mark.


\
 
 \ /
  Last update: 2015-04-16 19:01    [W:0.981 / U:1.980 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site