linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] maple_tree: Fix 32 bit mas_next testing
@ 2023-07-12 17:39 Liam R. Howlett
  2023-07-12 17:39 ` [PATCH 2/2] maple_tree: Fix node allocation testing on 32 bit Liam R. Howlett
  2023-07-13  7:47 ` [PATCH 1/2] maple_tree: Fix 32 bit mas_next testing Geert Uytterhoeven
  0 siblings, 2 replies; 3+ messages in thread
From: Liam R. Howlett @ 2023-07-12 17:39 UTC (permalink / raw)
  To: Andrew Morton
  Cc: maple-tree, linux-mm, linux-kernel, Liam R. Howlett, Geert Uytterhoeven

The test setup of mas_next is dependent on node entry size to create a 2
level tree, but the tests did not account for this in the expected value
when shifting beyond the scope of the tree.

Fix this by setting up the test to succeed depending on the node
entries which is dependent on the 32/64 bit setup.

Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Link: https://lore.kernel.org/linux-mm/CAMuHMdV4T53fOw7VPoBgPR7fP6RYqf=CBhD_y_vOg53zZX_DnA@mail.gmail.com/
Fixes: 120b116208a0 ("maple_tree: reorganize testing to restore module testing")
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
---
 lib/test_maple_tree.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/test_maple_tree.c b/lib/test_maple_tree.c
index 9f60e0c4cc8c..3207c2107918 100644
--- a/lib/test_maple_tree.c
+++ b/lib/test_maple_tree.c
@@ -1963,13 +1963,16 @@ static noinline void __init next_prev_test(struct maple_tree *mt)
 						   725};
 	static const unsigned long level2_32[] = { 1747, 2000, 1750, 1755,
 						   1760, 1765};
+	unsigned long last_index;
 
 	if (MAPLE_32BIT) {
 		nr_entries = 500;
 		level2 = level2_32;
+		last_index = 0x138e;
 	} else {
 		nr_entries = 200;
 		level2 = level2_64;
+		last_index = 0x7d6;
 	}
 
 	for (i = 0; i <= nr_entries; i++)
@@ -2076,7 +2079,7 @@ static noinline void __init next_prev_test(struct maple_tree *mt)
 
 	val = mas_next(&mas, ULONG_MAX);
 	MT_BUG_ON(mt, val != NULL);
-	MT_BUG_ON(mt, mas.index != 0x7d6);
+	MT_BUG_ON(mt, mas.index != last_index);
 	MT_BUG_ON(mt, mas.last != ULONG_MAX);
 
 	val = mas_prev(&mas, 0);
-- 
2.39.2



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 2/2] maple_tree: Fix node allocation testing on 32 bit
  2023-07-12 17:39 [PATCH 1/2] maple_tree: Fix 32 bit mas_next testing Liam R. Howlett
@ 2023-07-12 17:39 ` Liam R. Howlett
  2023-07-13  7:47 ` [PATCH 1/2] maple_tree: Fix 32 bit mas_next testing Geert Uytterhoeven
  1 sibling, 0 replies; 3+ messages in thread
From: Liam R. Howlett @ 2023-07-12 17:39 UTC (permalink / raw)
  To: Andrew Morton; +Cc: maple-tree, linux-mm, linux-kernel, Liam R. Howlett

Internal node counting was altered and the 64 bit test was updated,
however the 32bit test was missed.

Restore the 32bit test to a functional state.

Link: https://lore.kernel.org/linux-mm/CAMuHMdV4T53fOw7VPoBgPR7fP6RYqf=CBhD_y_vOg53zZX_DnA@mail.gmail.com/
Fixes: 541e06b772c1 ("maple_tree: remove GFP_ZERO from kmem_cache_alloc() and kmem_cache_alloc_bulk()")
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
---
 tools/testing/radix-tree/maple.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/testing/radix-tree/maple.c b/tools/testing/radix-tree/maple.c
index 312c0d9fcbae..9901ae821911 100644
--- a/tools/testing/radix-tree/maple.c
+++ b/tools/testing/radix-tree/maple.c
@@ -213,9 +213,9 @@ static noinline void __init check_new_node(struct maple_tree *mt)
 				e = i - 1;
 		} else {
 			if (i >= 4)
-				e = i - 4;
-			else if (i == 3)
-				e = i - 2;
+				e = i - 3;
+			else if (i >= 1)
+				e = i - 1;
 			else
 				e = 0;
 		}
-- 
2.39.2



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] maple_tree: Fix 32 bit mas_next testing
  2023-07-12 17:39 [PATCH 1/2] maple_tree: Fix 32 bit mas_next testing Liam R. Howlett
  2023-07-12 17:39 ` [PATCH 2/2] maple_tree: Fix node allocation testing on 32 bit Liam R. Howlett
@ 2023-07-13  7:47 ` Geert Uytterhoeven
  1 sibling, 0 replies; 3+ messages in thread
From: Geert Uytterhoeven @ 2023-07-13  7:47 UTC (permalink / raw)
  To: Liam R. Howlett; +Cc: Andrew Morton, maple-tree, linux-mm, linux-kernel

On Wed, Jul 12, 2023 at 7:39 PM Liam R. Howlett <Liam.Howlett@oracle.com> wrote:
> The test setup of mas_next is dependent on node entry size to create a 2
> level tree, but the tests did not account for this in the expected value
> when shifting beyond the scope of the tree.
>
> Fix this by setting up the test to succeed depending on the node
> entries which is dependent on the 32/64 bit setup.
>
> Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Link: https://lore.kernel.org/linux-mm/CAMuHMdV4T53fOw7VPoBgPR7fP6RYqf=CBhD_y_vOg53zZX_DnA@mail.gmail.com/

s/Link/Closes/

> Fixes: 120b116208a0 ("maple_tree: reorganize testing to restore module testing")
> Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>

On ARAnyM:

    TEST STARTING

    maple_tree: 3804524 of 3804524 tests passed

Tested-by: Geert Uytterhoeven <geert@linux-m68k.org>

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-07-13  7:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-12 17:39 [PATCH 1/2] maple_tree: Fix 32 bit mas_next testing Liam R. Howlett
2023-07-12 17:39 ` [PATCH 2/2] maple_tree: Fix node allocation testing on 32 bit Liam R. Howlett
2023-07-13  7:47 ` [PATCH 1/2] maple_tree: Fix 32 bit mas_next testing Geert Uytterhoeven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox