2009-10-22 03:19:07     problem about berkeley db4 on bf548

Document created by Aaronwu Employee on Aug 19, 2013
Version 1Show Document
  • View in full screen mode

2009-10-22 03:19:07     problem about berkeley db4 on bf548

watson xu (CHINA)

Message: 81576   

 

hi, all

 

i have a project running on blackfin bf547, uclinux 2008R1.5-RC3. I have port the berkeley db4 4.7.25 to the platform.

 

attachment 1 is my test program, it just read data record from database file and then discard the data.

 

attachment 2 is the db4 makefile.

 

when there is not so much data to be read, it works fine, but if there is more than about 800 records in the database, the program will write memory in other process's address space. and this cause the other program to crash.

 

i have tried to increase the stack size of the program to more than 3M, using the fdpichdr tool, but this doesn't change anything. seems it is not  a stack overflow,

 

 

 

thank in advance,

 

any suggestion is welcome.

 

db4-test.c

Makefile

TranslateQuoteReplyEditDelete

 

 

2009-10-22 03:22:51     Re: problem about berkeley db4 on bf548

Mike Frysinger (UNITED STATES)

Message: 81577   

 

you can use MPU/stack checking/mudflap/gdb/etc...:

  docs.blackfin.uclinux.org/doku.php?id=uclinux-dist:debugging_applications

QuoteReplyEditDelete

 

 

2009-10-22 03:28:24     Re: problem about berkeley db4 on bf548

watson xu (CHINA)

Message: 81578   

 

by the way, the problem will not happen on my fedora 11 host, the same compile options is used.

 

the valgrind does not find any memory violation.

TranslateQuoteReplyEditDelete

 

 

2009-10-22 03:34:41     Re: problem about berkeley db4 on bf548

watson xu (CHINA)

Message: 81579   

 

you can use MPU/stack checking/mudflap/gdb/etc...:

  docs.blackfin.uclinux.org/doku.php?id=uclinux-dist:debugging_applications

 

---

 

thank you very much, i have try to checking the stack using    -mstack-check-l1  option, but it cannot find any stack overflow.

 

increase the stack size does not help too, so i think this may not be a stack overflow.

TranslateQuoteReplyEditDelete

 

 

2009-10-22 08:27:54     Re: problem about berkeley db4 on bf548

Robin Getz (UNITED STATES)

Message: 81598   

 

Watson:

 

There are lots of problems that valgrind will not find that other checkers (like MPU or mudflap) will.

 

Did you try those like Mike suggested?

 

-Robin

QuoteReplyEditDelete

 

 

2009-10-26 00:31:03     Re: problem about berkeley db4 on bf548

watson xu (CHINA)

Message: 81695   

 

i have tried all the way, but cannot find any error message before system crash.

TranslateQuoteReplyEditDelete

 

 

2009-10-26 16:21:26     Re: problem about berkeley db4 on bf548

Robin Getz (UNITED STATES)

Message: 81716   

 

Watson:

 

Can you replicate the problem on a x86?

 

Why do you think "the program will write memory in other process's address space."? If that was true - turning on the MPU would find the problem right away.

 

-Robin

QuoteReplyEditDelete

 

 

2009-10-26 21:40:20     Re: problem about berkeley db4 on bf548

watson xu (CHINA)

Message: 81726   

 

things become complicated. it seems that the problem is not in DB4, but the kernel.

 

if i copy a large file while running a program named dspcomd, which just transfer data from SPORT0 to share memory,

 

then the program will warning data in share memory is corrupted. and then system will crash after a short time.

 

i have test my program 'dspcomd', it can run 8 days, if there is no other disk operation like copy large file.

 

by the way, my board is based on BF547, running uClinux-dist-2008R1.5, with modified sport driver, which is in the attachment.

 

bfin_sport.c

bfin_sport.h

TranslateQuoteReplyEditDelete

 

 

2009-10-26 22:40:09     Re: problem about berkeley db4 on bf548

Yi Li (CHINA)

Message: 81729   

 

Watson,

 

So you think the DB4 problem is caused by kernel (the sport)?

 

How can I reproduce the "crash" you mentioned?

 

-Yi

QuoteReplyEditDelete

 

 

2009-10-28 00:32:13     Re: problem about berkeley db4 on bf548

watson xu (CHINA)

Message: 81798   

 

hi, Mr Li:

 

i have found the way to reproduce the problem. seems that is a System V share memory issue. to reproduce

 

1、run share memory test program shm_test, it's source is in the attachment.

 

2、copy a large (more than 100MB) from one location to another.

 

after a few minutes, the program will report share memory corrupted.

 

on my board, every time this will happy, my kernel config is based on the bf548-ezkit,  almost the same as bf548-ezkit, except the necessary modification to run on my board.

 

thank you very much.

 

shm_test.c

config

TranslateQuoteReplyEditDelete

 

 

2009-10-28 06:01:03     Re: problem about berkeley db4 on bf548

Yi Li (CHINA)

Message: 81810   

 

Watson,

 

I am trying to reproduce. I will let you know the resule.

 

-Yi

QuoteReplyEditDelete

 

 

2009-10-28 21:54:06     Re: problem about berkeley db4 on bf548

watson xu (CHINA)

Message: 81833   

 

thank you, li,

 

i have post another thread as share memory issue at:

 

https://blackfin.uclinux.org/gf/project/uclinux-dist/forum/?_forum_action=ForumMessageBrowse&thread_id=36972&action=ForumBrowse&forum_id=39

 

and i have test this on the bf548-ezkit, the same problem occurs.  the new post includes these steps.

 

 

 

watson xu.

TranslateQuoteReplyEditDelete

 

 

2009-10-28 22:35:57     Re: problem about berkeley db4 on bf548

watson xu (CHINA)

Message: 81836   

 

someone says i should not post a new thread. so i move the message here and request to delete the new post.

 

hi, all

 

i have a project using bf548 and uClinux-dist-2008R1.5, there is a problem when running share memory application. the share memory will be corrupted when copy a large file (more than 100M).

 

and then i test it on the bf548-ezkit board, using the downloaded u-boot and uClinux-dist from blackfin.uclinux.org, the same probem will happen. the problem will be reproduced on bf548-ezkit (chip rev0.2) with the following steps:

 

1、download the u-boot-bf548-ezkit-para-2008R1.5.ldr and uImage-bf548-ezkit-2008R1.5-RC3 binary from blackfin.uclinux.org.

 

2、program the u-boot to the norflash.

 

3、boot the board and run ramboot to load the uImage-bf548-ezkit-2008R1.5-RC3 to the memory and start linux.

 

4、cross-compile the "shm_test.c" with  command :

 

      > bfin-linux-uclibc-gcc -o shm_test shm_test.c

 

    and download shm_test to the target board using tftp.

 

5、mount the hard disk:

 

     > mount /dev/sda1 /mnt/

 

     and create a large file:

 

     > dd if=/dev/zero of=/testfile.dat bs=200 count=1000000

 

6、run test program:

 

     > shm_test &

 

7、copy the test file to another:

 

    > cp testfile.dat testfile2.dat

 

then the test program will report "share memory corrupted.", this can be reproduced everytime. i think this may be a bug.

 

by the way, the bf548-ezkit chip revision is 0.2, running uClinux-dist-2008R1.5, when i mount nfs, access the nfs will cause 'Data access misaligned addresss violation'. but on my board (which is using rev0.1) will not occurs.

 

 

 

thanks.

 

Watson Xu

TranslateQuoteReplyEditDelete

 

 

2009-10-29 02:29:33     Re: problem about berkeley db4 on bf548

Yi Li (CHINA)

Message: 81843   

 

Thanks Watson. This would help us to reproduce and debug.

 

-Yi

Attachments

Outcomes