From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
patches@lists.linux.dev, kernel test robot <lkp@intel.com>,
Juergen Gross <jgross@suse.com>,
Boris Ostrovsky <boris.ostrovsky@oracle.com>,
Stefano Stabellini <sstabellini@kernel.org>,
Teddy Astie <teddy.astie@vates.tech>
Subject: [PATCH 5.15 25/77] xen: replace xen_remap() with memremap()
Date: Tue, 15 Jul 2025 15:13:24 +0200 [thread overview]
Message-ID: <20250715130752.716454036@linuxfoundation.org> (raw)
In-Reply-To: <20250715130751.668489382@linuxfoundation.org>
5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Juergen Gross <jgross@suse.com>
commit 41925b105e345ebc84cedb64f59d20cb14a62613 upstream.
xen_remap() is used to establish mappings for frames not under direct
control of the kernel: for Xenstore and console ring pages, and for
grant pages of non-PV guests.
Today xen_remap() is defined to use ioremap() on x86 (doing uncached
mappings), and ioremap_cache() on Arm (doing cached mappings).
Uncached mappings for those use cases are bad for performance, so they
should be avoided if possible. As all use cases of xen_remap() don't
require uncached mappings (the mapped area is always physical RAM),
a mapping using the standard WB cache mode is fine.
As sparse is flagging some of the xen_remap() use cases to be not
appropriate for iomem(), as the result is not annotated with the
__iomem modifier, eliminate xen_remap() completely and replace all
use cases with memremap() specifying the MEMREMAP_WB caching mode.
xen_unmap() can be replaced with memunmap().
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Acked-by: Stefano Stabellini <sstabellini@kernel.org>
Link: https://lore.kernel.org/r/20220530082634.6339-1-jgross@suse.com
Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Teddy Astie <teddy.astie@vates.tech> [backport to 5.15.y]
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/x86/include/asm/xen/page.h | 3 ---
drivers/tty/hvc/hvc_xen.c | 2 +-
drivers/xen/grant-table.c | 6 +++---
drivers/xen/xenbus/xenbus_probe.c | 3 +--
include/xen/arm/page.h | 3 ---
5 files changed, 5 insertions(+), 12 deletions(-)
--- a/arch/x86/include/asm/xen/page.h
+++ b/arch/x86/include/asm/xen/page.h
@@ -355,9 +355,6 @@ unsigned long arbitrary_virt_to_mfn(void
void make_lowmem_page_readonly(void *vaddr);
void make_lowmem_page_readwrite(void *vaddr);
-#define xen_remap(cookie, size) ioremap((cookie), (size))
-#define xen_unmap(cookie) iounmap((cookie))
-
static inline bool xen_arch_need_swiotlb(struct device *dev,
phys_addr_t phys,
dma_addr_t dev_addr)
--- a/drivers/tty/hvc/hvc_xen.c
+++ b/drivers/tty/hvc/hvc_xen.c
@@ -270,7 +270,7 @@ static int xen_hvm_console_init(void)
if (r < 0 || v == 0)
goto err;
gfn = v;
- info->intf = xen_remap(gfn << XEN_PAGE_SHIFT, XEN_PAGE_SIZE);
+ info->intf = memremap(gfn << XEN_PAGE_SHIFT, XEN_PAGE_SIZE, MEMREMAP_WB);
if (info->intf == NULL)
goto err;
info->vtermno = HVC_COOKIE;
--- a/drivers/xen/grant-table.c
+++ b/drivers/xen/grant-table.c
@@ -743,7 +743,7 @@ int gnttab_setup_auto_xlat_frames(phys_a
if (xen_auto_xlat_grant_frames.count)
return -EINVAL;
- vaddr = xen_remap(addr, XEN_PAGE_SIZE * max_nr_gframes);
+ vaddr = memremap(addr, XEN_PAGE_SIZE * max_nr_gframes, MEMREMAP_WB);
if (vaddr == NULL) {
pr_warn("Failed to ioremap gnttab share frames (addr=%pa)!\n",
&addr);
@@ -751,7 +751,7 @@ int gnttab_setup_auto_xlat_frames(phys_a
}
pfn = kcalloc(max_nr_gframes, sizeof(pfn[0]), GFP_KERNEL);
if (!pfn) {
- xen_unmap(vaddr);
+ memunmap(vaddr);
return -ENOMEM;
}
for (i = 0; i < max_nr_gframes; i++)
@@ -770,7 +770,7 @@ void gnttab_free_auto_xlat_frames(void)
if (!xen_auto_xlat_grant_frames.count)
return;
kfree(xen_auto_xlat_grant_frames.pfn);
- xen_unmap(xen_auto_xlat_grant_frames.vaddr);
+ memunmap(xen_auto_xlat_grant_frames.vaddr);
xen_auto_xlat_grant_frames.pfn = NULL;
xen_auto_xlat_grant_frames.count = 0;
--- a/drivers/xen/xenbus/xenbus_probe.c
+++ b/drivers/xen/xenbus/xenbus_probe.c
@@ -982,8 +982,7 @@ static int __init xenbus_init(void)
#endif
xen_store_gfn = (unsigned long)v;
xen_store_interface =
- xen_remap(xen_store_gfn << XEN_PAGE_SHIFT,
- XEN_PAGE_SIZE);
+ memremap(xen_store_gfn << XEN_PAGE_SHIFT, XEN_PAGE_SIZE, MEMREMAP_WB);
break;
default:
pr_warn("Xenstore state unknown\n");
--- a/include/xen/arm/page.h
+++ b/include/xen/arm/page.h
@@ -109,9 +109,6 @@ static inline bool set_phys_to_machine(u
return __set_phys_to_machine(pfn, mfn);
}
-#define xen_remap(cookie, size) ioremap_cache((cookie), (size))
-#define xen_unmap(cookie) iounmap((cookie))
-
bool xen_arch_need_swiotlb(struct device *dev,
phys_addr_t phys,
dma_addr_t dev_addr);
next prev parent reply other threads:[~2025-07-15 13:28 UTC|newest]
Thread overview: 86+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-15 13:12 [PATCH 5.15 00/77] 5.15.189-rc1 review Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 5.15 01/77] drm/exynos: exynos7_drm_decon: add vblank check in IRQ handling Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 5.15 02/77] ASoC: fsl_asrc: use internal measured ratio for non-ideal ratio mode Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 5.15 03/77] perf: Revert to requiring CAP_SYS_ADMIN for uprobes Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 5.15 04/77] fix proc_sys_compare() handling of in-lookup dentries Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 5.15 05/77] netlink: Fix wraparounds of sk->sk_rmem_alloc Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 5.15 06/77] tipc: Fix use-after-free in tipc_conn_close() Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 5.15 07/77] vsock: Fix transport_{g2h,h2g} TOCTOU Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 5.15 08/77] vsock: Fix transport_* TOCTOU Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 5.15 09/77] vsock: Fix IOCTL_VM_SOCKETS_GET_LOCAL_CID to check also `transport_local` Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 5.15 10/77] net: phy: smsc: Fix Auto-MDIX configuration when disabled by strap Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 5.15 11/77] net: phy: smsc: Fix link failure in forced mode with Auto-MDIX Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 5.15 12/77] atm: clip: Fix potential null-ptr-deref in to_atmarpd() Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 5.15 13/77] atm: clip: Fix memory leak of struct clip_vcc Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 5.15 14/77] atm: clip: Fix infinite recursive call of clip_push() Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 5.15 15/77] atm: clip: Fix NULL pointer dereference in vcc_sendmsg() Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 5.15 16/77] net/sched: Abort __tc_modify_qdisc if parent class does not exist Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 5.15 17/77] fs/proc: do_task_stat: use __for_each_thread() Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 5.15 18/77] ice: safer stats processing Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 5.15 19/77] rxrpc: Fix oops due to non-existence of prealloc backlog struct Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 5.15 20/77] bpf: fix precision backtracking instruction iteration Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 5.15 21/77] thermal/int340x_thermal: handle data_vault when the value is ZERO_SIZE_PTR Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 5.15 22/77] aoe: avoid potential deadlock at set_capacity Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 5.15 23/77] bpf, sockmap: Fix skb refcnt race after locking changes Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 5.15 24/77] jfs: fix null ptr deref in dtInsertEntry Greg Kroah-Hartman
2025-07-15 13:13 ` Greg Kroah-Hartman [this message]
2025-07-15 13:13 ` [PATCH 5.15 26/77] x86/mce/amd: Fix threshold limit reset Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 5.15 27/77] x86/mce: Dont remove sysfs if thresholding sysfs init fails Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 5.15 28/77] x86/mce: Make sure CMCI banks are cleared during shutdown on Intel Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 5.15 29/77] gre: Fix IPv6 multicast route creation Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 5.15 30/77] pinctrl: qcom: msm: mark certain pins as invalid for interrupts Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 5.15 31/77] drm/sched: Increment job count before swapping tail spsc queue Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 5.15 32/77] drm/gem: Fix race in drm_gem_handle_create_tail() Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 5.15 33/77] usb: gadget: u_serial: Fix race condition in TTY wakeup Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 5.15 34/77] Revert "ACPI: battery: negate current when discharging" Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 5.15 35/77] btrfs: propagate last_unlink_trans earlier when doing a rmdir Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 5.15 36/77] btrfs: use btrfs_record_snapshot_destroy() during rmdir Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 5.15 37/77] RDMA/mlx5: Fix vport loopback for MPV device Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 5.15 38/77] pwm: mediatek: Ensure to disable clocks in error path Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 5.15 39/77] netlink: Fix rmem check in netlink_broadcast_deliver() Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 5.15 40/77] netlink: make sure we allow at least one dump skb Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 5.15 41/77] virtio-net: ensure the received length does not exceed allocated size Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 5.15 42/77] xhci: Allow RPM on the USB controller (1022:43f7) by default Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 5.15 43/77] usb: xhci: quirk for data loss in ISOC transfers Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 5.15 44/77] xhci: Disable stream for xHC controller with XHCI_BROKEN_STREAMS Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 5.15 45/77] Input: xpad - support Acer NGR 200 Controller Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 5.15 46/77] usb:cdnsp: remove TRB_FLUSH_ENDPOINT command Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 5.15 47/77] usb: cdnsp: Replace snprintf() with the safer scnprintf() variant Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 5.15 48/77] usb: cdnsp: Fix issue with CV Bad Descriptor test Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 5.15 49/77] usb: dwc3: Abort suspend on soft disconnect failure Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 5.15 50/77] dma-buf: add dma_resv_for_each_fence_unlocked v8 Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 5.15 51/77] dma-buf: use new iterator in dma_resv_wait_timeout Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 5.15 52/77] dma-buf: fix timeout handling in dma_resv_wait_timeout v2 Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 5.15 53/77] platform/x86: think-lmi: Fix sysfs group cleanup Greg Kroah-Hartman
2025-07-15 18:38 ` Kurt Borja
2025-07-15 19:00 ` Kurt Borja
2025-07-15 19:04 ` Sasha Levin
2025-07-15 19:22 ` Kurt Borja
2025-07-15 19:12 ` Sasha Levin
2025-07-15 21:18 ` Kurt Borja
2025-07-15 13:13 ` [PATCH 5.15 54/77] wifi: zd1211rw: Fix potential NULL pointer dereference in zd_mac_tx_to_dev() Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 5.15 55/77] md/raid1: Fix stack memory use after return in raid1_reshape Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 5.15 56/77] raid10: cleanup memleak at raid10_make_request Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 5.15 57/77] nbd: fix uaf in nbd_genl_connect() error path Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 5.15 58/77] smb: server: make use of rdma_destroy_qp() Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 5.15 59/77] ksmbd: fix a mount write count leak in ksmbd_vfs_kern_path_locked() Greg Kroah-Hartman
2025-07-15 13:13 ` [PATCH 5.15 60/77] netfilter: flowtable: account for Ethernet header in nf_flow_pppoe_proto() Greg Kroah-Hartman
2025-07-15 13:14 ` [PATCH 5.15 61/77] net: appletalk: Fix device refcount leak in atrtr_create() Greg Kroah-Hartman
2025-07-15 13:14 ` [PATCH 5.15 62/77] net: phy: microchip: limit 100M workaround to link-down events on LAN88xx Greg Kroah-Hartman
2025-07-15 13:14 ` [PATCH 5.15 63/77] can: m_can: m_can_handle_lost_msg(): downgrade msg lost in rx message to debug level Greg Kroah-Hartman
2025-07-15 13:14 ` [PATCH 5.15 64/77] net: ll_temac: Fix missing tx_pending check in ethtools_set_ringparam() Greg Kroah-Hartman
2025-07-15 13:14 ` [PATCH 5.15 65/77] bnxt_en: Fix DCB ETS validation Greg Kroah-Hartman
2025-07-15 13:14 ` [PATCH 5.15 66/77] bnxt_en: Set DMA unmap len correctly for XDP_REDIRECT Greg Kroah-Hartman
2025-07-15 13:14 ` [PATCH 5.15 67/77] atm: idt77252: Add missing `dma_map_error()` Greg Kroah-Hartman
2025-07-15 13:14 ` [PATCH 5.15 68/77] um: vector: Reduce stack usage in vector_eth_configure() Greg Kroah-Hartman
2025-07-15 13:14 ` [PATCH 5.15 69/77] net: usb: qmi_wwan: add SIMCom 8230C composition Greg Kroah-Hartman
2025-07-15 13:14 ` [PATCH 5.15 70/77] HID: lenovo: Add support for ThinkPad X1 Tablet Thin Keyboard Gen2 Greg Kroah-Hartman
2025-07-15 13:14 ` [PATCH 5.15 71/77] vt: add missing notification when switching back to text mode Greg Kroah-Hartman
2025-07-15 13:14 ` [PATCH 5.15 72/77] HID: Add IGNORE quirk for SMARTLINKTECHNOLOGY Greg Kroah-Hartman
2025-07-15 13:14 ` [PATCH 5.15 73/77] HID: quirks: Add quirk for 2 Chicony Electronics HP 5MP Cameras Greg Kroah-Hartman
2025-07-15 13:14 ` [PATCH 5.15 74/77] Input: atkbd - do not skip atkbd_deactivate() when skipping ATKBD_CMD_GETID Greg Kroah-Hartman
2025-07-15 13:14 ` [PATCH 5.15 75/77] vhost-scsi: protect vq->log_used with vq->mutex Greg Kroah-Hartman
2025-07-15 13:14 ` [PATCH 5.15 76/77] x86/mm: Disable hugetlb page table sharing on 32-bit Greg Kroah-Hartman
2025-07-15 13:14 ` [PATCH 5.15 77/77] x86: Fix X86_FEATURE_VERW_CLEAR definition Greg Kroah-Hartman
2025-07-15 16:20 ` [PATCH 5.15 00/77] 5.15.189-rc1 review Vijayendra Suman
2025-07-16 14:59 ` Shuah Khan
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=20250715130752.716454036@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=boris.ostrovsky@oracle.com \
--cc=jgross@suse.com \
--cc=lkp@intel.com \
--cc=patches@lists.linux.dev \
--cc=sstabellini@kernel.org \
--cc=stable@vger.kernel.org \
--cc=teddy.astie@vates.tech \
/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;
as well as URLs for NNTP newsgroup(s).