[PATCH] perf/x86/intel/uncore: Remove WARN_ON_ONCE in uncore_pci_probe

From: Jiri Olsa
Date: Wed May 18 2016 - 02:16:23 EST


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] [<ffffffff8134913c>] dump_stack+0x63/0x87
[ 2.828730] [<ffffffff8108c761>] __warn+0xd1/0xf0
[ 2.834074] [<ffffffff8108c89d>] warn_slowpath_null+0x1d/0x20
[ 2.840581] [<ffffffff81015208>] uncore_pci_probe+0x2a8/0x2b0
[ 2.847093] [<ffffffff8138af25>] local_pci_probe+0x45/0xa0
[ 2.853310] [<ffffffff8135e749>] ? find_next_bit+0x19/0x20
[ 2.859525] [<ffffffff8138c3a6>] pci_device_probe+0x136/0x140
[ 2.866034] [<ffffffff81478be9>] driver_probe_device+0x239/0x460
[ 2.872831] [<ffffffff81478ed9>] __driver_attach+0xc9/0xf0
[ 2.879046] [<ffffffff81478e10>] ? driver_probe_device+0x460/0x460
[ 2.886038] [<ffffffff8147676c>] bus_for_each_dev+0x6c/0xc0
[ 2.892350] [<ffffffff8147845e>] driver_attach+0x1e/0x20
[ 2.898373] [<ffffffff81477ed0>] bus_add_driver+0x1d0/0x290
[ 2.904686] [<ffffffff81d85785>] ? uncore_cpu_setup+0x17/0x17
[ 2.911195] [<ffffffff81479980>] driver_register+0x60/0xe0
[ 2.917412] [<ffffffff8138a85c>] __pci_register_driver+0x4c/0x50
[ 2.924210] [<ffffffff81d859fc>] intel_uncore_init+0x277/0x2dd
[ 2.930813] [<ffffffff81d85785>] ? uncore_cpu_setup+0x17/0x17
[ 2.937322] [<ffffffff8100213d>] do_one_initcall+0xcd/0x1f0
[ 2.943636] [<ffffffff810ab933>] ? parse_args+0x293/0x480
[ 2.949755] [<ffffffff81d80360>] kernel_init_freeable+0x1a5/0x249
[ 2.956650] [<ffffffff81d7fa35>] ? set_debug_rodata+0x12/0x12
[ 2.963161] [<ffffffff816b5f0e>] kernel_init+0xe/0x110
[ 2.968991] [<ffffffff816c2c3f>] ret_from_fork+0x1f/0x40
[ 2.975012] [<ffffffff816b5f00>] ? rest_init+0x80/0x80

Removing the WARN_ON_ONCE, because it's valid to fail in here.

Signed-off-by: Jiri Olsa <jolsa@xxxxxxxxxx>
---
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