From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751963AbcERGQP (ORCPT ); Wed, 18 May 2016 02:16:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44614 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750954AbcERGQO (ORCPT ); Wed, 18 May 2016 02:16:14 -0400 Date: Wed, 18 May 2016 08:16:10 +0200 From: Jiri Olsa To: Thomas Gleixner Cc: Andi Kleen , Peter Zijlstra , linux-kernel@vger.kernel.org, Andi Kleen , x86@kernel.org, Ingo Molnar Subject: [PATCH] perf/x86/intel/uncore: Remove WARN_ON_ONCE in uncore_pci_probe Message-ID: <20160518061610.GA16649@krava> References: <20160517145648.GA28658@krava> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.6.1 (2016-04-27) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 18 May 2016 06:16:13 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 17, 2016 at 09:34:40PM +0200, Thomas Gleixner wrote: > On Tue, 17 May 2016, Jiri Olsa wrote: > > > > [ 2.766466] WARNING: CPU: 0 PID: 1 at arch/x86/events/intel/uncore.c:894 uncore_pci_probe+0x2a8/0x2b0 > > > > I'm booting with nr_cpus=1, which impact physical_to_logical_pkg > > setup.. the map will not be initialized because the rest of cpus > > is never initialized and set in cpu_present_mask > > > > it seems to me we should remove the warning, because it's valid to > > have only single cpu allowed > > Single package that is. The package map for cpu 0 is correct, i.e. package 0, > but that code tries to init the PCI/uncore for the other packages. > > So, yes. The WARN_ON() is wrong there. We should just return and be done with > it. > patch with changelog attached thanks, jirka --- When booting with nr_cpus=1, uncore_pci_probe tries to init the PCI/uncore also for the other packages and fails with warning when they are not found. [ 2.766466] WARNING: CPU: 0 PID: 1 at arch/x86/events/intel/uncore.c:894 uncore_pci_probe+0x2a8/0x2b0 [ 2.776749] Modules linked in: [ 2.780166] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.6.0tip+ #7 [ 2.787060] Hardware name: Dell Inc. PowerEdge R520/08DM12, BIOS 2.1.2 01/20/2014 [ 2.795409] 0000000000000286 00000000893ec9e0 ffff880624607bb0 ffffffff8134913c [ 2.803698] 0000000000000000 0000000000000000 ffff880624607bf0 ffffffff8108c761 [ 2.811988] 0000037effffffff ffffffff81802d20 0000000000000000 ffff88062436e000 [ 2.820275] Call Trace: [ 2.823006] [] dump_stack+0x63/0x87 [ 2.828730] [] __warn+0xd1/0xf0 [ 2.834074] [] warn_slowpath_null+0x1d/0x20 [ 2.840581] [] uncore_pci_probe+0x2a8/0x2b0 [ 2.847093] [] local_pci_probe+0x45/0xa0 [ 2.853310] [] ? find_next_bit+0x19/0x20 [ 2.859525] [] pci_device_probe+0x136/0x140 [ 2.866034] [] driver_probe_device+0x239/0x460 [ 2.872831] [] __driver_attach+0xc9/0xf0 [ 2.879046] [] ? driver_probe_device+0x460/0x460 [ 2.886038] [] bus_for_each_dev+0x6c/0xc0 [ 2.892350] [] driver_attach+0x1e/0x20 [ 2.898373] [] bus_add_driver+0x1d0/0x290 [ 2.904686] [] ? uncore_cpu_setup+0x17/0x17 [ 2.911195] [] driver_register+0x60/0xe0 [ 2.917412] [] __pci_register_driver+0x4c/0x50 [ 2.924210] [] intel_uncore_init+0x277/0x2dd [ 2.930813] [] ? uncore_cpu_setup+0x17/0x17 [ 2.937322] [] do_one_initcall+0xcd/0x1f0 [ 2.943636] [] ? parse_args+0x293/0x480 [ 2.949755] [] kernel_init_freeable+0x1a5/0x249 [ 2.956650] [] ? set_debug_rodata+0x12/0x12 [ 2.963161] [] kernel_init+0xe/0x110 [ 2.968991] [] ret_from_fork+0x1f/0x40 [ 2.975012] [] ? rest_init+0x80/0x80 Removing the WARN_ON_ONCE, because it's valid to fail in here. Signed-off-by: Jiri Olsa --- arch/x86/events/intel/uncore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/events/intel/uncore.c b/arch/x86/events/intel/uncore.c index 17734a6ef474..84dd13d7b4f1 100644 --- a/arch/x86/events/intel/uncore.c +++ b/arch/x86/events/intel/uncore.c @@ -891,7 +891,7 @@ static int uncore_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id return -ENODEV; pkg = topology_phys_to_logical_pkg(phys_id); - if (WARN_ON_ONCE(pkg < 0)) + if (pkg < 0) return -EINVAL; if (UNCORE_PCI_DEV_TYPE(id->driver_data) == UNCORE_EXTRA_PCI_DEV) { -- 2.4.11