Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751683AbbDPQhG (ORCPT ); Thu, 16 Apr 2015 12:37:06 -0400 Received: from foss.arm.com ([217.140.101.70]:38505 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750790AbbDPQg6 (ORCPT ); Thu, 16 Apr 2015 12:36:58 -0400 Date: Thu, 16 Apr 2015 17:36:53 +0100 From: Mark Rutland To: Kan Liang Cc: "acme@kernel.org" , "a.p.zijlstra@chello.nl" , "eranian@google.com" , "andi@firstfloor.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH V2 6/6] perf/x86/intel/uncore: do not implicitly set uncore event cpu Message-ID: <20150416163653.GC19775@leverpostej> References: <1429084576-1078-1-git-send-email-kan.liang@intel.com> <1429084576-1078-6-git-send-email-kan.liang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1429084576-1078-6-git-send-email-kan.liang@intel.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1611 Lines: 39 On Wed, Apr 15, 2015 at 08:56:16AM +0100, Kan Liang wrote: > From: Kan Liang > > 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 > --- > 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. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/