diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2011-11-09 11:56:37 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2011-11-14 07:01:24 -0500 |
commit | aa2bc1ade59003a379ffc485d6da2d92ea3370a6 (patch) | |
tree | 6d3551cbc594f6827682db9ab931e6e22a37fd6a /arch/x86 | |
parent | 1d5f003f5a964711853514b04ddc872eec0fdc7b (diff) |
perf: Don't use -ENOSPC for out of PMU resources
People (Linus) objected to using -ENOSPC to signal not having enough
resources on the PMU to satisfy the request. Use -EINVAL.
Requested-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Deng-Cheng Zhu <dengcheng.zhu@gmail.com>
Cc: David Daney <david.daney@cavium.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/n/tip-xv8geaz2zpbjhlx0svmpp28n@git.kernel.org
[ merged to newer kernel, fixed up MIPS impact ]
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/kernel/cpu/perf_event.c | 10 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/perf_event_p4.c | 2 |
2 files changed, 6 insertions, 6 deletions
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c index 640891014b2a..ff0e8d498750 100644 --- a/arch/x86/kernel/cpu/perf_event.c +++ b/arch/x86/kernel/cpu/perf_event.c | |||
@@ -588,7 +588,7 @@ done: | |||
588 | x86_pmu.put_event_constraints(cpuc, cpuc->event_list[i]); | 588 | x86_pmu.put_event_constraints(cpuc, cpuc->event_list[i]); |
589 | } | 589 | } |
590 | } | 590 | } |
591 | return num ? -ENOSPC : 0; | 591 | return num ? -EINVAL : 0; |
592 | } | 592 | } |
593 | 593 | ||
594 | /* | 594 | /* |
@@ -607,7 +607,7 @@ static int collect_events(struct cpu_hw_events *cpuc, struct perf_event *leader, | |||
607 | 607 | ||
608 | if (is_x86_event(leader)) { | 608 | if (is_x86_event(leader)) { |
609 | if (n >= max_count) | 609 | if (n >= max_count) |
610 | return -ENOSPC; | 610 | return -EINVAL; |
611 | cpuc->event_list[n] = leader; | 611 | cpuc->event_list[n] = leader; |
612 | n++; | 612 | n++; |
613 | } | 613 | } |
@@ -620,7 +620,7 @@ static int collect_events(struct cpu_hw_events *cpuc, struct perf_event *leader, | |||
620 | continue; | 620 | continue; |
621 | 621 | ||
622 | if (n >= max_count) | 622 | if (n >= max_count) |
623 | return -ENOSPC; | 623 | return -EINVAL; |
624 | 624 | ||
625 | cpuc->event_list[n] = event; | 625 | cpuc->event_list[n] = event; |
626 | n++; | 626 | n++; |
@@ -1316,7 +1316,7 @@ static int validate_event(struct perf_event *event) | |||
1316 | c = x86_pmu.get_event_constraints(fake_cpuc, event); | 1316 | c = x86_pmu.get_event_constraints(fake_cpuc, event); |
1317 | 1317 | ||
1318 | if (!c || !c->weight) | 1318 | if (!c || !c->weight) |
1319 | ret = -ENOSPC; | 1319 | ret = -EINVAL; |
1320 | 1320 | ||
1321 | if (x86_pmu.put_event_constraints) | 1321 | if (x86_pmu.put_event_constraints) |
1322 | x86_pmu.put_event_constraints(fake_cpuc, event); | 1322 | x86_pmu.put_event_constraints(fake_cpuc, event); |
@@ -1341,7 +1341,7 @@ static int validate_group(struct perf_event *event) | |||
1341 | { | 1341 | { |
1342 | struct perf_event *leader = event->group_leader; | 1342 | struct perf_event *leader = event->group_leader; |
1343 | struct cpu_hw_events *fake_cpuc; | 1343 | struct cpu_hw_events *fake_cpuc; |
1344 | int ret = -ENOSPC, n; | 1344 | int ret = -EINVAL, n; |
1345 | 1345 | ||
1346 | fake_cpuc = allocate_fake_cpuc(); | 1346 | fake_cpuc = allocate_fake_cpuc(); |
1347 | if (IS_ERR(fake_cpuc)) | 1347 | if (IS_ERR(fake_cpuc)) |
diff --git a/arch/x86/kernel/cpu/perf_event_p4.c b/arch/x86/kernel/cpu/perf_event_p4.c index 492bf1358a7c..ef484d9d0a25 100644 --- a/arch/x86/kernel/cpu/perf_event_p4.c +++ b/arch/x86/kernel/cpu/perf_event_p4.c | |||
@@ -1268,7 +1268,7 @@ reserve: | |||
1268 | } | 1268 | } |
1269 | 1269 | ||
1270 | done: | 1270 | done: |
1271 | return num ? -ENOSPC : 0; | 1271 | return num ? -EINVAL : 0; |
1272 | } | 1272 | } |
1273 | 1273 | ||
1274 | static __initconst const struct x86_pmu p4_pmu = { | 1274 | static __initconst const struct x86_pmu p4_pmu = { |