Re: [Qemu-devel] What "opaque" stand for?
Kaiyuan wrote: > and its meaning confuse me. What does "opaque" stand for? Opaque is normal everyday word in English. Its dictionary meaning is here: http://dictionary.reference.com/browse/opaque In the context of code code you posted, opaque means that the code gets passed a pointer to something, but the code doesn't know what it points to (eg it could be a struct, or a value, or an array etc). HTH, Erik -- ---------- Erik de Castro Lopo http://www.mega-nerd.com/
[Qemu-devel] [Bug 1042388] Re: qemu: Unsupported syscall: 257 (timer_create)
Unfortunately it doesn't work with armhf on amd64 linux-user. Use the test program from comment #27 I get: > schroot -c armhf -- ./timer_test_armhf About to call host's timer_create (0, 0x7fff6ee80720, 0x625b1f40) Host's timer_create returns -22 Failed to create timer: Invalid argument qemu: uncaught target signal 6 (Aborted) - core dumped E: Child terminated by signal ‘Aborted’ (Yes I made very certain the schroot was using my freshly compiled version of qemu-arm-static). -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1042388 Title: qemu: Unsupported syscall: 257 (timer_create) Status in QEMU: Fix Released Status in “qemu” package in Ubuntu: Triaged Bug description: Running qemu-arm-static for git HEAD. When I try to install ghc from debian into my arm chroot I get: Setting up ghc (7.4.1-4) ... qemu: Unsupported syscall: 257 ghc: timer_create: Function not implemented qemu: Unsupported syscall: 257 ghc-pkg: timer_create: Function not implemented dpkg: error processing ghc (--configure): subprocess installed post-installation script returned error exit status 1 Errors were encountered while processing: ghc E: Sub-process /usr/bin/dpkg returned an error code (1) To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/1042388/+subscriptions
[Qemu-devel] [Bug 1357206] Re: QEMU user mode still crashes in multi-thread code.
I think this if bug lp:1098729 which is still open. -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1357206 Title: QEMU user mode still crashes in multi-thread code. Status in QEMU: New Bug description: I compiled the qemu 2.0 release source and find out qemu crashing when emulating multi-thread code in user mode. I did a little search and found LP:668799 but it is far from now and it is probably not the problem here. I used program below as the test program: #include #include #include void *print_message_function( void *ptr ); main() { pthread_t thread1, thread2; const char *message1 = "Thread 1"; const char *message2 = "Thread 2"; int iret1, iret2; /* Create independent threads each of which will execute function */ iret1 = pthread_create( &thread1, NULL, print_message_function, (void*) message1); if(iret1) { fprintf(stderr,"Error - pthread_create() return code: %d\n",iret1); exit(EXIT_FAILURE); } iret2 = pthread_create( &thread2, NULL, print_message_function, (void*) message2); if(iret2) { fprintf(stderr,"Error - pthread_create() return code: %d\n",iret2); exit(EXIT_FAILURE); } printf("pthread_create() for thread 1 returns: %d\n",iret1); printf("pthread_create() for thread 2 returns: %d\n",iret2); /* Wait till threads are complete before main continues. Unless we */ /* wait we run the risk of executing an exit which will terminate */ /* the process and all threads before the threads have completed. */ pthread_join( thread1, NULL); pthread_join( thread2, NULL); exit(EXIT_SUCCESS); } void *print_message_function( void *ptr ) { char *message; message = (char *) ptr; printf("%s \n", message); } Compiled to i386 and aarch64 object, and both qemu-i386 and qemu-aarch64 had segmentation faults. To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/1357206/+subscriptions
[Qemu-devel] [Bug 1042388] Re: qemu: Unsupported syscall: 257 (timer_create)
I've been looking at it over the last week or so and I have submitted a patch toe the qemu-devel mailing list to fix another timer_create() problem sometime in the last week. Unfortunately the test case @pittit submitted is far harder to support than the original test case. In this case the timer_create() syscall gets passed pointers to functions and data in the target's address space and I have not figured out how to handle that yet. -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1042388 Title: qemu: Unsupported syscall: 257 (timer_create) Status in QEMU: Fix Released Status in “qemu” package in Ubuntu: Triaged Bug description: Running qemu-arm-static for git HEAD. When I try to install ghc from debian into my arm chroot I get: Setting up ghc (7.4.1-4) ... qemu: Unsupported syscall: 257 ghc: timer_create: Function not implemented qemu: Unsupported syscall: 257 ghc-pkg: timer_create: Function not implemented dpkg: error processing ghc (--configure): subprocess installed post-installation script returned error exit status 1 Errors were encountered while processing: ghc E: Sub-process /usr/bin/dpkg returned an error code (1) To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/1042388/+subscriptions
[Qemu-devel] [PATCH] linux-user: Add missing unlock_user_struct to timer_create.
Signed-off-by: Erik de Castro Lopo --- linux-user/syscall.c | 1 + 1 file changed, 1 insertion(+) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index a50229d..5f22b37 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -9432,6 +9432,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, host_sevp.sigev_signo = tswap32(ptarget_sevp->sigev_signo); host_sevp.sigev_notify = tswap32(ptarget_sevp->sigev_notify); +unlock_user_struct(ptarget_sevp, arg2, 0); phost_sevp = &host_sevp; } -- 2.0.1
Re: [Qemu-devel] [PATCH] linux-user/syscall.c : Minor cleanups of timer_create handling.
Peter Maydell wrote: > Amend it to what? The current code looks fine to me, > so I'm not sure what bug you're trying to fix here. There is still a missing call to unlock_user_struct() inside the "if (arg2)" block. Is that not worth fixing? Erik -- ---------- Erik de Castro Lopo http://www.mega-nerd.com/
Re: [Qemu-devel] [PATCH] linux-user/syscall.c : Minor cleanups of timer_create handling.
Peter Maydell wrote: > Doesn't this turn a timer_create(clkid, NULL, phtimer) into a > timer_create(clkid, something-not-NULL, phtimer) ? That > doesn't seem right to me (and the code you've deleted here > is the common idiom in syscall.c for handling those "arg > is pointer-to-struct-or-NULL" cases). You're right. Thanks. I will amend this. Erik -- ---------- Erik de Castro Lopo http://www.mega-nerd.com/
[Qemu-devel] [PATCH] linux-user/syscall.c : Minor cleanups of timer_create handling.
* Add missing unlock of user struct. * Remove unneeded pointer variable. Signed-off-by: Erik de Castro Lopo --- linux-user/syscall.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index a50229d..7d8f54a 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -9412,7 +9412,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, { /* args: clockid_t clockid, struct sigevent *sevp, timer_t *timerid */ -struct sigevent host_sevp = { {0}, }, *phost_sevp = NULL; +struct sigevent host_sevp = { {0}, }; struct target_sigevent *ptarget_sevp; struct target_timer_t *ptarget_timer; @@ -9432,10 +9432,10 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, host_sevp.sigev_signo = tswap32(ptarget_sevp->sigev_signo); host_sevp.sigev_notify = tswap32(ptarget_sevp->sigev_notify); -phost_sevp = &host_sevp; +unlock_user_struct(ptarget_sevp, arg2, 0); } -ret = get_errno(timer_create(clkid, phost_sevp, phtimer)); +ret = get_errno(timer_create(clkid, &host_sevp, phtimer)); if (ret) { phtimer = NULL; } else { -- 2.0.1
[Qemu-devel] [Bug 1042388] Re: qemu: Unsupported syscall: 257 (timer_create)
The fix that was commited to the Qemu git tree fixed the original test case I had. @pittit then found another test case that fails and I intend to fix that when I find a good chunk of free time. Problem is I only work on Wemu sporadically and it takes me quite a bit of time to get up to speed when I return to work on it. -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1042388 Title: qemu: Unsupported syscall: 257 (timer_create) Status in QEMU: Fix Released Status in “qemu” package in Ubuntu: Triaged Bug description: Running qemu-arm-static for git HEAD. When I try to install ghc from debian into my arm chroot I get: Setting up ghc (7.4.1-4) ... qemu: Unsupported syscall: 257 ghc: timer_create: Function not implemented qemu: Unsupported syscall: 257 ghc-pkg: timer_create: Function not implemented dpkg: error processing ghc (--configure): subprocess installed post-installation script returned error exit status 1 Errors were encountered while processing: ghc E: Sub-process /usr/bin/dpkg returned an error code (1) To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/1042388/+subscriptions
Re: [Qemu-devel] Question on pointers in the qemu user space emulation
Peter Maydell wrote: > On 17 January 2014 06:33, Erik de Castro Lopo wrote: > > I'm currently working on implementing a missing part of a linux-user > > syscall. This syscall includes a function pointer for a callback. > > Which syscall? Callbacks from the kernel are pretty tricky. > Basically you need to register a host function as the callback > with the host kernel, and stash the guest function pointer somewhere > so that when the callback comes in from the host kernel you can > arrange to interrupt the guest and restart it at the desired > location. > > Pretty much the only situation we support this for is the special > case of signal handlers. In fact I wasn't even aware there was > any other kind of kernel-to-userspace callback... The syscall is kind of signal related. When I implemented the POSIX timer syscalls a little while ago I got them working for my specific use case. Since then someone pointed out that the implementation was not complete and I'd like to fix that. The ticket is here: https://bugs.launchpad.net/qemu/+bug/1042388#27 and the guest user space test case here: https://bugs.launchpad.net/qemu/+bug/1042388/+attachment/3948443/+files/timer_test.c Erik -- ---------- Erik de Castro Lopo http://www.mega-nerd.com/
[Qemu-devel] Question on pointers in the qemu user space emulation
Hi all, I'm currently working on implementing a missing part of a linux-user syscall. This syscall includes a function pointer for a callback. If one has a 64 bit user space emulation running on a 32 bit host, how does one handle the fact that the pointer might be 64 bits? Does the fact that the 32 bit host con only ever give out 32 bit addreses to the 64 bit guest just cancel out the possibility of any problems? Cheers, Erik -- -- Erik de Castro Lopo http://www.mega-nerd.com/
[Qemu-devel] [Bug 1042388] Re: qemu: Unsupported syscall: 257 (timer_create)
Thanks for the test case Martin. Problem confirmed. The issue is that timer_create allows a number of different callback mechanisms and I had only implemented the one I need. Working on it now. -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1042388 Title: qemu: Unsupported syscall: 257 (timer_create) Status in QEMU: Fix Released Status in “qemu” package in Ubuntu: Triaged Bug description: Running qemu-arm-static for git HEAD. When I try to install ghc from debian into my arm chroot I get: Setting up ghc (7.4.1-4) ... qemu: Unsupported syscall: 257 ghc: timer_create: Function not implemented qemu: Unsupported syscall: 257 ghc-pkg: timer_create: Function not implemented dpkg: error processing ghc (--configure): subprocess installed post-installation script returned error exit status 1 Errors were encountered while processing: ghc E: Sub-process /usr/bin/dpkg returned an error code (1) To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/1042388/+subscriptions
Re: [Qemu-devel] [PATCH] linux-user: Remove regs parameter load_elf_binary and load_flt_binary
Will Newton wrote: > The regs parameter is not used anywhere, so remove it. > > Signed-off-by: Will Newton Reviewed-by: Erik de Castro Lopo -- ------ Erik de Castro Lopo http://www.mega-nerd.com/
Re: [Qemu-devel] [PATCH] linux-user: Remove regs parameter load_elf_binary and load_flt_binary
Will Newton wrote: > The regs parameter is not used anywhere, so remove it. > > Signed-off-by: Will Newton Reviewed-by: Erik de Castro Lopo -- ------ Erik de Castro Lopo http://www.mega-nerd.com/
Re: [Qemu-devel] [PATCH v3] linux-user: Support the accept4 socketcall
André Hentschel wrote: > From: André Hentschel > Cc: Riku Voipio > Signed-off-by: André Hentschel Reviewed-by: Erik de Castro Lopo -- ------ Erik de Castro Lopo http://www.mega-nerd.com/
Re: [Qemu-devel] [PATCH resend] linux-user: Support the accept4 socketcall
Hi André, This looks ok, except that scripts/checkpatch.pl says: WARNING: braces {} are necessary for all arms of this statement #36: FILE: linux-user/syscall.c:2254: +if (get_user_ual(sockfd, vptr) [...] total: 0 errors, 1 warnings, 30 lines checked Fix that and I'll be happy to slap a "reviewed-by" sticker on it. Be sure to CC me on the fixed version of the patch. Cheers, Erik -- ------ Erik de Castro Lopo http://www.mega-nerd.com/
[Qemu-devel] [Bug 1042388] Re: qemu: Unsupported syscall: 257 (timer_create)
This my Debian system: $ uname -a Linux rolly 3.11-2-amd64 #1 SMP Debian 3.11.10-1 (2013-12-04) x86_64 GNU/Linux I normally run my qemu chroot using schroot as follows: schroot -c armhf If I need to install packages I schroot as root: schroot -c armhf -u root In the chroot, I get: Linux rolly 3.11-2-amd64 #1 SMP Debian 3.11.10-1 (2013-12-04) armv7l GNU/Linux and as root I have successfully removed and installed ghc from the Debian repositories. -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1042388 Title: qemu: Unsupported syscall: 257 (timer_create) Status in QEMU: Confirmed Bug description: Running qemu-arm-static for git HEAD. When I try to install ghc from debian into my arm chroot I get: Setting up ghc (7.4.1-4) ... qemu: Unsupported syscall: 257 ghc: timer_create: Function not implemented qemu: Unsupported syscall: 257 ghc-pkg: timer_create: Function not implemented dpkg: error processing ghc (--configure): subprocess installed post-installation script returned error exit status 1 Errors were encountered while processing: ghc E: Sub-process /usr/bin/dpkg returned an error code (1) To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/1042388/+subscriptions
[Qemu-devel] [Bug 1042388] Re: qemu: Unsupported syscall: 257 (timer_create)
I don't have a machine running Ubuntu. I onlu lodged a bug here because this is the official bug tracker for Qemu. -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1042388 Title: qemu: Unsupported syscall: 257 (timer_create) Status in QEMU: Confirmed Bug description: Running qemu-arm-static for git HEAD. When I try to install ghc from debian into my arm chroot I get: Setting up ghc (7.4.1-4) ... qemu: Unsupported syscall: 257 ghc: timer_create: Function not implemented qemu: Unsupported syscall: 257 ghc-pkg: timer_create: Function not implemented dpkg: error processing ghc (--configure): subprocess installed post-installation script returned error exit status 1 Errors were encountered while processing: ghc E: Sub-process /usr/bin/dpkg returned an error code (1) To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/1042388/+subscriptions
[Qemu-devel] [Bug 1042388] Re: qemu: Unsupported syscall: 257 (timer_create)
I just tried it here on my system using: - QEMU compiled from git HEAD. - ghc 7.6.3-6 from Debian and I was able to start compiling GHC from git. I didn't let it run to completion because I only have my laptop available at the moment. I suggest you try debugging some more and maybe try building something smaller than GHC. -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1042388 Title: qemu: Unsupported syscall: 257 (timer_create) Status in QEMU: Confirmed Bug description: Running qemu-arm-static for git HEAD. When I try to install ghc from debian into my arm chroot I get: Setting up ghc (7.4.1-4) ... qemu: Unsupported syscall: 257 ghc: timer_create: Function not implemented qemu: Unsupported syscall: 257 ghc-pkg: timer_create: Function not implemented dpkg: error processing ghc (--configure): subprocess installed post-installation script returned error exit status 1 Errors were encountered while processing: ghc E: Sub-process /usr/bin/dpkg returned an error code (1) To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/1042388/+subscriptions
[Qemu-devel] [Bug 1042388] Re: qemu: Unsupported syscall: 257 (timer_create)
Its currently in git HEAD. It will be in the next full release which I think is 2.0. -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1042388 Title: qemu: Unsupported syscall: 257 (timer_create) Status in QEMU: Confirmed Bug description: Running qemu-arm-static for git HEAD. When I try to install ghc from debian into my arm chroot I get: Setting up ghc (7.4.1-4) ... qemu: Unsupported syscall: 257 ghc: timer_create: Function not implemented qemu: Unsupported syscall: 257 ghc-pkg: timer_create: Function not implemented dpkg: error processing ghc (--configure): subprocess installed post-installation script returned error exit status 1 Errors were encountered while processing: ghc E: Sub-process /usr/bin/dpkg returned an error code (1) To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/1042388/+subscriptions
[Qemu-devel] [Bug 1042388] Re: qemu: Unsupported syscall: 257 (timer_create)
If someone wants to fix what's currently in Ubtuntu they should make a package which includes those two patches. -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1042388 Title: qemu: Unsupported syscall: 257 (timer_create) Status in QEMU: Confirmed Bug description: Running qemu-arm-static for git HEAD. When I try to install ghc from debian into my arm chroot I get: Setting up ghc (7.4.1-4) ... qemu: Unsupported syscall: 257 ghc: timer_create: Function not implemented qemu: Unsupported syscall: 257 ghc-pkg: timer_create: Function not implemented dpkg: error processing ghc (--configure): subprocess installed post-installation script returned error exit status 1 Errors were encountered while processing: ghc E: Sub-process /usr/bin/dpkg returned an error code (1) To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/1042388/+subscriptions
[Qemu-devel] [Bug 1042388] Re: qemu: Unsupported syscall: 257 (timer_create)
This has been fixed in Git in the following commits: commit f4f1e10a58cb5ec7806d47d20671e668a52c3e70 Author: Erik de Castro Lopo Date: Fri Nov 29 18:39:23 2013 +1100 linux-user: Implement handling of 5 POSIX timer syscalls. Implement timer_create, timer_settime, timer_gettime, timer_getoverrun and timer_delete. Signed-off-by: Erik de Castro Lopo Signed-off-by: Riku Voipio commit 905bba13ca292cb8c83fe5ccdf8a95bd04168bb1 Author: Erik de Castro Lopo Date: Fri Nov 29 18:39:22 2013 +1100 linux-user: Add target struct defs needed for POSIX timer syscalls. Signed-off-by: Erik de Castro Lopo Signed-off-by: Riku Voipio Thi s bug can be closed as resolved. -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1042388 Title: qemu: Unsupported syscall: 257 (timer_create) Status in QEMU: Confirmed Bug description: Running qemu-arm-static for git HEAD. When I try to install ghc from debian into my arm chroot I get: Setting up ghc (7.4.1-4) ... qemu: Unsupported syscall: 257 ghc: timer_create: Function not implemented qemu: Unsupported syscall: 257 ghc-pkg: timer_create: Function not implemented dpkg: error processing ghc (--configure): subprocess installed post-installation script returned error exit status 1 Errors were encountered while processing: ghc E: Sub-process /usr/bin/dpkg returned an error code (1) To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/1042388/+subscriptions
Re: [Qemu-devel] Patch v4 : POSIX timer implementation for linux-user.
er...@mega-nerd.com wrote: > > Changes from v3 version of patch (suggestions from agraf on irc): > * Fix checkpatch.pl issues. > * Use ARRAY_SIZE instead of custom macro. > * Pass 0 as last arg to unlock_user_struct() in host_to_target_itimerspec. > > Changes from original patch: > * Call host's libc functions directly rather than _syscall*() (as suggested > by Peter Maydell). > * Remove un-needed #defines. Forgot the CC line. Two patches are here: http://patchwork.ozlabs.org/patch/295151/ http://patchwork.ozlabs.org/patch/295152/ Cheers, Erik -- ---------- Erik de Castro Lopo http://www.mega-nerd.com/
Re: [Qemu-devel] Patch v3 : POSIX timer implementation for linux-user.
Erik de Castro Lopo wrote: > Erik de Castro Lopo wrote: > > > mle...@mega-nerd.com wrote: > > > > > > > > Changes from original: > > > > > > * Call host's libc functions directly rather than _syscall*() (as > > > suggested > > > by Peter Maydell). > > > * Remove un-needed #defines. > > > > > > Launchpad bug is here: https://bugs.launchpad.net/bugs/1042388 > > > > > > Ping? > > http://patchwork.ozlabs.org/patch/284786/ > > Anyone willing to take a look at this one? Ok, 1.7 has been released and 2.0 is open. Can someone now please look at this one? Cheers, Erik -- -- Erik de Castro Lopo http://www.mega-nerd.com/
Re: [Qemu-devel] [PATCH v2] linux-user: Fix stat64 syscall for SPARC64
Stefan Weil wrote: > Some targets use a stat64 structure for the stat64 syscall while others > use a stat structure. SPARC64 used the wrong kind. > > Instead of extending the conditional compilation in syscall.c, now a > macro TARGET_HAS_STRUCT_STAT64 is defined whenever a target has a > target_stat64. > > Signed-off-by: Stefan Weil Reviewed-by: Erik de Castro Lopo -- ---------- Erik de Castro Lopo http://www.mega-nerd.com/
Re: [Qemu-devel] Patch v3 : POSIX timer implementation for linux-user.
Erik de Castro Lopo wrote: > mle...@mega-nerd.com wrote: > > > > > Changes from original: > > > > * Call host's libc functions directly rather than _syscall*() (as suggested > > by Peter Maydell). > > * Remove un-needed #defines. > > > > Launchpad bug is here: https://bugs.launchpad.net/bugs/1042388 > > > Ping? > http://patchwork.ozlabs.org/patch/284786/ Anyone willing to take a look at this one? Cheers, Erik -- ---------- Erik de Castro Lopo http://www.mega-nerd.com/
Re: [Qemu-devel] [PATCH] linux-user: create target_structs header to place ipc_perm and shmid_ds
CCing Riku Voipio who is listed in the MAINTAINERS file as the maintainer if linux-user. Erik de Castro Lopo wrote: > Petar Jovanovic wrote: > > > From: Petar Jovanovic > > > > Creating target_structs header in linux-user/$arch/ and making > > target_ipc_perm and target_shmid_ds its first inhabitants. > > The struct defintions may/should be further fine-tuned by arch maintainers. > > > > Signed-off-by: Petar Jovanovic > > Reviewed-by: Erik de Castro Lopo > > > I'm relatively new to QEMU and this is my first review. This change > looks sane to me, applies cleanly and compiles without any new warnings. > > In future I will be attempting to review anything in the linux-user > tree. > > Cheers, > Erik > -- > -- > Erik de Castro Lopo > http://www.mega-nerd.com/ > -- -- Erik de Castro Lopo http://www.mega-nerd.com/
Re: [Qemu-devel] Patch v3 : POSIX timer implementation for linux-user.
mle...@mega-nerd.com wrote: > > Changes from original: > > * Call host's libc functions directly rather than _syscall*() (as suggested > by Peter Maydell). > * Remove un-needed #defines. > > Launchpad bug is here: https://bugs.launchpad.net/bugs/1042388 Ping? http://patchwork.ozlabs.org/patch/284786/ Erik -- ---------- Erik de Castro Lopo http://www.mega-nerd.com/
Re: [Qemu-devel] [PATCH] linux-user: create target_structs header to place ipc_perm and shmid_ds
Petar Jovanovic wrote: > From: Petar Jovanovic > > Creating target_structs header in linux-user/$arch/ and making > target_ipc_perm and target_shmid_ds its first inhabitants. > The struct defintions may/should be further fine-tuned by arch maintainers. > > Signed-off-by: Petar Jovanovic Reviewed-by: Erik de Castro Lopo I'm relatively new to QEMU and this is my first review. This change looks sane to me, applies cleanly and compiles without any new warnings. In future I will be attempting to review anything in the linux-user tree. Cheers, Erik -- ---------- Erik de Castro Lopo http://www.mega-nerd.com/
Re: [Qemu-devel] Patch v3 : POSIX timer implementation for linux-user.
Erik de Castro Lopo wrote: > mle...@mega-nerd.com wrote: > > > > > Changes from original: > > > > * Call host's libc functions directly rather than _syscall*() (as suggested > > by Peter Maydell). > > * Remove un-needed #defines. > > > > Launchpad bug is here: https://bugs.launchpad.net/bugs/1042388 > > > Bah! This version segfaults in some circumstances. Double bah! This version (Patch v3) is good. My testing was crap. Erik -- ---------- Erik de Castro Lopo http://www.mega-nerd.com/
[Qemu-devel] [Bug 1042388] Re: qemu: Unsupported syscall: 257 (timer_create)
Bah, the patch in #13 segfaults in some circumstances, the previous one doesn't. -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1042388 Title: qemu: Unsupported syscall: 257 (timer_create) Status in QEMU: Confirmed Bug description: Running qemu-arm-static for git HEAD. When I try to install ghc from debian into my arm chroot I get: Setting up ghc (7.4.1-4) ... qemu: Unsupported syscall: 257 ghc: timer_create: Function not implemented qemu: Unsupported syscall: 257 ghc-pkg: timer_create: Function not implemented dpkg: error processing ghc (--configure): subprocess installed post-installation script returned error exit status 1 Errors were encountered while processing: ghc E: Sub-process /usr/bin/dpkg returned an error code (1) To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/1042388/+subscriptions
Re: [Qemu-devel] Patch v3 : POSIX timer implementation for linux-user.
mle...@mega-nerd.com wrote: > > Changes from original: > > * Call host's libc functions directly rather than _syscall*() (as suggested > by Peter Maydell). > * Remove un-needed #defines. > > Launchpad bug is here: https://bugs.launchpad.net/bugs/1042388 Bah! This version segfaults in some circumstances. Erik -- ---------- Erik de Castro Lopo http://www.mega-nerd.com/
[Qemu-devel] [Bug 1042388] Re: qemu: Unsupported syscall: 257 (timer_create)
Latest version of my patch. Also submitted to the qemu-devel mailing list. ** Attachment added: "posix-timer-patch.tgz" https://bugs.launchpad.net/qemu/+bug/1042388/+attachment/3882940/+files/posix-timer-patch.tgz -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1042388 Title: qemu: Unsupported syscall: 257 (timer_create) Status in QEMU: Confirmed Bug description: Running qemu-arm-static for git HEAD. When I try to install ghc from debian into my arm chroot I get: Setting up ghc (7.4.1-4) ... qemu: Unsupported syscall: 257 ghc: timer_create: Function not implemented qemu: Unsupported syscall: 257 ghc-pkg: timer_create: Function not implemented dpkg: error processing ghc (--configure): subprocess installed post-installation script returned error exit status 1 Errors were encountered while processing: ghc E: Sub-process /usr/bin/dpkg returned an error code (1) To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/1042388/+subscriptions
Re: [Qemu-devel] [PATCH 1/2] linux-user: Add target struct defs needed for POSIX timer syscalls.
Erik de Castro Lopo wrote: > --- Sorry, this is actually version 2 of this patch. Still working out git send-email. Cheers, Erik
[Qemu-devel] [PATCH 1/2] linux-user: Add target struct defs needed for POSIX timer syscalls.
--- linux-user/syscall_defs.h | 30 +- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 5f53a28..ca683d1 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -168,6 +168,11 @@ struct target_itimerval { struct target_timeval it_value; }; +struct target_itimerspec { +struct target_timespec it_interval; +struct target_timespec it_value; +}; + typedef abi_long target_clock_t; #define TARGET_HZ 100 @@ -1819,7 +1824,7 @@ struct target_stat { abi_longst_blocks; /* Number 512-byte blocks allocated. */ abi_ulong target_st_atime; - abi_ulong target_st_atime_nsec; + abi_ulong target_st_atime_nsec; abi_ulong target_st_mtime; abi_ulong target_st_mtime_nsec; abi_ulong target_st_ctime; @@ -2513,3 +2518,26 @@ struct target_ucred { }; #endif + + +#define SIGEV_PAD_SIZE (sizeof(((struct sigevent *)0)->_sigev_un._pad) \ +/ sizeof(((struct sigevent *)0)->_sigev_un._pad[0])) + +struct target_timer_t { +abi_ulong ptr; +}; + +struct target_sigevent { +target_sigval_t sigev_value; +int32_t sigev_signo; +int32_t sigev_notify; +union { +int32_t _pad[SIGEV_PAD_SIZE]; +int32_t _tid; + +struct { +void (*_function)(sigval_t); +void *_attribute; +} _sigev_thread; +} _sigev_un; +}; -- 1.8.4.rc3
[Qemu-devel] [PATCH 2/2] linux-user: Implement handling of 5 POSIX timer syscalls.
Implement timer_create, timer_settime, timer_gettime, timer_getoverrun and timer_delete. --- linux-user/syscall.c | 188 +++ 1 file changed, 188 insertions(+) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 4a14a43..5be400d 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -428,6 +428,38 @@ _syscall4(int, sys_prlimit64, pid_t, pid, int, resource, struct host_rlimit64 *, old_limit) #endif +#if defined(TARGET_NR_timer_create) +#ifndef __NR_timer_create +# define __NR_timer_create -1 +# define __NR_timer_settime -1 +# define __NR_timer_gettime -1 +# define __NR_timer_getoverrun -1 +# define __NR_timer_delete -1 +#endif + +#define __NR_sys_timer_create __NR_timer_create +#define __NR_sys_timer_settime __NR_timer_settime +#define __NR_sys_timer_gettime __NR_timer_gettime +#define __NR_sys_timer_getoverrun __NR_timer_getoverrun +#define __NR_sys_timer_delete __NR_timer_delete + + +/* Maxiumum of 32 active timers allowed at any one time. */ +static timer_t g_posix_timers[32] = { 0, } ; + +static inline int next_free_host_timer(void) +{ +int k ; +/* FIXME: Does finding the next free slot require a lock? */ +for (k = 0; k < ARRAY_SIZE(g_posix_timers); k++) +if (g_posix_timers[k] == 0) { +g_posix_timers[k] = (timer_t) 1; +return k; +} +return -1; +} +#endif + /* ARM EABI and MIPS expect 64bit types aligned even on pairs or registers */ #ifdef TARGET_ARM static inline int regpairs_aligned(void *cpu_env) { @@ -4838,6 +4870,45 @@ static inline abi_long host_to_target_timespec(abi_ulong target_addr, return 0; } +static inline abi_long target_to_host_itimerspec(struct itimerspec *host_itspec, + abi_ulong target_addr) +{ +struct target_itimerspec *target_itspec; + +if (!lock_user_struct(VERIFY_READ, target_itspec, target_addr, 1)) { +return -TARGET_EFAULT; +} + +host_itspec->it_interval.tv_sec = +tswapal(target_itspec->it_interval.tv_sec); +host_itspec->it_interval.tv_nsec = +tswapal(target_itspec->it_interval.tv_nsec); +host_itspec->it_value.tv_sec = tswapal(target_itspec->it_value.tv_sec); +host_itspec->it_value.tv_nsec = tswapal(target_itspec->it_value.tv_nsec); + +unlock_user_struct(target_itspec, target_addr, 1); +return 0; +} + +static inline abi_long host_to_target_itimerspec(abi_ulong target_addr, + struct itimerspec *host_its) +{ +struct target_itimerspec *target_itspec; + +if (!lock_user_struct(VERIFY_WRITE, target_itspec, target_addr, 0)) { +return -TARGET_EFAULT; +} + +target_itspec->it_interval.tv_sec = tswapal(host_its->it_interval.tv_sec); +target_itspec->it_interval.tv_nsec = tswapal(host_its->it_interval.tv_nsec); + +target_itspec->it_value.tv_sec = tswapal(host_its->it_value.tv_sec); +target_itspec->it_value.tv_nsec = tswapal(host_its->it_value.tv_nsec); + +unlock_user_struct(target_itspec, target_addr, 1); +return 0; +} + #if defined(TARGET_NR_stat64) || defined(TARGET_NR_newfstatat) static inline abi_long host_to_target_stat64(void *cpu_env, abi_ulong target_addr, @@ -9195,6 +9266,123 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, break; } #endif + +#ifdef TARGET_NR_timer_create +case TARGET_NR_timer_create: +{ +/* args: clockid_t clockid, struct sigevent *sevp, timer_t *timerid */ + +struct sigevent host_sevp = { {0}, }, *phost_sevp = NULL; +struct target_sigevent *ptarget_sevp; +struct target_timer_t *ptarget_timer; + +int clkid = arg1; +int timer_index = next_free_host_timer(); + +if (timer_index < 0) { +ret = -TARGET_EAGAIN; +} else { +timer_t *phtimer = g_posix_timers + timer_index; + +if (arg2) { +if (!lock_user_struct(VERIFY_READ, ptarget_sevp, arg2, 1)) { +goto efault; +} + +host_sevp.sigev_signo = tswap32(ptarget_sevp->sigev_signo); +host_sevp.sigev_notify = tswap32(ptarget_sevp->sigev_notify); + +phost_sevp = &host_sevp; +} + +ret = get_errno(timer_create(clkid, phost_sevp, phtimer)); +if (ret) { +phtimer = NULL; +} else { +if (!lock_user_struct(VERIFY_WRITE, ptarget_timer, arg3, 1)) { +goto efault; +} +ptarget_timer->ptr = tswap32(0xcafe | timer_index); +unlock_user_struct(ptarget_timer, arg3, 1); +} +} +break; +} +#endif + +#ifdef TARGET_NR_timer_settime +case TARGET_NR_timer_settime: +{ +/* args: timer_t timerid, int
Re: [Qemu-devel] [PATCH 2/2] linux-user: Implement handling of 5 POSIX timer syscalls.
Peter Maydell wrote: > Is there a good reason for doing these all via manual syscalls > rather than just using the host's libc interface to them? Thats a really good question. As you can see from the commit date I wrote this patch over a year ago and I can't remember why it ended up like it did. Possibly it was the first thing I tried that worked. I'll have a look at doing it as you suggested. Cheers, Erik -- ---------- Erik de Castro Lopo http://www.mega-nerd.com/
[Qemu-devel] [Bug 1042388] Re: qemu: Unsupported syscall: 257 (timer_create)
The two patches have been sent to the qemu-devel mailing list and I will also attach them here. ?field.comment=The two patches have been sent to the qemu-devel mailing list and I will also attach them here. ** Attachment added: "posix-timer-patch.tgz" https://bugs.launchpad.net/qemu/+bug/1042388/+attachment/3881604/+files/posix-timer-patch.tgz -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1042388 Title: qemu: Unsupported syscall: 257 (timer_create) Status in QEMU: Confirmed Bug description: Running qemu-arm-static for git HEAD. When I try to install ghc from debian into my arm chroot I get: Setting up ghc (7.4.1-4) ... qemu: Unsupported syscall: 257 ghc: timer_create: Function not implemented qemu: Unsupported syscall: 257 ghc-pkg: timer_create: Function not implemented dpkg: error processing ghc (--configure): subprocess installed post-installation script returned error exit status 1 Errors were encountered while processing: ghc E: Sub-process /usr/bin/dpkg returned an error code (1) To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/1042388/+subscriptions
Re: [Qemu-devel] [PATCH 2/2] LICENSE: clarify
Paolo Bonzini wrote: > 4) Restrict GPLv2-only contributions to user mode emulation (due to > code from Linux) and PCI passthrough (due to code from Neocleus). It would be nice to have that statement or something like it mentioning the linux-user/ tree added to the LICENSE file. Cheers, Erik -- -- Erik de Castro Lopo http://www.mega-nerd.com/
Re: [Qemu-devel] Licensing question
Stefan Weil wrote: > No, there is no such statement. > > There is an agreement that files with GPL should be GPLv2+ > (not only GPLv2), but files may also use other free licenses. > > In file LICENSE, it is said that QEMU as a whole is released > under the GNU General Public License. > > Some files are copied from Linux and therefore must use > the Linux license (usually GPLv2). > > syscall_defs.h might be a copy from Linux (=> GPLv2). > If not, the default rule from LICENSE could be applied (=> GPL). Thanks Stefan. The file does not seem to come from the linux kernel and google found a bunch of other files with the same name, but they either seemed to be un-related files (eg one from OpenBSD) or to be dervied from this file in Qemu. That means the file is under the default license for Qemu. The LICENSE file simply says "GNU General Public License" without specifying which version of that license. Does this mean GPLv2, GPLv2+, GPL3 or GPLv3+? Sorry about these annoying questions, but lawyers tend to be sticklers for these minor details. Cheer, Erik -- ---------- Erik de Castro Lopo http://www.mega-nerd.com/
[Qemu-devel] Licensing question
Hi all, I have a patch I would like to submit and I am currently running it past my employer's legal department. The legal department has identified 10 different licenses in the Qemu codebase and has asked about the two files I am modifying: linux-user/syscall.c linux-user/syscall_defs.h For the first its easy as it is clearly marked as GPLv2+. The second is unmarked. Is there some blanket statement somewhere that all files that are not explicitly marked are under say GPLv2+? Cheers, Erik -- -- Erik de Castro Lopo http://www.mega-nerd.com/
[Qemu-devel] [Bug 1042388] Re: qemu: Unsupported syscall: 257 (timer_create)
Still waiting on approval from my employer's lawyers to release it. Have no idea how long this is going to take. -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1042388 Title: qemu: Unsupported syscall: 257 (timer_create) Status in QEMU: Confirmed Bug description: Running qemu-arm-static for git HEAD. When I try to install ghc from debian into my arm chroot I get: Setting up ghc (7.4.1-4) ... qemu: Unsupported syscall: 257 ghc: timer_create: Function not implemented qemu: Unsupported syscall: 257 ghc-pkg: timer_create: Function not implemented dpkg: error processing ghc (--configure): subprocess installed post-installation script returned error exit status 1 Errors were encountered while processing: ghc E: Sub-process /usr/bin/dpkg returned an error code (1) To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/1042388/+subscriptions
Re: [Qemu-devel] [Bug 1042388] Re: qemu: Unsupported syscall: 257 (timer_create)
LocutusOfBorg wrote: > Any news on this? Sorry, still working on getting permission from my employer to get this released. Erik -- -- Erik de Castro Lopo http://www.mega-nerd.com/
[Qemu-devel] [Bug 668799] Re: qemu-arm segfaults executing msgmerge (gettext)
The test I'm using in LP:1098729 hangs or segfaults nearly every single run. -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/668799 Title: qemu-arm segfaults executing msgmerge (gettext) Status in QEMU: New Status in Linaro QEMU: New Bug description: upstream qemu.git revision b45e9c05dbacba8e992f0bffeca04c6379c3ad45 Starting program: /usr/bin/qemu-arm msgmerge-static ar.po anjuta.pot [Thread debugging using libthread_db enabled] [New Thread 0x74bc3ff0 (LWP 26108)] [New Thread 0x74b8aff0 (LWP 26109)] [New Thread 0x74b51ff0 (LWP 26110)] [New Thread 0x74b18ff0 (LWP 26111)] [New Thread 0x74adfff0 (LWP 26112)] [New Thread 0x74aa6ff0 (LWP 26113)] [New Thread 0x74a6dff0 (LWP 26114)] [New Thread 0x74a34ff0 (LWP 26115)] [New Thread 0x749fbff0 (LWP 26116)] [New Thread 0x749c2ff0 (LWP 26117)] [New Thread 0x74989ff0 (LWP 26118)] [New Thread 0x74950ff0 (LWP 26119)] [New Thread 0x74917ff0 (LWP 26120)] [New Thread 0x748deff0 (LWP 26121)] [New Thread 0x748a5ff0 (LWP 26122)] [New Thread 0x7486cff0 (LWP 26123)] [New Thread 0x74833ff0 (LWP 26124)] [New Thread 0x747faff0 (LWP 26125)] [New Thread 0x747c1ff0 (LWP 26126)] [New Thread 0x74788ff0 (LWP 26127)] [New Thread 0x7474fff0 (LWP 26128)] [New Thread 0x74716ff0 (LWP 26129)] [New Thread 0x746ddff0 (LWP 26130)] . Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x74aa6ff0 (LWP 26113)] 0x600480d4 in tb_reset_jump_recursive2 (tb=0x74c63540, n=0) at /home/user/git/qemu/exec.c:1333 1333tb1 = tb1->jmp_next[n1]; (gdb) bt #0 0x600480d4 in tb_reset_jump_recursive2 (tb=0x74c63540, n=0) at /home/user/git/qemu/exec.c:1333 #1 0x600481c0 in tb_reset_jump_recursive (tb=0x74c63540) at /home/user/git/qemu/exec.c:1361 #2 0x60048160 in tb_reset_jump_recursive2 (tb=0x74c634d8, n=0) at /home/user/git/qemu/exec.c:1355 #3 0x600481c0 in tb_reset_jump_recursive (tb=0x74c634d8) at /home/user/git/qemu/exec.c:1361 #4 0x60048160 in tb_reset_jump_recursive2 (tb=0x74c63470, n=0) at /home/user/git/qemu/exec.c:1355 #5 0x600481c0 in tb_reset_jump_recursive (tb=0x74c63470) at /home/user/git/qemu/exec.c:1361 #6 0x60048160 in tb_reset_jump_recursive2 (tb=0x74c63408, n=1) at /home/user/git/qemu/exec.c:1355 #7 0x600481d1 in tb_reset_jump_recursive (tb=0x74c63408) at /home/user/git/qemu/exec.c:1362 #8 0x60048160 in tb_reset_jump_recursive2 (tb=0x74c633a0, n=0) at /home/user/git/qemu/exec.c:1355 #9 0x600481c0 in tb_reset_jump_recursive (tb=0x74c633a0) at /home/user/git/qemu/exec.c:1361 #10 0x60048160 in tb_reset_jump_recursive2 (tb=0x74c63338, n=0) at /home/user/git/qemu/exec.c:1355 #11 0x600481c0 in tb_reset_jump_recursive (tb=0x74c63338) at /home/user/git/qemu/exec.c:1361 #12 0x60048160 in tb_reset_jump_recursive2 (tb=0x74c632d0, n=0) at /home/user/git/qemu/exec.c:1355 ---Type to continue, or q to quit--- #13 0x600481c0 in tb_reset_jump_recursive (tb=0x74c632d0) at /home/user/git/qemu/exec.c:1361 #14 0x60048160 in tb_reset_jump_recursive2 (tb=0x74c63268, n=1) at /home/user/git/qemu/exec.c:1355 #15 0x600481d1 in tb_reset_jump_recursive (tb=0x74c63268) at /home/user/git/qemu/exec.c:1362 #16 0x60048160 in tb_reset_jump_recursive2 (tb=0x74c63200, n=0) at /home/user/git/qemu/exec.c:1355 #17 0x600481c0 in tb_reset_jump_recursive (tb=0x74c63200) at /home/user/git/qemu/exec.c:1361 #18 0x600487c5 in cpu_unlink_tb (env=0x62385400) at /home/user/git/qemu/exec.c:1617 #19 0x600488e8 in cpu_exit (env=0x62385400) at /home/user/git/qemu/exec.c:1662 #20 0x6798 in start_exclusive () at /home/user/git/qemu/linux-user/main.c:152 #21 0x6a4b in do_kernel_trap (env=0x62359940) at /home/user/git/qemu/linux-user/main.c:493 #22 0x600023f3 in cpu_loop (env=0x62359940) at /home/user/git/qemu/linux-user/main.c:797 #23 0x600123df in clone_func (arg=0x7ffd76e0) at /home/user/git/qemu/linux-user/syscall.c:3561 #24 0x600b382d in start_thread (arg=) at pthread_create.c:297 #25 0x600f1809 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112 #26 0x in ?? () (gdb) Its interesting to see this : #0 0x600480d4 in tb_reset_jump_recursive2 (tb=0x74c63540, n=0) at /home/user/git/qemu/exec.c:1333 tb1 = 0x0 << tb_n
[Qemu-devel] [Bug 1098729] Re: qemu-user-static for armhf: segfault in threaded code
At the top of function cpu_unlink_tb() in translate-all.c: /* FIXME: TB unchaining isn't SMP safe. For now just ignore the problem and hope the cpu will stop of its own accord. For userspace emulation this often isn't actually as bad as it sounds. Often signals are used primarily to interrupt blocking syscalls. */ -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1098729 Title: qemu-user-static for armhf: segfault in threaded code Status in QEMU: New Bug description: Currently running QEMU from git (fedf2de31023) and running the armhf version of qemu-user-static which I have renamed qemu-armhf-static to follow the naming convention used in Debian. The host systems is a Debian testing x86_64-linux and I have an Debian testing armhf chroot which I invoke using schroot. Majority of program in the armhf chroot run fine, but I'm getting qemu segfaults in multi-threaded programs. As an example, I've grabbed the threads demo program here: https://computing.llnl.gov/tutorials/pthreads/samples/dotprod_mutex.c and changed NUMTHRDS from 4 to 10. I compile it as (same compile command on both x86_64 host and armhf guest): gcc -Wall -lpthread dotprod_mutex.c -o dotprod_mutex When compiled for x86_64 host it runs perfectly and even under Valgrind displays no errors whatsoever. However, when I compile the program in my armhs chroot and run it it usually (but not always) segaults or hangs or crashes. Example output: (armhf) $ ./dotprod_mutex Thread 1 did 10 to 20: mysum=10.00 global sum=10.00 Thread 0 did 0 to 10: mysum=10.00 global sum=20.00 TCG temporary leak before f6731ca0 qemu-arm-static: /home/erikd/Git/qemu-posix-timer-hacking/Upstream/tcg/tcg-op.h:2371: tcg_gen_goto_tb: Assertion `(tcg_ctx.goto_tb_issue_mask & (1 << idx)) == 0' failed. (armhf) $ ./dotprod_mutex qemu: uncaught target signal 11 (Segmentation fault) - core dumped Segmentation fault (armhf) $ ./dotprod_mutex qemu-arm-static: /home/erikd/Git/qemu-posix-timer-hacking/Upstream/tcg/tcg.c:519: tcg_temp_free_internal: Assertion `idx >= s->nb_globals && idx < s->nb_temps' failed. (armhf) $ ./dotprod_mutex Thread 1 did 10 to 20: mysum=10.00 global sum=10.00 qemu: uncaught target signal 11 (Segmentation fault) - core dumped Segmentation fault To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/1098729/+subscriptions
[Qemu-devel] [Bug 1098729] Re: qemu-user-static for armhf: segfault in threaded code
What's the best way to debug the qemu user space emulation? I read this: http://wiki.qemu.org/Documentation/Debugging but that seems to mainly refer to the qemu machine emulation. I added -ggdb to QEMU_CFLAGS in config-host.mak so it builds with debug symbols but gdb still doesn't provide any useful information beyond the following: Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". [New Thread 0x7ffefdb6b700 (LWP 11210)] [New Thread 0x7ffefdaf5700 (LWP 11211)] [New Thread 0x7ffefda7f700 (LWP 11212)] [New Thread 0x7ffefda09700 (LWP 11213)] [New Thread 0x7ffefd993700 (LWP 11214)] Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7ffefdaf5700 (LWP 11211)] 0x60363b58 in static_code_gen_buffer () (gdb) bt #0 0x60363b58 in static_code_gen_buffer () #1 0xf50ba518 in ?? () #2 0x624a9360 in ?? () #3 0x7ffefdaf4b80 in ?? () #4 0x326cebdf4a8e4700 in ?? () #5 0x7ffe in ?? () #6 0x in ?? () and valgrind doesn't help either. -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1098729 Title: qemu-user-static for armhf: segfault in threaded code Status in QEMU: New Bug description: Currently running QEMU from git (fedf2de31023) and running the armhf version of qemu-user-static which I have renamed qemu-armhf-static to follow the naming convention used in Debian. The host systems is a Debian testing x86_64-linux and I have an Debian testing armhf chroot which I invoke using schroot. Majority of program in the armhf chroot run fine, but I'm getting qemu segfaults in multi-threaded programs. As an example, I've grabbed the threads demo program here: https://computing.llnl.gov/tutorials/pthreads/samples/dotprod_mutex.c and changed NUMTHRDS from 4 to 10. I compile it as (same compile command on both x86_64 host and armhf guest): gcc -Wall -lpthread dotprod_mutex.c -o dotprod_mutex When compiled for x86_64 host it runs perfectly and even under Valgrind displays no errors whatsoever. However, when I compile the program in my armhs chroot and run it it usually (but not always) segaults or hangs or crashes. Example output: (armhf) $ ./dotprod_mutex Thread 1 did 10 to 20: mysum=10.00 global sum=10.00 Thread 0 did 0 to 10: mysum=10.00 global sum=20.00 TCG temporary leak before f6731ca0 qemu-arm-static: /home/erikd/Git/qemu-posix-timer-hacking/Upstream/tcg/tcg-op.h:2371: tcg_gen_goto_tb: Assertion `(tcg_ctx.goto_tb_issue_mask & (1 << idx)) == 0' failed. (armhf) $ ./dotprod_mutex qemu: uncaught target signal 11 (Segmentation fault) - core dumped Segmentation fault (armhf) $ ./dotprod_mutex qemu-arm-static: /home/erikd/Git/qemu-posix-timer-hacking/Upstream/tcg/tcg.c:519: tcg_temp_free_internal: Assertion `idx >= s->nb_globals && idx < s->nb_temps' failed. (armhf) $ ./dotprod_mutex Thread 1 did 10 to 20: mysum=10.00 global sum=10.00 qemu: uncaught target signal 11 (Segmentation fault) - core dumped Segmentation fault To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/1098729/+subscriptions
[Qemu-devel] [Bug 1098729] Re: qemu-user-static for armhf: segfault in threaded code
Begining to think this is memory corruption because of the number of different failure modes. In addition to the crashes in the initial report I have also seen the following: qemu: uncaught target signal 4 (Illegal instruction) - core dumped More temporaries freed than allocated! TCG temporary leak before 0001d1dc qemu-arm-static: /home/erikd/Git/qemu-pthread-hacking/tcg/tcg.c:1888: tcg_reg_alloc_op: Assertion `ts->val_type == 1' failed. /home/erikd/Git/qemu-pthread-hacking/tcg/tcg.c:149: tcg fatal error -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1098729 Title: qemu-user-static for armhf: segfault in threaded code Status in QEMU: New Bug description: Currently running QEMU from git (fedf2de31023) and running the armhf version of qemu-user-static which I have renamed qemu-armhf-static to follow the naming convention used in Debian. The host systems is a Debian testing x86_64-linux and I have an Debian testing armhf chroot which I invoke using schroot. Majority of program in the armhf chroot run fine, but I'm getting qemu segfaults in multi-threaded programs. As an example, I've grabbed the threads demo program here: https://computing.llnl.gov/tutorials/pthreads/samples/dotprod_mutex.c and changed NUMTHRDS from 4 to 10. I compile it as (same compile command on both x86_64 host and armhf guest): gcc -Wall -lpthread dotprod_mutex.c -o dotprod_mutex When compiled for x86_64 host it runs perfectly and even under Valgrind displays no errors whatsoever. However, when I compile the program in my armhs chroot and run it it usually (but not always) segaults or hangs or crashes. Example output: (armhf) $ ./dotprod_mutex Thread 1 did 10 to 20: mysum=10.00 global sum=10.00 Thread 0 did 0 to 10: mysum=10.00 global sum=20.00 TCG temporary leak before f6731ca0 qemu-arm-static: /home/erikd/Git/qemu-posix-timer-hacking/Upstream/tcg/tcg-op.h:2371: tcg_gen_goto_tb: Assertion `(tcg_ctx.goto_tb_issue_mask & (1 << idx)) == 0' failed. (armhf) $ ./dotprod_mutex qemu: uncaught target signal 11 (Segmentation fault) - core dumped Segmentation fault (armhf) $ ./dotprod_mutex qemu-arm-static: /home/erikd/Git/qemu-posix-timer-hacking/Upstream/tcg/tcg.c:519: tcg_temp_free_internal: Assertion `idx >= s->nb_globals && idx < s->nb_temps' failed. (armhf) $ ./dotprod_mutex Thread 1 did 10 to 20: mysum=10.00 global sum=10.00 qemu: uncaught target signal 11 (Segmentation fault) - core dumped Segmentation fault To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/1098729/+subscriptions
[Qemu-devel] [Bug 1098729] Re: qemu-user-static for armhf: segfault in threaded code
I can also comple a purely static version of the test program in the armhf chroot using: gcc -Wall -static -pthread dotprod_mutex.c -o dotprod-mutex-static and then run it simply using: qemu-arm-static dotprod-mutex-static which fails just like it does in the chroot. -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1098729 Title: qemu-user-static for armhf: segfault in threaded code Status in QEMU: New Bug description: Currently running QEMU from git (fedf2de31023) and running the armhf version of qemu-user-static which I have renamed qemu-armhf-static to follow the naming convention used in Debian. The host systems is a Debian testing x86_64-linux and I have an Debian testing armhf chroot which I invoke using schroot. Majority of program in the armhf chroot run fine, but I'm getting qemu segfaults in multi-threaded programs. As an example, I've grabbed the threads demo program here: https://computing.llnl.gov/tutorials/pthreads/samples/dotprod_mutex.c and changed NUMTHRDS from 4 to 10. I compile it as (same compile command on both x86_64 host and armhf guest): gcc -Wall -lpthread dotprod_mutex.c -o dotprod_mutex When compiled for x86_64 host it runs perfectly and even under Valgrind displays no errors whatsoever. However, when I compile the program in my armhs chroot and run it it usually (but not always) segaults or hangs or crashes. Example output: (armhf) $ ./dotprod_mutex Thread 1 did 10 to 20: mysum=10.00 global sum=10.00 Thread 0 did 0 to 10: mysum=10.00 global sum=20.00 TCG temporary leak before f6731ca0 qemu-arm-static: /home/erikd/Git/qemu-posix-timer-hacking/Upstream/tcg/tcg-op.h:2371: tcg_gen_goto_tb: Assertion `(tcg_ctx.goto_tb_issue_mask & (1 << idx)) == 0' failed. (armhf) $ ./dotprod_mutex qemu: uncaught target signal 11 (Segmentation fault) - core dumped Segmentation fault (armhf) $ ./dotprod_mutex qemu-arm-static: /home/erikd/Git/qemu-posix-timer-hacking/Upstream/tcg/tcg.c:519: tcg_temp_free_internal: Assertion `idx >= s->nb_globals && idx < s->nb_temps' failed. (armhf) $ ./dotprod_mutex Thread 1 did 10 to 20: mysum=10.00 global sum=10.00 qemu: uncaught target signal 11 (Segmentation fault) - core dumped Segmentation fault To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/1098729/+subscriptions
[Qemu-devel] [Bug 1098729] [NEW] qemu-user-static for armhf: segfault in threaded code
Public bug reported: Currently running QEMU from git (fedf2de31023) and running the armhf version of qemu-user-static which I have renamed qemu-armhf-static to follow the naming convention used in Debian. The host systems is a Debian testing x86_64-linux and I have an Debian testing armhf chroot which I invoke using schroot. Majority of program in the armhf chroot run fine, but I'm getting qemu segfaults in multi-threaded programs. As an example, I've grabbed the threads demo program here: https://computing.llnl.gov/tutorials/pthreads/samples/dotprod_mutex.c and changed NUMTHRDS from 4 to 10. I compile it as (same compile command on both x86_64 host and armhf guest): gcc -Wall -lpthread dotprod_mutex.c -o dotprod_mutex When compiled for x86_64 host it runs perfectly and even under Valgrind displays no errors whatsoever. However, when I compile the program in my armhs chroot and run it it usually (but not always) segaults or hangs or crashes. Example output: (armhf) $ ./dotprod_mutex Thread 1 did 10 to 20: mysum=10.00 global sum=10.00 Thread 0 did 0 to 10: mysum=10.00 global sum=20.00 TCG temporary leak before f6731ca0 qemu-arm-static: /home/erikd/Git/qemu-posix-timer-hacking/Upstream/tcg/tcg-op.h:2371: tcg_gen_goto_tb: Assertion `(tcg_ctx.goto_tb_issue_mask & (1 << idx)) == 0' failed. (armhf) $ ./dotprod_mutex qemu: uncaught target signal 11 (Segmentation fault) - core dumped Segmentation fault (armhf) $ ./dotprod_mutex qemu-arm-static: /home/erikd/Git/qemu-posix-timer-hacking/Upstream/tcg/tcg.c:519: tcg_temp_free_internal: Assertion `idx >= s->nb_globals && idx < s->nb_temps' failed. (armhf) $ ./dotprod_mutex Thread 1 did 10 to 20: mysum=10.00 global sum=10.00 qemu: uncaught target signal 11 (Segmentation fault) - core dumped Segmentation fault ** Affects: qemu Importance: Undecided Status: New -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1098729 Title: qemu-user-static for armhf: segfault in threaded code Status in QEMU: New Bug description: Currently running QEMU from git (fedf2de31023) and running the armhf version of qemu-user-static which I have renamed qemu-armhf-static to follow the naming convention used in Debian. The host systems is a Debian testing x86_64-linux and I have an Debian testing armhf chroot which I invoke using schroot. Majority of program in the armhf chroot run fine, but I'm getting qemu segfaults in multi-threaded programs. As an example, I've grabbed the threads demo program here: https://computing.llnl.gov/tutorials/pthreads/samples/dotprod_mutex.c and changed NUMTHRDS from 4 to 10. I compile it as (same compile command on both x86_64 host and armhf guest): gcc -Wall -lpthread dotprod_mutex.c -o dotprod_mutex When compiled for x86_64 host it runs perfectly and even under Valgrind displays no errors whatsoever. However, when I compile the program in my armhs chroot and run it it usually (but not always) segaults or hangs or crashes. Example output: (armhf) $ ./dotprod_mutex Thread 1 did 10 to 20: mysum=10.00 global sum=10.00 Thread 0 did 0 to 10: mysum=10.00 global sum=20.00 TCG temporary leak before f6731ca0 qemu-arm-static: /home/erikd/Git/qemu-posix-timer-hacking/Upstream/tcg/tcg-op.h:2371: tcg_gen_goto_tb: Assertion `(tcg_ctx.goto_tb_issue_mask & (1 << idx)) == 0' failed. (armhf) $ ./dotprod_mutex qemu: uncaught target signal 11 (Segmentation fault) - core dumped Segmentation fault (armhf) $ ./dotprod_mutex qemu-arm-static: /home/erikd/Git/qemu-posix-timer-hacking/Upstream/tcg/tcg.c:519: tcg_temp_free_internal: Assertion `idx >= s->nb_globals && idx < s->nb_temps' failed. (armhf) $ ./dotprod_mutex Thread 1 did 10 to 20: mysum=10.00 global sum=10.00 qemu: uncaught target signal 11 (Segmentation fault) - core dumped Segmentation fault To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/1098729/+subscriptions
Re: [Qemu-devel] [Bug 1042388] Re: qemu: Unsupported syscall: 257 (timer_create)
Matt Robinson wrote: > Is this patch available for public consumption? It doesn't seem to be > upstream. Unfortunately not yet. I'm working on getting permission to release it. Cheers, Erik -- ---------- Erik de Castro Lopo http://www.mega-nerd.com/ -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1042388 Title: qemu: Unsupported syscall: 257 (timer_create) Status in QEMU: New Bug description: Running qemu-arm-static for git HEAD. When I try to install ghc from debian into my arm chroot I get: Setting up ghc (7.4.1-4) ... qemu: Unsupported syscall: 257 ghc: timer_create: Function not implemented qemu: Unsupported syscall: 257 ghc-pkg: timer_create: Function not implemented dpkg: error processing ghc (--configure): subprocess installed post-installation script returned error exit status 1 Errors were encountered while processing: ghc E: Sub-process /usr/bin/dpkg returned an error code (1) To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/1042388/+subscriptions
Re: [Qemu-devel] [Bug 1054831] Re: qemu-user-static for sparc32plus : bash: fork: Invalid argument
Dillon Amburgey wrote: > This is due to QEMU sparc32plus-linux-user not being compiled with NPTL > support. I just check, and NPTL is enabled. I also did this on the binary I compiled: $ strings /usr/bin/qemu-sparc32plus-static | grep nptl ../nptl/sysdeps/pthread/createthread.c ../nptl/pthread_mutex_lock.c nptl-init.c ../nptl/sysdeps/unix/sysv/linux/x86_64/../fork.c which suggests that it has been compiled with NPTL. -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1054831 Title: qemu-user-static for sparc32plus : bash: fork: Invalid argument Status in QEMU: New Bug description: On Debian x86-64 host system I setup a sparc chroot using: host $ mkdir sparc host $ sudo debootstrap --arch=sparc --foreign wheezy sparc http://ftp.au.debian.org/debian host $ sudo cp ~/Git/qemu/sparc32plus-linux-user/qemu-sparc32plus sparc/usr/bin/qemu-sparc32plus-static host $ LANG=C sudo chroot sparc/ /usr/bin/qemu-sparc32plus-static /bin/bash When I then run the second stage of debootstrap I get: target $ /debootstrap/debootstrap --second-stage bash: fork: Invalid argument The above procedures works perfectly for armhf. This is with current git HEAD (commit 93b6599734f81328ee3d608f57667742cafeea72). To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/1054831/+subscriptions
[Qemu-devel] [Bug 1054831] [NEW] qemu-user-static for sparc32plus : bash: fork: Invalid argument
Public bug reported: On Debian x86-64 host system I setup a sparc chroot using: host $ mkdir sparc host $ sudo debootstrap --arch=sparc --foreign wheezy sparc http://ftp.au.debian.org/debian host $ sudo cp ~/Git/qemu/sparc32plus-linux-user/qemu-sparc32plus sparc/usr/bin/qemu-sparc32plus-static host $ LANG=C sudo chroot sparc/ /usr/bin/qemu-sparc32plus-static /bin/bash When I then run the second stage of debootstrap I get: target $ /debootstrap/debootstrap --second-stage bash: fork: Invalid argument The above procedures works perfectly for armhf. This is with current git HEAD (commit 93b6599734f81328ee3d608f57667742cafeea72). ** Affects: qemu Importance: Undecided Status: New -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1054831 Title: qemu-user-static for sparc32plus : bash: fork: Invalid argument Status in QEMU: New Bug description: On Debian x86-64 host system I setup a sparc chroot using: host $ mkdir sparc host $ sudo debootstrap --arch=sparc --foreign wheezy sparc http://ftp.au.debian.org/debian host $ sudo cp ~/Git/qemu/sparc32plus-linux-user/qemu-sparc32plus sparc/usr/bin/qemu-sparc32plus-static host $ LANG=C sudo chroot sparc/ /usr/bin/qemu-sparc32plus-static /bin/bash When I then run the second stage of debootstrap I get: target $ /debootstrap/debootstrap --second-stage bash: fork: Invalid argument The above procedures works perfectly for armhf. This is with current git HEAD (commit 93b6599734f81328ee3d608f57667742cafeea72). To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/1054831/+subscriptions
Re: [Qemu-devel] [PATCH] linux-user: Add naive implementation of capget() syscall
Blue Swirl wrote: > This is not correct. The structure needs to be converted field by > field to host native format, especially endianness. I'm working in a similar syscall implementation (POSIX timers) and I'm currently testing it in an debian armhf chroot running on my x86-64 laptop. After quite a bit of debugging its now working perfectly. However, both armhf and x86-64 are little endian, so I'd like to make sure it works on a big endian CPU emulation as well. Unfortunately, I can't find one that works (I tried ppc, sparc and mips). They all seem to have different problems and I can't seem to run anything with the linux-user emulation. Erik -- ---------- Erik de Castro Lopo http://www.mega-nerd.com/
[Qemu-devel] lp bug #1052857: qemu-user compiled static for ppc fails
HI all, I reported this bug ion launchpad, but it never seemed to show up here on the list: https://bugs.launchpad.net/qemu/+bug/1052857 Anyone have any clues on what's going on here? Erik -- -- Erik de Castro Lopo http://www.mega-nerd.com/
[Qemu-devel] [Bug 1052857] [NEW] qemu-user compiled static for ppc fails
Public bug reported: On debian I used debootstrap to set up a powerpc chroot. If I then copy in a statically linked qemu-user ppc binary it will work for some commands in the chroot and fail for others. Steps to reproduce: host$ mkdir powerpc host$ sudo debootstrap --arch=powerpc --foreign wheezy powerpc http://ftp.debian.org/debian host$ sudo cp /usr/bin/qemu-ppc-static powerpc/usr/bin/ host$ LANG=C sudo chroot powerpc /usr/bin/qemu-ppc-static /bin/bash I have no name!@guest:/# pwd / I have no name!@guest:/# cd home/ I have no name!@guest:/home# ls qemu-ppc-static: /tmp/buildd/qemu-1.1.2+dfsg/linux-user/signal.c:4341: setup_frame: Assertion `({ unsigned long __guest = (unsigned long)(ka->_sa_handler) - guest_base; (__guest < (1ul << 32)) && (!reserved_va || (__guest < reserved_va)); })' failed. I have also built this from the git HEAD sources (hash 6b80f7db8a7f84d21e46d01e30c8497733bb23a0) and I get the same result. ** Affects: qemu Importance: Undecided Status: New -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1052857 Title: qemu-user compiled static for ppc fails Status in QEMU: New Bug description: On debian I used debootstrap to set up a powerpc chroot. If I then copy in a statically linked qemu-user ppc binary it will work for some commands in the chroot and fail for others. Steps to reproduce: host$ mkdir powerpc host$ sudo debootstrap --arch=powerpc --foreign wheezy powerpc http://ftp.debian.org/debian host$ sudo cp /usr/bin/qemu-ppc-static powerpc/usr/bin/ host$ LANG=C sudo chroot powerpc /usr/bin/qemu-ppc-static /bin/bash I have no name!@guest:/# pwd / I have no name!@guest:/# cd home/ I have no name!@guest:/home# ls qemu-ppc-static: /tmp/buildd/qemu-1.1.2+dfsg/linux-user/signal.c:4341: setup_frame: Assertion `({ unsigned long __guest = (unsigned long)(ka->_sa_handler) - guest_base; (__guest < (1ul << 32)) && (!reserved_va || (__guest < reserved_va)); })' failed. I have also built this from the git HEAD sources (hash 6b80f7db8a7f84d21e46d01e30c8497733bb23a0) and I get the same result. To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/1052857/+subscriptions
[Qemu-devel] [Bug 1042388] Re: qemu: Unsupported syscall: 257 (timer_create)
I have a fix for this. I can now successfully install ghc and compile programs with it. In the process of cleaning up the patch and working on a test for the test suite. -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1042388 Title: qemu: Unsupported syscall: 257 (timer_create) Status in QEMU: New Bug description: Running qemu-arm-static for git HEAD. When I try to install ghc from debian into my arm chroot I get: Setting up ghc (7.4.1-4) ... qemu: Unsupported syscall: 257 ghc: timer_create: Function not implemented qemu: Unsupported syscall: 257 ghc-pkg: timer_create: Function not implemented dpkg: error processing ghc (--configure): subprocess installed post-installation script returned error exit status 1 Errors were encountered while processing: ghc E: Sub-process /usr/bin/dpkg returned an error code (1) To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/1042388/+subscriptions
Re: [Qemu-devel] Posix timer syscalls ; dealing with the timer_t type
Andreas Färber wrote: > Hi, > > Am 30.08.2012 14:30, schrieb Erik de Castro Lopo: > > I'm working on implementing Posix timers in linux-user. > > > > I'm having trouble figuring out how to handle the timer_t type. > > Consider the following code with say 32 bit ARM being emulated > > on 64 bit x86-64: > > > > timer_t timerid; > > > > err = timer_create(clockid, &sev, &timerid); > > err = timer_gettime(timerid, &curr); > > > > The issue is that memory for the timer_t value in the 32 bit > > target is alloacted on the stack (where the timer_t is 4 bytes) > > but the value provided by the 64 bit host where the timer_t is > > 8 bytes. > > > > Any suggestions on dealing with this? > > typedef target_ulong target_timer_t; > > or abi_ulong, or without the u if signed. The timer_t type is actually an alias for void*. > Depending on where/how you use this, you may need to convert back and > forth between host and target values. The complication is that each call to the host's timer_create() function generates 64 bits of data, but on the 32 bit target, where there are only 32 bits to store that data. The only obvious solution is store the 64 bit pointers from the host in a table and return the index into that table to the target as its version of the timer_t. Does that make sense? Cheers, Erik -- -- Erik de Castro Lopo http://www.mega-nerd.com/
[Qemu-devel] Posix timer syscalls ; dealing with the timer_t type
Hi all, I'm working on implementing Posix timers in linux-user. I'm having trouble figuring out how to handle the timer_t type. Consider the following code with say 32 bit ARM being emulated on 64 bit x86-64: timer_t timerid; err = timer_create(clockid, &sev, &timerid); err = timer_gettime(timerid, &curr); The issue is that memory for the timer_t value in the 32 bit target is alloacted on the tack (where the timer_t is 4 bytes) but the value provided by the 64 bit host where the timer_t is 8 bytes. Any suggestions on dealing with this? Erik -- ---------- Erik de Castro Lopo http://www.mega-nerd.com/
Re: [Qemu-devel] Posix timer syscalls [Bug 1042388]
Peter Maydell wrote: > You need to look at how the kernel decides which of the > fields of the union is valid, and use the same logic to > decide how to convert it in qemu. > > In this case I think that means that if > (sigev_notify & SIGEV_THREAD_ID) != 0, _tid is valid and > must be converted. Otherwise convert _sigev_thread. Ah, that makes sense. Thanks. Cheers, Erik -- ---------- Erik de Castro Lopo http://www.mega-nerd.com/
[Qemu-devel] Posix timer syscalls [Bug 1042388]
Hi all, I've spent some time messing about in linux-user/syscall.c and I have stubs for all 5 posix timer syscalls: int timer_create(clockid_t clockid, struct sigevent *sevp, timer_t *timerid); int timer_settime(timer_t timerid, int flags, const struct itimerspec *new_value, struct itimerspec * old_value); int timer_gettime(timer_t timerid, struct itimerspec *curr_value); int timer_getoverrun(timer_t timerid); int timer_delete(timer_t timerid); Obviously all these parameters need to be converted between host and target. I've already found struct target_itimerspec in linux-user/syscall_defs.h and that looks like it will be useful. I'm having trouble struct sigevent pointer that is passed to timer_create() which is defined as: typedef struct sigevent { sigval_t sigev_value; int sigev_signo; int sigev_notify; union { int _pad[SIGEV_PAD_SIZE]; int _tid; struct { void (*_function)(sigval_t); void *_attribute; /* really pthread_attr_t */ } _sigev_thread; } _sigev_un; } sigevent_t; Any ideas on how to handle the union within this struct? Cheers, Erik -- ------ Erik de Castro Lopo http://www.mega-nerd.com/
Re: [Qemu-devel] [Bug 1042388] Re: qemu: Unsupported syscall: 257 (timer_create)
Peter Maydell wrote: > A couple of days for somebody who knows what they're doing and has > a convenient test case. Working on it.
Re: [Qemu-devel] [Bug 1042388] Re: qemu: Unsupported syscall: 257 (timer_create)
Peter Maydell wrote: > Yes, qemu's linux-user emulation layer doesn't currently support any of > the posix timer syscalls. Any idea how much work is involved to implement this? -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1042388 Title: qemu: Unsupported syscall: 257 (timer_create) Status in QEMU: New Bug description: Running qemu-arm-static for git HEAD. When I try to install ghc from debian into my arm chroot I get: Setting up ghc (7.4.1-4) ... qemu: Unsupported syscall: 257 ghc: timer_create: Function not implemented qemu: Unsupported syscall: 257 ghc-pkg: timer_create: Function not implemented dpkg: error processing ghc (--configure): subprocess installed post-installation script returned error exit status 1 Errors were encountered while processing: ghc E: Sub-process /usr/bin/dpkg returned an error code (1) To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/1042388/+subscriptions
[Qemu-devel] [Bug 1042388] [NEW] qemu: Unsupported syscall: 257
Public bug reported: Running qemu-arm-static for git HEAD. When I try to install ghc from debian into my arm chroot I get: Setting up ghc (7.4.1-4) ... qemu: Unsupported syscall: 257 ghc: timer_create: Function not implemented qemu: Unsupported syscall: 257 ghc-pkg: timer_create: Function not implemented dpkg: error processing ghc (--configure): subprocess installed post-installation script returned error exit status 1 Errors were encountered while processing: ghc E: Sub-process /usr/bin/dpkg returned an error code (1) ** Affects: qemu Importance: Undecided Status: New -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1042388 Title: qemu: Unsupported syscall: 257 Status in QEMU: New Bug description: Running qemu-arm-static for git HEAD. When I try to install ghc from debian into my arm chroot I get: Setting up ghc (7.4.1-4) ... qemu: Unsupported syscall: 257 ghc: timer_create: Function not implemented qemu: Unsupported syscall: 257 ghc-pkg: timer_create: Function not implemented dpkg: error processing ghc (--configure): subprocess installed post-installation script returned error exit status 1 Errors were encountered while processing: ghc E: Sub-process /usr/bin/dpkg returned an error code (1) To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/1042388/+subscriptions