From: "Michael S. Tsirkin" <mst@redhat.com>
To: malc <av1474@comtv.ru>, qemu-devel@nongnu.org, anthony@codemonkey.ws
Subject: [Qemu-devel] [PATCH] qemu: work around for "posix-aio-compat"
Date: Thu, 8 Oct 2009 22:37:40 +0200 [thread overview]
Message-ID: <20091008203740.GA20727@redhat.com> (raw)
With commit ee3993069ff55fa6f1c64daf1e09963e340db8e4,
"posix-aio-compat: avoid signal race when spawning a thread"
winxp installation on a raw format file fails
during disk format, with a message "your
disk may be damaged".
This commit moved signal mask from aio thread to creating thread.
It turns out if we keep the mask in aio thread as well, the problem
disappears. It should not be needed, but since this is harmless, let's
keep it around until someone inclined to debug pthread library internals
can check this issue.
While we are at it, convert sigprocmask to pthread_sigmask
as per posix.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
For the benefit of whoever tries to debug this any deeper here's
documentation on how to reproduce the issue to be saved in git logs
(need to tweak paths obviously):
The test was done on FC11, 32 bit userspace, 64 bit kernel 2.6.31.
./configure --prefix=/scm/qemu-kvm-debug --target-list=x86_64-softmmu \
--enable-kvm
make -j 8 && make install
rm /scm/images/winxp-bisect.raw
/scm/qemu-kvm-debug/bin/qemu-img create -f raw \
/scm/images/winxp-bisect.raw 2G
/scm/qemu-kvm-debug/bin/qemu-system-x86_64 -enable-kvm -cdrom \
/home/mst/en_windows_xp_professional_with_service_pack_3_x86_cd_x14-80428.iso \
/scm/images/winxp-bisect.raw
Select format to NTFS.
---
OK, I'm out of time with this issue, let's apply a work-around
until someone interested comes around?
posix-aio-compat.c | 14 ++++++++++++--
diff --git a/posix-aio-compat.c b/posix-aio-compat.c
index 400d898..4abbe3a 100644
--- a/posix-aio-compat.c
+++ b/posix-aio-compat.c
@@ -301,6 +301,16 @@ static size_t handle_aiocb_rw(struct qemu_paiocb *aiocb)
static void *aio_thread(void *unused)
{
pid_t pid;
+ sigset_t set;
+
+ /* block all signals */
+ /* Should not be necessary as we should inherit mask
+ * from creating thread. However, without this,
+ * on FC11, using raw file, WinXP installation fails during disk format
+ * saying disk was damaged. pthread library bug?
+ * */
+ if (sigfillset(&set)) die("sigfillset");
+ if (pthread_sigmask(SIG_BLOCK, &set, NULL)) die("pthread_sigmask");
pid = getpid();
@@ -371,11 +381,11 @@ static void spawn_thread(void)
/* block all signals */
if (sigfillset(&set)) die("sigfillset");
- if (sigprocmask(SIG_SETMASK, &set, &oldset)) die("sigprocmask");
+ if (pthread_sigmask(SIG_SETMASK, &set, &oldset)) die("pthread_sigmask");
thread_create(&thread_id, &attr, aio_thread, NULL);
- if (sigprocmask(SIG_SETMASK, &oldset, NULL)) die("sigprocmask restore");
+ if (pthread_sigmask(SIG_SETMASK, &oldset, NULL)) die("pthread_sigmask restore");
}
static void qemu_paio_submit(struct qemu_paiocb *aiocb)
--
1.6.5.rc2
next reply other threads:[~2009-10-08 20:40 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-08 20:37 Michael S. Tsirkin [this message]
2009-10-08 20:53 ` [Qemu-devel] Re: [PATCH] qemu: work around for "posix-aio-compat" malc
2009-10-08 21:13 ` malc
2009-10-08 21:46 ` Michael S. Tsirkin
2009-10-08 22:17 ` malc
2009-10-08 23:19 ` Michael S. Tsirkin
2009-10-09 1:06 ` [Qemu-devel] Emulated network cards Natalia Portillo
2009-10-09 8:54 ` Luca Tettamanti
2009-10-09 13:05 ` Natalia Portillo
2009-10-09 13:16 ` [Qemu-devel] Re: [PATCH] qemu: work around for "posix-aio-compat" malc
2009-10-08 21:00 ` Michael S. Tsirkin
2009-10-20 18:39 ` [Qemu-devel] " Mark McLoughlin
2009-10-20 18:57 ` [Qemu-devel] " Paolo Bonzini
2009-10-21 15:42 ` Michael S. Tsirkin
2009-10-21 15:54 ` Michael S. Tsirkin
2009-10-21 17:28 ` Paolo Bonzini
2009-10-21 17:35 ` Michael S. Tsirkin
2009-10-21 17:44 ` Paolo Bonzini
2009-10-21 17:46 ` Michael S. Tsirkin
2009-10-21 18:38 ` Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20091008203740.GA20727@redhat.com \
--to=mst@redhat.com \
--cc=anthony@codemonkey.ws \
--cc=av1474@comtv.ru \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.