staging: zsmalloc: Fix link error on ARM
Subsystems (3)
PATCH 1/1 staging: zsmalloc: Fix link error on ARM
Testing the arm chromebook config against the upstream kernel produces a linker error for the zsmalloc module from staging. The symbol flush_tlb_kernel_range is not available there. Fix this by removing the reimplementation of unmap_kernel_range in the zsmalloc module and using the function directly.
--- drivers/staging/zsmalloc/zsmalloc-main.c | 5 +---- mm/vmalloc.c | 1 + 2 files changed, 2 insertions(+), 4 deletions(-)
drivers/staging/zsmalloc/zsmalloc-main.c +1 -4
@@ -656,11 +656,8 @@ static inline void __zs_unmap_object(struct mapping_area *area, struct page *pages[2], int off, int size) { unsigned long addr = (unsigned long)area->vm_addr; -unsigned long end = addr + (PAGE_SIZE *2 ); -flush_cache_vunmap (addr, end); -unmap_kernel_range_noflush (addr,PAGE_SIZE *2 ); -flush_tlb_kernel_range (addr, end); +unmap_kernel_range (addr,PAGE_SIZE *2 ); }#else /* USE_PGTABLE_MAPPING */
mm/vmalloc.c +1 -0
@@ -1266,6 +1266,7 @@ void unmap_kernel_range(unsigned long addr, unsigned long size)vunmap_page_range (addr, end);flush_tlb_kernel_range (addr, end); } +EXPORT_SYMBOL_GPL (unmap_kernel_range);int map_vm_area (struct vm_struct *area,pgprot_t prot,struct page ***pages) {
Signature · 8 lines
1.7.9.5 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Greg Kroah-Hartman
maintainerQuoted 8 lines · Joerg Roedel
Testing the arm chromebook config against the upstream kernel produces a linker error for the zsmalloc module from staging. The symbol
flush_tlb_kernel_rangeis not available there. Fix this by removing the reimplementation ofunmap_kernel_rangein the zsmalloc module and using the function directly.Signed-off-by Joerg Roedel <[email protected]>
Why is this not an error for any other architecture? Why is arm special?
Quoted 27 lines
--- drivers/staging/zsmalloc/zsmalloc-main.c | 5 +---- mm/vmalloc.c | 1 + 2 files changed, 2 insertions(+), 4 deletions(-)drivers/staging/zsmalloc/zsmalloc-main.c +1
-4@@ -656,11 +656,8 @@ static inline void __zs_unmap_object(struct mapping_area *area, struct page *pages[2], int off, int size) { unsigned long addr = (unsigned long)area->vm_addr; -unsigned long end = addr + (PAGE_SIZE *2 ); -flush_cache_vunmap (addr, end); -unmap_kernel_range_noflush (addr,PAGE_SIZE *2 ); -flush_tlb_kernel_range (addr, end); +unmap_kernel_range (addr,PAGE_SIZE *2 ); }#else /* USE_PGTABLE_MAPPING */ mm/vmalloc.c +0
-0
mm/vmalloc.c void unmap_kernel_range(unsigned long addr, unsigned long size) · line 1269
Quoted 4 lines
mm/vmalloc.c +1
-0@@ -1266,6 +1266,7 @@ void unmap_kernel_range(unsigned long addr, unsigned long size)vunmap_page_range (addr, end);flush_tlb_kernel_range (addr, end); } +EXPORT_SYMBOL_GPL (unmap_kernel_range);
I _really_ don't like adding core exports for a staging driver, there is no guarantee that the staging driver will not just be deleted tomorrow.
So, if at all possible, I don't want to do this.
Perhaps, just make it so the staging code can't be a module?
greg k-h
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 8 lines · Greg Kroah-Hartman
Quoted 7 lines · Joerg Roedel
Testing the arm chromebook config against the upstream kernel produces a linker error for the zsmalloc module from staging. The symbol
flush_tlb_kernel_rangeis not available there. Fix this by removing the reimplementation ofunmap_kernel_rangein the zsmalloc module and using the function directly.
Quoted 4 lines
Quoted 1 line
Signed-off-by Joerg Roedel <[email protected]>Why is this not an error for any other architecture? Why is arm special?
The version of the function __zs_unmap_object() which uses flush_tlb_kernel_range() in the zsmalloc driver is only compiled in when USE_PGTABLE_MAPPING is defined. And USE_PGTABLE_MAPPING is defined in the same file only when CONFIG_ARM is defined. So this happens only on ARM.
Regards,
Joerg
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Greg Kroah-Hartman
maintainerQuoted 11 lines · Joerg Roedel
Quoted 10 lines · Greg Kroah-Hartman
Quoted 8 lines · Joerg Roedel
Testing the arm chromebook config against the upstream kernel produces a linker error for the zsmalloc module from staging. The symbol
flush_tlb_kernel_rangeis not available there. Fix this by removing the reimplementation ofunmap_kernel_rangein the zsmalloc module and using the function directly.Signed-off-by Joerg Roedel <[email protected]>
Quoted 8 lines
Quoted 2 lines
Why is this not an error for any other architecture? Why is arm special?
The version of the function
__zs_unmap_object()which usesflush_tlb_kernel_range()in the zsmalloc driver is only compiled in whenUSE_PGTABLE_MAPPINGis defined. AndUSE_PGTABLE_MAPPINGis defined in the same file only whenCONFIG_ARMis defined. So this happens only on ARM.
Then should I just mark the driver as broken on ARM?
Any reason for not including the driver authors on the Cc: for this patch?
greg k-h
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 3 lines · Greg Kroah-Hartman
On Wed, Mar 27, 2013 at 12:03:59AM +0100, Joerg Roedel wrote:
Then should I just mark the driver as broken on ARM?
Well, at least ARM on SMP, for !SMP the missing function is defined and will be inlined.
Quoted 2 lines
Any reason for not including the driver authors on the Cc: for this patch?
I wasn't sure who the driver author is in the long list of persons from the get_maintainer script. So it was more or less lazyness :)
Should I try to get that patch through the driver authors instead of you?
Joerg
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Greg Kroah-Hartman
maintainerQuoted 7 lines · Joerg Roedel
Quoted 3 lines · Greg Kroah-Hartman
On Wed, Mar 27, 2013 at 12:03:59AM +0100, Joerg Roedel wrote:
Then should I just mark the driver as broken on ARM?
Well, at least ARM on SMP, for !SMP the missing function is defined and will be inlined.
Then some Kconfig dependancies could be tweaked to try to make this work properly, not building the driver where it will be broken.
Quoted 8 lines
Quoted 2 lines
Any reason for not including the driver authors on the Cc: for this patch?
I wasn't sure who the driver author is in the long list of persons from the
get_maintainerscript. So it was more or less lazyness :)Should I try to get that patch through the driver authors instead of you?
At least cc: them to have them weigh in on the issue, I know they are trying to do something in this area, but I didn't think it was the same as your patch.
thanks,
greg k-h
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
(Sending again with the zsmalloc driver writers on the list)
Quoted 8 lines · Joerg Roedel
Testing the arm chromebook config against the upstream kernel produces a linker error for the zsmalloc module from staging. The symbol
flush_tlb_kernel_rangeis not available there. Fix this by removing the reimplementation ofunmap_kernel_rangein the zsmalloc module and using the function directly.Signed-off-by Joerg Roedel <[email protected]>
Oops, it was my fault. When I tested [1] on CONFIG_SMP machine on ARM, it worked well. It means it's not always problem on every CONFIG_SMP on ARM machine but some SMP machine define flush_tlb_kernel_range, others don't.
At that time, Russell King already suggested same thing with your patch and I meant to clean it up because the patch was already merged but I didn't. Because we didn't catch up that it breaks build on some configuration so I thought it's just clean up patch and Greg didn't want to accept NOT-BUG patch of any z* family.
Now, it's BUG patch.
Remained problem is that Greg doesn't want to export core function for staging driver and it's reasonable for me.
So my opinion is remove zsmalloc module build and could recover it with making unmap_kernel_range exported function after we merged it into mainline.
And please Cc stable.
[1] [99155188, zsmalloc: Fix TLB coherency and build problem]
Quoted 43 lines
--- drivers/staging/zsmalloc/zsmalloc-main.c | 5 +---- mm/vmalloc.c | 1 + 2 files changed, 2 insertions(+), 4 deletions(-)drivers/staging/zsmalloc/zsmalloc-main.c +1
-4@@ -656,11 +656,8 @@ static inline void __zs_unmap_object(struct mapping_area *area, struct page *pages[2], int off, int size) { unsigned long addr = (unsigned long)area->vm_addr; -unsigned long end = addr + (PAGE_SIZE *2 ); -flush_cache_vunmap (addr, end); -unmap_kernel_range_noflush (addr,PAGE_SIZE *2 ); -flush_tlb_kernel_range (addr, end); +unmap_kernel_range (addr,PAGE_SIZE *2 ); }#else /* USE_PGTABLE_MAPPING */ mm/vmalloc.c +1
-0@@ -1266,6 +1266,7 @@ void unmap_kernel_range(unsigned long addr, unsigned long size)vunmap_page_range (addr, end);flush_tlb_kernel_range (addr, end); } +EXPORT_SYMBOL_GPL (unmap_kernel_range);int map_vm_area (struct vm_struct *area,pgprot_t prot,struct page ***pages) {Signature · 8 lines
1.7.9.5 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Signature · 8 lines
Kind regards, Minchan Kim -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 11 lines · Minchan Kim
Oops, it was my fault. When I tested [1] on
CONFIG_SMPmachine on ARM, it worked well. It means it's not always problem on everyCONFIG_SMPon ARM machine but some SMP machine defineflush_tlb_kernel_range, others don't.At that time, Russell King already suggested same thing with your patch and I meant to clean it up because the patch was already merged but I didn't. Because we didn't catch up that it breaks build on some configuration so I thought it's just clean up patch and Greg didn't want to accept NOT-BUG patch of any z* family.
Quoted 4 lines
Now, it's BUG patch.
Remained problem is that Greg doesn't want to export core function for staging driver and it's reasonable for me.
Okay, I see. So that is probably also the reason for the reimplementation of unmap_kernel_range in the zsmalloc module :)
Quoted 3 lines
So my opinion is remove zsmalloc module build and could recover it with making
unmap_kernel_rangeexported function after we merged it into mainline.
Sounds reasonable, I update the patch to only allow zsmalloc to be built-in. The benefit is that this still allows to use unmap_kernel_range() in the driver.
Thanks,
Joerg
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 1 line · Minchan Kim
And please Cc stable.
Okay, here it is. The result is compile-tested.
Changes since v1:
* Remove the module-export for unmap_kernel_range and make zsmalloc built-in instead
Here is the patch:
Minchan Kim
Acked-byQuoted 26 lines · Joerg Roedel
Quoted 1 line · Minchan Kim
And please Cc stable.
Okay, here it is. The result is compile-tested.
Changes since v1:
* Remove the module-export for
unmap_kernel_rangeand make zsmalloc built-in insteadHere is the patch:
Quoted 1 line
From
2b70502720b36909f9f39bdf27be21321a219c31Mon Sep 17 00:00:00 2001From: Joerg Roedel <[email protected]>
Date: Tue, 26 Mar 2013 23:24:22 +0100
Subject: [PATCH v2] staging: zsmalloc: Fix link error on ARMTesting the arm chromebook config against the upstream kernel produces a linker error for the zsmalloc module from staging. The symbol
flush_tlb_kernel_rangeis not available there. Fix this by removing the reimplementation ofunmap_kernel_rangein the zsmalloc module and using the function directly. Theunmap_kernel_rangefunction is not usable by modules, so also disallow building the driver as a module for now.
Quoted 2 lines
Signed-off-by Joerg Roedel <[email protected]>
Signature · 8 lines
Kind regards, Minchan Kim -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>