diff options
author | tsutsui <tsutsui@pkgsrc.org> | 2013-06-28 19:30:28 +0000 |
---|---|---|
committer | tsutsui <tsutsui@pkgsrc.org> | 2013-06-28 19:30:28 +0000 |
commit | 5818ebcdab5e1b0916d6022cad15180299a5f0ae (patch) | |
tree | e1abffc4d061584c875350510f6d81e4be0061a0 /emulators | |
parent | 3af19bf14cffc596c27c8507649a8831ec95af45 (diff) | |
download | pkgsrc-5818ebcdab5e1b0916d6022cad15180299a5f0ae.tar.gz |
Fix a hangup problem under load of multiple disk xfers on NetBSD hosts.
- fix a "fallback implementation of counting semaphores with mutex+condvar":
http://git.qemu.org/?p=qemu.git;a=commit;h=c166cb72f1676855816340666c3b618beef4b
976
- waiting threads are not restarted properly if more than one threads
are waiting unblock signals in qemu_sem_timedwait()
- possible missing pthread_cond_signal(3) calls when waiting threads
are returned by ETIMEDOUT
- fix an uninitialized variable
Discussed with and patch is provieded by soda@.
XXX: configure should check if the target system has sem_timedwait(3)
to switch this fallback implementation since sem_timedwait(3) has
been added in NetBSD -current:
http://mail-index.NetBSD.org/source-changes/2012/03/08/msg032625.html
http://mail-index.NetBSD.org/source-changes/2012/03/08/msg032626.html
Bump PKGREVISION.
Diffstat (limited to 'emulators')
-rw-r--r-- | emulators/qemu/Makefile | 3 | ||||
-rw-r--r-- | emulators/qemu/distinfo | 3 | ||||
-rw-r--r-- | emulators/qemu/patches/patch-util_qemu-thread-posix.c | 65 |
3 files changed, 69 insertions, 2 deletions
diff --git a/emulators/qemu/Makefile b/emulators/qemu/Makefile index 4425669b164..02847be2d1b 100644 --- a/emulators/qemu/Makefile +++ b/emulators/qemu/Makefile @@ -1,6 +1,7 @@ -# $NetBSD: Makefile,v 1.109 2013/06/16 18:27:25 tsutsui Exp $ +# $NetBSD: Makefile,v 1.110 2013/06/28 19:30:28 tsutsui Exp $ DISTNAME= qemu-1.4.2 +PKGREVISION= 1 CATEGORIES= emulators MASTER_SITES= http://wiki.qemu.org/download/ EXTRACT_SUFX= .tar.bz2 diff --git a/emulators/qemu/distinfo b/emulators/qemu/distinfo index 00d1ecb0b09..e401d9495f7 100644 --- a/emulators/qemu/distinfo +++ b/emulators/qemu/distinfo @@ -1,4 +1,4 @@ -$NetBSD: distinfo,v 1.83 2013/06/27 14:09:35 tsutsui Exp $ +$NetBSD: distinfo,v 1.84 2013/06/28 19:30:28 tsutsui Exp $ SHA1 (qemu-1.4.2.tar.bz2) = 7e01e57e7385dba76125f69829aa78e98acdce4f RMD160 (qemu-1.4.2.tar.bz2) = 4b136a6f2192b07aaf04270a60c9326635d8865a @@ -15,3 +15,4 @@ SHA1 (patch-net_tap-bsd.c) = 4d21ea8dd639db2a98ef9e341c3b863c9be965e2 SHA1 (patch-slirp_tcp__subr.c) = c134e0fe0ce6b8fc92a630c98891b4c3e56cc861 SHA1 (patch-user-exec.c) = 6400647b4a08885ebd4bd8f57d19d3fdb66ae434 SHA1 (patch-util_hbitmap.c) = 8c3d42d9b594efc1b5eb0ccfb5d110bd63eaa9f0 +SHA1 (patch-util_qemu-thread-posix.c) = 04be1ce985dad2ffd78c300b8e1dd10fced1641a diff --git a/emulators/qemu/patches/patch-util_qemu-thread-posix.c b/emulators/qemu/patches/patch-util_qemu-thread-posix.c new file mode 100644 index 00000000000..0f14bb107ca --- /dev/null +++ b/emulators/qemu/patches/patch-util_qemu-thread-posix.c @@ -0,0 +1,65 @@ +$NetBSD: patch-util_qemu-thread-posix.c,v 1.1 2013/06/28 19:30:28 tsutsui Exp $ + +Fix a hangup problem under load of multiple disk xfers on NetBSD hosts: + - fix a "fallback implementation of counting semaphores with mutex+condvar": +http://git.qemu.org/?p=qemu.git;a=commit;h=c166cb72f1676855816340666c3b618beef4b976 + - waiting threads are not restarted properly if more than one threads + are waiting unblock signals in qemu_sem_timedwait() + - possible missing pthread_cond_signal(3) calls when waiting threads + are returned by ETIMEDOUT + - fix an uninitialized variable +Discussed with and patch is provieded by soda@. + +--- util/qemu-thread-posix.c.orig 2013-05-24 13:37:58.000000000 +0000 ++++ util/qemu-thread-posix.c +@@ -172,10 +172,9 @@ void qemu_sem_post(QemuSemaphore *sem) + pthread_mutex_lock(&sem->lock); + if (sem->count == INT_MAX) { + rc = EINVAL; +- } else if (sem->count++ < 0) { +- rc = pthread_cond_signal(&sem->cond); + } else { +- rc = 0; ++ sem->count++; ++ rc = pthread_cond_signal(&sem->cond); + } + pthread_mutex_unlock(&sem->lock); + if (rc != 0) { +@@ -207,19 +206,21 @@ int qemu_sem_timedwait(QemuSemaphore *se + struct timespec ts; + + #if defined(__APPLE__) || defined(__NetBSD__) ++ rc = 0; + compute_abs_deadline(&ts, ms); + pthread_mutex_lock(&sem->lock); +- --sem->count; +- while (sem->count < 0) { ++ while (sem->count <= 0) { + rc = pthread_cond_timedwait(&sem->cond, &sem->lock, &ts); + if (rc == ETIMEDOUT) { +- ++sem->count; + break; + } + if (rc != 0) { + error_exit(rc, __func__); + } + } ++ if (rc != ETIMEDOUT) { ++ --sem->count; ++ } + pthread_mutex_unlock(&sem->lock); + return (rc == ETIMEDOUT ? -1 : 0); + #else +@@ -251,10 +252,10 @@ void qemu_sem_wait(QemuSemaphore *sem) + { + #if defined(__APPLE__) || defined(__NetBSD__) + pthread_mutex_lock(&sem->lock); +- --sem->count; +- while (sem->count < 0) { ++ while (sem->count <= 0) { + pthread_cond_wait(&sem->cond, &sem->lock); + } ++ --sem->count; + pthread_mutex_unlock(&sem->lock); + #else + int rc; |