This went to the list before, but it was a reply on a different
thread, so probably got missed.  Please apply.

This patch adds some extra details to comments in a number of
testcases, giving useful information about the rationale and origins
of the test.  In particular it adds a prominent warning on testcases
which include "magic" offsets and addresses chosen carefully to
trigger particular subtle kernel bugs.

Signed-off-by: David Gibson <[EMAIL PROTECTED]>

Index: libhugetlbfs/tests/huge_at_4GB_normal_below.c
===================================================================
--- libhugetlbfs.orig/tests/huge_at_4GB_normal_below.c  2006-11-08 
13:27:48.000000000 +1100
+++ libhugetlbfs/tests/huge_at_4GB_normal_below.c       2006-11-08 
13:27:54.000000000 +1100
@@ -27,9 +27,17 @@
 
 #include "hugetests.h"
 
-/* Designed to pick up a bug on ppc64 where
+/*
+ * Test rationale:
+ *
+ * Designed to pick up a bug on ppc64 where
  * touches_hugepage_high_range() falsely reported true for ranges
- * reaching below 4GB */
+ * reaching below 4GB
+ *
+ * WARNING: The offsets and addresses used within are specifically
+ * calculated to trigger the bug as it existed.  Don't mess with them
+ * unless you *really* know what you're doing.
+ */
 
 int main(int argc, char *argv[])
 {
Index: libhugetlbfs/tests/huge_below_4GB_normal_above.c
===================================================================
--- libhugetlbfs.orig/tests/huge_below_4GB_normal_above.c       2006-11-08 
13:27:48.000000000 +1100
+++ libhugetlbfs/tests/huge_below_4GB_normal_above.c    2006-11-08 
13:27:54.000000000 +1100
@@ -27,9 +27,17 @@
 
 #include "hugetests.h"
 
-/* Designed to pick up a bug on ppc64 where
+/*
+ * Test rationale:
+ *
+ * Designed to pick up a bug on ppc64 where
  * touches_hugepage_low_range() could give false positives because of
- * the peculiar (undefined) behaviour of << for large shifts */
+ * the peculiar (undefined) behaviour of << for large shifts
+ *
+ * WARNING: The offsets and addresses used within are specifically
+ * calculated to trigger the bug as it existed.  Don't mess with them
+ * unless you *really* know what you're doing.
+ */
 
 int main(int argc, char *argv[])
 {
Index: libhugetlbfs/tests/map_high_truncate_2.c
===================================================================
--- libhugetlbfs.orig/tests/map_high_truncate_2.c       2006-11-08 
13:27:48.000000000 +1100
+++ libhugetlbfs/tests/map_high_truncate_2.c    2006-11-08 13:27:54.000000000 
+1100
@@ -41,6 +41,13 @@
  *
  * Test adapted to the libhugetlbfs framework from an example by
  * Kenneth Chen <[EMAIL PROTECTED]>
+ *
+ * WARNING: The offsets and addresses used within are specifically
+ * calculated to trigger the bug as it existed.  Don't mess with them
+ * unless you *really* know what you're doing.
+ *
+ * The kernel bug in question was fixed with commit
+ * 856fc29505556cf263f3dcda2533cf3766c14ab6.
  */
 #define MAP_LENGTH     (4 * hpage_size)
 #define TRUNCATE_POINT 0x60000000UL
Index: libhugetlbfs/tests/truncate_above_4GB.c
===================================================================
--- libhugetlbfs.orig/tests/truncate_above_4GB.c        2006-11-08 
13:27:48.000000000 +1100
+++ libhugetlbfs/tests/truncate_above_4GB.c     2006-11-08 13:27:54.000000000 
+1100
@@ -37,6 +37,13 @@
  * At one stage, a misconversion of hugetlb_vmtruncate_list to a
  * prio_tree meant that on 32-bit machines, truncates at or above 4GB
  * could truncate lower pages, resulting in BUG_ON()s.
+ *
+ * WARNING: The offsets and addresses used within are specifically
+ * calculated to trigger the bug as it existed.  Don't mess with them
+ * unless you *really* know what you're doing.
+ *
+ * The kernel bug in question was fixed with commit
+ * 856fc29505556cf263f3dcda2533cf3766c14ab6.
  */
 #define FOURGIG ((off64_t)0x100000000ULL)
 
Index: libhugetlbfs/tests/truncate_reserve_wraparound.c
===================================================================
--- libhugetlbfs.orig/tests/truncate_reserve_wraparound.c       2006-11-08 
13:27:48.000000000 +1100
+++ libhugetlbfs/tests/truncate_reserve_wraparound.c    2006-11-08 
13:27:54.000000000 +1100
@@ -29,6 +29,18 @@
 
 #include "hugetests.h"
 
+/*
+ * Test rationale:
+ *
+ * At one stage, improper handling of tests against i_size could mess
+ * up accounting of reserved hugepages on certain truncate
+ * operations.
+ *
+ * This bug was fixed with a band-aid (enough to pass this test) in
+ * commit ebed4bfc8da8df5b6b0bc4a5064a949f04683509.  A more complete
+ * fix still pending as of 3d4248885b9fca818e7fe6b66328e714876d36ad.
+ */
+
 #define RANDOM_CONSTANT        0x1234ABCD
 
 static sigjmp_buf sig_escape;
Index: libhugetlbfs/tests/truncate_sigbus_versus_oom.c
===================================================================
--- libhugetlbfs.orig/tests/truncate_sigbus_versus_oom.c        2006-11-08 
13:27:48.000000000 +1100
+++ libhugetlbfs/tests/truncate_sigbus_versus_oom.c     2006-11-08 
13:27:54.000000000 +1100
@@ -35,6 +35,10 @@
  * i_size.  This bug means that attempting to instantiate a page
  * beyond the end of a hugepage file can result in an OOM and SIGKILL
  * instead of the correct SIGBUS.
+ *
+ * This bug was fixed with a band-aid (enough to pass this test) in
+ * commit ebed4bfc8da8df5b6b0bc4a5064a949f04683509.  A more complete
+ * fix still pending as of 3d4248885b9fca818e7fe6b66328e714876d36ad.
  */
 static void sigbus_handler(int signum, siginfo_t *si, void *uc)
 {

-- 
David Gibson                    | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
                                | _way_ _around_!
http://www.ozlabs.org/~dgibson

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Libhugetlbfs-devel mailing list
Libhugetlbfs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel

Reply via email to