All of lore.kernel.org
 help / color / mirror / Atom feed
From: Barry Song <21cnbao@gmail.com>
To: "Winkler, Tomas" <tomas.winkler@intel.com>
Cc: "Sang, Oliver" <oliver.sang@intel.com>, lkp <lkp@intel.com>,
	"Brandeburg, Jesse" <jesse.brandeburg@intel.com>,
	"Nguyen, Anthony L" <anthony.l.nguyen@intel.com>,
	Barry Song <song.bao.hua@hisilicon.com>,
	LKML <linux-kernel@vger.kernel.org>,
	"lkp@lists.01.org" <lkp@lists.01.org>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Marc Zyngier <maz@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	"Jonathan.Cameron@huawei.com" <Jonathan.Cameron@huawei.com>,
	"bilbao@vt.edu" <bilbao@vt.edu>, Jonathan Corbet <corbet@lwn.net>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"leon@kernel.org" <leon@kernel.org>,
	"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	Linuxarm <linuxarm@huawei.com>,
	"luzmaximilian@gmail.com" <luzmaximilian@gmail.com>,
	"mchehab+huawei@kernel.org" <mchehab+huawei@kernel.org>,
	"schnelle@linux.ibm.com" <schnelle@linux.ibm.com>,
	"intel-wired-lan@lists.osuosl.org"
	<intel-wired-lan@lists.osuosl.org>
Subject: Re: [PCI/MSI] a4fc4cf388: dmesg.genirq:Flags_mismatch_irq##(mei_me)vs.#(xhci_hcd)
Date: Sun, 3 Oct 2021 21:32:28 +1300	[thread overview]
Message-ID: <CAGsJ_4ygPbLFqpRu7_N4RvfTY++OumQCFz=yxgcnb3VoqPwRAg@mail.gmail.com> (raw)
In-Reply-To: <8ab95f7f784448038d7777c45f1f2d55@intel.com>

On Fri, Sep 3, 2021 at 7:34 AM Winkler, Tomas <tomas.winkler@intel.com> wrote:
>
> > dmesg.genirq:Flags_mismatch_irq##(mei_me)vs.#(xhci_hcd)
> >
> > On Tue, Aug 31, 2021 at 1:21 PM Barry Song <21cnbao@gmail.com> wrote:
> > >
> > > On Mon, Aug 30, 2021 at 2:38 AM kernel test robot
> > <oliver.sang@intel.com> wrote:
> > > >
> > > >
> > > >
> > > > Greeting,
> > > >
> > > > FYI, we noticed the following commit (built with gcc-9):
> > > >
> > > > commit: a4fc4cf388319ea957ffbdab5073bdd267de9082 ("[PATCH v3 3/3]
> > > > PCI/MSI: remove msi_attrib.default_irq in msi_desc")
> > > > url:
> > > > https://github.com/0day-ci/linux/commits/Barry-Song/PCI-MSI-Clarify-
> > > > the-IRQ-sysfs-ABI-for-PCI-devices/20210825-183018
> > > > base:
> > > > https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git
> > > > 6e764bcd1cf72a2846c0e53d3975a09b242c04c9
> > > >
> > > > in testcase: kernel-selftests
> > > > version: kernel-selftests-x86_64-ebaa603b-1_20210825
> > > > with following parameters:
> > > >
> > > >         group: pidfd
> > > >         ucode: 0xe2
> > > >
> > > > test-description: The kernel contains a set of "self tests" under the
> > tools/testing/selftests/ directory. These are intended to be small unit tests
> > to exercise individual code paths in the kernel.
> > > > test-url: https://www.kernel.org/doc/Documentation/kselftest.txt
> > > >
> > > >
> > > > on test machine: 4 threads Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz
> > > > with 32G memory
> > > >
> > > > caused below changes (please refer to attached dmesg/kmsg for entire
> > log/backtrace):
> > > >
> > > >
> > > >
> > > > If you fix the issue, kindly add following tag
> > > > Reported-by: kernel test robot <oliver.sang@intel.com>
> > > >
> > > >
> > > >
> > > > [  179.602028][   T34] genirq: Flags mismatch irq 16. 00002000 (mei_me) vs.
> > 00000000 (xhci_hcd)
> > > > [  179.614073][   T34] CPU: 2 PID: 34 Comm: kworker/u8:2 Not tainted
> > 5.14.0-rc7-00014-ga4fc4cf38831 #1
> > > > [  179.623225][   T34] Hardware name: Dell Inc. OptiPlex 7040/0Y7WYT,
> > BIOS 1.8.1 12/05/2017
> > > > [  179.631432][   T34] Workqueue: events_unbound async_run_entry_fn
> > > > [  179.637543][   T34] Call Trace:
> > > > [  179.640789][   T34]  dump_stack_lvl+0x45/0x59
> > > > [  179.645253][   T34]  __setup_irq.cold+0x50/0xd4
> > > > [  179.649893][   T34]  ? mei_me_pg_exit_sync+0x480/0x480 [mei_me]
> > > > [  179.655923][   T34]  request_threaded_irq+0x10c/0x180
> > > > [  179.661073][   T34]  ? mei_me_irq_quick_handler+0x240/0x240
> > [mei_me]
> > > > [  179.667528][   T34]  mei_me_probe+0x131/0x300 [mei_me]
> > > > [  179.672767][   T34]  local_pci_probe+0x42/0x80
> > > > [  179.677313][   T34]  pci_device_probe+0x107/0x1c0
> > > > [  179.682118][   T34]  really_probe+0xb6/0x380
> > > > [  179.687094][   T34]  __driver_probe_device+0xfe/0x180
> > > > [  179.692242][   T34]  driver_probe_device+0x1e/0xc0
> > > > [  179.697133][   T34]  __driver_attach_async_helper+0x2b/0x80
> > > > [  179.702802][   T34]  async_run_entry_fn+0x30/0x140
> > > > [  179.707693][   T34]  process_one_work+0x274/0x5c0
> > > > [  179.712503][   T34]  worker_thread+0x50/0x3c0
> > > > [  179.716959][   T34]  ? process_one_work+0x5c0/0x5c0
> > > > [  179.721936][   T34]  kthread+0x14f/0x180
> > > > [  179.725958][   T34]  ? set_kthread_struct+0x40/0x40
> > > > [  179.730935][   T34]  ret_from_fork+0x22/0x30
> > > > [  179.735699][   T34] mei_me 0000:00:16.0: request_threaded_irq failure.
> > irq = 16
> > > > [  179.743125][   T34] mei_me 0000:00:16.0: initialization failed.
> > > > [  179.749399][   T34] mei_me: probe of 0000:00:16.0 failed with error -16
> > > >
> > > >
> > >
> > > it seems there is a direct reference to pdev->irq.
> > > Hi Oliver, would you try if the below patch can fix the problem:
> >
> > + Tomas
> >
> > sorry. after second looking, drivers/misc/mei/pci-me.c has many places using
> > pdev->irq directly. We really need this driver's maintainers to address the
> > problem.
>
> Will look at that.

Hi Tomas,

I assume using hw->irq or not is a separate topic, does vim command
%s/pdev->irq/pci_irq_vector(pdev, 0)/g
as below fix the current crash problem because of directly dereferencing
pdev->irq?

diff --git a/drivers/misc/mei/pci-me.c b/drivers/misc/mei/pci-me.c
index c3393b383e59..97495931fadd 100644
--- a/drivers/misc/mei/pci-me.c
+++ b/drivers/misc/mei/pci-me.c
@@ -216,18 +216,18 @@ static int mei_me_probe(struct pci_dev *pdev,
const struct pci_device_id *ent)

  pci_enable_msi(pdev);

- hw->irq = pdev->irq;
+ hw->irq = pci_irq_vector(pdev, 0);

  /* request and enable interrupt */
  irqflags = pci_dev_msi_enabled(pdev) ? IRQF_ONESHOT : IRQF_SHARED;

- err = request_threaded_irq(pdev->irq,
+ err = request_threaded_irq(pci_irq_vector(pdev, 0),
  mei_me_irq_quick_handler,
  mei_me_irq_thread_handler,
  irqflags, KBUILD_MODNAME, dev);
  if (err) {
  dev_err(&pdev->dev, "request_threaded_irq failure. irq = %d\n",
-        pdev->irq);
+        pci_irq_vector(pdev, 0));
  goto end;
  }

@@ -278,7 +278,7 @@ static int mei_me_probe(struct pci_dev *pdev,
const struct pci_device_id *ent)
 release_irq:
  mei_cancel_work(dev);
  mei_disable_interrupts(dev);
- free_irq(pdev->irq, dev);
+ free_irq(pci_irq_vector(pdev, 0), dev);
 end:
  dev_err(&pdev->dev, "initialization failed.\n");
  return err;
@@ -307,7 +307,7 @@ static void mei_me_shutdown(struct pci_dev *pdev)
  mei_me_unset_pm_domain(dev);

  mei_disable_interrupts(dev);
- free_irq(pdev->irq, dev);
+ free_irq(pci_irq_vector(pdev, 0), dev);
 }

 /**
@@ -336,7 +336,7 @@ static void mei_me_remove(struct pci_dev *pdev)

  mei_disable_interrupts(dev);

- free_irq(pdev->irq, dev);
+ free_irq(pci_irq_vector(pdev, 0), dev);

  mei_deregister(dev);
 }
@@ -356,7 +356,7 @@ static int mei_me_pci_suspend(struct device *device)

  mei_disable_interrupts(dev);

- free_irq(pdev->irq, dev);
+ free_irq(pci_irq_vector(pdev, 0), dev);
  pci_disable_msi(pdev);

  return 0;
@@ -378,14 +378,14 @@ static int mei_me_pci_resume(struct device *device)
  irqflags = pci_dev_msi_enabled(pdev) ? IRQF_ONESHOT : IRQF_SHARED;

  /* request and enable interrupt */
- err = request_threaded_irq(pdev->irq,
+ err = request_threaded_irq(pci_irq_vector(pdev, 0),
  mei_me_irq_quick_handler,
  mei_me_irq_thread_handler,
  irqflags, KBUILD_MODNAME, dev);

  if (err) {
  dev_err(&pdev->dev, "request_threaded_irq failed: irq = %d.\n",
- pdev->irq);
+ pci_irq_vector(pdev, 0));
  return err;
  }


Thanks
barry

WARNING: multiple messages have this Message-ID (diff)
From: Barry Song <21cnbao@gmail.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [PCI/MSI] a4fc4cf388: dmesg.genirq:Flags_mismatch_irq##(mei_me)vs.#(xhci_hcd)
Date: Sun, 3 Oct 2021 21:32:28 +1300	[thread overview]
Message-ID: <CAGsJ_4ygPbLFqpRu7_N4RvfTY++OumQCFz=yxgcnb3VoqPwRAg@mail.gmail.com> (raw)
In-Reply-To: <8ab95f7f784448038d7777c45f1f2d55@intel.com>

On Fri, Sep 3, 2021 at 7:34 AM Winkler, Tomas <tomas.winkler@intel.com> wrote:
>
> > dmesg.genirq:Flags_mismatch_irq##(mei_me)vs.#(xhci_hcd)
> >
> > On Tue, Aug 31, 2021 at 1:21 PM Barry Song <21cnbao@gmail.com> wrote:
> > >
> > > On Mon, Aug 30, 2021 at 2:38 AM kernel test robot
> > <oliver.sang@intel.com> wrote:
> > > >
> > > >
> > > >
> > > > Greeting,
> > > >
> > > > FYI, we noticed the following commit (built with gcc-9):
> > > >
> > > > commit: a4fc4cf388319ea957ffbdab5073bdd267de9082 ("[PATCH v3 3/3]
> > > > PCI/MSI: remove msi_attrib.default_irq in msi_desc")
> > > > url:
> > > > https://github.com/0day-ci/linux/commits/Barry-Song/PCI-MSI-Clarify-
> > > > the-IRQ-sysfs-ABI-for-PCI-devices/20210825-183018
> > > > base:
> > > > https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git
> > > > 6e764bcd1cf72a2846c0e53d3975a09b242c04c9
> > > >
> > > > in testcase: kernel-selftests
> > > > version: kernel-selftests-x86_64-ebaa603b-1_20210825
> > > > with following parameters:
> > > >
> > > >         group: pidfd
> > > >         ucode: 0xe2
> > > >
> > > > test-description: The kernel contains a set of "self tests" under the
> > tools/testing/selftests/ directory. These are intended to be small unit tests
> > to exercise individual code paths in the kernel.
> > > > test-url: https://www.kernel.org/doc/Documentation/kselftest.txt
> > > >
> > > >
> > > > on test machine: 4 threads Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz
> > > > with 32G memory
> > > >
> > > > caused below changes (please refer to attached dmesg/kmsg for entire
> > log/backtrace):
> > > >
> > > >
> > > >
> > > > If you fix the issue, kindly add following tag
> > > > Reported-by: kernel test robot <oliver.sang@intel.com>
> > > >
> > > >
> > > >
> > > > [  179.602028][   T34] genirq: Flags mismatch irq 16. 00002000 (mei_me) vs.
> > 00000000 (xhci_hcd)
> > > > [  179.614073][   T34] CPU: 2 PID: 34 Comm: kworker/u8:2 Not tainted
> > 5.14.0-rc7-00014-ga4fc4cf38831 #1
> > > > [  179.623225][   T34] Hardware name: Dell Inc. OptiPlex 7040/0Y7WYT,
> > BIOS 1.8.1 12/05/2017
> > > > [  179.631432][   T34] Workqueue: events_unbound async_run_entry_fn
> > > > [  179.637543][   T34] Call Trace:
> > > > [  179.640789][   T34]  dump_stack_lvl+0x45/0x59
> > > > [  179.645253][   T34]  __setup_irq.cold+0x50/0xd4
> > > > [  179.649893][   T34]  ? mei_me_pg_exit_sync+0x480/0x480 [mei_me]
> > > > [  179.655923][   T34]  request_threaded_irq+0x10c/0x180
> > > > [  179.661073][   T34]  ? mei_me_irq_quick_handler+0x240/0x240
> > [mei_me]
> > > > [  179.667528][   T34]  mei_me_probe+0x131/0x300 [mei_me]
> > > > [  179.672767][   T34]  local_pci_probe+0x42/0x80
> > > > [  179.677313][   T34]  pci_device_probe+0x107/0x1c0
> > > > [  179.682118][   T34]  really_probe+0xb6/0x380
> > > > [  179.687094][   T34]  __driver_probe_device+0xfe/0x180
> > > > [  179.692242][   T34]  driver_probe_device+0x1e/0xc0
> > > > [  179.697133][   T34]  __driver_attach_async_helper+0x2b/0x80
> > > > [  179.702802][   T34]  async_run_entry_fn+0x30/0x140
> > > > [  179.707693][   T34]  process_one_work+0x274/0x5c0
> > > > [  179.712503][   T34]  worker_thread+0x50/0x3c0
> > > > [  179.716959][   T34]  ? process_one_work+0x5c0/0x5c0
> > > > [  179.721936][   T34]  kthread+0x14f/0x180
> > > > [  179.725958][   T34]  ? set_kthread_struct+0x40/0x40
> > > > [  179.730935][   T34]  ret_from_fork+0x22/0x30
> > > > [  179.735699][   T34] mei_me 0000:00:16.0: request_threaded_irq failure.
> > irq = 16
> > > > [  179.743125][   T34] mei_me 0000:00:16.0: initialization failed.
> > > > [  179.749399][   T34] mei_me: probe of 0000:00:16.0 failed with error -16
> > > >
> > > >
> > >
> > > it seems there is a direct reference to pdev->irq.
> > > Hi Oliver, would you try if the below patch can fix the problem:
> >
> > + Tomas
> >
> > sorry. after second looking, drivers/misc/mei/pci-me.c has many places using
> > pdev->irq directly. We really need this driver's maintainers to address the
> > problem.
>
> Will look at that.

Hi Tomas,

I assume using hw->irq or not is a separate topic, does vim command
%s/pdev->irq/pci_irq_vector(pdev, 0)/g
as below fix the current crash problem because of directly dereferencing
pdev->irq?

diff --git a/drivers/misc/mei/pci-me.c b/drivers/misc/mei/pci-me.c
index c3393b383e59..97495931fadd 100644
--- a/drivers/misc/mei/pci-me.c
+++ b/drivers/misc/mei/pci-me.c
@@ -216,18 +216,18 @@ static int mei_me_probe(struct pci_dev *pdev,
const struct pci_device_id *ent)

  pci_enable_msi(pdev);

- hw->irq = pdev->irq;
+ hw->irq = pci_irq_vector(pdev, 0);

  /* request and enable interrupt */
  irqflags = pci_dev_msi_enabled(pdev) ? IRQF_ONESHOT : IRQF_SHARED;

- err = request_threaded_irq(pdev->irq,
+ err = request_threaded_irq(pci_irq_vector(pdev, 0),
  mei_me_irq_quick_handler,
  mei_me_irq_thread_handler,
  irqflags, KBUILD_MODNAME, dev);
  if (err) {
  dev_err(&pdev->dev, "request_threaded_irq failure. irq = %d\n",
-        pdev->irq);
+        pci_irq_vector(pdev, 0));
  goto end;
  }

@@ -278,7 +278,7 @@ static int mei_me_probe(struct pci_dev *pdev,
const struct pci_device_id *ent)
 release_irq:
  mei_cancel_work(dev);
  mei_disable_interrupts(dev);
- free_irq(pdev->irq, dev);
+ free_irq(pci_irq_vector(pdev, 0), dev);
 end:
  dev_err(&pdev->dev, "initialization failed.\n");
  return err;
@@ -307,7 +307,7 @@ static void mei_me_shutdown(struct pci_dev *pdev)
  mei_me_unset_pm_domain(dev);

  mei_disable_interrupts(dev);
- free_irq(pdev->irq, dev);
+ free_irq(pci_irq_vector(pdev, 0), dev);
 }

 /**
@@ -336,7 +336,7 @@ static void mei_me_remove(struct pci_dev *pdev)

  mei_disable_interrupts(dev);

- free_irq(pdev->irq, dev);
+ free_irq(pci_irq_vector(pdev, 0), dev);

  mei_deregister(dev);
 }
@@ -356,7 +356,7 @@ static int mei_me_pci_suspend(struct device *device)

  mei_disable_interrupts(dev);

- free_irq(pdev->irq, dev);
+ free_irq(pci_irq_vector(pdev, 0), dev);
  pci_disable_msi(pdev);

  return 0;
@@ -378,14 +378,14 @@ static int mei_me_pci_resume(struct device *device)
  irqflags = pci_dev_msi_enabled(pdev) ? IRQF_ONESHOT : IRQF_SHARED;

  /* request and enable interrupt */
- err = request_threaded_irq(pdev->irq,
+ err = request_threaded_irq(pci_irq_vector(pdev, 0),
  mei_me_irq_quick_handler,
  mei_me_irq_thread_handler,
  irqflags, KBUILD_MODNAME, dev);

  if (err) {
  dev_err(&pdev->dev, "request_threaded_irq failed: irq = %d.\n",
- pdev->irq);
+ pci_irq_vector(pdev, 0));
  return err;
  }


Thanks
barry

WARNING: multiple messages have this Message-ID (diff)
From: Barry Song <21cnbao@gmail.com>
To: lkp@lists.01.org
Subject: Re: [PCI/MSI] a4fc4cf388: dmesg.genirq:Flags_mismatch_irq##(mei_me)vs.#(xhci_hcd)
Date: Sun, 03 Oct 2021 21:32:28 +1300	[thread overview]
Message-ID: <CAGsJ_4ygPbLFqpRu7_N4RvfTY++OumQCFz=yxgcnb3VoqPwRAg@mail.gmail.com> (raw)
In-Reply-To: <8ab95f7f784448038d7777c45f1f2d55@intel.com>

[-- Attachment #1: Type: text/plain, Size: 6649 bytes --]

On Fri, Sep 3, 2021 at 7:34 AM Winkler, Tomas <tomas.winkler@intel.com> wrote:
>
> > dmesg.genirq:Flags_mismatch_irq##(mei_me)vs.#(xhci_hcd)
> >
> > On Tue, Aug 31, 2021 at 1:21 PM Barry Song <21cnbao@gmail.com> wrote:
> > >
> > > On Mon, Aug 30, 2021 at 2:38 AM kernel test robot
> > <oliver.sang@intel.com> wrote:
> > > >
> > > >
> > > >
> > > > Greeting,
> > > >
> > > > FYI, we noticed the following commit (built with gcc-9):
> > > >
> > > > commit: a4fc4cf388319ea957ffbdab5073bdd267de9082 ("[PATCH v3 3/3]
> > > > PCI/MSI: remove msi_attrib.default_irq in msi_desc")
> > > > url:
> > > > https://github.com/0day-ci/linux/commits/Barry-Song/PCI-MSI-Clarify-
> > > > the-IRQ-sysfs-ABI-for-PCI-devices/20210825-183018
> > > > base:
> > > > https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git
> > > > 6e764bcd1cf72a2846c0e53d3975a09b242c04c9
> > > >
> > > > in testcase: kernel-selftests
> > > > version: kernel-selftests-x86_64-ebaa603b-1_20210825
> > > > with following parameters:
> > > >
> > > >         group: pidfd
> > > >         ucode: 0xe2
> > > >
> > > > test-description: The kernel contains a set of "self tests" under the
> > tools/testing/selftests/ directory. These are intended to be small unit tests
> > to exercise individual code paths in the kernel.
> > > > test-url: https://www.kernel.org/doc/Documentation/kselftest.txt
> > > >
> > > >
> > > > on test machine: 4 threads Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz
> > > > with 32G memory
> > > >
> > > > caused below changes (please refer to attached dmesg/kmsg for entire
> > log/backtrace):
> > > >
> > > >
> > > >
> > > > If you fix the issue, kindly add following tag
> > > > Reported-by: kernel test robot <oliver.sang@intel.com>
> > > >
> > > >
> > > >
> > > > [  179.602028][   T34] genirq: Flags mismatch irq 16. 00002000 (mei_me) vs.
> > 00000000 (xhci_hcd)
> > > > [  179.614073][   T34] CPU: 2 PID: 34 Comm: kworker/u8:2 Not tainted
> > 5.14.0-rc7-00014-ga4fc4cf38831 #1
> > > > [  179.623225][   T34] Hardware name: Dell Inc. OptiPlex 7040/0Y7WYT,
> > BIOS 1.8.1 12/05/2017
> > > > [  179.631432][   T34] Workqueue: events_unbound async_run_entry_fn
> > > > [  179.637543][   T34] Call Trace:
> > > > [  179.640789][   T34]  dump_stack_lvl+0x45/0x59
> > > > [  179.645253][   T34]  __setup_irq.cold+0x50/0xd4
> > > > [  179.649893][   T34]  ? mei_me_pg_exit_sync+0x480/0x480 [mei_me]
> > > > [  179.655923][   T34]  request_threaded_irq+0x10c/0x180
> > > > [  179.661073][   T34]  ? mei_me_irq_quick_handler+0x240/0x240
> > [mei_me]
> > > > [  179.667528][   T34]  mei_me_probe+0x131/0x300 [mei_me]
> > > > [  179.672767][   T34]  local_pci_probe+0x42/0x80
> > > > [  179.677313][   T34]  pci_device_probe+0x107/0x1c0
> > > > [  179.682118][   T34]  really_probe+0xb6/0x380
> > > > [  179.687094][   T34]  __driver_probe_device+0xfe/0x180
> > > > [  179.692242][   T34]  driver_probe_device+0x1e/0xc0
> > > > [  179.697133][   T34]  __driver_attach_async_helper+0x2b/0x80
> > > > [  179.702802][   T34]  async_run_entry_fn+0x30/0x140
> > > > [  179.707693][   T34]  process_one_work+0x274/0x5c0
> > > > [  179.712503][   T34]  worker_thread+0x50/0x3c0
> > > > [  179.716959][   T34]  ? process_one_work+0x5c0/0x5c0
> > > > [  179.721936][   T34]  kthread+0x14f/0x180
> > > > [  179.725958][   T34]  ? set_kthread_struct+0x40/0x40
> > > > [  179.730935][   T34]  ret_from_fork+0x22/0x30
> > > > [  179.735699][   T34] mei_me 0000:00:16.0: request_threaded_irq failure.
> > irq = 16
> > > > [  179.743125][   T34] mei_me 0000:00:16.0: initialization failed.
> > > > [  179.749399][   T34] mei_me: probe of 0000:00:16.0 failed with error -16
> > > >
> > > >
> > >
> > > it seems there is a direct reference to pdev->irq.
> > > Hi Oliver, would you try if the below patch can fix the problem:
> >
> > + Tomas
> >
> > sorry. after second looking, drivers/misc/mei/pci-me.c has many places using
> > pdev->irq directly. We really need this driver's maintainers to address the
> > problem.
>
> Will look at that.

Hi Tomas,

I assume using hw->irq or not is a separate topic, does vim command
%s/pdev->irq/pci_irq_vector(pdev, 0)/g
as below fix the current crash problem because of directly dereferencing
pdev->irq?

diff --git a/drivers/misc/mei/pci-me.c b/drivers/misc/mei/pci-me.c
index c3393b383e59..97495931fadd 100644
--- a/drivers/misc/mei/pci-me.c
+++ b/drivers/misc/mei/pci-me.c
@@ -216,18 +216,18 @@ static int mei_me_probe(struct pci_dev *pdev,
const struct pci_device_id *ent)

  pci_enable_msi(pdev);

- hw->irq = pdev->irq;
+ hw->irq = pci_irq_vector(pdev, 0);

  /* request and enable interrupt */
  irqflags = pci_dev_msi_enabled(pdev) ? IRQF_ONESHOT : IRQF_SHARED;

- err = request_threaded_irq(pdev->irq,
+ err = request_threaded_irq(pci_irq_vector(pdev, 0),
  mei_me_irq_quick_handler,
  mei_me_irq_thread_handler,
  irqflags, KBUILD_MODNAME, dev);
  if (err) {
  dev_err(&pdev->dev, "request_threaded_irq failure. irq = %d\n",
-        pdev->irq);
+        pci_irq_vector(pdev, 0));
  goto end;
  }

@@ -278,7 +278,7 @@ static int mei_me_probe(struct pci_dev *pdev,
const struct pci_device_id *ent)
 release_irq:
  mei_cancel_work(dev);
  mei_disable_interrupts(dev);
- free_irq(pdev->irq, dev);
+ free_irq(pci_irq_vector(pdev, 0), dev);
 end:
  dev_err(&pdev->dev, "initialization failed.\n");
  return err;
@@ -307,7 +307,7 @@ static void mei_me_shutdown(struct pci_dev *pdev)
  mei_me_unset_pm_domain(dev);

  mei_disable_interrupts(dev);
- free_irq(pdev->irq, dev);
+ free_irq(pci_irq_vector(pdev, 0), dev);
 }

 /**
@@ -336,7 +336,7 @@ static void mei_me_remove(struct pci_dev *pdev)

  mei_disable_interrupts(dev);

- free_irq(pdev->irq, dev);
+ free_irq(pci_irq_vector(pdev, 0), dev);

  mei_deregister(dev);
 }
@@ -356,7 +356,7 @@ static int mei_me_pci_suspend(struct device *device)

  mei_disable_interrupts(dev);

- free_irq(pdev->irq, dev);
+ free_irq(pci_irq_vector(pdev, 0), dev);
  pci_disable_msi(pdev);

  return 0;
@@ -378,14 +378,14 @@ static int mei_me_pci_resume(struct device *device)
  irqflags = pci_dev_msi_enabled(pdev) ? IRQF_ONESHOT : IRQF_SHARED;

  /* request and enable interrupt */
- err = request_threaded_irq(pdev->irq,
+ err = request_threaded_irq(pci_irq_vector(pdev, 0),
  mei_me_irq_quick_handler,
  mei_me_irq_thread_handler,
  irqflags, KBUILD_MODNAME, dev);

  if (err) {
  dev_err(&pdev->dev, "request_threaded_irq failed: irq = %d.\n",
- pdev->irq);
+ pci_irq_vector(pdev, 0));
  return err;
  }


Thanks
barry

  reply	other threads:[~2021-10-03  8:32 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-25 10:26 [PATCH v3 0/3] PCI/MSI: Clarify the IRQ sysfs ABI for PCI devices Barry Song
2021-08-25 10:26 ` [Intel-wired-lan] " Barry Song
2021-08-25 10:26 ` [PATCH v3 1/3] Documentation: ABI: sysfs-bus-pci: Add description for IRQ entry Barry Song
2021-08-25 10:26   ` [Intel-wired-lan] " Barry Song
2021-08-25 10:26 ` [PATCH v3 2/3] PCI/sysfs: Don't depend on pci_dev.irq " Barry Song
2021-08-25 10:26   ` [Intel-wired-lan] " Barry Song
2021-08-25 13:30   ` Marc Zyngier
2021-08-25 13:30     ` [Intel-wired-lan] " Marc Zyngier
2021-08-25 10:26 ` [PATCH v3 3/3] PCI/MSI: remove msi_attrib.default_irq in msi_desc Barry Song
2021-08-25 10:26   ` [Intel-wired-lan] " Barry Song
2021-08-25 13:38   ` Marc Zyngier
2021-08-25 13:38     ` [Intel-wired-lan] " Marc Zyngier
2021-08-29 14:55   ` [PCI/MSI] a4fc4cf388: dmesg.genirq:Flags_mismatch_irq##(mei_me)vs.#(xhci_hcd) kernel test robot
2021-08-29 14:55     ` kernel test robot
2021-08-29 14:55     ` [Intel-wired-lan] " kernel test robot
2021-08-31  1:21     ` Barry Song
2021-08-31  1:21       ` Barry Song
2021-08-31  1:21       ` [Intel-wired-lan] " Barry Song
2021-08-31  1:36       ` Barry Song
2021-08-31  1:36         ` Barry Song
2021-08-31  1:36         ` [Intel-wired-lan] " Barry Song
2021-09-02 19:34         ` Winkler, Tomas
2021-09-02 19:34           ` Winkler, Tomas
2021-09-02 19:34           ` [Intel-wired-lan] " Winkler, Tomas
2021-10-03  8:32           ` Barry Song [this message]
2021-10-03  8:32             ` Barry Song
2021-10-03  8:32             ` [Intel-wired-lan] " Barry Song
2021-10-15 14:45             ` [LKP] " Carel Si
2021-10-15 14:45               ` Carel Si
2021-10-15 14:45               ` [Intel-wired-lan] [LKP] " Carel Si
2021-10-16  0:08               ` Barry Song
2021-10-16  0:08                 ` Barry Song
2021-10-16  0:08                 ` [Intel-wired-lan] [LKP] " Barry Song
2021-10-19  6:52                 ` Carel Si
2021-10-19  6:52                   ` Carel Si
2021-10-19  6:52                   ` [Intel-wired-lan] [LKP] " Carel Si
2021-08-31  8:08       ` Marc Zyngier
2021-08-31  8:08         ` Marc Zyngier
2021-08-31  8:08         ` [Intel-wired-lan] " Marc Zyngier
2021-08-31 21:36         ` Barry Song
2021-08-31 21:36           ` Barry Song
2021-08-31 21:36           ` [Intel-wired-lan] " Barry Song
2021-09-01 13:09           ` Marc Zyngier
2021-09-01 13:09             ` Marc Zyngier
2021-09-01 13:09             ` [Intel-wired-lan] " Marc Zyngier
2021-10-16 10:11 ` [PATCH v3 0/3] PCI/MSI: Clarify the IRQ sysfs ABI for PCI devices Barry Song
2021-10-16 10:11   ` [Intel-wired-lan] " Barry Song
2021-10-18 21:50 ` Bjorn Helgaas
2021-10-18 21:50   ` [Intel-wired-lan] " Bjorn Helgaas
2021-10-19  7:39   ` Marc Zyngier
2021-10-19  7:39     ` [Intel-wired-lan] " Marc Zyngier

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='CAGsJ_4ygPbLFqpRu7_N4RvfTY++OumQCFz=yxgcnb3VoqPwRAg@mail.gmail.com' \
    --to=21cnbao@gmail.com \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=anthony.l.nguyen@intel.com \
    --cc=bhelgaas@google.com \
    --cc=bilbao@vt.edu \
    --cc=corbet@lwn.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=jesse.brandeburg@intel.com \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=lkp@intel.com \
    --cc=lkp@lists.01.org \
    --cc=luzmaximilian@gmail.com \
    --cc=maz@kernel.org \
    --cc=mchehab+huawei@kernel.org \
    --cc=oliver.sang@intel.com \
    --cc=schnelle@linux.ibm.com \
    --cc=song.bao.hua@hisilicon.com \
    --cc=tglx@linutronix.de \
    --cc=tomas.winkler@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.