[PATCH] sparc/mm: export symbols for lazy_mmu_mode KUnit tests

Kevin Brodsky posted 1 patch 1 month, 3 weeks ago
arch/sparc/mm/tlb.c | 6 ++++++
1 file changed, 6 insertions(+)
[PATCH] sparc/mm: export symbols for lazy_mmu_mode KUnit tests
Posted by Kevin Brodsky 1 month, 3 weeks ago
Upcoming KUnit tests will call lazy_mmu_mode_{enable,disable}.
These tests may be built as a module, and because of inlining this
means that arch_{enter,flush,leave}_lazy_mmu_mode need to be
exported.

Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com>
---

The CI reports that sparc needs pretty much the same time treatment as
powerpc... Here's another patch to take care of that.

Andrew, could you please add it after the powerpc one? At this point it's
probably best to remove the comment above MODULE_IMPORT_NS() in
mm/tests/lazy_mmu_mode_kunit.c. Thank you and sorry for the noise!
---
 arch/sparc/mm/tlb.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/sparc/mm/tlb.c b/arch/sparc/mm/tlb.c
index 3a852071d260..6d9dd5eb1328 100644
--- a/arch/sparc/mm/tlb.c
+++ b/arch/sparc/mm/tlb.c
@@ -11,6 +11,8 @@
 #include <linux/preempt.h>
 #include <linux/pagemap.h>
 
+#include <kunit/visibility.h>
+
 #include <asm/tlbflush.h>
 #include <asm/cacheflush.h>
 #include <asm/mmu_context.h>
@@ -54,6 +56,8 @@ void arch_enter_lazy_mmu_mode(void)
 {
 	preempt_disable();
 }
+/* For lazy_mmu_mode KUnit tests */
+EXPORT_SYMBOL_IF_KUNIT(arch_enter_lazy_mmu_mode);
 
 void arch_flush_lazy_mmu_mode(void)
 {
@@ -62,12 +66,14 @@ void arch_flush_lazy_mmu_mode(void)
 	if (tb->tlb_nr)
 		flush_tlb_pending();
 }
+EXPORT_SYMBOL_IF_KUNIT(arch_flush_lazy_mmu_mode);
 
 void arch_leave_lazy_mmu_mode(void)
 {
 	arch_flush_lazy_mmu_mode();
 	preempt_enable();
 }
+EXPORT_SYMBOL_IF_KUNIT(arch_leave_lazy_mmu_mode);
 
 static void tlb_batch_add_one(struct mm_struct *mm, unsigned long vaddr,
 			      bool exec, unsigned int hugepage_shift)

base-commit: 8f0b4cce4481fb22653697cced8d0d04027cb1e8
-- 
2.51.2
Re: [PATCH] sparc/mm: export symbols for lazy_mmu_mode KUnit tests
Posted by Kevin Brodsky 3 weeks, 5 days ago
On 18/12/2025 11:05, Kevin Brodsky wrote:
> Upcoming KUnit tests will call lazy_mmu_mode_{enable,disable}.
> These tests may be built as a module, and because of inlining this
> means that arch_{enter,flush,leave}_lazy_mmu_mode need to be
> exported.
>
> Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com>
> ---
>
> The CI reports that sparc needs pretty much the same time treatment as
> powerpc... Here's another patch to take care of that.
>
> Andrew, could you please add it after the powerpc one? At this point it's
> probably best to remove the comment above MODULE_IMPORT_NS() in
> mm/tests/lazy_mmu_mode_kunit.c. Thank you and sorry for the noise!

Gentle ping - I think we need this patch in mm-unstable, the CI has been
complaining as well. Thanks!

- Kevin

> ---
>  arch/sparc/mm/tlb.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/arch/sparc/mm/tlb.c b/arch/sparc/mm/tlb.c
> index 3a852071d260..6d9dd5eb1328 100644
> --- a/arch/sparc/mm/tlb.c
> +++ b/arch/sparc/mm/tlb.c
> @@ -11,6 +11,8 @@
>  #include <linux/preempt.h>
>  #include <linux/pagemap.h>
>  
> +#include <kunit/visibility.h>
> +
>  #include <asm/tlbflush.h>
>  #include <asm/cacheflush.h>
>  #include <asm/mmu_context.h>
> @@ -54,6 +56,8 @@ void arch_enter_lazy_mmu_mode(void)
>  {
>  	preempt_disable();
>  }
> +/* For lazy_mmu_mode KUnit tests */
> +EXPORT_SYMBOL_IF_KUNIT(arch_enter_lazy_mmu_mode);
>  
>  void arch_flush_lazy_mmu_mode(void)
>  {
> @@ -62,12 +66,14 @@ void arch_flush_lazy_mmu_mode(void)
>  	if (tb->tlb_nr)
>  		flush_tlb_pending();
>  }
> +EXPORT_SYMBOL_IF_KUNIT(arch_flush_lazy_mmu_mode);
>  
>  void arch_leave_lazy_mmu_mode(void)
>  {
>  	arch_flush_lazy_mmu_mode();
>  	preempt_enable();
>  }
> +EXPORT_SYMBOL_IF_KUNIT(arch_leave_lazy_mmu_mode);
>  
>  static void tlb_batch_add_one(struct mm_struct *mm, unsigned long vaddr,
>  			      bool exec, unsigned int hugepage_shift)
>
> base-commit: 8f0b4cce4481fb22653697cced8d0d04027cb1e8
Re: [PATCH] sparc/mm: export symbols for lazy_mmu_mode KUnit tests
Posted by Andreas Larsson 3 weeks, 3 days ago
On 2026-01-12 11:09, Kevin Brodsky wrote:
> On 18/12/2025 11:05, Kevin Brodsky wrote:
>> Upcoming KUnit tests will call lazy_mmu_mode_{enable,disable}.
>> These tests may be built as a module, and because of inlining this
>> means that arch_{enter,flush,leave}_lazy_mmu_mode need to be
>> exported.
>>
>> Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com>
>> ---
>>
>> The CI reports that sparc needs pretty much the same time treatment as
>> powerpc... Here's another patch to take care of that.
>>
>> Andrew, could you please add it after the powerpc one? At this point it's
>> probably best to remove the comment above MODULE_IMPORT_NS() in
>> mm/tests/lazy_mmu_mode_kunit.c. Thank you and sorry for the noise!
> 
> Gentle ping - I think we need this patch in mm-unstable, the CI has been
> complaining as well. Thanks!

I get this problem as well, which is solved by this patch.

>> ---
>>  arch/sparc/mm/tlb.c | 6 ++++++
>>  1 file changed, 6 insertions(+)
>>
>> diff --git a/arch/sparc/mm/tlb.c b/arch/sparc/mm/tlb.c
>> index 3a852071d260..6d9dd5eb1328 100644
>> --- a/arch/sparc/mm/tlb.c
>> +++ b/arch/sparc/mm/tlb.c
>> @@ -11,6 +11,8 @@
>>  #include <linux/preempt.h>
>>  #include <linux/pagemap.h>
>>  
>> +#include <kunit/visibility.h>
>> +
>>  #include <asm/tlbflush.h>
>>  #include <asm/cacheflush.h>
>>  #include <asm/mmu_context.h>
>> @@ -54,6 +56,8 @@ void arch_enter_lazy_mmu_mode(void)
>>  {
>>  	preempt_disable();
>>  }
>> +/* For lazy_mmu_mode KUnit tests */
>> +EXPORT_SYMBOL_IF_KUNIT(arch_enter_lazy_mmu_mode);
>>  
>>  void arch_flush_lazy_mmu_mode(void)
>>  {
>> @@ -62,12 +66,14 @@ void arch_flush_lazy_mmu_mode(void)
>>  	if (tb->tlb_nr)
>>  		flush_tlb_pending();
>>  }
>> +EXPORT_SYMBOL_IF_KUNIT(arch_flush_lazy_mmu_mode);
>>  
>>  void arch_leave_lazy_mmu_mode(void)
>>  {
>>  	arch_flush_lazy_mmu_mode();
>>  	preempt_enable();
>>  }
>> +EXPORT_SYMBOL_IF_KUNIT(arch_leave_lazy_mmu_mode);
>>  
>>  static void tlb_batch_add_one(struct mm_struct *mm, unsigned long vaddr,
>>  			      bool exec, unsigned int hugepage_shift)
>>
>> base-commit: 8f0b4cce4481fb22653697cced8d0d04027cb1e8
Regardless of if it becomes a patch of its own in the end, or is
folded into another:

Acked-by: Andreas Larsson <andreas@gaisler.com>

Cheers,
Andreas