Re: [LTP] [PATCH 2/8] Hugetlb: Migrating libhugetlbfs huge_at_4GB_normal_below

Richard Palethorpe
2022-12-05T14:00:10Z

Hello,

Tarun Sahu <tsahu@linux.ibm.com> writes:

> Migrating the libhugetlbfs/testcases/huge_at_4GB_normal_below.c test
>
> Test Description: Designed to pick up a bug on ppc64 where
> touches_hugepage_high_range() falsely reported true for ranges reaching
> below 4GB
>
> Signed-off-by: Tarun Sahu <tsahu@linux.ibm.com>
> ---
> runtest/hugetlb | 1 +
> testcases/kernel/mem/.gitignore | 1 +
> .../kernel/mem/hugetlb/hugemmap/hugemmap13.c | 122 ++++++++++++++++++
> 3 files changed, 124 insertions(+)
> create mode 100644 testcases/kernel/mem/hugetlb/hugemmap/hugemmap13.c
>
> diff --git a/runtest/hugetlb b/runtest/hugetlb
> index 4c16e1e7c..2029ee4b3 100644
> --- a/runtest/hugetlb
> +++ b/runtest/hugetlb
> @@ -14,6 +14,7 @@ hugemmap09 hugemmap09
> hugemmap10 hugemmap10
> hugemmap11 hugemmap11
> hugemmap12 hugemmap12
> +hugemmap13 hugemmap13
> hugemmap05_1 hugemmap05 -m
> hugemmap05_2 hugemmap05 -s
> hugemmap05_3 hugemmap05 -s -m
> diff --git a/testcases/kernel/mem/.gitignore b/testcases/kernel/mem/.gitignore
> index adea760c7..5955ed613 100644
> --- a/testcases/kernel/mem/.gitignore
> +++ b/testcases/kernel/mem/.gitignore
> @@ -13,6 +13,7 @@
> /hugetlb/hugemmap/hugemmap10
> /hugetlb/hugemmap/hugemmap11
> /hugetlb/hugemmap/hugemmap12
> +/hugetlb/hugemmap/hugemmap13
> /hugetlb/hugeshmat/hugeshmat01
> /hugetlb/hugeshmat/hugeshmat02
> /hugetlb/hugeshmat/hugeshmat03
> diff --git a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap13.c b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap13.c
> new file mode 100644
> index 000000000..84a84e074
> --- /dev/null
> +++ b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap13.c
> @@ -0,0 +1,122 @@
> +// SPDX-License-Identifier: LGPL-2.1-or-later
> +/*
> + * Copyright (C) 2005-2006 David Gibson & Adam Litke, IBM Corporation.
> + * Author: David Gibson & Adam Litke
> + */
> +
> +/*\
> + * [Description]
> + *
> + * Designed to pick up a bug on ppc64 where touches_hugepage_high_range()
> + * falsely reported true for ranges reaching below 4GB

Hhmm seems like the macro no longer exists. This isn't a great test
description.

This appers to be the fix for the bug mentioned:
https://lkml.org/lkml/2005/11/23/540

Maybe we could add to this that the test creates a hugepage just above
the 32bit memory space and a normal page below it. That on old kernels
this would trigger a bug caused by an off-by-one error.

--
Thank you,
Richard.