public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH] fix the SEGBUS signal error
       [not found] <309535663.439391290666931720.JavaMail.root@zmail06.collab.prod.int.phx2.redhat.com>
@ 2010-11-25  6:39 ` Zhouping Liu
  2010-11-25  8:31   ` Mike Frysinger
  2010-11-25 20:37   ` Garrett Cooper
  0 siblings, 2 replies; 3+ messages in thread
From: Zhouping Liu @ 2010-11-25  6:39 UTC (permalink / raw)
  To: ltp-list


[-- Attachment #1.1: Type: text/plain, Size: 1800 bytes --]

Hi,all 
when I run this test program : 
#./hugemmap04 -I 3600 -H /var/hugetlbfs 
I found it returned quickly. 
I used gdb tool to debug it, it returned error with the 'SEGBUS' signal error, 
and the error occurred in the 178 lines '*(int*)addr = 0;'. 
it's okay when I add this line 
write(fildes, "write some words to the TEMPFILE file\n",40); 
you can run this c program to find this error. 
$cat test.c 

#include <stdio.h> 
#include <stdlib.h> 
#include <fcntl.h> 
#include <sys/mman.h> 
char * TEMPFILE="mmapfile"; 
int freepages = 0; 
int main() 
{ 
long *addr; 
int fd; 
long long mapsize; 
if ((fd = open(TEMPFILE, O_RDWR | O_CREAT | O_TRUNC,0666)) < 0) { 
printf("open error\n"); 
return -2; 
} 
freepages = 100; 
mapsize = (long long)freepages * 2048 * 1024; 
printf("mapsize is %lld \n",mapsize); 
addr = (long *)mmap(NULL,mapsize, PROT_READ | PROT_WRITE, MAP_SHARED, fd,0); 
if (addr == MAP_FAILED) { 
printf("mmap error\n"); 
return -1; 
} 
/* if you enable this line,there will be no error. */ 
//write(fd,"I don't know\n",20); 
*(int *)addr = 0; 
sleep(10); 
close(fd); 
return 0; 
} 

$./test 
mapsize is 209715200 
Bus error (core dumped) 
$ 

Signed-off-by: Zhouping Liu < zliu@ redhat > 

diff --git a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap04.c b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap04.c 
index 485b465..cc7b249 100644 
--- a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap04.c 
+++ b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap04.c 
@@ -174,6 +174,8 @@ main(int ac, char **av) 
continue; 
} else { 
tst_resm(TPASS, "Succeeded mapping file using %d pages",freepages); 
+ /* the write function just do initalization */ 
+ write(fildes, "write some words to the TEMPFILE file\n",40); 
/* force to allocate page and change HugePages_Free */ 
*(int*)addr = 0; 
} 


[-- Attachment #1.2: Type: text/html, Size: 3780 bytes --]

[-- Attachment #2: Type: text/plain, Size: 402 bytes --]

------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev

[-- Attachment #3: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [PATCH] fix the SEGBUS signal error
  2010-11-25  6:39 ` [LTP] [PATCH] fix the SEGBUS signal error Zhouping Liu
@ 2010-11-25  8:31   ` Mike Frysinger
  2010-11-25 20:37   ` Garrett Cooper
  1 sibling, 0 replies; 3+ messages in thread
From: Mike Frysinger @ 2010-11-25  8:31 UTC (permalink / raw)
  To: ltp-list


[-- Attachment #1.1: Type: Text/Plain, Size: 104 bytes --]

your patch seems to be horribly mangled.  please use `git send-email` or 
something like that.
-mike

[-- Attachment #1.2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 402 bytes --]

------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev

[-- Attachment #3: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [PATCH] fix the SEGBUS signal error
  2010-11-25  6:39 ` [LTP] [PATCH] fix the SEGBUS signal error Zhouping Liu
  2010-11-25  8:31   ` Mike Frysinger
@ 2010-11-25 20:37   ` Garrett Cooper
  1 sibling, 0 replies; 3+ messages in thread
From: Garrett Cooper @ 2010-11-25 20:37 UTC (permalink / raw)
  To: Zhouping Liu; +Cc: ltp-list

On Wed, Nov 24, 2010 at 10:39 PM, Zhouping Liu <zliu@redhat.com> wrote:
> Hi,all
> when I run this test program :
> #./hugemmap04 -I 3600 -H /var/hugetlbfs
> I found it returned quickly.
> I used gdb  tool to debug it, it returned error with the 'SEGBUS' signal
> error,
> and the error occurred in the 178 lines '*(int*)addr = 0;'.
> it's okay when I add this line
> write(fildes, "write some words to the TEMPFILE file\n",40);
> you can run this c program to find this error.
> $cat test.c
>
> #include <stdio.h>
> #include <stdlib.h>
> #include <fcntl.h>
> #include <sys/mman.h>
> char * TEMPFILE="mmapfile";
> int freepages = 0;
> int main()
> {
>     long *addr;
>     int fd;
>     long long mapsize;
>     if ((fd = open(TEMPFILE, O_RDWR | O_CREAT | O_TRUNC,0666)) < 0) {
>         printf("open error\n");
>         return -2;
>     }
>     freepages = 100;
>     mapsize = (long long)freepages * 2048 * 1024;
>     printf("mapsize is %lld \n",mapsize);
>     addr = (long *)mmap(NULL,mapsize, PROT_READ | PROT_WRITE, MAP_SHARED,
> fd,0);
>     if (addr == MAP_FAILED) {
>         printf("mmap error\n");
>         return -1;
>     }
>      /*  if you enable this line,there will be no error. */
>     //write(fd,"I don't know\n",20);
>     *(int *)addr = 0;
>     sleep(10);
>     close(fd);
>     return 0;
> }
>
> $./test
> mapsize is 209715200
> Bus error (core dumped)
> $
>
> Signed-off-by: Zhouping Liu <zliu@redhat>
>
> diff --git a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap04.c
> b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap04.c
> index 485b465..cc7b249 100644
> --- a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap04.c
> +++ b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap04.c
> @@ -174,6 +174,8 @@ main(int ac, char **av)
>                         continue;
>                 } else {
>                         tst_resm(TPASS, "Succeeded mapping file using %d
> pages",freepages);
> +                       /* the write function just do initalization */
> +                       write(fildes, "write some words to the TEMPFILE
> file\n",40);
>                         /* force to allocate page and change HugePages_Free
> */
>                         *(int*)addr = 0;
>                 }

    That doesn't make sense (this test is junk in its current form
anyhow, but your conclusion doesn't make sense regardless), in
particular because this logic has worked on a number of other
platforms and OSes before this.
    Please dig deeper to figure out what the real error is.
Thanks,
-Garrett

------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

end of thread, other threads:[~2010-11-25 20:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <309535663.439391290666931720.JavaMail.root@zmail06.collab.prod.int.phx2.redhat.com>
2010-11-25  6:39 ` [LTP] [PATCH] fix the SEGBUS signal error Zhouping Liu
2010-11-25  8:31   ` Mike Frysinger
2010-11-25 20:37   ` Garrett Cooper

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