Skip to contentSkip to conversation

arm64: export __cpu_{clear,copy}_user_page functions

PATCH In review Mark Salter 2 participants 4 messages Jun 17, 2014 – Jun 23, 2014 arm64

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm64: export __cpu_{clear,copy}_user_page functions

The __cpu_clear_user_page() and __cpu_copy_user_page() functions are not currently exported. This prevents modules from using clear_user_page() and opy_user_page().

---
 arch/arm64/mm/copypage.c | 2 ++
 1 file changed, 2 insertions(+)
arch/arm64/mm/copypage.c +2 -0
index 9aecbac..13bbc3be 100644
@@ -27,8 +27,10 @@ void __cpu_copy_user_page(void *kto, const void *kfrom, unsigned long vaddr)
 	copy_page(kto, kfrom);
 	__flush_dcache_area(kto, PAGE_SIZE);
 }
+EXPORT_SYMBOL_GPL(__cpu_copy_user_page);
 
 void __cpu_clear_user_page(void *kaddr, unsigned long vaddr)
 {
 	clear_page(kaddr);
 }
+EXPORT_SYMBOL_GPL(__cpu_clear_user_page);
Signature · 1 line
1.9.0
maintainer
#1 lore raw
Quoted 14 lines · Mark Salter

The __cpu_clear_user_page() and __cpu_copy_user_page() functions are not currently exported. This prevents modules from using clear_user_page() and opy_user_page().

---
 arch/arm64/mm/copypage.c | 2 ++
 1 file changed, 2 insertions(+)
arch/arm64/mm/copypage.c +0 -0
index 9aecbac..13bbc3be 100644

arch/arm64/mm/copypage.c void __cpu_copy_user_page(void *kto, const void *kfrom, unsigned long vaddr) · line 36

Quoted 10 lines
arch/arm64/mm/copypage.c +2 -0
@@ -27,8 +27,10 @@ void __cpu_copy_user_page(void *kto, const void *kfrom, unsigned long vaddr)
 	copy_page(kto, kfrom);
 	__flush_dcache_area(kto, PAGE_SIZE);
 }
+EXPORT_SYMBOL_GPL(__cpu_copy_user_page);
 
 void __cpu_clear_user_page(void *kaddr, unsigned long vaddr)
 {
 	clear_page(kaddr);
 }
+EXPORT_SYMBOL_GPL(__cpu_clear_user_page);

I wonder why we still have these functions. I don't think we need any D-cache flushing for copy_user_page(), so we could simply remove this code and define copy_user_page() as copy_page() (similarly for clear_user_page). I'll post a patch separately removing the copy_page, copy_user_page etc. functions (now that we also have optimised memcpy and memset).

Signature · 1 line
Catalin
#2 lore raw
Quoted 20 lines · Catalin Marinas
Quoted 19 lines · Mark Salter

The __cpu_clear_user_page() and __cpu_copy_user_page() functions are not currently exported. This prevents modules from using clear_user_page() and opy_user_page().

---
 arch/arm64/mm/copypage.c | 2 ++
 1 file changed, 2 insertions(+)
arch/arm64/mm/copypage.c +1 -0
index 9aecbac..13bbc3be 100644
@@ -27,8 +27,10 @@ void __cpu_copy_user_page(void *kto, const void *kfrom, unsigned long vaddr)
 	copy_page(kto, kfrom);
 	__flush_dcache_area(kto, PAGE_SIZE);
 }
+EXPORT_SYMBOL_GPL(__cpu_copy_user_page);
 
Quoted 13 lines

arch/arm64/mm/copypage.c void __cpu_copy_user_page(void *kto, const void *kfrom, unsigned long vaddr) · line 36

Quoted 5 lines
arch/arm64/mm/copypage.c +1 -0
 void __cpu_clear_user_page(void *kaddr, unsigned long vaddr)
 {
 	clear_page(kaddr);
 }
+EXPORT_SYMBOL_GPL(__cpu_clear_user_page);

I wonder why we still have these functions. I don't think we need any D-cache flushing for copy_user_page(), so we could simply remove this code and define copy_user_page() as copy_page() (similarly for clear_user_page). I'll post a patch separately removing the copy_page, copy_user_page etc. functions (now that we also have optimised memcpy and memset).

Even better. I much prefer removing code than adding it. Thanks.

maintainer
#3 lore raw
Quoted 34 lines · Mark Salter
Quoted 20 lines · Catalin Marinas
Quoted 19 lines · Mark Salter

The __cpu_clear_user_page() and __cpu_copy_user_page() functions are not currently exported. This prevents modules from using clear_user_page() and opy_user_page().

---
 arch/arm64/mm/copypage.c | 2 ++
 1 file changed, 2 insertions(+)
arch/arm64/mm/copypage.c +1 -0
index 9aecbac..13bbc3be 100644
@@ -27,8 +27,10 @@ void __cpu_copy_user_page(void *kto, const void *kfrom, unsigned long vaddr)
 	copy_page(kto, kfrom);
 	__flush_dcache_area(kto, PAGE_SIZE);
 }
+EXPORT_SYMBOL_GPL(__cpu_copy_user_page);
 
Quoted 12 lines

arch/arm64/mm/copypage.c void __cpu_copy_user_page(void *kto, const void *kfrom, unsigned long vaddr) · line 36

Quoted 5 lines
arch/arm64/mm/copypage.c +1 -0
 void __cpu_clear_user_page(void *kaddr, unsigned long vaddr)
 {
 	clear_page(kaddr);
 }
+EXPORT_SYMBOL_GPL(__cpu_clear_user_page);

I wonder why we still have these functions. I don't think we need any D-cache flushing for copy_user_page(), so we could simply remove this code and define copy_user_page() as copy_page() (similarly for clear_user_page). I'll post a patch separately removing the copy_page, copy_user_page etc. functions (now that we also have optimised memcpy and memset).

Quoted 1 line

Even better. I much prefer removing code than adding it. Thanks.

For the time being I'll merge your patch since using memset for clear_page adds a small overhead with checking the alignment and the fill value (not much but consistently slower in my mmap benchmarks).

Signature · 1 line
Catalin