From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 253113C3432 for ; Tue, 12 May 2026 07:22:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.133 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778570569; cv=none; b=eZy0/QOF4gXFaU5DTv+fA4vPwSRAxEUqDc31AzFrflIgnu9oyz0ecvB7a2y8oIyOZfbQcAVZbu/kLzHFWODwLaf0T8X35hIboNE+HR2NG+YkNoQ1EM4UJYqJY5SP5xkNzHSfqGCCD9jRrSQMmw1c+jr4V0lXfFDR+UOMvVldWTI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778570569; c=relaxed/simple; bh=yD8lBTY3FzSmhgTNHYTOOlJGrZyr1bmv/cEbYVbWoCc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=aOOZoK505mKywfGOCaGXob7LG4igBl5YJ5UCH61YQXnpY69TWaTnLQtF5V874tLCY9BCg8K47uQyoMB4iYFnD2oDU+OfzdOiC0gWqKuKoeYaizFNl8+vuP74vi/Vnb8ugbmACVAEvTYDLnV0whan0ZgC9FqhbrgeNgoN6rJ3J84= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=KGcCIkVp; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="KGcCIkVp" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=WBXJrpX4o5ySU0yBlg+HveZcx5GYzeIrv7sJ3ISrK7k=; b=KGcCIkVpJ047bmHnZ3cMpJSZCc HboNf7pzCvoZQrMJ8dolHTufKN2+3WajRbNFtw36lW3+xM8At+z/7zsjmnioAAzsFAFcm9Pq3fAQe yP4aK8JGvTLdnphI7PYfqmCnF0qHtwkZpbm2il+neqdCXGkEk0lhCrJTPvLq6htW1OMtSCNd9zMsm nkvL2k9cYOyhxjbKa/81VRUnT5gR/yLgzGJozTZgalR1iyJBPEKUym8OsJD1pRm/PC7Dzv312XZ5/ QRQbg5CeApgQfubiccjLvvPFTNL8CIOiHHhCvDiYPW4kwt82q6SO+1RIEMTwMR63mPnuExVc9iesV 2WizK88A==; Received: from hch by bombadil.infradead.org with local (Exim 4.99.1 #2 (Red Hat Linux)) id 1wMhRw-0000000FuPz-0gV7; Tue, 12 May 2026 07:22:40 +0000 Date: Tue, 12 May 2026 00:22:40 -0700 From: Christoph Hellwig To: Ravi Kumar Bandi 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 Message-ID: References: <20260511161643.30662-1-ravib@amazon.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260511161643.30662-1-ravib@amazon.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html 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.