From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754786AbcIFINd (ORCPT ); Tue, 6 Sep 2016 04:13:33 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:45897 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753716AbcIFIN3 (ORCPT ); Tue, 6 Sep 2016 04:13:29 -0400 Date: Tue, 6 Sep 2016 10:13:23 +0200 From: Peter Zijlstra To: Jiri Olsa Cc: lkml , Ingo Molnar , Yanqiu Zhang , Tony Luck , Vikas Shivappa , Thomas Gleixner Subject: Re: [PATCH] perf/x86/intel/cqm: Check cqm/mbm enabled state in event init Message-ID: <20160906081323.GE10153@twins.programming.kicks-ass.net> References: <1473089407-21857-1-git-send-email-jolsa@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1473089407-21857-1-git-send-email-jolsa@kernel.org> User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 05, 2016 at 05:30:07PM +0200, Jiri Olsa wrote: > Yanqiu Zhang reported kernel panic when using mbm event > on system where CQM is detected but without mbm event > support, like with perf: > > # perf stat -e 'intel_cqm/event=3/' -a > > BUG: unable to handle kernel NULL pointer dereference at 0000000000000020 > IP: [] update_sample+0xbc/0xe0 > ... > > [] __intel_mbm_event_init+0x18/0x20 > [] flush_smp_call_function_queue+0x7b/0x160 > [] generic_smp_call_function_single_interrupt+0x13/0x60 > [] smp_call_function_interrupt+0x27/0x40 > [] call_function_interrupt+0x8c/0xa0 > ... > > The reason is that we currently allow to init mbm event > even if mbm support is not detected. Adding checks for > both cqm and mbm events and support into cqm's event_init. > > Reported-by: Yanqiu Zhang > Signed-off-by: Jiri Olsa Fixes: 33c3cc7acfd9 ("perf/x86/mbm: Add Intel Memory B/W Monitoring enumeration and init") Cc: stable@vger.kernelo.org # 4.6+