public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Siddharth Vadapalli <s-vadapalli@ti.com>
To: Bjorn Helgaas <helgaas@kernel.org>
Cc: <lpieralisi@kernel.org>, <kwilczynski@kernel.org>,
	<mani@kernel.org>, <robh@kernel.org>, <bhelgaas@google.com>,
	<cassel@kernel.org>, <kishon@kernel.org>,
	<sergio.paracuellos@gmail.com>, <18255117159@163.com>,
	<jirislaby@kernel.org>, <m-karicheri2@ti.com>,
	<santosh.shilimkar@ti.com>, <stable@vger.kernel.org>,
	<linux-pci@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>, <srk@ti.com>,
	<s-vadapalli@ti.com>
Subject: Re: [PATCH 2/2] PCI: keystone: Remove the __init macro for the ks_pcie_host_init() callback
Date: Wed, 22 Oct 2025 15:33:50 +0530	[thread overview]
Message-ID: <1d9ba815214ba97e2a9a6d091661cf59ae22c7ca.camel@ti.com> (raw)
In-Reply-To: <20251002143627.GA267439@bhelgaas>

On Thu, 2025-10-02 at 09:36 -0500, Bjorn Helgaas wrote:

Hello Bjorn,

> On Fri, Sep 12, 2025 at 03:37:59PM +0530, Siddharth Vadapalli wrote:
> > The ks_pcie_host_init() callback registered by the driver is invoked by
> > dw_pcie_host_init(). Since the driver probe is not guaranteed to finish
> > before the kernel initialization phase, the memory associated with
> > ks_pcie_host_init() may already be freed by free_initmem().
> > 
> > It is observed in practice that the print associated with free_initmem()
> > which is:
> > 	"Freeing unused kernel memory: ..."
> > is displayed before the driver is probed, following which an exception is
> > triggered when ks_pcie_host_init() is invoked which looks like:
> > 
> > 	Unable to handle kernel paging request at virtual address ...
> > 	Mem abort info:
> > 	...
> > 	pc : ks_pcie_host_init+0x0/0x540
> > 	lr : dw_pcie_host_init+0x170/0x498
> > 	...
> > 	ks_pcie_host_init+0x0/0x540 (P)
> > 	ks_pcie_probe+0x728/0x84c
> > 	platform_probe+0x5c/0x98
> > 	really_probe+0xbc/0x29c
> > 	__driver_probe_device+0x78/0x12c
> > 	driver_probe_device+0xd8/0x15c
> > 	...
> > 
> > Fix this by removing the "__init" macro associated with the
> > ks_pcie_host_init() callback and the ks_pcie_init_id() function that it
> > internally invokes.
> > 
> > Fixes: 0c4ffcfe1fbc ("PCI: keystone: Add TI Keystone PCIe driver")
> > Cc: <stable@vger.kernel.org>
> > Signed-off-by: Siddharth Vadapalli <s-vadapalli@ti.com>
> 
> I dropped this from pci/controller/keystone because of the resulting
> section mismatch:
> 
>   https://lore.kernel.org/r/202510010726.GPljD7FR-lkp@intel.com
> 
> ks_pcie_host_init() calls hook_fault_code(), which is __init, so we
> can't make ks_pcie_host_init() non-__init.
> 
> Both are bad problems, but there's no point in just swapping one
> problem for a different one.

Since this patch is required only for the case where the driver supports
being built as a loadable module, I have reworked on the patch and have
squashed it into patch 4 of the following series:
https://lore.kernel.org/r/20251022095724.997218-5-s-vadapalli@ti.com/
The implementation above ensures that 'hook_fault_code()' is placed within
an '__init' function while the '__init' keywords can safely be removed from
the remaining functions. Please review and let me know.

Regards,
Siddharth.


  reply	other threads:[~2025-10-22 10:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-12 10:07 [PATCH 0/2] PCI: Keystone: __init and IRQ Fixes Siddharth Vadapalli
2025-09-12 10:07 ` [PATCH 1/2] PCI: keystone: Use devm_request_irq() to free "ks-pcie-error-irq" on exit Siddharth Vadapalli
2025-09-12 10:07 ` [PATCH 2/2] PCI: keystone: Remove the __init macro for the ks_pcie_host_init() callback Siddharth Vadapalli
2025-10-02 14:36   ` Bjorn Helgaas
2025-10-22 10:03     ` Siddharth Vadapalli [this message]
2025-09-29 16:25 ` [PATCH 0/2] PCI: Keystone: __init and IRQ Fixes Manivannan Sadhasivam

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=1d9ba815214ba97e2a9a6d091661cf59ae22c7ca.camel@ti.com \
    --to=s-vadapalli@ti.com \
    --cc=18255117159@163.com \
    --cc=bhelgaas@google.com \
    --cc=cassel@kernel.org \
    --cc=helgaas@kernel.org \
    --cc=jirislaby@kernel.org \
    --cc=kishon@kernel.org \
    --cc=kwilczynski@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=m-karicheri2@ti.com \
    --cc=mani@kernel.org \
    --cc=robh@kernel.org \
    --cc=santosh.shilimkar@ti.com \
    --cc=sergio.paracuellos@gmail.com \
    --cc=srk@ti.com \
    --cc=stable@vger.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