Jiri, It works, thank you!
Tested-by: Fengguang Wu <fengguang...@intel.com> > --- > diff --git a/kernel/events/core.c b/kernel/events/core.c > index 661951a..a53857e 100644 > --- a/kernel/events/core.c > +++ b/kernel/events/core.c > @@ -5423,6 +5423,8 @@ struct swevent_htable { > > /* Recursion avoidance in each contexts */ > int recursion[PERF_NR_CONTEXTS]; > + > + bool offline; > }; > > static DEFINE_PER_CPU(struct swevent_htable, swevent_htable); > @@ -5669,8 +5671,10 @@ static int perf_swevent_add(struct perf_event *event, > int flags) > hwc->state = !(flags & PERF_EF_START); > > head = find_swevent_head(swhash, event); > - if (WARN_ON_ONCE(!head)) > + if (!head) { > + WARN_ON_ONCE(!swhash->offline); > return -EINVAL; > + } > > hlist_add_head_rcu(&event->hlist_entry, head); > > @@ -7850,6 +7854,7 @@ static void perf_event_init_cpu(int cpu) > struct swevent_htable *swhash = &per_cpu(swevent_htable, cpu); > > mutex_lock(&swhash->hlist_mutex); > + swhash->offline = false; > if (swhash->hlist_refcount > 0) { > struct swevent_hlist *hlist; > > @@ -7907,6 +7912,7 @@ static void perf_event_exit_cpu(int cpu) > perf_event_exit_cpu_context(cpu); > > mutex_lock(&swhash->hlist_mutex); > + swhash->offline = true; > swevent_hlist_release(swhash); > mutex_unlock(&swhash->hlist_mutex); > } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/