The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Ravi Kumar Bandi <ravib@amazon.com>
Cc: hch@infradead.org, david@kernel.org, akpm@linux-foundation.org,
	bhelgaas@google.com, djbw@kernel.org,
	ilpo.jarvinen@linux.intel.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] resource: export iomem_get_mapping() for loadable modules
Date: Tue, 12 May 2026 00:22:40 -0700	[thread overview]
Message-ID: <agLVQPEKVLJNoU7p@infradead.org> (raw)
In-Reply-To: <20260511161643.30662-1-ravib@amazon.com>

On Mon, May 11, 2026 at 04:16:43PM +0000, Ravi Kumar Bandi wrote:
> On Mon, May 11, 2026 at 00:17:45 -0700, Christoph Hellwig wrote:
> > And why?
> 
> On Mon, May 11, 2026 at 09:14:04 +0200, David Hildenbrand wrote:
> > Which in-tree driver wants to make use of this?
> 
> Thank you both for reviewing the patch.
> 
> Currently this is needed by a PCIe endpoint driver that handles surprise
> removal on a device without a hot-plug pin routed to the CPU.

Which endpoint driver?

> When link-down is detected, the endpoint driver needs to zap existing
> userspace BAR mappings (mmap'd via sysfs resource files) to deliver SIGBUS
> rather than leaving stale mappings to a dead device, preventing kernel
> crashes on subsequent accesses.

Why would the endpoint driver map iomem to userspace?

> unmap_mapping_range() is already EXPORT_SYMBOL'd for this purpose
> (mm/memory.c), but without iomem_get_mapping() being exported, loadable
> modules cannot use it correctly for PCI BAR mappings, forcing ugly
> workarounds such as walking all process VMAs.

Well, we need to see the user(s) first, but once they materialize this
begs for a higher level API.  Until then it is moot anyway.


  parent reply	other threads:[~2026-05-12  7:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-11  6:56 [PATCH] resource: export iomem_get_mapping() for loadable modules Ravi Kumar Bandi
2026-05-11  7:14 ` David Hildenbrand (Arm)
2026-05-11  7:17   ` Christoph Hellwig
2026-05-11 16:16     ` Ravi Kumar Bandi
2026-05-12  7:10       ` David Hildenbrand (Arm)
2026-05-12  7:31         ` Ravi Kumar Bandi
2026-05-12  7:22       ` Christoph Hellwig [this message]
2026-05-12  7:50         ` Ravi Kumar Bandi

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=agLVQPEKVLJNoU7p@infradead.org \
    --to=hch@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=bhelgaas@google.com \
    --cc=david@kernel.org \
    --cc=djbw@kernel.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ravib@amazon.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