Skip to content

Commit 51c1abb

Browse files
committed
Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf fixes from Ingo Molnar: "Three fixlets and two small (and low risk) hw-enablement changes" * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: perf: Fix event group context move x86/perf: Add IvyBridge EP support perf/x86: Fix P6 driver section warning arch/x86/tools/insn_sanity.c: Identify source of messages perf/x86: Enable Intel Lincroft/Penwell/Cloverview Atom support
2 parents 5dc31b5 + 0231bb5 commit 51c1abb

File tree

4 files changed

+32
-6
lines changed

4 files changed

+32
-6
lines changed

arch/x86/kernel/cpu/perf_event_intel.c

+5-1
Original file line numberDiff line numberDiff line change
@@ -2019,7 +2019,10 @@ __init int intel_pmu_init(void)
20192019
break;
20202020

20212021
case 28: /* Atom */
2022-
case 54: /* Cedariew */
2022+
case 38: /* Lincroft */
2023+
case 39: /* Penwell */
2024+
case 53: /* Cloverview */
2025+
case 54: /* Cedarview */
20232026
memcpy(hw_cache_event_ids, atom_hw_cache_event_ids,
20242027
sizeof(hw_cache_event_ids));
20252028

@@ -2084,6 +2087,7 @@ __init int intel_pmu_init(void)
20842087
pr_cont("SandyBridge events, ");
20852088
break;
20862089
case 58: /* IvyBridge */
2090+
case 62: /* IvyBridge EP */
20872091
memcpy(hw_cache_event_ids, snb_hw_cache_event_ids,
20882092
sizeof(hw_cache_event_ids));
20892093
memcpy(hw_cache_extra_regs, snb_hw_cache_extra_regs,

arch/x86/kernel/cpu/perf_event_p6.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ static const u64 p6_perfmon_event_map[] =
1919

2020
};
2121

22-
static __initconst u64 p6_hw_cache_event_ids
22+
static u64 p6_hw_cache_event_ids
2323
[PERF_COUNT_HW_CACHE_MAX]
2424
[PERF_COUNT_HW_CACHE_OP_MAX]
2525
[PERF_COUNT_HW_CACHE_RESULT_MAX] =

arch/x86/tools/insn_sanity.c

+8-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ static FILE *input_file; /* Input file name */
5555
static void usage(const char *err)
5656
{
5757
if (err)
58-
fprintf(stderr, "Error: %s\n\n", err);
58+
fprintf(stderr, "%s: Error: %s\n\n", prog, err);
5959
fprintf(stderr, "Usage: %s [-y|-n|-v] [-s seed[,no]] [-m max] [-i input]\n", prog);
6060
fprintf(stderr, "\t-y 64bit mode\n");
6161
fprintf(stderr, "\t-n 32bit mode\n");
@@ -269,7 +269,13 @@ int main(int argc, char **argv)
269269
insns++;
270270
}
271271

272-
fprintf(stdout, "%s: decoded and checked %d %s instructions with %d errors (seed:0x%x)\n", (errors) ? "Failure" : "Success", insns, (input_file) ? "given" : "random", errors, seed);
272+
fprintf(stdout, "%s: %s: decoded and checked %d %s instructions with %d errors (seed:0x%x)\n",
273+
prog,
274+
(errors) ? "Failure" : "Success",
275+
insns,
276+
(input_file) ? "given" : "random",
277+
errors,
278+
seed);
273279

274280
return errors ? 1 : 0;
275281
}

kernel/events/core.c

+18-2
Original file line numberDiff line numberDiff line change
@@ -907,6 +907,15 @@ list_add_event(struct perf_event *event, struct perf_event_context *ctx)
907907
ctx->nr_stat++;
908908
}
909909

910+
/*
911+
* Initialize event state based on the perf_event_attr::disabled.
912+
*/
913+
static inline void perf_event__state_init(struct perf_event *event)
914+
{
915+
event->state = event->attr.disabled ? PERF_EVENT_STATE_OFF :
916+
PERF_EVENT_STATE_INACTIVE;
917+
}
918+
910919
/*
911920
* Called at perf_event creation and when events are attached/detached from a
912921
* group.
@@ -6179,8 +6188,7 @@ perf_event_alloc(struct perf_event_attr *attr, int cpu,
61796188
event->overflow_handler = overflow_handler;
61806189
event->overflow_handler_context = context;
61816190

6182-
if (attr->disabled)
6183-
event->state = PERF_EVENT_STATE_OFF;
6191+
perf_event__state_init(event);
61846192

61856193
pmu = NULL;
61866194

@@ -6609,9 +6617,17 @@ SYSCALL_DEFINE5(perf_event_open,
66096617

66106618
mutex_lock(&gctx->mutex);
66116619
perf_remove_from_context(group_leader);
6620+
6621+
/*
6622+
* Removing from the context ends up with disabled
6623+
* event. What we want here is event in the initial
6624+
* startup state, ready to be add into new context.
6625+
*/
6626+
perf_event__state_init(group_leader);
66126627
list_for_each_entry(sibling, &group_leader->sibling_list,
66136628
group_entry) {
66146629
perf_remove_from_context(sibling);
6630+
perf_event__state_init(sibling);
66156631
put_ctx(gctx);
66166632
}
66176633
mutex_unlock(&gctx->mutex);

0 commit comments

Comments
 (0)