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

Very slow cdvd_inject speeds on macos #15

Open
kirbysayshi opened this issue Oct 28, 2020 · 0 comments
Open

Very slow cdvd_inject speeds on macos #15

kirbysayshi opened this issue Oct 28, 2020 · 0 comments
Labels

Comments

@kirbysayshi
Copy link

kirbysayshi commented Oct 28, 2020

Hello!

I recently tried using this tool on mac. It compiles quite easily! But I found a few issues. I hope this helps someone else trying to use this tool on mac.

OSX Semaphore Deadlock

By default, cdvd_inject will hang due to what appears to be a semaphore deadlock. I did some light debugging and found that the read call here

int result = iin->read (iin, 16, 1, &buf, &len);
will loop infinitely waiting for the semaphore to be ready here

hdl-dump/thd_iin.c

Lines 153 to 184 in 92213b5

do
{
#if defined(USE_NAMED_SEMAPHORES)
result = sem_wait (thd->master_lock);
#else
result = sem_wait (&thd->master_lock);
#endif
if (result == 0)
{ /* worker is idle */
const buffer_t *buf = thd->buf + (thd->active_buf % 2);
if (start_sector == buf->start_sector &&
num_sectors == buf->num_sectors)
{ /* data is currently available */
*data = buf->buf;
*length = buf->bytes;
result = buf->result;
break;
}
else
{ /* data not available; schedule and wait untill its ready */
thd->job.start_sector = start_sector;
thd->job.num_sectors = num_sectors;
thd->job.dest = thd->buf + (thd->active_buf % 2);
#if defined(USE_NAMED_SEMAPHORES)
sem_post (thd->worker_lock);
#else
sem_post (&thd->worker_lock);
#endif
}
}
}
while (1);

Compiling with USE_THREADED_IIN=no allows cdvd_inject to function, however!

Extremely slow local speeds

Although USE_THREADED_IIN=no allows cdvd_inject to proceed, it does so extremely slowly. My speeds were around 0.7 or 0.8 MB/sec for a local drive. Compare this to a Windows build of hdl_dump (same commit as mac build) that is moving at ~20 MB/sec (and I've seen higher, ~80MB/sec with a different drive, seemingly maxing out PATA speeds)!

Conclusion

Overall, thank you for maintaining this tool, and for working to make it run on OSX. Now that XDumb no longer functions due to recent mac updates, this is one of the last functioning tools! If there is something I can do to help make mac more compatible, please let me know.

P.S. Here is a script for uploading multiple ISO/bin+cue from a folder (works on both OSX and Windows) in case it helps anyone: https://gist.github.com/kirbysayshi/d35d279c85adb5c54c6385c9b636c64d

@AKuHAK AKuHAK added the wontfix label Jan 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants