From: Jens Axboe <axboe@kernel.dk>
To: "Akers, Jason B" <jason.b.akers@intel.com>
Cc: "fio@vger.kernel.org" <fio@vger.kernel.org>
Subject: Re: syscall problem on Android x86
Date: Fri, 26 Apr 2013 12:17:32 -0600 [thread overview]
Message-ID: <20130426181732.GZ9563@kernel.dk> (raw)
In-Reply-To: <372C7AE269BA5E4D92B1082F530ED4B85069CD30@ORSMSX110.amr.corp.intel.com>
On Fri, Apr 26 2013, Akers, Jason B wrote:
> Fio hangs when run on the Android x86 emulator.
>
> Tracking through, I found that the last call made is shmget() (in init.c - setup_thread_area()).
> I believe that the hang is related to the fio syscall implementation for x86.
>
> os-android.h defines shmget as: syscall(__NR_shmget, __key, __size, __shmflg);
>
> In arch-x86.h __NR_shmget is defined to 29. This was added on April 11th (a415b2cc).
>
> Looking deeper, I see that syscall 29 is actually mapped to pause(). (see SYSCALLS.TXT in bionic/libc) I confirmed that sys_pause() was being called by using a kernel breakpoint. This explains why fio hangs.
>
> Now the question is: What to do about it?
> For some reason shmget is only exposed for Android ARM targets even though it is part of the kernel (system.map) for x86.
>
> I see two options:
> 1. add shmget to SYSCALLS.TXT for x86 and recompile. Remove the hardcoded __NR_shmget from arch-x86.h and put a #error instead to warn others that a kernel patch is necessary for Android x86.
>
> 2. use a "blessed" shared memory allocation method for Android targets (like ashmem / mmap??) Not sure how difficult it would be to make this work with the existing FIO architecture.
>
> Any other ideas / thoughts / feedback / suggestions are appreciated.
So sounds like you are catching the x86 definition of __NR_shmget which
is indeed 29, but you are building on Arm. That sounds pretty weird. The
below patch should wire up the right Arm syscalls, but I think you need
into why it's claiming to be x86 while it is in fact building for arm.
diff --git a/arch/arch-arm.h b/arch/arch-arm.h
index 7cd9502..8a7398e 100644
--- a/arch/arch-arm.h
+++ b/arch/arch-arm.h
@@ -18,6 +18,13 @@
#define __NR_sys_vmsplice 343
#endif
+#ifndef __NR_shmget
+#define __NR_shmat 305
+#define __NR_shmdt 306
+#define __NR_shmget 307
+#define __NR_shmctl 308
+#endif
+
#if defined (__ARM_ARCH_4__) || defined (__ARM_ARCH_4T__) \
|| defined (__ARM_ARCH_5__) || defined (__ARM_ARCH_5T__) || defined (__ARM_ARCH_5TE__) || defined (__ARM_ARCH_5TEJ__) \
|| defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__)
diff --git a/arch/arch-x86.h b/arch/arch-x86.h
index 49e64dd..ce2414d 100644
--- a/arch/arch-x86.h
+++ b/arch/arch-x86.h
@@ -30,9 +30,10 @@ static inline void do_cpuid(unsigned int *eax, unsigned int *ebx,
#endif
#ifndef __NR_shmget
-#define __NR_shmget 29
-#define __NR_shmat 30
-#define __NR_shmctl 31
+#define __NR_shmget 29
+#define __NR_shmat 30
+#define __NR_shmctl 31
+#define __NR_shmdt 67
#endif
#define FIO_HUGE_PAGE 4194304
--
Jens Axboe
next prev parent reply other threads:[~2013-04-26 18:17 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-26 17:43 syscall problem on Android x86 Akers, Jason B
2013-04-26 18:17 ` Jens Axboe [this message]
2013-04-26 19:46 ` Akers, Jason B
2013-04-26 20:04 ` Jens Axboe
2013-04-26 20:35 ` Akers, Jason B
2013-04-26 20:42 ` Jens Axboe
2013-04-27 1:59 ` Aaron Carroll
2013-04-27 2:27 ` Jens Axboe
2013-04-29 18:16 ` Akers, Jason B
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=20130426181732.GZ9563@kernel.dk \
--to=axboe@kernel.dk \
--cc=fio@vger.kernel.org \
--cc=jason.b.akers@intel.com \
/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.