public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Johan Hovold <johan@kernel.org>
Cc: "Bjorn Helgaas" <helgaas@kernel.org>,
	"Pali Rohár" <pali@kernel.org>,
	"Johan Hovold" <johan+linaro@kernel.org>,
	"Kishon Vijay Abraham I" <kishon@ti.com>,
	"Xiaowei Song" <songxiaowei@hisilicon.com>,
	"Binghui Wang" <wangbinghui@hisilicon.com>,
	"Thierry Reding" <thierry.reding@gmail.com>,
	"Ryder Lee" <ryder.lee@mediatek.com>,
	"Jianjun Wang" <jianjun.wang@mediatek.com>,
	linux-pci@vger.kernel.org, "Krzysztof Wilczyński" <kw@linux.com>,
	"Ley Foon Tan" <ley.foon.tan@intel.com>,
	linux-kernel@vger.kernel.org
Subject: Re: Why set .suppress_bind_attrs even though .remove() implemented?
Date: Mon, 25 Jul 2022 15:43:40 +0100	[thread overview]
Message-ID: <87czdtxnfn.wl-maz@kernel.org> (raw)
In-Reply-To: <Yt6Z3cBrVy1lVTp1@hovoldconsulting.com>

On Mon, 25 Jul 2022 14:25:49 +0100,
Johan Hovold <johan@kernel.org> wrote:
> 
> [ +CC: maz ]
> 
> On Fri, Jul 22, 2022 at 09:38:58AM -0500, Bjorn Helgaas wrote:
> > On Fri, Jul 22, 2022 at 03:26:44PM +0200, Johan Hovold wrote:
> > > On Thu, Jul 21, 2022 at 05:21:22PM -0500, Bjorn Helgaas wrote:
> > 
> > > > qcom is a DWC driver, so all the IRQ stuff happens in
> > > > dw_pcie_host_init().  qcom_pcie_remove() does call
> > > > dw_pcie_host_deinit(), which calls irq_domain_remove(), but nobody
> > > > calls irq_dispose_mapping().
> > > > 
> > > > I'm thoroughly confused by all this.  But I suspect that maybe I
> > > > should drop the "make qcom modular" patch because it seems susceptible
> > > > to this problem:
> > > > 
> > > >   https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git/commit/?h=pci/ctrl/qcom&id=41b68c2d097e
> > > 
> > > That should not be necessary.
> > > 
> > > As you note above, interrupt handling is implemented in dwc core so if
> > > there are any issue here at all, which I doubt, then all of the dwc
> > > drivers that currently can be built as modules would all be broken and
> > > this would need to be fixed in core.
> > 
> > I don't know yet whether there's an issue.  We need a clear argument
> > for why there is or is not.  The fact that others might be broken is
> > not an argument for breaking another one ;)
> 
> It's not breaking anything that is currently working, and if there's
> some corner case during module unload, that's not the end of the world
> either.

It may not be the end of the world for you, but you have absolutely no
idea of what dangling pointers to kernel memory will do on a user
machine, nor how this can be further exploited. Unloading a module
should never result in an unsafe kernel.

> It's a feature useful for developers and no one expects remove code to
> be perfect (e.g. resilient against someone trying to break it by doing
> things in parallel, etc.).

If that's a feature for you while you are developing, then please keep
this change as part of your own hacking toolbox. IMO the upstream
kernel shouldn't be subjected to this.

> 
> > > I've been using the modular pcie-qcom patch for months now, unloading
> > > and reloading the driver repeatedly to test power sequencing, without
> > > noticing any problems whatsoever.
> > 
> > Pali's commit log suggests that unloading the module is not, by
> > itself, enough to trigger the problem:
> > 
> >   https://lore.kernel.org/linux-pci/20220709161858.15031-1-pali@kernel.org/
> > 
> > Can you test the scenario he mentions?
> 
> Turns out the pcie-qcom driver does not support legacy interrupts so
> there's no risk of there being any lingering mappings if I understand
> things correctly.

It still does MSIs, thanks to dw_pcie_host_init(). If you can remove
the driver while devices are up and running with MSIs allocated,
things may get ugly if things align the wrong way (if a driver still
has a reference to an irq_desc or irq_data, for example).

	M.

-- 
Without deviation from the norm, progress is not possible.

  reply	other threads:[~2022-07-25 14:43 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-21 19:54 Why set .suppress_bind_attrs even though .remove() implemented? Bjorn Helgaas
2022-07-21 20:46 ` Pali Rohár
2022-07-21 20:48   ` Conor.Dooley
2022-07-21 22:21   ` Bjorn Helgaas
2022-07-21 22:48     ` Pali Rohár
2022-07-22 13:26     ` Johan Hovold
2022-07-22 14:38       ` Bjorn Helgaas
2022-07-25 13:25         ` Johan Hovold
2022-07-25 14:43           ` Marc Zyngier [this message]
2022-07-25 15:18             ` Johan Hovold
2022-07-25 17:35               ` Marc Zyngier
2022-07-26  9:56                 ` Johan Hovold
2022-07-27 19:57                   ` Bjorn Helgaas
2022-07-28 12:17                     ` Johan Hovold
2024-10-17  5:23                       ` Manivannan Sadhasivam
2024-10-17  7:50                         ` Marc Zyngier
2024-10-17  8:25                           ` Manivannan Sadhasivam
2024-10-17  8:48                             ` Marc Zyngier
2024-10-17  9:30                               ` Manivannan Sadhasivam
2024-10-17  9:56                                 ` Marc Zyngier
2022-09-27 15:27                 ` Lorenzo Pieralisi
2022-09-28  6:36                   ` Johan Hovold
2022-07-22 14:39     ` Bjorn Helgaas
2022-07-22 17:06       ` Marc Zyngier
2022-07-22 17:17         ` Bjorn Helgaas
2022-07-24  9:38           ` Marc Zyngier
2022-07-25 20:18             ` Florian Fainelli
2022-07-25 17:49         ` Conor.Dooley
2022-07-26  7:26           ` 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=87czdtxnfn.wl-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=helgaas@kernel.org \
    --cc=jianjun.wang@mediatek.com \
    --cc=johan+linaro@kernel.org \
    --cc=johan@kernel.org \
    --cc=kishon@ti.com \
    --cc=kw@linux.com \
    --cc=ley.foon.tan@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=pali@kernel.org \
    --cc=ryder.lee@mediatek.com \
    --cc=songxiaowei@hisilicon.com \
    --cc=thierry.reding@gmail.com \
    --cc=wangbinghui@hisilicon.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox