Skip to contentSkip to conversation

Spawning threads in KVM/QEMU

DISCUSSION Anthony Liguori 4 participants 5 messages Nov 13, 2007 – Nov 14, 2007 3 messages not in the archive KVM

lore
Share & tools
lore
#0 lore raw

Hi,

I've been experimenting with creating IO threads for the PV device drivers. Unfortunately, my experiments haven't gotten very far as QEMU tends to hang up a bit into booting the guest whenever I spawn a thread that does any sort of read/write on a file descriptor. My suspicion is that it has something to do with signals being delivered to the wrong thread but after masking out all the signals for this thread, I still had no luck.

Any clues to what may be going on?

Regards,

Anthony Liguori

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/

A message that is not in the archive (sent off-list or not yet received): 473A05D6.2040003-r/[email protected]

#2 lore raw
Quoted 11 lines · Anthony Liguori

Hi,

I've been experimenting with creating IO threads for the PV device drivers. Unfortunately, my experiments haven't gotten very far as QEMU tends to hang up a bit into booting the guest whenever I spawn a thread that does any sort of read/write on a file descriptor. My suspicion is that it has something to do with signals being delivered to the wrong thread but after masking out all the signals for this thread, I still had no luck.

Maybe you set the mask too late? try setting it before creating the thread:
sigfillset(&thread_sig_mask); sigdelset(&thread_sig_mask,SIGILL); sigdelset(&thread_sig_mask,SIGFPE); sigdelset(&thread_sig_mask,SIGSEGV); pthread_sigmask(SIG_SETMASK, &thread_sig_mask, &curr_sig_mask);

 if ((r = pthread_create(&thread_tid, NULL, thread_func, &init_data))) {
    ....

}
pthread_sigmask(SIG_SETMASK, &curr_sig_mask, NULL);

Quoted 6 lines

Any clues to what may be going on?

Regards,

Anthony Liguori

Quoted 11 lines

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
kvm-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-devel

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/

A message that is not in the archive (sent off-list or not yet received): 473A283B.5040905-atKUWr5tajBWk0Htik3J/[email protected]

#4 lore raw
Quoted 9 lines · Dor Laor
Quoted 8 lines · Anthony Liguori

I've been experimenting with creating IO threads for the PV device drivers. Unfortunately, my experiments haven't gotten very far as QEMU tends to hang up a bit into booting the guest whenever I spawn a thread that does any sort of read/write on a file descriptor. My suspicion is that it has something to do with signals being delivered to the wrong thread but after masking out all the signals for this thread, I still had no luck.

Quoted 5 lines

Maybe you set the mask too late? try setting it before creating the thread:
sigfillset(&thread_sig_mask); sigdelset(&thread_sig_mask,SIGILL); sigdelset(&thread_sig_mask,SIGFPE); sigdelset(&thread_sig_mask,SIGSEGV);

When using RTC or HPET for timing you also need to mask SIGIO; you may also need to change F_SETOWN (enable_sigio_timer) with the correct thread id, i.e.:

fcntl(fd, F_SETOWN, gettid());

Luca

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/

A message that is not in the archive (sent off-list or not yet received): 68676e00711131508l4cb1cafajd559ca804d61b3c3-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#6 lore raw
Quoted 20 lines · Luca Tettamanti
Quoted 11 lines · Dor Laor
Quoted 9 lines · Anthony Liguori

I've been experimenting with creating IO threads for the PV device drivers. Unfortunately, my experiments haven't gotten very far as QEMU tends to hang up a bit into booting the guest whenever I spawn a thread that does any sort of read/write on a file descriptor. My suspicion is that it has something to do with signals being delivered to the wrong thread but after masking out all the signals for this thread, I still had no luck.

Quoted 6 lines

Maybe you set the mask too late? try setting it before creating the thread:
sigfillset(&thread_sig_mask); sigdelset(&thread_sig_mask,SIGILL); sigdelset(&thread_sig_mask,SIGFPE); sigdelset(&thread_sig_mask,SIGSEGV);

Quoted 9 lines

When using RTC or HPET for timing you also need to mask SIGIO; you may also need to change F_SETOWN (enable_sigio_timer) with the correct thread id, i.e.:

fcntl(fd, F_SETOWN, gettid());

Luca

I do mask SIGIO - first the set is fiilled, then SGILL,SIGFPE,SIGSEGV are back enabled. Regards, Dor

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/

_______________________________________________
kvm-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-devel

#7 lore raw
In reply to a message not in the archive
Quoted 20 lines · Dor Laor
Quoted 12 lines · Anthony Liguori

Hi,

I've been experimenting with creating IO threads for the PV device drivers. Unfortunately, my experiments haven't gotten very far as QEMU tends to hang up a bit into booting the guest whenever I spawn a thread that does any sort of read/write on a file descriptor. My suspicion is that it has something to do with signals being delivered to the wrong thread but after masking out all the signals for this thread, I still had no luck.

Maybe you set the mask too late? try setting it before creating the thread:
sigfillset(&thread_sig_mask); sigdelset(&thread_sig_mask,SIGILL); sigdelset(&thread_sig_mask,SIGFPE); sigdelset(&thread_sig_mask,SIGSEGV); pthread_sigmask(SIG_SETMASK, &thread_sig_mask, &curr_sig_mask);

Quoted 5 lines
 if ((r = pthread_create(&thread_tid, NULL, thread_func, &init_data))) {
    ....

}
pthread_sigmask(SIG_SETMASK, &curr_sig_mask, NULL);

Actually when running with kvm, most signals are blocked while running in userspace. They're only enabled when the guest is running. So no special action should be necessary.

For pure qemu, it is necessary of course.

Signature · 8 lines
error compiling committee.c: too many arguments to function


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/