[PATCH] kdb: use kmap_local_page()

zhangheng posted 1 patch 1 year, 1 month ago
There is a newer version of this series
kernel/debug/kdb/kdb_support.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
[PATCH] kdb: use kmap_local_page()
Posted by zhangheng 1 year, 1 month ago
Use kmap_local_page() instead of kmap_atomic() which has been deprecated.

Signed-off-by: zhangheng <zhangheng@kylinos.cn>
---
 kernel/debug/kdb/kdb_support.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/debug/kdb/kdb_support.c b/kernel/debug/kdb/kdb_support.c
index 0a39497140bf..530743e7a25e 100644
--- a/kernel/debug/kdb/kdb_support.c
+++ b/kernel/debug/kdb/kdb_support.c
@@ -305,7 +305,7 @@ int kdb_putarea_size(unsigned long addr, void *res, size_t size)
 
 /*
  * kdb_getphys - Read data from a physical address. Validate the
- * 	address is in range, use kmap_atomic() to get data
+ *	address is in range, use kmap_local_page() to get data
  * 	similar to kdb_getarea() - but for phys addresses
  * Inputs:
  * 	res	Pointer to the word to receive the result
@@ -324,9 +324,9 @@ static int kdb_getphys(void *res, unsigned long addr, size_t size)
 	if (!pfn_valid(pfn))
 		return 1;
 	page = pfn_to_page(pfn);
-	vaddr = kmap_atomic(page);
+	vaddr = kmap_local_page(page);
 	memcpy(res, vaddr + (addr & (PAGE_SIZE - 1)), size);
-	kunmap_atomic(vaddr);
+	kunmap_local(vaddr);
 
 	return 0;
 }
-- 
2.45.2
Re: [PATCH] kdb: use kmap_local_page()
Posted by Doug Anderson 1 year, 1 month ago
Hi,

On Fri, Dec 20, 2024 at 2:25 AM zhangheng <zhangheng@kylinos.cn> wrote:
>
> Use kmap_local_page() instead of kmap_atomic() which has been deprecated.
>
> Signed-off-by: zhangheng <zhangheng@kylinos.cn>

nit: The fact that the "name" part of this is in all lowercase and
matches your email address makes me think you're lacking the "name"
part of your git config. Is "zhangheng" how you normally identify
yourself, or should there be spaces / capitalization? An Internet
search makes me think maybe this should be "Zhang Heng" ?

> ---
>  kernel/debug/kdb/kdb_support.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

I wasn't up on the whole kmap_atomic() deprecation, but LWN to the
rescue [1]. With that context, this looks fine to me.

Reviewed-by: Douglas Anderson <dianders@chromium.org>

[1] https://lwn.net/Articles/836144/