Skip to contentSkip to conversation

Ltp-list Digest, Vol 63, Issue 22

LTP hake huang 2 participants 3 messages Aug 19, 2011 – Aug 26, 2011 2 messages not in the archive

lore
Share & tools
lore

hake huang

author
#1 lore raw
In reply to a message not in the archive

Hi,

I test LTP in arm, cortex-a9 which is 4 core system, and find that the mmap1 of memtest06, failed. when I check the LTP mail list and find this patch
http://www.mail-archive.com/[email protected]/msg10706.html
however, when I apply this patch, I can still see the same problem but with less frequency. It looks like the write process and read process are running on different core, when write process unmap and remap the address, and the other process is read at the same time.

So any suggestions?

Regards,

Hake

2011/8/16 <[email protected]>

Quoted 487 lines

Send Ltp-list mailing list submissions to
[email protected]

To subscribe or unsubscribe via the World Wide Web, visit
https://lists.sourceforge.net/lists/listinfo/ltp-list
or, via email, send a message with subject or body 'help' to
[email protected]

You can reach the person managing the list at
[email protected]

When replying, please edit your Subject line so it is more specific than "Re: Contents of Ltp-list digest..."

Today's Topics:

  1.  [PATCH 4/6] hugemmap02.c (tangchen)
  2.  [PATCH 5/6] hugemmap03.c (tangchen)
  3.  [PATCH 6/6] hugemmap04.c (tangchen)

----------------------------------------------------------------------

Message: 1
Date: Tue, 16 Aug 2011 16:02:23 +0800
From: tangchen <[email protected]>
Subject: [LTP] [PATCH 4/6] hugemmap02.c
To: Cyril Hrubis <[email protected]>, Garrett Cooper
<[email protected]>
Cc: "[email protected]" <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"

---
 testcases/kernel/mem/hugetlb/hugemmap/hugemmap02.c |   47
+++++++-------------
 1 files changed, 16 insertions(+), 31 deletions(-)
testcases/kernel/mem/hugetlb/hugemmap/hugemmap02.c +1 -0
index 45cddf7..3bbbc46 100644
@@ -63,6 +63,7 @@
 #include "test.h"
 #include "usctest.h"
 #include "system_specific_hugepages_info.h"
+#include "libmnt.h"
 
 #define LOW_ADDR       (void *)(0x80000000)
 #define LOW_ADDR2      (void *)(0x90000000)
@@ -77,38 +78,17 @@ unsigned long *addrlist[5]; /* list of addresses of

memory mapped region */
int i;
int fildes; /* file descriptor for tempfile */
int nfildes; /* file descriptor for /dev/zero */

testcases/kernel/mem/hugetlb/hugemmap/hugemmap02.c +1 -7
-char *Hopt;                     /* location of hugetlbfs */
+char *mount_point = NULL;
 
-void setup();                  /* Main setup function of test */
-void cleanup();                        /* cleanup function for the test */
-
-void help()
-{
-       printf("  -H /..  Location of hugetlbfs, i.e. -H /var/hugetlbfs

\n");

testcases/kernel/mem/hugetlb/hugemmap/hugemmap02.c +2 -5
-}
+void setup(void);                      /* Main setup function of test */
+void cleanup(void);                    /* cleanup function for the test */
 
 int
 main(int ac, char **av)
 {
       int lc;
-       char *msg;
-        int Hflag = 0;
       int page_sz, map_sz;
 
-               option_t options[] = {
-               { "H:",   &Hflag, &Hopt },    /* Required for location of

hugetlbfs */
- { NULL, NULL, NULL } /* NULL required to end array
*/

testcases/kernel/mem/hugetlb/hugemmap/hugemmap02.c +0 -10
-               };
-
-       /* Parse standard options given to run the test. */
-       if ((msg = parse_opts(ac, av, options, &help)) != NULL)
-               tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s, use
-help", msg);
-
-       if (Hflag == 0) {
-               tst_brkm(TBROK, NULL,
-                   "-H option is REQUIRED for this test, use -h for

options help");

testcases/kernel/mem/hugetlb/hugemmap/hugemmap02.c +10 -7
-       }
-
       page_sz = getpagesize();
       map_sz = 2 * 1024 * hugepages_size();
@@ -206,15 +186,20 @@ main(int ac, char **av)
 *          Write some known data into file and get the size of the file.
 */
 void
-setup()
+setup(void)
 {
-       tst_tmpdir();
-
-       snprintf(TEMPFILE, sizeof(TEMPFILE), "%s/mmapfile%d", Hopt,
 getpid());
-
+       tst_require_root(NULL);
       tst_sig(FORK, DEF_HANDLER, cleanup);
 
       TEST_PAUSE;
+
+       tst_tmpdir();
+       mount_point = get_tst_tmpdir();
+
+       mount_hugetlbfs(mount_point);
+       hugepage_alloc(1024);
+
+       snprintf(TEMPFILE, sizeof(TEMPFILE), "%s/mmapfile%d", mount_point,
 getpid());
 }

/*

testcases/kernel/mem/hugetlb/hugemmap/hugemmap02.c +2 -3
@@ -223,7 +208,7 @@ setup()
 *            Remove the temporary directory created.
 */
 void
-cleanup()
+cleanup(void)
 {
       /*
        * print timing stats if that option was specified.
@@ -231,6 +216,6 @@ cleanup()
       TEST_CLEANUP;
 
       unlink(TEMPFILE);
-
+       umount_hugetlbfs(mount_point);
       tst_rmdir();
 }
--

1.7.1

--
Best Regards,
Tang chen
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 0004-hugemmap02.c-Automatically-mount-hugetlbfs-on-huge.patch

------------------------------

Message: 2
Date: Tue, 16 Aug 2011 16:03:25 +0800
From: tangchen <[email protected]>
Subject: [LTP] [PATCH 5/6] hugemmap03.c
To: Cyril Hrubis <[email protected]>, Garrett Cooper
<[email protected]>
Cc: "[email protected]" <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"

---
 testcases/kernel/mem/hugetlb/hugemmap/hugemmap03.c |   66
++++++++------------
 1 files changed, 26 insertions(+), 40 deletions(-)
testcases/kernel/mem/hugetlb/hugemmap/hugemmap03.c +5 -13
index cac94b0..b17b19d 100644
@@ -54,54 +54,31 @@
 #include "test.h"
 #include "usctest.h"
 #include "system_specific_hugepages_info.h"
+#include "libmnt.h"
 
 #define HIGH_ADDR      (void *)(0x1000000000000)
 
-char* TEMPFILE="mmapfile";
+char TEMPFILE[MAXPATHLEN];
 
 char *TCID="hugemmap03";       /* Test program identifier.    */
 int TST_TOTAL=1;               /* Total number of test cases. */
 unsigned long *addr;           /* addr of memory mapped region */
 int fildes;                    /* file descriptor for tempfile */
-char *Hopt;                     /* location of hugetlbfs */
+char *mount_point = NULL;
 
-void setup();                  /* Main setup function of test */
-void cleanup();                        /* cleanup function for the test */
-
-void help()
-{
-       printf("  -H /..  Location of hugetlbfs, i.e. -H /var/hugetlbfs
 \n");
-}
+void setup(void);                      /* Main setup function of test */
+void cleanup(void);                    /* cleanup function for the test */
 
 int
 main(int ac, char **av)
 {
       int lc;                 /* loop counter */
-       char *msg;              /* message returned from parse_opts */
-        int Hflag=0;              /* binary flag: opt or not */
       int page_sz;
 
 #if __WORDSIZE==32  /* 32-bit compiled */
       tst_brkm(TCONF, NULL, "This test is only for 64bit");
 #endif
 
-               option_t options[] = {
-               { "H:",   &Hflag, &Hopt },    /* Required for location of

hugetlbfs */
- { NULL, NULL, NULL } /* NULL required to end array
*/

testcases/kernel/mem/hugetlb/hugemmap/hugemmap03.c +0 -12
-               };
-
-       /* Parse standard options given to run the test. */
-       msg = parse_opts(ac, av, options, &help);
-       if (msg != (char *) NULL) {
-               tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s, use
-help", msg);
-               tst_exit();
-       }
-
-       if (Hflag == 0) {
-               tst_brkm(TBROK, NULL, "-H option is REQUIRED for this test,

use -h for options help");

testcases/kernel/mem/hugetlb/hugemmap/hugemmap03.c +1 -5
-               tst_exit();
-       }
-
       page_sz = getpagesize();
 
       setup();
@@ -122,8 +99,15 @@ main(int ac, char **av)
               addr = mmap(HIGH_ADDR, page_sz, PROT_READ,
                           MAP_SHARED | MAP_FIXED, fildes, 0);
               if (addr != MAP_FAILED) {
-                       tst_resm(TFAIL, "Normal mmap() into high region
 unexpectedly succeeded on %s, errno=%d : %s",
-                                TEMPFILE, errno, strerror(errno));
+                       tst_resm(TFAIL|TERRNO, "Normal mmap() into high

region unexpectedly "

testcases/kernel/mem/hugetlb/hugemmap/hugemmap03.c +6 -0
+                               "succeeded on %s",
+                               TEMPFILE);
+
+                       /* Unmap the mapped memory */
+                       if (munmap(addr, page_sz) != 0) {
+                               tst_brkm(TFAIL|TERRNO, NULL, "munmap()

fails to unmap the "

testcases/kernel/mem/hugetlb/hugemmap/hugemmap03.c +2 -0
+                                       "memory");
+                       }
                       continue;
               } else {
                       tst_resm(TPASS, "Normal mmap() into high region

failed correctly");

testcases/kernel/mem/hugetlb/hugemmap/hugemmap03.c +9 -8
@@ -132,7 +116,6 @@ main(int ac, char **av)
 
               close(fildes);
       }
-
       cleanup();
 
       tst_exit();
@@ -149,18 +132,20 @@ main(int ac, char **av)
 *          Write some known data into file and get the size of the file.
 */
 void
-setup()
+setup(void)
 {
-       char mypid[40];
-
-       sprintf(mypid,"/%d",getpid());
-       TEMPFILE=strcat(mypid,TEMPFILE);
-       TEMPFILE=strcat(Hopt,TEMPFILE);
-
+       tst_require_root(NULL);
       tst_sig(FORK, DEF_HANDLER, cleanup);
 
       TEST_PAUSE;
 
+       tst_tmpdir();
+       mount_point = get_tst_tmpdir();
+
+       mount_hugetlbfs(mount_point);
+       hugepage_alloc(1024);
+
+       snprintf(TEMPFILE, sizeof(TEMPFILE), "%s/mmapfile%d", mount_point,
 getpid());
 }
 

/*

testcases/kernel/mem/hugetlb/hugemmap/hugemmap03.c +3 -3
@@ -169,7 +154,7 @@ setup()
 *            Remove the temporary directory created.
 */
 void
-cleanup()
+cleanup(void)
 {
       /*
        * print timing stats if that option was specified.
@@ -177,5 +162,6 @@ cleanup()
       TEST_CLEANUP;
 
       unlink(TEMPFILE);
-
+       umount_hugetlbfs(mount_point);
+       tst_rmdir();
 }
--

1.7.1

--
Best Regards,
Tang chen
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 0005-hugemmap03.c-Automatically-mount-hugetlbfs-on-huge.patch

------------------------------

Message: 3
Date: Tue, 16 Aug 2011 16:04:10 +0800
From: tangchen <[email protected]>
Subject: [LTP] [PATCH 6/6] hugemmap04.c
To: Cyril Hrubis <[email protected]>, Garrett Cooper
<[email protected]>
Cc: "[email protected]" <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"

---
 testcases/kernel/mem/hugetlb/hugemmap/hugemmap04.c |   52
++++++--------------
 1 files changed, 16 insertions(+), 36 deletions(-)
testcases/kernel/mem/hugetlb/hugemmap/hugemmap04.c +2 -1
index 4cc6ed4..9774e87 100644
@@ -73,10 +73,11 @@
 #include "test.h"
 #include "usctest.h"
 #include "system_specific_hugepages_info.h"
+#include "libmnt.h"
 
 #define BUFFER_SIZE  256
 
-char* TEMPFILE="mmapfile";
+char TEMPFILE[MAXPATHLEN];
 
 char *TCID="hugemmap04";       /* Test program identifier.    */
 int TST_TOTAL=1;               /* Total number of test cases. */
@@ -87,41 +88,17 @@ int freepages=0;            /* Amount of free huge

pages to use for testing */
int beforetest=0; /* Amount of free huge pages before testing
*/
int aftertest=0; /* Amount of free huge pages after testing
*/
int hugepagesmapped=0; /* Amount of huge pages mapped after
testing */

testcases/kernel/mem/hugetlb/hugemmap/hugemmap04.c +1 -7
-char *Hopt;                     /* location of hugetlbfs */
+char *mount_point = NULL;
 
-void setup();                  /* Main setup function of test */
-void cleanup();                        /* cleanup function for the test */
-
-void help()
-{
-       printf("  -H /..  Location of hugetlbfs, i.e. -H /var/hugetlbfs

\n");

testcases/kernel/mem/hugetlb/hugemmap/hugemmap04.c +2 -5
-}
+void setup(void);                      /* Main setup function of test */
+void cleanup(void);                    /* cleanup function for the test */
 
 int
 main(int ac, char **av)
 {
       int lc;                 /* loop counter */
-       char *msg;              /* message returned from parse_opts */
-        int Hflag=0;              /* binary flag: opt or not */
       int huge_pagesize=0;
 
-               option_t options[] = {
-               { "H:",   &Hflag, &Hopt },    /* Required for location of

hugetlbfs */
- { NULL, NULL, NULL } /* NULL required to end array
*/

testcases/kernel/mem/hugetlb/hugemmap/hugemmap04.c +0 -12
-               };
-
-       /* Parse standard options given to run the test. */
-       msg = parse_opts(ac, av, options, &help);
-       if (msg != (char *) NULL) {
-               tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s, use
-help", msg);
-               tst_exit();
-       }
-
-       if (Hflag == 0) {
-               tst_brkm(TBROK, NULL, "-H option is REQUIRED for this test,

use -h for options help");

testcases/kernel/mem/hugetlb/hugemmap/hugemmap04.c +1 -4
-               tst_exit();
-       }
-
       /* Check number of hugepages */
       if (get_no_of_hugepages() <= 0 || hugepages_size() <= 0)
               tst_brkm(TCONF, cleanup, "Not enough available Hugepages");
@@ -151,7 +128,7 @@ main(int ac, char **av)
               tst_resm(TINFO,"Total amount of free huge pages is
 %d",freepages);
               tst_resm(TINFO,"Max number allowed for 1 mmap file in
 32-bits is 128");
               if (freepages > 128)
-                 freepages=128;
+                       freepages=128;
 #endif

/*
* Call mmap

testcases/kernel/mem/hugetlb/hugemmap/hugemmap04.c +8 -6
@@ -206,16 +183,18 @@ main(int ac, char **av)
 void
 setup()
 {
-       char mypid[40];
-
-       sprintf(mypid,"/%d",getpid());
-       TEMPFILE=strcat(mypid,TEMPFILE);
-       TEMPFILE=strcat(Hopt,TEMPFILE);
-
+       tst_require_root(NULL);
       tst_sig(FORK, DEF_HANDLER, cleanup);
 
       TEST_PAUSE;
 
+       tst_tmpdir();
+       mount_point = get_tst_tmpdir();
+
+       mount_hugetlbfs(mount_point);
+       hugepage_alloc(1024);
+
+       snprintf(TEMPFILE, sizeof(TEMPFILE), "%s/mmapfile%d", mount_point,
 getpid());
 }
 

/*

testcases/kernel/mem/hugetlb/hugemmap/hugemmap04.c +2 -2
@@ -232,5 +211,6 @@ cleanup()
       TEST_CLEANUP;
 
       unlink(TEMPFILE);
-
+       umount_hugetlbfs(mount_point);
+       tst_rmdir();
 }
--

1.7.1

--
Best Regards,
Tang chen
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 0006-hugemmap04.c-Automatically-mount-hugetlbfs-on-huge.patch

------------------------------

------------------------------------------------------------------------------
uberSVN's rich system and user administration capabilities and model configuration take the hassle out of deploying and managing Subversion and the tools developers use with it. Learn more about uberSVN and get a free download at: http://p.sf.net/sfu/wandisco-dev2dev

------------------------------

Quoted 9 lines

_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

End of Ltp-list Digest, Vol 63, Issue 22
****************************************

------------------------------------------------------------------------------
Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2

_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#2 lore raw

Hi!

Quoted 9 lines

I test LTP in arm, cortex-a9 which is 4 core system, and find that the mmap1 of memtest06, failed. when I check the LTP mail list and find this patch
http://www.mail-archive.com/[email protected]/msg10706.html
however, when I apply this patch, I can still see the same problem but with less frequency. It looks like the write process and read process are running on different core, when write process unmap and remap the address, and the other process is read at the same time.

So any suggestions?

There is probably a race condition, what is exact output from the test on the failure?

Signature · 12 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
EMC VNX: the world's simplest storage, starting under $10K
The only unified storage solution that offers unified management 
Up to 160% more powerful than alternatives and 25% more efficient. 
Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
author
#4 lore raw
In reply to a message not in the archive

CC

---------- Forwarded message ----------
From: hake huang <[email protected]>
Date: 2011/8/26
Subject: Re: [LTP] Ltp-list Digest, Vol 63, Issue 22
To: Cyril Hrubis <[email protected]>

the log

#mmap1 -x 0.01

mmap1       0  TINFO  :  created thread[726717552]
mmap1       0  TINFO  :  pid[5117]: map, change contents, unmap files 1000
times
mmap1       0  TINFO  :  created thread[736490608]
mmap1       0  TINFO  :  pid[5117] - read contents of memory 0x2bf02000 1000

times
mmap1 0 TINFO : page fault occurred at 0x2ab27000
caught unexpected signal - 11 --- exiting

Regards,

Hake

2011/8/25 Cyril Hrubis <[email protected]>

Quoted 13 lines

Hi!

Quoted 1 line

I test LTP in arm, cortex-a9 which is 4 core system, and find that the

mmap1

Quoted 3 lines

of memtest06, failed. when I check the LTP mail list and find this patch
http://www.mail-archive.com/[email protected]/msg10706.html
however, when I apply this patch, I can still see the same problem but

with

Quoted 1 line

less frequency. It looks like the write process and read process are

running

Quoted 1 line

on different core, when write process unmap and remap the address, and

the

Quoted 2 lines

other process is read at the same time.

Quoted 9 lines
Quoted 1 line

So any suggestions?

There is probably a race condition, what is exact output from the test on the failure?

--
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
EMC VNX: the world's simplest storage, starting under $10K The only unified storage solution that offers unified management Up to 160% more powerful than alternatives and 25% more efficient. Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev

_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list