public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: Andi Kleen <andi@firstfloor.org>,
	Peter Zijlstra <peterz@infradead.org>,
	linux-kernel@vger.kernel.org, Andi Kleen <ak@linux.intel.com>,
	x86@kernel.org, Ingo Molnar <mingo@kernel.org>
Subject: [PATCH] perf/x86/intel/uncore: Remove WARN_ON_ONCE in uncore_pci_probe
Date: Wed, 18 May 2016 08:16:10 +0200	[thread overview]
Message-ID: <20160518061610.GA16649@krava> (raw)
In-Reply-To: <alpine.DEB.2.11.1605172124200.3851@nanos>

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@kernel.org>
---
 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

      reply	other threads:[~2016-05-18  6:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-17 14:56 [RFC][WARNING] warning in uncore_pci_probe Jiri Olsa
2016-05-17 19:34 ` Thomas Gleixner
2016-05-18  6:16   ` Jiri Olsa [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160518061610.GA16649@krava \
    --to=jolsa@redhat.com \
    --cc=ak@linux.intel.com \
    --cc=andi@firstfloor.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox