remove various unused set_memory_* related functions and exports v2
Hi all,
while looking into implementing a DMA memory allocator for PCIe unsnooped transactions I've started looking at the set_memory_* and related APIs, and it turns out that many of them are unused. Fix for that below.
Changes since v2:
- dropped the already merged arm64 patch
- fix a subject line to not mention the wrong functions
PATCH 1/5 x86: unexport set_memory_x and set_memory_nx
No module currently messed with clearing or setting the execute permission of kernel memory, and none really should.
--- arch/x86/mm/pageattr.c | 2 -- 1 file changed, 2 deletions(-)
arch/x86/mm/pageattr.c +0 -2
@@ -1967,7 +1967,6 @@ int set_memory_x(unsigned long addr, int numpages)return change_page_attr_clear (&addr, numpages,__pgprot (_PAGE_NX),0 ); } -EXPORT_SYMBOL (set_memory_x);int set_memory_nx (unsigned long addr,int numpages) {
@@ -1976,7 +1975,6 @@ int set_memory_nx(unsigned long addr, int numpages)return change_page_attr_set (&addr, numpages,__pgprot (_PAGE_NX),0 ); } -EXPORT_SYMBOL (set_memory_nx);int set_memory_ro (unsigned long addr,int numpages) {
Signature · 1 line
2.20.1
[tip: x86/mm] x86/mm: Unexport set_memory_x() and set_memory_nx()
The following commit has been merged into the x86/mm branch of tip:
The following commit has been merged into the x86/mm branch of tip:
Commit-ID: ec46133d3b81053701e2a29047dfb6228ff487bd Gitweb: https://git.kernel.org/tip/ec46133d3b81053701e2a29047dfb6228ff487bd Author: Christoph Hellwig <[email protected]> AuthorDate: Mon, 26 Aug 2019 09:55:54 +02:00 Committer: Ingo Molnar <[email protected]> CommitterDate: Tue, 03 Sep 2019 09:26:37 +02:00
x86/mm: Unexport set_memory_x() and set_memory_nx()
No module currently messed with clearing or setting the execute permission of kernel memory, and none really should.
--- arch/x86/mm/pageattr.c | 2 -- 1 file changed, 2 deletions(-)
arch/x86/mm/pageattr.c +0 -2
@@ -1977,7 +1977,6 @@ int set_memory_x(unsigned long addr, int numpages)return change_page_attr_clear (&addr, numpages,__pgprot (_PAGE_NX),0 ); } -EXPORT_SYMBOL (set_memory_x);int set_memory_nx (unsigned long addr,int numpages) {
@@ -1986,7 +1985,6 @@ int set_memory_nx(unsigned long addr, int numpages)return change_page_attr_set (&addr, numpages,__pgprot (_PAGE_NX),0 ); } -EXPORT_SYMBOL (set_memory_nx);int set_memory_ro (unsigned long addr,int numpages) {
PATCH 2/5 x86: remove the unused set_memory_array_* functions
In reply to Christoph Hellwig--- arch/x86/include/asm/set_memory.h | 5 --- arch/x86/mm/pageattr.c | 75 ------------------------------- 2 files changed, 80 deletions(-)
arch/x86/include/asm/set_memory.h +0 -5
@@ -48,11 +48,6 @@ int set_memory_encrypted(unsigned long addr, int numpages);int set_memory_decrypted (unsigned long addr,int numpages);int set_memory_np_noalias (unsigned long addr,int numpages); -int set_memory_array_uc (unsigned long *addr,int addrinarray); -int set_memory_array_wc (unsigned long *addr,int addrinarray); -int set_memory_array_wt (unsigned long *addr,int addrinarray); -int set_memory_array_wb (unsigned long *addr,int addrinarray); -int set_pages_array_uc (struct page **pages,int addrinarray);int set_pages_array_wc (struct page **pages,int addrinarray);int set_pages_array_wt (struct page **pages,int addrinarray);
arch/x86/mm/pageattr.c +0 -75
87 lines not on this page · raw message
Signature · 1 line
2.20.1
[tip: x86/mm] x86/mm: Remove the unused set_memory_array_*() functions
The following commit has been merged into the x86/mm branch of tip:
The following commit has been merged into the x86/mm branch of tip:
Commit-ID: a919198b97c85e093c81eaae0b4864206ec2fe02 Gitweb: https://git.kernel.org/tip/a919198b97c85e093c81eaae0b4864206ec2fe02 Author: Christoph Hellwig <[email protected]> AuthorDate: Mon, 26 Aug 2019 09:55:55 +02:00 Committer: Ingo Molnar <[email protected]> CommitterDate: Tue, 03 Sep 2019 09:26:37 +02:00
x86/mm: Remove the unused set_memory_array_*() functions
--- arch/x86/include/asm/set_memory.h | 5 +-- arch/x86/mm/pageattr.c | 75 +------------------------------ 2 files changed, 80 deletions(-)
arch/x86/include/asm/set_memory.h +0 -5
@@ -48,11 +48,6 @@ int set_memory_encrypted(unsigned long addr, int numpages);int set_memory_decrypted (unsigned long addr,int numpages);int set_memory_np_noalias (unsigned long addr,int numpages); -int set_memory_array_uc (unsigned long *addr,int addrinarray); -int set_memory_array_wc (unsigned long *addr,int addrinarray); -int set_memory_array_wt (unsigned long *addr,int addrinarray); -int set_memory_array_wb (unsigned long *addr,int addrinarray); -int set_pages_array_uc (struct page **pages,int addrinarray);int set_pages_array_wc (struct page **pages,int addrinarray);int set_pages_array_wt (struct page **pages,int addrinarray);
arch/x86/mm/pageattr.c +0 -75
87 lines not on this page · raw message
PATCH 3/5 x86: remove set_pages_x and set_pages_nx
In reply to Christoph HellwigThese wrappers don't provide a real benefit over just using set_memory_x and set_memory_nx.
--- arch/x86/include/asm/set_memory.h | 2 -- arch/x86/kernel/machine_kexec_32.c | 4 ++-- arch/x86/mm/init_32.c | 2 +- arch/x86/mm/pageattr.c | 16 ---------------- 4 files changed, 3 insertions(+), 21 deletions(-)
arch/x86/include/asm/set_memory.h +0 -2
@@ -75,8 +75,6 @@ int set_pages_array_wb(struct page **pages, int addrinarray);int set_pages_uc (struct page *page,int numpages);int set_pages_wb (struct page *page,int numpages); -int set_pages_x (struct page *page,int numpages); -int set_pages_nx (struct page *page,int numpages);int set_pages_ro (struct page *page,int numpages);int set_pages_rw (struct page *page,int numpages);
arch/x86/kernel/machine_kexec_32.c +2 -2
@@ -148,7 +148,7 @@ int machine_kexec_prepare(struct kimage *image) {int error; -set_pages_x (image->control_code_page,1 ); +set_memory_x ((unsigned long )page_address (image->control_code_page),1 ); error =machine_kexec_alloc_page_tables (image);if (error)return error;
@@ -162,7 +162,7 @@ int machine_kexec_prepare(struct kimage *image)*/ void machine_kexec_cleanup (struct kimage *image) { -set_pages_nx (image->control_code_page,1 ); +set_memory_nx ((unsigned long )page_address (image->control_code_page),1 );machine_kexec_free_page_tables (image); }
arch/x86/mm/init_32.c +1 -1
@@ -916,7 +916,7 @@ static void mark_nxdata_nx(void)if (__supported_pte_mask & _PAGE_NX)printk (KERN_INFO "NX-protecting the kernel data: %luk\n" , size >>10 ); -set_pages_nx (virt_to_page (start), size >>PAGE_SHIFT ); +set_memory_nx (start, size >>PAGE_SHIFT ); }void mark_rodata_ro (void )
arch/x86/mm/pageattr.c +0 -16
@@ -2103,22 +2103,6 @@ int set_pages_array_wb(struct page **pages, int numpages) }EXPORT_SYMBOL (set_pages_array_wb); -int set_pages_x (struct page *page,int numpages) -{ -unsigned long addr = (unsigned long )page_address (page); - -return set_memory_x (addr, numpages); -} -EXPORT_SYMBOL (set_pages_x); - -int set_pages_nx (struct page *page,int numpages) -{ -unsigned long addr = (unsigned long )page_address (page); - -return set_memory_nx (addr, numpages); -} -EXPORT_SYMBOL (set_pages_nx); -int set_pages_ro (struct page *page,int numpages) {unsigned long addr = (unsigned long )page_address (page);
Signature · 1 line
2.20.1
[tip: x86/mm] x86/mm: Remove set_pages_x() and set_pages_nx()
The following commit has been merged into the x86/mm branch of tip:
The following commit has been merged into the x86/mm branch of tip:
Commit-ID: 185be15143aa308184310df9fde3d409ca9f83bb Gitweb: https://git.kernel.org/tip/185be15143aa308184310df9fde3d409ca9f83bb Author: Christoph Hellwig <[email protected]> AuthorDate: Mon, 26 Aug 2019 09:55:56 +02:00 Committer: Ingo Molnar <[email protected]> CommitterDate: Tue, 03 Sep 2019 09:26:37 +02:00
x86/mm: Remove set_pages_x() and set_pages_nx()
These wrappers don't provide a real benefit over just using set_memory_x() and set_memory_nx().
--- arch/x86/include/asm/set_memory.h | 2 -- arch/x86/kernel/machine_kexec_32.c | 4 ++-- arch/x86/mm/init_32.c | 2 +- arch/x86/mm/pageattr.c | 16 ---------------- 4 files changed, 3 insertions(+), 21 deletions(-)
arch/x86/include/asm/set_memory.h +0 -2
@@ -75,8 +75,6 @@ int set_pages_array_wb(struct page **pages, int addrinarray);int set_pages_uc (struct page *page,int numpages);int set_pages_wb (struct page *page,int numpages); -int set_pages_x (struct page *page,int numpages); -int set_pages_nx (struct page *page,int numpages);int set_pages_ro (struct page *page,int numpages);int set_pages_rw (struct page *page,int numpages);
arch/x86/kernel/machine_kexec_32.c +2 -2
@@ -148,7 +148,7 @@ int machine_kexec_prepare(struct kimage *image) {int error; -set_pages_x (image->control_code_page,1 ); +set_memory_x ((unsigned long )page_address (image->control_code_page),1 ); error =machine_kexec_alloc_page_tables (image);if (error)return error;
@@ -162,7 +162,7 @@ int machine_kexec_prepare(struct kimage *image)*/ void machine_kexec_cleanup (struct kimage *image) { -set_pages_nx (image->control_code_page,1 ); +set_memory_nx ((unsigned long )page_address (image->control_code_page),1 );machine_kexec_free_page_tables (image); }
arch/x86/mm/init_32.c +1 -1
@@ -916,7 +916,7 @@ static void mark_nxdata_nx(void)if (__supported_pte_mask & _PAGE_NX)printk (KERN_INFO "NX-protecting the kernel data: %luk\n" , size >>10 ); -set_pages_nx (virt_to_page (start), size >>PAGE_SHIFT ); +set_memory_nx (start, size >>PAGE_SHIFT ); }void mark_rodata_ro (void )
arch/x86/mm/pageattr.c +0 -16
@@ -2113,22 +2113,6 @@ int set_pages_array_wb(struct page **pages, int numpages) }EXPORT_SYMBOL (set_pages_array_wb); -int set_pages_x (struct page *page,int numpages) -{ -unsigned long addr = (unsigned long )page_address (page); - -return set_memory_x (addr, numpages); -} -EXPORT_SYMBOL (set_pages_x); - -int set_pages_nx (struct page *page,int numpages) -{ -unsigned long addr = (unsigned long )page_address (page); - -return set_memory_nx (addr, numpages); -} -EXPORT_SYMBOL (set_pages_nx); -int set_pages_ro (struct page *page,int numpages) {unsigned long addr = (unsigned long )page_address (page);
PATCH 4/5 x86: remove the unused set_memory_wt function
In reply to Christoph Hellwig--- arch/x86/include/asm/set_memory.h | 1 - arch/x86/mm/pageattr.c | 17 ----------------- 2 files changed, 18 deletions(-)
arch/x86/include/asm/set_memory.h +0 -1
@@ -40,7 +40,6 @@ int _set_memory_wt(unsigned long addr, int numpages);int _set_memory_wb (unsigned long addr,int numpages);int set_memory_uc (unsigned long addr,int numpages);int set_memory_wc (unsigned long addr,int numpages); -int set_memory_wt (unsigned long addr,int numpages);int set_memory_wb (unsigned long addr,int numpages);int set_memory_np (unsigned long addr,int numpages);int set_memory_4k (unsigned long addr,int numpages);
arch/x86/mm/pageattr.c +0 -17
@@ -1848,23 +1848,6 @@ int _set_memory_wt(unsigned long addr, int numpages) cachemode2pgprot(_PAGE_CACHE_MODE_WT), 0); } -int set_memory_wt (unsigned long addr,int numpages) -{ -int ret; - - ret =reserve_memtype (__pa (addr),__pa (addr) + numpages *PAGE_SIZE , - _PAGE_CACHE_MODE_WT,NULL ); -if (ret) -return ret; - - ret =_set_memory_wt (addr, numpages); -if (ret) -free_memtype (__pa (addr),__pa (addr) + numpages *PAGE_SIZE ); - -return ret; -} -EXPORT_SYMBOL_GPL (set_memory_wt); -int _set_memory_wb (unsigned long addr,int numpages) {/* WB cache mode is hard wired to all cache attribute bits being 0 */
Signature · 1 line
2.20.1
[tip: x86/mm] x86/mm: Remove the unused set_memory_wt() function
The following commit has been merged into the x86/mm branch of tip:
The following commit has been merged into the x86/mm branch of tip:
Commit-ID: aeb415fbe9f62e6db0fabd2023d39728ccc705fd Gitweb: https://git.kernel.org/tip/aeb415fbe9f62e6db0fabd2023d39728ccc705fd Author: Christoph Hellwig <[email protected]> AuthorDate: Mon, 26 Aug 2019 09:55:57 +02:00 Committer: Ingo Molnar <[email protected]> CommitterDate: Tue, 03 Sep 2019 09:26:37 +02:00
x86/mm: Remove the unused set_memory_wt() function
--- arch/x86/include/asm/set_memory.h | 1 - arch/x86/mm/pageattr.c | 17 ----------------- 2 files changed, 18 deletions(-)
arch/x86/include/asm/set_memory.h +0 -1
@@ -40,7 +40,6 @@ int _set_memory_wt(unsigned long addr, int numpages);int _set_memory_wb (unsigned long addr,int numpages);int set_memory_uc (unsigned long addr,int numpages);int set_memory_wc (unsigned long addr,int numpages); -int set_memory_wt (unsigned long addr,int numpages);int set_memory_wb (unsigned long addr,int numpages);int set_memory_np (unsigned long addr,int numpages);int set_memory_4k (unsigned long addr,int numpages);
arch/x86/mm/pageattr.c +0 -17
@@ -1858,23 +1858,6 @@ int _set_memory_wt(unsigned long addr, int numpages) cachemode2pgprot(_PAGE_CACHE_MODE_WT), 0); } -int set_memory_wt (unsigned long addr,int numpages) -{ -int ret; - - ret =reserve_memtype (__pa (addr),__pa (addr) + numpages *PAGE_SIZE , - _PAGE_CACHE_MODE_WT,NULL ); -if (ret) -return ret; - - ret =_set_memory_wt (addr, numpages); -if (ret) -free_memtype (__pa (addr),__pa (addr) + numpages *PAGE_SIZE ); - -return ret; -} -EXPORT_SYMBOL_GPL (set_memory_wt); -int _set_memory_wb (unsigned long addr,int numpages) {/* WB cache mode is hard wired to all cache attribute bits being 0 */
PATCH 5/5 x86: remove the unused set_pages_array_wt function
In reply to Christoph Hellwig--- arch/x86/include/asm/set_memory.h | 1 - arch/x86/mm/pageattr.c | 6 ------ 2 files changed, 7 deletions(-)
arch/x86/include/asm/set_memory.h +0 -1
@@ -49,7 +49,6 @@ int set_memory_np_noalias(unsigned long addr, int numpages);int set_pages_array_uc (struct page **pages,int addrinarray);int set_pages_array_wc (struct page **pages,int addrinarray); -int set_pages_array_wt (struct page **pages,int addrinarray);int set_pages_array_wb (struct page **pages,int addrinarray);/*
arch/x86/mm/pageattr.c +0 -6
@@ -2047,12 +2047,6 @@ int set_pages_array_wc(struct page **pages, int numpages) }EXPORT_SYMBOL (set_pages_array_wc); -int set_pages_array_wt (struct page **pages,int numpages) -{ -return _set_pages_array (pages, numpages, _PAGE_CACHE_MODE_WT); -} -EXPORT_SYMBOL_GPL (set_pages_array_wt); -int set_pages_wb (struct page *page,int numpages) {unsigned long addr = (unsigned long )page_address (page);
Signature · 1 line
2.20.1