* [PATCH 0/5] uprobes: transition from kmap_atomic to kmap_local_page
@ 2026-01-03 8:42 Keke Ming
2026-01-03 8:42 ` [PATCH 1/5] riscv/uprobes: use kmap_local_page() in arch_uprobe_copy_ixol() Keke Ming
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: Keke Ming @ 2026-01-03 8:42 UTC (permalink / raw)
To: mhiramat, oleg, peterz
Cc: linux, catalin.marinas, will, tsbogend, pjw, palmer, aou, akpm,
linux-kernel, linux-trace-kernel, linux-mm, linux-arm-kernel,
linux-mips, linux-riscv, Keke Ming
The use of kmap_atomic/kunmap_atomic is deprecated. The purpose of
kmap-like functions is to create temporary mappings.
kmap_atomic() typically disables preemption, while kmap_local_page()
allows preemption.
According to the documentation, kmap_atomic() is primarily necessary
for contexts that cannot sleep.
> kmap_atomic() may also be used by interrupt contexts, since it does
> not sleep and the callers too may not sleep until after
> kunmap_atomic() is called.
> kunmap_atomic() may implicitly depend on the side effects of atomic
> mappings, i.e. disabling page faults or preemption, or both. In that
> case, explicit calls to pagefault_disable() or preempt_disable() or
> both must be made in conjunction with the use of kmap_local_page().
Link: https://docs.kernel.org/mm/highmem.html#temporary-virtual-mappings
Link: https://lwn.net/Articles/836144/
Keke Ming (5):
riscv/uprobes: use kmap_local_page() in arch_uprobe_copy_ixol()
arm64/uprobes: use kmap_local_page() in arch_uprobe_copy_ixol()
mips/uprobes: use kmap_local_page() in arch_uprobe_copy_ixol()
arm/uprobes: use kmap_local_page() in arch_uprobe_copy_ixol()
uprobes: use kmap_local_page() for temporary page mappings
arch/arm/probes/uprobes/core.c | 4 ++--
arch/arm64/kernel/probes/uprobes.c | 4 ++--
arch/mips/kernel/uprobes.c | 4 ++--
arch/riscv/kernel/probes/uprobes.c | 4 ++--
kernel/events/uprobes.c | 12 ++++++------
5 files changed, 14 insertions(+), 14 deletions(-)
--
2.43.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/5] riscv/uprobes: use kmap_local_page() in arch_uprobe_copy_ixol()
2026-01-03 8:42 [PATCH 0/5] uprobes: transition from kmap_atomic to kmap_local_page Keke Ming
@ 2026-01-03 8:42 ` Keke Ming
2026-01-03 8:42 ` [PATCH 2/5] arm64/uprobes: " Keke Ming
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Keke Ming @ 2026-01-03 8:42 UTC (permalink / raw)
To: mhiramat, oleg, peterz
Cc: linux, catalin.marinas, will, tsbogend, pjw, palmer, aou, akpm,
linux-kernel, linux-trace-kernel, linux-mm, linux-arm-kernel,
linux-mips, linux-riscv, Keke Ming
Replace deprecated kmap_atomic() with kmap_local_page().
Signed-off-by: Keke Ming <ming.jvle@gmail.com>
---
arch/riscv/kernel/probes/uprobes.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/riscv/kernel/probes/uprobes.c b/arch/riscv/kernel/probes/uprobes.c
index cc15f7ca6cc1..f0d0691a8688 100644
--- a/arch/riscv/kernel/probes/uprobes.c
+++ b/arch/riscv/kernel/probes/uprobes.c
@@ -165,7 +165,7 @@ void arch_uprobe_copy_ixol(struct page *page, unsigned long vaddr,
void *src, unsigned long len)
{
/* Initialize the slot */
- void *kaddr = kmap_atomic(page);
+ void *kaddr = kmap_local_page(page);
void *dst = kaddr + (vaddr & ~PAGE_MASK);
unsigned long start = (unsigned long)dst;
@@ -178,5 +178,5 @@ void arch_uprobe_copy_ixol(struct page *page, unsigned long vaddr,
}
flush_icache_range(start, start + len);
- kunmap_atomic(kaddr);
+ kunmap_local(kaddr);
}
--
2.43.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/5] arm64/uprobes: use kmap_local_page() in arch_uprobe_copy_ixol()
2026-01-03 8:42 [PATCH 0/5] uprobes: transition from kmap_atomic to kmap_local_page Keke Ming
2026-01-03 8:42 ` [PATCH 1/5] riscv/uprobes: use kmap_local_page() in arch_uprobe_copy_ixol() Keke Ming
@ 2026-01-03 8:42 ` Keke Ming
2026-01-03 8:42 ` [PATCH 3/5] mips/uprobes: " Keke Ming
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Keke Ming @ 2026-01-03 8:42 UTC (permalink / raw)
To: mhiramat, oleg, peterz
Cc: linux, catalin.marinas, will, tsbogend, pjw, palmer, aou, akpm,
linux-kernel, linux-trace-kernel, linux-mm, linux-arm-kernel,
linux-mips, linux-riscv, Keke Ming
Replace deprecated kmap_atomic() with kmap_local_page().
Signed-off-by: Keke Ming <ming.jvle@gmail.com>
---
arch/arm64/kernel/probes/uprobes.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/kernel/probes/uprobes.c b/arch/arm64/kernel/probes/uprobes.c
index 941668800aea..4c55bf832ec3 100644
--- a/arch/arm64/kernel/probes/uprobes.c
+++ b/arch/arm64/kernel/probes/uprobes.c
@@ -15,7 +15,7 @@
void arch_uprobe_copy_ixol(struct page *page, unsigned long vaddr,
void *src, unsigned long len)
{
- void *xol_page_kaddr = kmap_atomic(page);
+ void *xol_page_kaddr = kmap_local_page(page);
void *dst = xol_page_kaddr + (vaddr & ~PAGE_MASK);
/*
@@ -32,7 +32,7 @@ void arch_uprobe_copy_ixol(struct page *page, unsigned long vaddr,
sync_icache_aliases((unsigned long)dst, (unsigned long)dst + len);
done:
- kunmap_atomic(xol_page_kaddr);
+ kunmap_local(xol_page_kaddr);
}
unsigned long uprobe_get_swbp_addr(struct pt_regs *regs)
--
2.43.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 3/5] mips/uprobes: use kmap_local_page() in arch_uprobe_copy_ixol()
2026-01-03 8:42 [PATCH 0/5] uprobes: transition from kmap_atomic to kmap_local_page Keke Ming
2026-01-03 8:42 ` [PATCH 1/5] riscv/uprobes: use kmap_local_page() in arch_uprobe_copy_ixol() Keke Ming
2026-01-03 8:42 ` [PATCH 2/5] arm64/uprobes: " Keke Ming
@ 2026-01-03 8:42 ` Keke Ming
2026-01-03 8:42 ` [PATCH 4/5] arm/uprobes: " Keke Ming
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Keke Ming @ 2026-01-03 8:42 UTC (permalink / raw)
To: mhiramat, oleg, peterz
Cc: linux, catalin.marinas, will, tsbogend, pjw, palmer, aou, akpm,
linux-kernel, linux-trace-kernel, linux-mm, linux-arm-kernel,
linux-mips, linux-riscv, Keke Ming
Replace deprecated kmap_atomic() with kmap_local_page().
Signed-off-by: Keke Ming <ming.jvle@gmail.com>
---
arch/mips/kernel/uprobes.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/mips/kernel/uprobes.c b/arch/mips/kernel/uprobes.c
index 401b148f8917..05cfc320992b 100644
--- a/arch/mips/kernel/uprobes.c
+++ b/arch/mips/kernel/uprobes.c
@@ -214,11 +214,11 @@ void arch_uprobe_copy_ixol(struct page *page, unsigned long vaddr,
unsigned long kaddr, kstart;
/* Initialize the slot */
- kaddr = (unsigned long)kmap_atomic(page);
+ kaddr = (unsigned long)kmap_local_page(page);
kstart = kaddr + (vaddr & ~PAGE_MASK);
memcpy((void *)kstart, src, len);
flush_icache_range(kstart, kstart + len);
- kunmap_atomic((void *)kaddr);
+ kunmap_local((void *)kaddr);
}
/**
--
2.43.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 4/5] arm/uprobes: use kmap_local_page() in arch_uprobe_copy_ixol()
2026-01-03 8:42 [PATCH 0/5] uprobes: transition from kmap_atomic to kmap_local_page Keke Ming
` (2 preceding siblings ...)
2026-01-03 8:42 ` [PATCH 3/5] mips/uprobes: " Keke Ming
@ 2026-01-03 8:42 ` Keke Ming
2026-01-03 8:42 ` [PATCH 5/5] uprobes: use kmap_local_page() for temporary page mappings Keke Ming
2026-01-03 10:56 ` [PATCH 0/5] uprobes: transition from kmap_atomic to kmap_local_page Oleg Nesterov
5 siblings, 0 replies; 7+ messages in thread
From: Keke Ming @ 2026-01-03 8:42 UTC (permalink / raw)
To: mhiramat, oleg, peterz
Cc: linux, catalin.marinas, will, tsbogend, pjw, palmer, aou, akpm,
linux-kernel, linux-trace-kernel, linux-mm, linux-arm-kernel,
linux-mips, linux-riscv, Keke Ming
Replace deprecated kmap_atomic() with kmap_local_page().
Signed-off-by: Keke Ming <ming.jvle@gmail.com>
---
arch/arm/probes/uprobes/core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/probes/uprobes/core.c b/arch/arm/probes/uprobes/core.c
index 3d96fb41d624..0e1c6b9e7e54 100644
--- a/arch/arm/probes/uprobes/core.c
+++ b/arch/arm/probes/uprobes/core.c
@@ -113,7 +113,7 @@ int arch_uprobe_analyze_insn(struct arch_uprobe *auprobe, struct mm_struct *mm,
void arch_uprobe_copy_ixol(struct page *page, unsigned long vaddr,
void *src, unsigned long len)
{
- void *xol_page_kaddr = kmap_atomic(page);
+ void *xol_page_kaddr = kmap_local_page(page);
void *dst = xol_page_kaddr + (vaddr & ~PAGE_MASK);
preempt_disable();
@@ -126,7 +126,7 @@ void arch_uprobe_copy_ixol(struct page *page, unsigned long vaddr,
preempt_enable();
- kunmap_atomic(xol_page_kaddr);
+ kunmap_local(xol_page_kaddr);
}
--
2.43.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 5/5] uprobes: use kmap_local_page() for temporary page mappings
2026-01-03 8:42 [PATCH 0/5] uprobes: transition from kmap_atomic to kmap_local_page Keke Ming
` (3 preceding siblings ...)
2026-01-03 8:42 ` [PATCH 4/5] arm/uprobes: " Keke Ming
@ 2026-01-03 8:42 ` Keke Ming
2026-01-03 10:56 ` [PATCH 0/5] uprobes: transition from kmap_atomic to kmap_local_page Oleg Nesterov
5 siblings, 0 replies; 7+ messages in thread
From: Keke Ming @ 2026-01-03 8:42 UTC (permalink / raw)
To: mhiramat, oleg, peterz
Cc: linux, catalin.marinas, will, tsbogend, pjw, palmer, aou, akpm,
linux-kernel, linux-trace-kernel, linux-mm, linux-arm-kernel,
linux-mips, linux-riscv, Keke Ming
Replace deprecated kmap_atomic() with kmap_local_page().
Signed-off-by: Keke Ming <ming.jvle@gmail.com>
---
kernel/events/uprobes.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
index d546d32390a8..a7d7d83ca1d7 100644
--- a/kernel/events/uprobes.c
+++ b/kernel/events/uprobes.c
@@ -179,16 +179,16 @@ bool __weak is_trap_insn(uprobe_opcode_t *insn)
void uprobe_copy_from_page(struct page *page, unsigned long vaddr, void *dst, int len)
{
- void *kaddr = kmap_atomic(page);
+ void *kaddr = kmap_local_page(page);
memcpy(dst, kaddr + (vaddr & ~PAGE_MASK), len);
- kunmap_atomic(kaddr);
+ kunmap_local(kaddr);
}
static void copy_to_page(struct page *page, unsigned long vaddr, const void *src, int len)
{
- void *kaddr = kmap_atomic(page);
+ void *kaddr = kmap_local_page(page);
memcpy(kaddr + (vaddr & ~PAGE_MASK), src, len);
- kunmap_atomic(kaddr);
+ kunmap_local(kaddr);
}
static int verify_opcode(struct page *page, unsigned long vaddr, uprobe_opcode_t *insn,
@@ -323,7 +323,7 @@ __update_ref_ctr(struct mm_struct *mm, unsigned long vaddr, short d)
return ret == 0 ? -EBUSY : ret;
}
- kaddr = kmap_atomic(page);
+ kaddr = kmap_local_page(page);
ptr = kaddr + (vaddr & ~PAGE_MASK);
if (unlikely(*ptr + d < 0)) {
@@ -336,7 +336,7 @@ __update_ref_ctr(struct mm_struct *mm, unsigned long vaddr, short d)
*ptr += d;
ret = 0;
out:
- kunmap_atomic(kaddr);
+ kunmap_local(kaddr);
put_page(page);
return ret;
}
--
2.43.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/5] uprobes: transition from kmap_atomic to kmap_local_page
2026-01-03 8:42 [PATCH 0/5] uprobes: transition from kmap_atomic to kmap_local_page Keke Ming
` (4 preceding siblings ...)
2026-01-03 8:42 ` [PATCH 5/5] uprobes: use kmap_local_page() for temporary page mappings Keke Ming
@ 2026-01-03 10:56 ` Oleg Nesterov
5 siblings, 0 replies; 7+ messages in thread
From: Oleg Nesterov @ 2026-01-03 10:56 UTC (permalink / raw)
To: Keke Ming
Cc: mhiramat, peterz, linux, catalin.marinas, will, tsbogend, pjw,
palmer, aou, akpm, linux-kernel, linux-trace-kernel, linux-mm,
linux-arm-kernel, linux-mips, linux-riscv
On 01/03, Keke Ming wrote:
>
> Keke Ming (5):
> riscv/uprobes: use kmap_local_page() in arch_uprobe_copy_ixol()
> arm64/uprobes: use kmap_local_page() in arch_uprobe_copy_ixol()
> mips/uprobes: use kmap_local_page() in arch_uprobe_copy_ixol()
> arm/uprobes: use kmap_local_page() in arch_uprobe_copy_ixol()
> uprobes: use kmap_local_page() for temporary page mappings
>
> arch/arm/probes/uprobes/core.c | 4 ++--
> arch/arm64/kernel/probes/uprobes.c | 4 ++--
> arch/mips/kernel/uprobes.c | 4 ++--
> arch/riscv/kernel/probes/uprobes.c | 4 ++--
> kernel/events/uprobes.c | 12 ++++++------
> 5 files changed, 14 insertions(+), 14 deletions(-)
Thanks,
Acked-by: Oleg Nesterov <oleg@redhat.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-01-03 10:56 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-03 8:42 [PATCH 0/5] uprobes: transition from kmap_atomic to kmap_local_page Keke Ming
2026-01-03 8:42 ` [PATCH 1/5] riscv/uprobes: use kmap_local_page() in arch_uprobe_copy_ixol() Keke Ming
2026-01-03 8:42 ` [PATCH 2/5] arm64/uprobes: " Keke Ming
2026-01-03 8:42 ` [PATCH 3/5] mips/uprobes: " Keke Ming
2026-01-03 8:42 ` [PATCH 4/5] arm/uprobes: " Keke Ming
2026-01-03 8:42 ` [PATCH 5/5] uprobes: use kmap_local_page() for temporary page mappings Keke Ming
2026-01-03 10:56 ` [PATCH 0/5] uprobes: transition from kmap_atomic to kmap_local_page Oleg Nesterov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox