Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lock up if VVP is run concurrently #7

Open
ink1 opened this issue Aug 7, 2018 · 0 comments
Open

lock up if VVP is run concurrently #7

ink1 opened this issue Aug 7, 2018 · 0 comments

Comments

@ink1
Copy link

ink1 commented Aug 7, 2018

When two or more VVP processes are run concurrently they may all need to open the same background for memory mapping. For some reason the background is opened for read and write rather than for read only and this locks up the processes so everything just hangs.

I've identified the relevant bits of code here
https://github.com/Yandell-Lab/VVP-pub/blob/master/search_binary_bkgrnd.c#L20
https://github.com/Yandell-Lab/VVP-pub/blob/master/search_binary_bkgrnd.c#L24
and here
https://github.com/Yandell-Lab/VVP-pub/blob/master/search_binary_bkgrnd.c#L61
https://github.com/Yandell-Lab/VVP-pub/blob/master/search_binary_bkgrnd.c#L64

I've made a patch which seems to be working although I must admit I have not looked deep into the code.

20c20
<     int fdSrc = open(bin_file, O_RDONLY, 0);
---
>     int fdSrc = open(bin_file, O_RDWR, 0);
24c24
<     mm_bin = (unsigned char *)mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE | MAP_POPULATE, fdSrc, 0);
---
>     mm_bin = (unsigned char *)mmap(NULL, st.st_size, PROT_READ | PROT_WRITE, MAP_SHARED, fdSrc, 0);
61c61
<     int fdSrc = open(bit_file, O_RDONLY, 0);
---
>     int fdSrc = open(bit_file, O_RDWR, 0);
64c64
<     mm_bits = (unsigned char *)mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE | MAP_POPULATE, fdSrc, 0);
---
>     mm_bits = (unsigned char *)mmap(NULL, st.st_size, PROT_READ | PROT_WRITE, MAP_SHARED, fdSrc, 0);

Is write access really necessary?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant