qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] ARM multithreading status
@ 2009-07-06 15:16 Timo Suoranta
  2009-07-06 15:28 ` Daniel Jacobowitz
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Timo Suoranta @ 2009-07-06 15:16 UTC (permalink / raw)
  To: Qemu-devel

I run into multithreading issues with Qemu 0.10.5 running arm debian,  
Linux kernel 2.6.28. I found some couple of years old info saying qemu  
doesn't properly support multithreading:

http://www.mail-archive.com/qemu-devel@nongnu.org/msg08233.html

What is the current status? Has this been fixed? Or could it be the  
cause of my problems?

My problem is that my threading test code manages to create and join  
one pthread, but the next pthread_create, while it starts a new  
thread, doesn't return, and in fact the whole linux system is unable  
to start any new processes until the test program ends.

--
timo 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] ARM multithreading status
  2009-07-06 15:16 [Qemu-devel] ARM multithreading status Timo Suoranta
@ 2009-07-06 15:28 ` Daniel Jacobowitz
  2009-07-06 15:31 ` Paul Brook
  2009-07-09 21:40 ` Felipe Contreras
  2 siblings, 0 replies; 8+ messages in thread
From: Daniel Jacobowitz @ 2009-07-06 15:28 UTC (permalink / raw)
  To: Timo Suoranta; +Cc: Qemu-devel

On Mon, Jul 06, 2009 at 06:16:03PM +0300, Timo Suoranta wrote:
> I run into multithreading issues with Qemu 0.10.5 running arm debian,
> Linux kernel 2.6.28. I found some couple of years old info saying
> qemu doesn't properly support multithreading:

It sounds like you're running a system simulator with an ARM Linux
kernel inside of QEMU?  In that case none of the threading issues
(which have been fixed, btw) apply - they are only for linux-user.
Threading should work fine inside a guest.

-- 
Daniel Jacobowitz
CodeSourcery

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] ARM multithreading status
  2009-07-06 15:16 [Qemu-devel] ARM multithreading status Timo Suoranta
  2009-07-06 15:28 ` Daniel Jacobowitz
@ 2009-07-06 15:31 ` Paul Brook
  2009-07-09 21:40 ` Felipe Contreras
  2 siblings, 0 replies; 8+ messages in thread
From: Paul Brook @ 2009-07-06 15:31 UTC (permalink / raw)
  To: qemu-devel; +Cc: Timo Suoranta

> My problem is that my threading test code manages to create and join
> one pthread, but the next pthread_create, while it starts a new
> thread, doesn't return, and in fact the whole linux system is unable
> to start any new processes until the test program ends.

I assume you're talking about userspace emulation. For system emulation qemu 
doesn't know or care how the guest handles threads, it works just like a real 
machine.

Either way it sounds like a kernel bug. One process should never be able to 
interfere with the rest of the system like this.

Paul

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] ARM multithreading status
  2009-07-06 15:16 [Qemu-devel] ARM multithreading status Timo Suoranta
  2009-07-06 15:28 ` Daniel Jacobowitz
  2009-07-06 15:31 ` Paul Brook
@ 2009-07-09 21:40 ` Felipe Contreras
  2009-07-10  7:34   ` Timo Suoranta
  2 siblings, 1 reply; 8+ messages in thread
From: Felipe Contreras @ 2009-07-09 21:40 UTC (permalink / raw)
  To: Timo Suoranta; +Cc: Qemu-devel

On Mon, Jul 6, 2009 at 3:16 PM, Timo
Suoranta<timo.suoranta@acrodea.co.jp> wrote:
> I run into multithreading issues with Qemu 0.10.5 running arm debian, Linux
> kernel 2.6.28. I found some couple of years old info saying qemu doesn't
> properly support multithreading:
>
> http://www.mail-archive.com/qemu-devel@nongnu.org/msg08233.html
>
> What is the current status? Has this been fixed? Or could it be the cause of
> my problems?
>
> My problem is that my threading test code manages to create and join one
> pthread, but the next pthread_create, while it starts a new thread, doesn't
> return, and in fact the whole linux system is unable to start any new
> processes until the test program ends.

I don't know if this helps, but I had a problem when joining a thread
in arm linux user, and this patch fixed it:
http://git.savannah.gnu.org/cgit/qemu.git/commit/?id=c2764719914ff0c4d6c06adafea17629600f21ba

-- 
Felipe Contreras

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] ARM multithreading status
  2009-07-09 21:40 ` Felipe Contreras
@ 2009-07-10  7:34   ` Timo Suoranta
  2009-07-14  8:22     ` Timo Suoranta
  0 siblings, 1 reply; 8+ messages in thread
From: Timo Suoranta @ 2009-07-10  7:34 UTC (permalink / raw)
  To: Qemu-devel

Felipe Contreras wrote:
>> My problem is that my threading test code manages to create and join one
>> pthread, but the next pthread_create, while it starts a new thread, doesn't
>> return, and in fact the whole linux system is unable to start any new
>> processes until the test program ends.
> 
> I don't know if this helps, but I had a problem when joining a thread
> in arm linux user, and this patch fixed it:
> http://git.savannah.gnu.org/cgit/qemu.git/commit/?id=c2764719914ff0c4d6c06adafea17629600f21ba

I'm using qemu-system-arm - so I guess the patch would not help.

I've simplified my test program - I could perhaps share a binary (or 
maybe even sources after some further cleanup) - in case someone could 
investigate this further. I've built it from the very same sources 
running 2.6.26-1 kernel on both x86 and qemu / arm.

Running on x86 Lenny in VMWare works.
Running on ARM (some real device) works.
Running on ARM Lenny in QEMU hangs.
Running on Android emulator works.

The android emulator is based on Qemu, but it uses different kernel.

I suspect there is something in the combination of QEMU and the kernel 
I'm using which makes multi threading go bad :/

--
timo

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] ARM multithreading status
  2009-07-10  7:34   ` Timo Suoranta
@ 2009-07-14  8:22     ` Timo Suoranta
  2009-07-14 13:03       ` Timo Suoranta
  2009-07-15 20:41       ` Jamie Lokier
  0 siblings, 2 replies; 8+ messages in thread
From: Timo Suoranta @ 2009-07-14  8:22 UTC (permalink / raw)
  To: Qemu-devel

Using qemu-system-arm, pthread_create() does not seem to return if I 
give it function which simply has empty infinite loop. Is that supposed 
to work? I used this:

http://people.debian.org/~aurel32/qemu/armel/

Funny thing is, such test actually works fine if I run it through GDB. 
No need to step, just run. I've attached my test code below as it is not 
very long.

Any ideas? To me it looks like scheduler is not preempting :/
Thanks!

--
timo

#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>


void* forever(void *arg)
{
     printf("entering forever\n");
     for(;;){}
     printf("leaving forever\n");
     return 0;
}

int main(int argc, char *argv[])
{
     int         res;
     pthread_t   thread;

     printf("pthread_create...\n");
     res = pthread_create(&thread, 0, forever, 0);
     printf("pthread_create done\n");

     if(res != 0)
     {
         printf("pthread_create() failed\n");
         exit(-1);
     }

     printf("pthread_detach...\n");
     res = pthread_detach(thread);
     printf("pthread_detach done\n");

     if(res != 0)
     {
         printf("pthread_detach() failed\n");
         exit(-1);
     }

     printf("calling pthread_detach() ok\n");

     return 0;
}

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] ARM multithreading status
  2009-07-14  8:22     ` Timo Suoranta
@ 2009-07-14 13:03       ` Timo Suoranta
  2009-07-15 20:41       ` Jamie Lokier
  1 sibling, 0 replies; 8+ messages in thread
From: Timo Suoranta @ 2009-07-14 13:03 UTC (permalink / raw)
  To: Qemu-devel

Some additional information:

- Using clone() instead of pthreads results similar behavior.
- Running simple main(){ for(;;){}; } application inside QEMU ARM Linux
effectively blocks a lot of stuff, like ls (unless cached).

Timo Suoranta wrote:
> Using qemu-system-arm, pthread_create() does not seem to return if I 
> give it function which simply has empty infinite loop. Is that supposed 
> to work? I used this:
> 
> http://people.debian.org/~aurel32/qemu/armel/
> 
> Funny thing is, such test actually works fine if I run it through GDB. 
> No need to step, just run. I've attached my test code below as it is not 
> very long.
> 
> Any ideas? To me it looks like scheduler is not preempting :/
> Thanks!
...

--
timo

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] ARM multithreading status
  2009-07-14  8:22     ` Timo Suoranta
  2009-07-14 13:03       ` Timo Suoranta
@ 2009-07-15 20:41       ` Jamie Lokier
  1 sibling, 0 replies; 8+ messages in thread
From: Jamie Lokier @ 2009-07-15 20:41 UTC (permalink / raw)
  To: Timo Suoranta; +Cc: Qemu-devel

Timo Suoranta wrote:
> Any ideas? To me it looks like scheduler is not preempting :/

Looks the same to me.  The ARM kernel should be getting timer
interrupts, at least, and scheduling between threads in that.

-- Jamie

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-07-15 20:41 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-06 15:16 [Qemu-devel] ARM multithreading status Timo Suoranta
2009-07-06 15:28 ` Daniel Jacobowitz
2009-07-06 15:31 ` Paul Brook
2009-07-09 21:40 ` Felipe Contreras
2009-07-10  7:34   ` Timo Suoranta
2009-07-14  8:22     ` Timo Suoranta
2009-07-14 13:03       ` Timo Suoranta
2009-07-15 20:41       ` Jamie Lokier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).