All of lore.kernel.org
 help / color / mirror / Atom feed
* Make FIO for Android
@ 2013-04-11 17:57 Krishnamurthy, Anush
       [not found] ` <CAKCZDgnM85AcwD6Ss5YWNjXwY-OE7QFQh22nFdEFHkta_N0hRA@mail.gmail.com>
  0 siblings, 1 reply; 24+ messages in thread
From: Krishnamurthy, Anush @ 2013-04-11 17:57 UTC (permalink / raw)
  To: fio

I would like to make FIO for Android source. I tried Aaron's post and ran into problems. I also tried making a Android.mk and got into undeclared values for __NR_shm*

When I make here is what i get..

akrish9@akrish9-ws:~/setup/fio [master] $ make V=1 UNAME=Android cross_prefix=~/android-ndk-r8e/toolchains/x86-4.6/prebuilt/linux-x86_64/bin/i686-linux-android-
Makefile:12: config-host.mak: No such file or directory
Running configure for you...
compile test failed
Configure failed, check config.log and/or the above output



when i try to configure i get this..

akrish9@akrish9-ws:~/setup/fio [master] $ ./configure --cpu=i386 --extra-cflags="-D__ANDROID__" --cc=/home/akrish9/android-ndk-r8e/toolchains/x86-4.6/prebuilt/linux-x86_64/i686-linux-android/bin/gcc
compile test failed
Configure failed, check config.log and/or the above output
akrish9@akrish9-ws:~/setup/fio [master] $ cat config.log
# FIO configure log Thu Apr 11 10:46:48 MST 2013
# Configured with: './configure' '--cpu=i386' '--extra-cflags=-D__ANDROID__' '--cc=/home/akrish9/android-ndk-r8e/toolchains/x86-4.6/prebuilt/linux-x86_64/i686-linux-android/bin/gcc'
#
gcc -D_GNU_SOURCE -include config-host.h -D__ANDROID__ -c -o /tmp/fio-conf--4681-.o /tmp/fio-conf--4681-.c
Compiling test case cross


Any help here is appreciated.

Thanks,
Anush Krishnamurthy





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

* Re: Make FIO for Android
       [not found] ` <CAKCZDgnM85AcwD6Ss5YWNjXwY-OE7QFQh22nFdEFHkta_N0hRA@mail.gmail.com>
@ 2013-04-12  1:20   ` Krishnamurthy, Anush
  2013-04-12  2:48     ` Aaron Carroll
  0 siblings, 1 reply; 24+ messages in thread
From: Krishnamurthy, Anush @ 2013-04-12  1:20 UTC (permalink / raw)
  To: Aaron Carroll; +Cc: fio

Thanks Aaron. I will give this a go. I also wanted to know if you ever tried compiling this in the native source. I mean the whole android source.

Regards
Anush Krishnamurthy


On Apr 11, 2013, at 6:17 PM, "Aaron Carroll" <xaaronc@gmail.com<mailto:xaaronc@gmail.com>> wrote:

Hi Anush,

On 12 April 2013 03:57, Krishnamurthy, Anush <anush.krishnamurthy@intel.com<mailto:anush.krishnamurthy@intel.com>> wrote:
I would like to make FIO for Android source. I tried Aaron's post and ran into problems. I also tried making a Android.mk and got into undeclared values for __NR_shm*

When I make here is what i get..

akrish9@akrish9-ws:~/setup/fio [master] $ make V=1 UNAME=Android cross_prefix=~/android-ndk-r8e/toolchains/x86-4.6/prebuilt/linux-x86_64/bin/i686-linux-android-

This is not the problem here, but the preferred way to invoke cross compiles is now:
  make CROSS_COMPILE=/path/to/bin/i686-linux-android-
Uname is deprecated.

Now, the issue is that you can't run the Android toolchains directly out of the NDK, because the lib paths are wrong.  What you need to do is build a standalone toolchain with ./build/tools/make-standalone-toolchain.sh from the NDK root dir. The script has a bunch of args to specify the versions and archs.  That will generate a tar of a standalone toolchain: untar is somewhere and point CROSS_COMPILE to there, and it should build.

Except that if you're targeting x86, it doesn't, due to a previously reported issue with some inline asm:
  arch/arch-x86-common.h:9:2: error: inconsistent operand constraints in an 'asm'

I'm not sure what's going on there, but I don't speak x86 asm.



Cheers,
   -- Aaron





Makefile:12: config-host.mak: No such file or directory
Running configure for you...
compile test failed
Configure failed, check config.log and/or the above output



when i try to configure i get this..

akrish9@akrish9-ws:~/setup/fio [master] $ ./configure --cpu=i386 --extra-cflags="-D__ANDROID__" --cc=/home/akrish9/android-ndk-r8e/toolchains/x86-4.6/prebuilt/linux-x86_64/i686-linux-android/bin/gcc
compile test failed
Configure failed, check config.log and/or the above output
akrish9@akrish9-ws:~/setup/fio [master] $ cat config.log
# FIO configure log Thu Apr 11 10:46:48 MST 2013
# Configured with: './configure' '--cpu=i386' '--extra-cflags=-D__ANDROID__' '--cc=/home/akrish9/android-ndk-r8e/toolchains/x86-4.6/prebuilt/linux-x86_64/i686-linux-android/bin/gcc'
#
gcc -D_GNU_SOURCE -include config-host.h -D__ANDROID__ -c -o /tmp/fio-conf--4681-.o /tmp/fio-conf--4681-.c
Compiling test case cross


Any help here is appreciated.

Thanks,
Anush Krishnamurthy




--
To unsubscribe from this list: send the line "unsubscribe fio" in
the body of a message to majordomo@vger.kernel.org<mailto:majordomo@vger.kernel.org>
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

* Re: Make FIO for Android
  2013-04-12  1:20   ` Krishnamurthy, Anush
@ 2013-04-12  2:48     ` Aaron Carroll
  2013-04-12  3:17       ` Krishnamurthy, Anush
  0 siblings, 1 reply; 24+ messages in thread
From: Aaron Carroll @ 2013-04-12  2:48 UTC (permalink / raw)
  To: Krishnamurthy, Anush; +Cc: fio

On 12 April 2013 11:20, Krishnamurthy, Anush
<anush.krishnamurthy@intel.com> wrote:
> Thanks Aaron. I will give this a go. I also wanted to know if you ever tried
> compiling this in the native source. I mean the whole android source.

I have not.  Others have tried creating Android.mk make files for
this, but IIRC they bypass the fio build system and specify everything
manually. If you know how to do such a thing without creating a
maintenance nightmare, I think that would be well received.

Thanks,
  -- Aaron


>
> Regards
> Anush Krishnamurthy
>
>
> On Apr 11, 2013, at 6:17 PM, "Aaron Carroll" <xaaronc@gmail.com> wrote:
>
> Hi Anush,
>
> On 12 April 2013 03:57, Krishnamurthy, Anush <anush.krishnamurthy@intel.com>
> wrote:
>>
>> I would like to make FIO for Android source. I tried Aaron's post and ran
>> into problems. I also tried making a Android.mk and got into undeclared
>> values for __NR_shm*
>>
>> When I make here is what i get..
>>
>> akrish9@akrish9-ws:~/setup/fio [master] $ make V=1 UNAME=Android
>> cross_prefix=~/android-ndk-r8e/toolchains/x86-4.6/prebuilt/linux-x86_64/bin/i686-linux-android-
>
>
> This is not the problem here, but the preferred way to invoke cross compiles
> is now:
>   make CROSS_COMPILE=/path/to/bin/i686-linux-android-
> Uname is deprecated.
>
> Now, the issue is that you can't run the Android toolchains directly out of
> the NDK, because the lib paths are wrong.  What you need to do is build a
> standalone toolchain with ./build/tools/make-standalone-toolchain.sh from
> the NDK root dir. The script has a bunch of args to specify the versions and
> archs.  That will generate a tar of a standalone toolchain: untar is
> somewhere and point CROSS_COMPILE to there, and it should build.
>
> Except that if you're targeting x86, it doesn't, due to a previously
> reported issue with some inline asm:
>   arch/arch-x86-common.h:9:2: error: inconsistent operand constraints in an
> 'asm'
>
> I'm not sure what's going on there, but I don't speak x86 asm.
>
>
>
> Cheers,
>    -- Aaron
>
>
>
>
>
>> Makefile:12: config-host.mak: No such file or directory
>> Running configure for you...
>> compile test failed
>> Configure failed, check config.log and/or the above output
>>
>>
>>
>> when i try to configure i get this..
>>
>> akrish9@akrish9-ws:~/setup/fio [master] $ ./configure --cpu=i386
>> --extra-cflags="-D__ANDROID__"
>> --cc=/home/akrish9/android-ndk-r8e/toolchains/x86-4.6/prebuilt/linux-x86_64/i686-linux-android/bin/gcc
>> compile test failed
>> Configure failed, check config.log and/or the above output
>> akrish9@akrish9-ws:~/setup/fio [master] $ cat config.log
>> # FIO configure log Thu Apr 11 10:46:48 MST 2013
>> # Configured with: './configure' '--cpu=i386'
>> '--extra-cflags=-D__ANDROID__'
>> '--cc=/home/akrish9/android-ndk-r8e/toolchains/x86-4.6/prebuilt/linux-x86_64/i686-linux-android/bin/gcc'
>> #
>> gcc -D_GNU_SOURCE -include config-host.h -D__ANDROID__ -c -o
>> /tmp/fio-conf--4681-.o /tmp/fio-conf--4681-.c
>> Compiling test case cross
>>
>>
>> Any help here is appreciated.
>>
>> Thanks,
>> Anush Krishnamurthy
>>
>>
>>
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe fio" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
>

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

* Re: Make FIO for Android
  2013-04-12  2:48     ` Aaron Carroll
@ 2013-04-12  3:17       ` Krishnamurthy, Anush
  2013-04-12  3:28         ` Aaron Carroll
  0 siblings, 1 reply; 24+ messages in thread
From: Krishnamurthy, Anush @ 2013-04-12  3:17 UTC (permalink / raw)
  To: Aaron Carroll; +Cc: fio

Thanks Aaron - 

I tried doing that and I got stuck at gettime_thread.c which refers to shmctl and shmat etc. it is looking for __NR_shmat and not able to find it. Basically native android source does not have shared memory in any of the headers. 

Regards
Anush Krishnamurthy


On Apr 11, 2013, at 7:49 PM, "Aaron Carroll" <xaaronc@gmail.com> wrote:

> On 12 April 2013 11:20, Krishnamurthy, Anush
> <anush.krishnamurthy@intel.com> wrote:
>> Thanks Aaron. I will give this a go. I also wanted to know if you ever tried
>> compiling this in the native source. I mean the whole android source.
> 
> I have not.  Others have tried creating Android.mk make files for
> this, but IIRC they bypass the fio build system and specify everything
> manually. If you know how to do such a thing without creating a
> maintenance nightmare, I think that would be well received.
> 
> Thanks,
>  -- Aaron
> 
> 
>> 
>> Regards
>> Anush Krishnamurthy
>> 
>> 
>> On Apr 11, 2013, at 6:17 PM, "Aaron Carroll" <xaaronc@gmail.com> wrote:
>> 
>> Hi Anush,
>> 
>> On 12 April 2013 03:57, Krishnamurthy, Anush <anush.krishnamurthy@intel.com>
>> wrote:
>>> 
>>> I would like to make FIO for Android source. I tried Aaron's post and ran
>>> into problems. I also tried making a Android.mk and got into undeclared
>>> values for __NR_shm*
>>> 
>>> When I make here is what i get..
>>> 
>>> akrish9@akrish9-ws:~/setup/fio [master] $ make V=1 UNAME=Android
>>> cross_prefix=~/android-ndk-r8e/toolchains/x86-4.6/prebuilt/linux-x86_64/bin/i686-linux-android-
>> 
>> 
>> This is not the problem here, but the preferred way to invoke cross compiles
>> is now:
>>  make CROSS_COMPILE=/path/to/bin/i686-linux-android-
>> Uname is deprecated.
>> 
>> Now, the issue is that you can't run the Android toolchains directly out of
>> the NDK, because the lib paths are wrong.  What you need to do is build a
>> standalone toolchain with ./build/tools/make-standalone-toolchain.sh from
>> the NDK root dir. The script has a bunch of args to specify the versions and
>> archs.  That will generate a tar of a standalone toolchain: untar is
>> somewhere and point CROSS_COMPILE to there, and it should build.
>> 
>> Except that if you're targeting x86, it doesn't, due to a previously
>> reported issue with some inline asm:
>>  arch/arch-x86-common.h:9:2: error: inconsistent operand constraints in an
>> 'asm'
>> 
>> I'm not sure what's going on there, but I don't speak x86 asm.
>> 
>> 
>> 
>> Cheers,
>>   -- Aaron
>> 
>> 
>> 
>> 
>> 
>>> Makefile:12: config-host.mak: No such file or directory
>>> Running configure for you...
>>> compile test failed
>>> Configure failed, check config.log and/or the above output
>>> 
>>> 
>>> 
>>> when i try to configure i get this..
>>> 
>>> akrish9@akrish9-ws:~/setup/fio [master] $ ./configure --cpu=i386
>>> --extra-cflags="-D__ANDROID__"
>>> --cc=/home/akrish9/android-ndk-r8e/toolchains/x86-4.6/prebuilt/linux-x86_64/i686-linux-android/bin/gcc
>>> compile test failed
>>> Configure failed, check config.log and/or the above output
>>> akrish9@akrish9-ws:~/setup/fio [master] $ cat config.log
>>> # FIO configure log Thu Apr 11 10:46:48 MST 2013
>>> # Configured with: './configure' '--cpu=i386'
>>> '--extra-cflags=-D__ANDROID__'
>>> '--cc=/home/akrish9/android-ndk-r8e/toolchains/x86-4.6/prebuilt/linux-x86_64/i686-linux-android/bin/gcc'
>>> #
>>> gcc -D_GNU_SOURCE -include config-host.h -D__ANDROID__ -c -o
>>> /tmp/fio-conf--4681-.o /tmp/fio-conf--4681-.c
>>> Compiling test case cross
>>> 
>>> 
>>> Any help here is appreciated.
>>> 
>>> Thanks,
>>> Anush Krishnamurthy
>>> 
>>> 
>>> 
>>> 
>>> --
>>> To unsubscribe from this list: send the line "unsubscribe fio" in
>>> the body of a message to majordomo@vger.kernel.org
>>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>> 
>> 

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

* Re: Make FIO for Android
  2013-04-12  3:17       ` Krishnamurthy, Anush
@ 2013-04-12  3:28         ` Aaron Carroll
  2013-04-12  3:37           ` Aaron Carroll
  0 siblings, 1 reply; 24+ messages in thread
From: Aaron Carroll @ 2013-04-12  3:28 UTC (permalink / raw)
  To: Krishnamurthy, Anush; +Cc: fio

Anush,

Yes, you are right.  I'd forgot I'd fixed that in my local tree.  The
following patch should fix that issue, but as I said I still get the
unresolved inline asm problem.

 -- Aaron


diff --git a/arch/arch-x86.h b/arch/arch-x86.h
index 8eea538..69cf60b 100644
--- a/arch/arch-x86.h
+++ b/arch/arch-x86.h
@@ -20,6 +20,12 @@
 #define __NR_sys_vmsplice      316
 #endif

+#ifndef __NR_shmget
+#define __NR_shmget 29
+#define __NR_shmat 30
+#define __NR_shmctl 31
+#endif
+
 #define        FIO_HUGE_PAGE           4194304

 #define nop            __asm__ __volatile__("rep;nop": : :"memory")



On 12 April 2013 13:17, Krishnamurthy, Anush
<anush.krishnamurthy@intel.com> wrote:
> Thanks Aaron -
>
> I tried doing that and I got stuck at gettime_thread.c which refers to shmctl and shmat etc. it is looking for __NR_shmat and not able to find it. Basically native android source does not have shared memory in any of the headers.
>
> Regards
> Anush Krishnamurthy
>
>
> On Apr 11, 2013, at 7:49 PM, "Aaron Carroll" <xaaronc@gmail.com> wrote:
>
>> On 12 April 2013 11:20, Krishnamurthy, Anush
>> <anush.krishnamurthy@intel.com> wrote:
>>> Thanks Aaron. I will give this a go. I also wanted to know if you ever tried
>>> compiling this in the native source. I mean the whole android source.
>>
>> I have not.  Others have tried creating Android.mk make files for
>> this, but IIRC they bypass the fio build system and specify everything
>> manually. If you know how to do such a thing without creating a
>> maintenance nightmare, I think that would be well received.
>>
>> Thanks,
>>  -- Aaron
>>
>>
>>>
>>> Regards
>>> Anush Krishnamurthy
>>>
>>>
>>> On Apr 11, 2013, at 6:17 PM, "Aaron Carroll" <xaaronc@gmail.com> wrote:
>>>
>>> Hi Anush,
>>>
>>> On 12 April 2013 03:57, Krishnamurthy, Anush <anush.krishnamurthy@intel.com>
>>> wrote:
>>>>
>>>> I would like to make FIO for Android source. I tried Aaron's post and ran
>>>> into problems. I also tried making a Android.mk and got into undeclared
>>>> values for __NR_shm*
>>>>
>>>> When I make here is what i get..
>>>>
>>>> akrish9@akrish9-ws:~/setup/fio [master] $ make V=1 UNAME=Android
>>>> cross_prefix=~/android-ndk-r8e/toolchains/x86-4.6/prebuilt/linux-x86_64/bin/i686-linux-android-
>>>
>>>
>>> This is not the problem here, but the preferred way to invoke cross compiles
>>> is now:
>>>  make CROSS_COMPILE=/path/to/bin/i686-linux-android-
>>> Uname is deprecated.
>>>
>>> Now, the issue is that you can't run the Android toolchains directly out of
>>> the NDK, because the lib paths are wrong.  What you need to do is build a
>>> standalone toolchain with ./build/tools/make-standalone-toolchain.sh from
>>> the NDK root dir. The script has a bunch of args to specify the versions and
>>> archs.  That will generate a tar of a standalone toolchain: untar is
>>> somewhere and point CROSS_COMPILE to there, and it should build.
>>>
>>> Except that if you're targeting x86, it doesn't, due to a previously
>>> reported issue with some inline asm:
>>>  arch/arch-x86-common.h:9:2: error: inconsistent operand constraints in an
>>> 'asm'
>>>
>>> I'm not sure what's going on there, but I don't speak x86 asm.
>>>
>>>
>>>
>>> Cheers,
>>>   -- Aaron
>>>
>>>
>>>
>>>
>>>
>>>> Makefile:12: config-host.mak: No such file or directory
>>>> Running configure for you...
>>>> compile test failed
>>>> Configure failed, check config.log and/or the above output
>>>>
>>>>
>>>>
>>>> when i try to configure i get this..
>>>>
>>>> akrish9@akrish9-ws:~/setup/fio [master] $ ./configure --cpu=i386
>>>> --extra-cflags="-D__ANDROID__"
>>>> --cc=/home/akrish9/android-ndk-r8e/toolchains/x86-4.6/prebuilt/linux-x86_64/i686-linux-android/bin/gcc
>>>> compile test failed
>>>> Configure failed, check config.log and/or the above output
>>>> akrish9@akrish9-ws:~/setup/fio [master] $ cat config.log
>>>> # FIO configure log Thu Apr 11 10:46:48 MST 2013
>>>> # Configured with: './configure' '--cpu=i386'
>>>> '--extra-cflags=-D__ANDROID__'
>>>> '--cc=/home/akrish9/android-ndk-r8e/toolchains/x86-4.6/prebuilt/linux-x86_64/i686-linux-android/bin/gcc'
>>>> #
>>>> gcc -D_GNU_SOURCE -include config-host.h -D__ANDROID__ -c -o
>>>> /tmp/fio-conf--4681-.o /tmp/fio-conf--4681-.c
>>>> Compiling test case cross
>>>>
>>>>
>>>> Any help here is appreciated.
>>>>
>>>> Thanks,
>>>> Anush Krishnamurthy
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> To unsubscribe from this list: send the line "unsubscribe fio" in
>>>> the body of a message to majordomo@vger.kernel.org
>>>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>>
>>>

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

* Re: Make FIO for Android
  2013-04-12  3:28         ` Aaron Carroll
@ 2013-04-12  3:37           ` Aaron Carroll
  2013-04-12  5:58             ` Jens Axboe
  0 siblings, 1 reply; 24+ messages in thread
From: Aaron Carroll @ 2013-04-12  3:37 UTC (permalink / raw)
  To: Krishnamurthy, Anush; +Cc: fio

[-- Attachment #1: Type: text/plain, Size: 5143 bytes --]

Apologies, I'm being a moron today.

That won't apply cleanly due to minor changes in arch-x86.h, but easy
to apply by hand. Also the type of ioprio_set() has changed, but
Android was not updated.

So, attached is a patch that should get tip back to the state where I
thought it was -- weird asm errors.

Sorry for the confusion.
  -- Aaron


On 12 April 2013 13:28, Aaron Carroll <xaaronc@gmail.com> wrote:
> Anush,
>
> Yes, you are right.  I'd forgot I'd fixed that in my local tree.  The
> following patch should fix that issue, but as I said I still get the
> unresolved inline asm problem.
>
>  -- Aaron
>
>
> diff --git a/arch/arch-x86.h b/arch/arch-x86.h
> index 8eea538..69cf60b 100644
> --- a/arch/arch-x86.h
> +++ b/arch/arch-x86.h
> @@ -20,6 +20,12 @@
>  #define __NR_sys_vmsplice      316
>  #endif
>
> +#ifndef __NR_shmget
> +#define __NR_shmget 29
> +#define __NR_shmat 30
> +#define __NR_shmctl 31
> +#endif
> +
>  #define        FIO_HUGE_PAGE           4194304
>
>  #define nop            __asm__ __volatile__("rep;nop": : :"memory")
>
>
>
> On 12 April 2013 13:17, Krishnamurthy, Anush
> <anush.krishnamurthy@intel.com> wrote:
>> Thanks Aaron -
>>
>> I tried doing that and I got stuck at gettime_thread.c which refers to shmctl and shmat etc. it is looking for __NR_shmat and not able to find it. Basically native android source does not have shared memory in any of the headers.
>>
>> Regards
>> Anush Krishnamurthy
>>
>>
>> On Apr 11, 2013, at 7:49 PM, "Aaron Carroll" <xaaronc@gmail.com> wrote:
>>
>>> On 12 April 2013 11:20, Krishnamurthy, Anush
>>> <anush.krishnamurthy@intel.com> wrote:
>>>> Thanks Aaron. I will give this a go. I also wanted to know if you ever tried
>>>> compiling this in the native source. I mean the whole android source.
>>>
>>> I have not.  Others have tried creating Android.mk make files for
>>> this, but IIRC they bypass the fio build system and specify everything
>>> manually. If you know how to do such a thing without creating a
>>> maintenance nightmare, I think that would be well received.
>>>
>>> Thanks,
>>>  -- Aaron
>>>
>>>
>>>>
>>>> Regards
>>>> Anush Krishnamurthy
>>>>
>>>>
>>>> On Apr 11, 2013, at 6:17 PM, "Aaron Carroll" <xaaronc@gmail.com> wrote:
>>>>
>>>> Hi Anush,
>>>>
>>>> On 12 April 2013 03:57, Krishnamurthy, Anush <anush.krishnamurthy@intel.com>
>>>> wrote:
>>>>>
>>>>> I would like to make FIO for Android source. I tried Aaron's post and ran
>>>>> into problems. I also tried making a Android.mk and got into undeclared
>>>>> values for __NR_shm*
>>>>>
>>>>> When I make here is what i get..
>>>>>
>>>>> akrish9@akrish9-ws:~/setup/fio [master] $ make V=1 UNAME=Android
>>>>> cross_prefix=~/android-ndk-r8e/toolchains/x86-4.6/prebuilt/linux-x86_64/bin/i686-linux-android-
>>>>
>>>>
>>>> This is not the problem here, but the preferred way to invoke cross compiles
>>>> is now:
>>>>  make CROSS_COMPILE=/path/to/bin/i686-linux-android-
>>>> Uname is deprecated.
>>>>
>>>> Now, the issue is that you can't run the Android toolchains directly out of
>>>> the NDK, because the lib paths are wrong.  What you need to do is build a
>>>> standalone toolchain with ./build/tools/make-standalone-toolchain.sh from
>>>> the NDK root dir. The script has a bunch of args to specify the versions and
>>>> archs.  That will generate a tar of a standalone toolchain: untar is
>>>> somewhere and point CROSS_COMPILE to there, and it should build.
>>>>
>>>> Except that if you're targeting x86, it doesn't, due to a previously
>>>> reported issue with some inline asm:
>>>>  arch/arch-x86-common.h:9:2: error: inconsistent operand constraints in an
>>>> 'asm'
>>>>
>>>> I'm not sure what's going on there, but I don't speak x86 asm.
>>>>
>>>>
>>>>
>>>> Cheers,
>>>>   -- Aaron
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>> Makefile:12: config-host.mak: No such file or directory
>>>>> Running configure for you...
>>>>> compile test failed
>>>>> Configure failed, check config.log and/or the above output
>>>>>
>>>>>
>>>>>
>>>>> when i try to configure i get this..
>>>>>
>>>>> akrish9@akrish9-ws:~/setup/fio [master] $ ./configure --cpu=i386
>>>>> --extra-cflags="-D__ANDROID__"
>>>>> --cc=/home/akrish9/android-ndk-r8e/toolchains/x86-4.6/prebuilt/linux-x86_64/i686-linux-android/bin/gcc
>>>>> compile test failed
>>>>> Configure failed, check config.log and/or the above output
>>>>> akrish9@akrish9-ws:~/setup/fio [master] $ cat config.log
>>>>> # FIO configure log Thu Apr 11 10:46:48 MST 2013
>>>>> # Configured with: './configure' '--cpu=i386'
>>>>> '--extra-cflags=-D__ANDROID__'
>>>>> '--cc=/home/akrish9/android-ndk-r8e/toolchains/x86-4.6/prebuilt/linux-x86_64/i686-linux-android/bin/gcc'
>>>>> #
>>>>> gcc -D_GNU_SOURCE -include config-host.h -D__ANDROID__ -c -o
>>>>> /tmp/fio-conf--4681-.o /tmp/fio-conf--4681-.c
>>>>> Compiling test case cross
>>>>>
>>>>>
>>>>> Any help here is appreciated.
>>>>>
>>>>> Thanks,
>>>>> Anush Krishnamurthy
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> To unsubscribe from this list: send the line "unsubscribe fio" in
>>>>> the body of a message to majordomo@vger.kernel.org
>>>>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>>>
>>>>

[-- Attachment #2: android-x86.patch --]
[-- Type: application/octet-stream, Size: 1230 bytes --]

diff --git a/arch/arch-x86.h b/arch/arch-x86.h
index 8eea538..69cf60b 100644
--- a/arch/arch-x86.h
+++ b/arch/arch-x86.h
@@ -20,6 +20,12 @@
 #define __NR_sys_vmsplice	316
 #endif
 
+#ifndef __NR_shmget
+#define __NR_shmget 29
+#define __NR_shmat 30
+#define __NR_shmctl 31
+#endif
+
 #define	FIO_HUGE_PAGE		4194304
 
 #define nop		__asm__ __volatile__("rep;nop": : :"memory")
diff --git a/os/os-android.h b/os/os-android.h
index 070aa1a..b844982 100644
--- a/os/os-android.h
+++ b/os/os-android.h
@@ -79,11 +79,6 @@ static inline int shmdt (const void *__shmaddr)
 
 #define SPLICE_DEF_SIZE	(64*1024)
 
-static inline int ioprio_set(int which, int who, int ioprio)
-{
-	return syscall(__NR_ioprio_set, which, who, ioprio);
-}
-
 enum {
 	IOPRIO_CLASS_NONE,
 	IOPRIO_CLASS_RT,
@@ -100,6 +95,18 @@ enum {
 #define IOPRIO_BITS		16
 #define IOPRIO_CLASS_SHIFT	13
 
+static inline int ioprio_set(int which, int who, int ioprio_class, int ioprio)
+{
+	/*
+	 * If no class is set, assume BE
+	 */
+	if (!ioprio_class)
+		ioprio_class = IOPRIO_CLASS_BE;
+
+	ioprio |= ioprio_class << IOPRIO_CLASS_SHIFT;
+	return syscall(__NR_ioprio_set, which, who, ioprio);
+}
+
 #ifndef BLKGETSIZE64
 #define BLKGETSIZE64	_IOR(0x12,114,size_t)
 #endif

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

* Re: Make FIO for Android
  2013-04-12  3:37           ` Aaron Carroll
@ 2013-04-12  5:58             ` Jens Axboe
  2013-04-12  6:10               ` Aaron Carroll
  0 siblings, 1 reply; 24+ messages in thread
From: Jens Axboe @ 2013-04-12  5:58 UTC (permalink / raw)
  To: Aaron Carroll; +Cc: Krishnamurthy, Anush, fio

On Fri, Apr 12 2013, Aaron Carroll wrote:
> Apologies, I'm being a moron today.
> 
> That won't apply cleanly due to minor changes in arch-x86.h, but easy
> to apply by hand. Also the type of ioprio_set() has changed, but
> Android was not updated.
> 
> So, attached is a patch that should get tip back to the state where I
> thought it was -- weird asm errors.

Applied, thanks. Let me see if I can rewrite the cpuid bit, that is the
one that is still causing you problems, right?

-- 
Jens Axboe


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

* Re: Make FIO for Android
  2013-04-12  5:58             ` Jens Axboe
@ 2013-04-12  6:10               ` Aaron Carroll
  2013-04-12  6:18                 ` Jens Axboe
  0 siblings, 1 reply; 24+ messages in thread
From: Aaron Carroll @ 2013-04-12  6:10 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Krishnamurthy, Anush, fio

On 12 April 2013 15:58, Jens Axboe <axboe@kernel.dk> wrote:
> On Fri, Apr 12 2013, Aaron Carroll wrote:
>> Apologies, I'm being a moron today.
>>
>> That won't apply cleanly due to minor changes in arch-x86.h, but easy
>> to apply by hand. Also the type of ioprio_set() has changed, but
>> Android was not updated.
>>
>> So, attached is a patch that should get tip back to the state where I
>> thought it was -- weird asm errors.
>
> Applied, thanks. Let me see if I can rewrite the cpuid bit, that is the
> one that is still causing you problems, right?

Yes, so if I build with:
 make CROSS_COMPILE=~/dev/android-toolchains-r8c/x86-4.6/bin/i686-linux-android-

I get:
    CC libfio.o
libfio.c: In function 'initialize_fio':
arch/arch-x86-common.h:9:2: error: inconsistent operand constraints in an 'asm'
arch/arch-x86-common.h:9:2: error: inconsistent operand constraints in an 'asm'
arch/arch-x86-common.h:9:2: error: inconsistent operand constraints in an 'asm'
arch/arch-x86-common.h:9:2: error: inconsistent operand constraints in an 'asm'
arch/arch-x86-common.h:9:2: error: inconsistent operand constraints in an 'asm'
make: *** [libfio.o] Error 1


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

* Re: Make FIO for Android
  2013-04-12  6:10               ` Aaron Carroll
@ 2013-04-12  6:18                 ` Jens Axboe
  2013-04-12  6:24                   ` Aaron Carroll
  0 siblings, 1 reply; 24+ messages in thread
From: Jens Axboe @ 2013-04-12  6:18 UTC (permalink / raw)
  To: Aaron Carroll; +Cc: Krishnamurthy, Anush, fio

On Fri, Apr 12 2013, Aaron Carroll wrote:
> On 12 April 2013 15:58, Jens Axboe <axboe@kernel.dk> wrote:
> > On Fri, Apr 12 2013, Aaron Carroll wrote:
> >> Apologies, I'm being a moron today.
> >>
> >> That won't apply cleanly due to minor changes in arch-x86.h, but easy
> >> to apply by hand. Also the type of ioprio_set() has changed, but
> >> Android was not updated.
> >>
> >> So, attached is a patch that should get tip back to the state where I
> >> thought it was -- weird asm errors.
> >
> > Applied, thanks. Let me see if I can rewrite the cpuid bit, that is the
> > one that is still causing you problems, right?
> 
> Yes, so if I build with:
>  make CROSS_COMPILE=~/dev/android-toolchains-r8c/x86-4.6/bin/i686-linux-android-

For testing purposes, it'd be handy to have the toolchain. Can I just
download it somewhere?

-- 
Jens Axboe


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

* Re: Make FIO for Android
  2013-04-12  6:18                 ` Jens Axboe
@ 2013-04-12  6:24                   ` Aaron Carroll
  2013-04-12  6:30                     ` Jens Axboe
  0 siblings, 1 reply; 24+ messages in thread
From: Aaron Carroll @ 2013-04-12  6:24 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Krishnamurthy, Anush, fio

On 12 April 2013 16:18, Jens Axboe <axboe@kernel.dk> wrote:
> On Fri, Apr 12 2013, Aaron Carroll wrote:
>> On 12 April 2013 15:58, Jens Axboe <axboe@kernel.dk> wrote:
>> > On Fri, Apr 12 2013, Aaron Carroll wrote:
>> >> Apologies, I'm being a moron today.
>> >>
>> >> That won't apply cleanly due to minor changes in arch-x86.h, but easy
>> >> to apply by hand. Also the type of ioprio_set() has changed, but
>> >> Android was not updated.
>> >>
>> >> So, attached is a patch that should get tip back to the state where I
>> >> thought it was -- weird asm errors.
>> >
>> > Applied, thanks. Let me see if I can rewrite the cpuid bit, that is the
>> > one that is still causing you problems, right?
>>
>> Yes, so if I build with:
>>  make CROSS_COMPILE=~/dev/android-toolchains-r8c/x86-4.6/bin/i686-linux-android-
>
> For testing purposes, it'd be handy to have the toolchain. Can I just
> download it somewhere?

Yep, grab the NDK from here:
  http://developer.android.com/tools/sdk/ndk/index.html

untar, cd to the base dir, and run:
  ./build/tools/make-standalone-toolchain.sh --arch=x86 --platform=android-14

That will generate a bzipped tarball, which is a working standalone
Android/x86 toolchain.


  -- Aaron


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

* Re: Make FIO for Android
  2013-04-12  6:24                   ` Aaron Carroll
@ 2013-04-12  6:30                     ` Jens Axboe
  2013-04-12  6:34                       ` Aaron Carroll
  0 siblings, 1 reply; 24+ messages in thread
From: Jens Axboe @ 2013-04-12  6:30 UTC (permalink / raw)
  To: Aaron Carroll; +Cc: Krishnamurthy, Anush, fio

On Fri, Apr 12 2013, Aaron Carroll wrote:
> On 12 April 2013 16:18, Jens Axboe <axboe@kernel.dk> wrote:
> > On Fri, Apr 12 2013, Aaron Carroll wrote:
> >> On 12 April 2013 15:58, Jens Axboe <axboe@kernel.dk> wrote:
> >> > On Fri, Apr 12 2013, Aaron Carroll wrote:
> >> >> Apologies, I'm being a moron today.
> >> >>
> >> >> That won't apply cleanly due to minor changes in arch-x86.h, but easy
> >> >> to apply by hand. Also the type of ioprio_set() has changed, but
> >> >> Android was not updated.
> >> >>
> >> >> So, attached is a patch that should get tip back to the state where I
> >> >> thought it was -- weird asm errors.
> >> >
> >> > Applied, thanks. Let me see if I can rewrite the cpuid bit, that is the
> >> > one that is still causing you problems, right?
> >>
> >> Yes, so if I build with:
> >>  make CROSS_COMPILE=~/dev/android-toolchains-r8c/x86-4.6/bin/i686-linux-android-
> >
> > For testing purposes, it'd be handy to have the toolchain. Can I just
> > download it somewhere?
> 
> Yep, grab the NDK from here:
>   http://developer.android.com/tools/sdk/ndk/index.html
> 
> untar, cd to the base dir, and run:
>   ./build/tools/make-standalone-toolchain.sh --arch=x86 --platform=android-14
> 
> That will generate a bzipped tarball, which is a working standalone
> Android/x86 toolchain.

Great, thanks! Will see if I can't get that asm android happy too.

-- 
Jens Axboe


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

* Re: Make FIO for Android
  2013-04-12  6:30                     ` Jens Axboe
@ 2013-04-12  6:34                       ` Aaron Carroll
  2013-04-12  6:38                         ` Jens Axboe
  0 siblings, 1 reply; 24+ messages in thread
From: Aaron Carroll @ 2013-04-12  6:34 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Krishnamurthy, Anush, fio

On 12 April 2013 16:30, Jens Axboe <axboe@kernel.dk> wrote:
> Great, thanks! Will see if I can't get that asm android happy too.

Thanks.  Does it make sense to use the GCC builtin __get_cpuid() ?
That seems to build fine both native x86 and Android/x86 here.


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

* Re: Make FIO for Android
  2013-04-12  6:34                       ` Aaron Carroll
@ 2013-04-12  6:38                         ` Jens Axboe
  2013-04-12  6:51                           ` Aaron Carroll
  0 siblings, 1 reply; 24+ messages in thread
From: Jens Axboe @ 2013-04-12  6:38 UTC (permalink / raw)
  To: Aaron Carroll; +Cc: Krishnamurthy, Anush, fio

On Fri, Apr 12 2013, Aaron Carroll wrote:
> On 12 April 2013 16:30, Jens Axboe <axboe@kernel.dk> wrote:
> > Great, thanks! Will see if I can't get that asm android happy too.
> 
> Thanks.  Does it make sense to use the GCC builtin __get_cpuid() ?
> That seems to build fine both native x86 and Android/x86 here.

Depends on when that was introduced. You'd be surprised to find the
ancient distros that some people build it on... But the cpuid stuff
should be basic enough that it isn't a lot of trouble to carry it. At
least when we figure out why the Android NDK doesn't like the current
restraints :-)

-- 
Jens Axboe


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

* Re: Make FIO for Android
  2013-04-12  6:38                         ` Jens Axboe
@ 2013-04-12  6:51                           ` Aaron Carroll
  2013-04-12  7:00                             ` Jens Axboe
  0 siblings, 1 reply; 24+ messages in thread
From: Aaron Carroll @ 2013-04-12  6:51 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Krishnamurthy, Anush, fio

[-- Attachment #1: Type: text/plain, Size: 1087 bytes --]

On 12 April 2013 16:38, Jens Axboe <axboe@kernel.dk> wrote:
> On Fri, Apr 12 2013, Aaron Carroll wrote:
>> On 12 April 2013 16:30, Jens Axboe <axboe@kernel.dk> wrote:
>> > Great, thanks! Will see if I can't get that asm android happy too.
>>
>> Thanks.  Does it make sense to use the GCC builtin __get_cpuid() ?
>> That seems to build fine both native x86 and Android/x86 here.
>
> Depends on when that was introduced. You'd be surprised to find the
> ancient distros that some people build it on... But the cpuid stuff
> should be basic enough that it isn't a lot of trouble to carry it. At
> least when we figure out why the Android NDK doesn't like the current
> restraints :-)

Digging around the GCC headers seems to have helped.  If you change
the constraint on ebx to:
        : "=a" (*eax), "=r" (*ebx), "=c" (*ecx), "=d" (*edx)
then it builds.

The relevant comment from cpuid.h:
  /* %ebx may be the PIC register.  */
which is ifdef'd on __PIC__

Dunno what that means, but it builds with that, plus a very small
Android-specific fix.  Both in attached patch.


      -- Aaron

[-- Attachment #2: android-x86.patch --]
[-- Type: application/octet-stream, Size: 748 bytes --]

diff --git a/arch/arch-x86-common.h b/arch/arch-x86-common.h
index 78fd40c..c8ec8d9 100644
--- a/arch/arch-x86-common.h
+++ b/arch/arch-x86-common.h
@@ -7,7 +7,7 @@ static inline void do_cpuid(unsigned int *eax, unsigned int *ebx,
 			    unsigned int *ecx, unsigned int *edx)
 {
 	asm volatile("cpuid"
-		: "=a" (*eax), "=b" (*ebx), "=c" (*ecx), "=d" (*edx)
+		: "=a" (*eax), "=r" (*ebx), "=c" (*ecx), "=d" (*edx)
 		: "0" (*eax), "2" (*ecx)
 		: "memory");
 }
diff --git a/os/os-android.h b/os/os-android.h
index b844982..df22333 100644
--- a/os/os-android.h
+++ b/os/os-android.h
@@ -13,6 +13,7 @@
 #include <sched.h>
 #include <linux/unistd.h>
 #include <linux/major.h>
+#include <asm/byteorder.h>
 
 #include "binject.h"
 #include "../file.h"

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

* Re: Make FIO for Android
  2013-04-12  6:51                           ` Aaron Carroll
@ 2013-04-12  7:00                             ` Jens Axboe
  2013-04-12  7:10                               ` Aaron Carroll
  0 siblings, 1 reply; 24+ messages in thread
From: Jens Axboe @ 2013-04-12  7:00 UTC (permalink / raw)
  To: Aaron Carroll; +Cc: Krishnamurthy, Anush, fio

On Fri, Apr 12 2013, Aaron Carroll wrote:
> tuff
> > should be basic enough that it isn't a lot of trouble to carry it. At
> > least when we figure out why the Android NDK doesn't like the current
> > restraints :-)
> 
> Digging around the GCC headers seems to have helped.  If you change
> the constraint on ebx to:
>         : "=a" (*eax), "=r" (*ebx), "=c" (*ecx), "=d" (*edx)
> then it builds.

But it doesn't work, we lose the output :-)

> The relevant comment from cpuid.h:
>   /* %ebx may be the PIC register.  */
> which is ifdef'd on __PIC__
> 
> Dunno what that means, but it builds with that, plus a very small
> Android-specific fix.  Both in attached patch.

Patch is garbled?

-- 
Jens Axboe


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

* Re: Make FIO for Android
  2013-04-12  7:00                             ` Jens Axboe
@ 2013-04-12  7:10                               ` Aaron Carroll
  2013-04-12  7:12                                 ` Aaron Carroll
  2013-04-12  7:16                                 ` Jens Axboe
  0 siblings, 2 replies; 24+ messages in thread
From: Aaron Carroll @ 2013-04-12  7:10 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Krishnamurthy, Anush, fio

On 12 April 2013 17:00, Jens Axboe <axboe@kernel.dk> wrote:
> On Fri, Apr 12 2013, Aaron Carroll wrote:
>> tuff
>> > should be basic enough that it isn't a lot of trouble to carry it. At
>> > least when we figure out why the Android NDK doesn't like the current
>> > restraints :-)
>>
>> Digging around the GCC headers seems to have helped.  If you change
>> the constraint on ebx to:
>>         : "=a" (*eax), "=r" (*ebx), "=c" (*ecx), "=d" (*edx)
>> then it builds.
>
> But it doesn't work, we lose the output :-)

Ahh, I missed some important stuff.  The ASM from cpuid.h looks like
this on my Android/x86 GCC:

#define __cpuid(level, a, b, c, d)          \
  __asm__ ("xchg{l}\t{%%}ebx, %1\n\t"           \
       "cpuid\n\t"                  \
       "xchg{l}\t{%%}ebx, %1\n\t"           \
       : "=a" (a), "=r" (b), "=c" (c), "=d" (d) \
       : "0" (level))

Hopefully someone who knows what they're doing can turn that into an fio fix :)

>> The relevant comment from cpuid.h:
>>   /* %ebx may be the PIC register.  */
>> which is ifdef'd on __PIC__
>>
>> Dunno what that means, but it builds with that, plus a very small
>> Android-specific fix.  Both in attached patch.
>
> Patch is garbled?

Ok, so gmail sucks for dev work.  Sorry.  The Android bit follows inline.

diff --git a/os/os-android.h b/os/os-android.h
index b844982..df22333 100644
--- a/os/os-android.h
+++ b/os/os-android.h
@@ -13,6 +13,7 @@
 #include <sched.h>
 #include <linux/unistd.h>
 #include <linux/major.h>
+#include <asm/byteorder.h>

 #include "binject.h"
 #include "../file.h"


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

* Re: Make FIO for Android
  2013-04-12  7:10                               ` Aaron Carroll
@ 2013-04-12  7:12                                 ` Aaron Carroll
  2013-04-12  7:16                                 ` Jens Axboe
  1 sibling, 0 replies; 24+ messages in thread
From: Aaron Carroll @ 2013-04-12  7:12 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Krishnamurthy, Anush, fio

By the way, that patch plus a (working, ideally) cpuid fix gives a
clean build on Android/arm and Android/x86

On 12 April 2013 17:10, Aaron Carroll <xaaronc@gmail.com> wrote:
> On 12 April 2013 17:00, Jens Axboe <axboe@kernel.dk> wrote:
>> On Fri, Apr 12 2013, Aaron Carroll wrote:
>>> tuff
>>> > should be basic enough that it isn't a lot of trouble to carry it. At
>>> > least when we figure out why the Android NDK doesn't like the current
>>> > restraints :-)
>>>
>>> Digging around the GCC headers seems to have helped.  If you change
>>> the constraint on ebx to:
>>>         : "=a" (*eax), "=r" (*ebx), "=c" (*ecx), "=d" (*edx)
>>> then it builds.
>>
>> But it doesn't work, we lose the output :-)
>
> Ahh, I missed some important stuff.  The ASM from cpuid.h looks like
> this on my Android/x86 GCC:
>
> #define __cpuid(level, a, b, c, d)          \
>   __asm__ ("xchg{l}\t{%%}ebx, %1\n\t"           \
>        "cpuid\n\t"                  \
>        "xchg{l}\t{%%}ebx, %1\n\t"           \
>        : "=a" (a), "=r" (b), "=c" (c), "=d" (d) \
>        : "0" (level))
>
> Hopefully someone who knows what they're doing can turn that into an fio fix :)
>
>>> The relevant comment from cpuid.h:
>>>   /* %ebx may be the PIC register.  */
>>> which is ifdef'd on __PIC__
>>>
>>> Dunno what that means, but it builds with that, plus a very small
>>> Android-specific fix.  Both in attached patch.
>>
>> Patch is garbled?
>
> Ok, so gmail sucks for dev work.  Sorry.  The Android bit follows inline.
>
> diff --git a/os/os-android.h b/os/os-android.h
> index b844982..df22333 100644
> --- a/os/os-android.h
> +++ b/os/os-android.h
> @@ -13,6 +13,7 @@
>  #include <sched.h>
>  #include <linux/unistd.h>
>  #include <linux/major.h>
> +#include <asm/byteorder.h>
>
>  #include "binject.h"
>  #include "../file.h"


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

* Re: Make FIO for Android
  2013-04-12  7:10                               ` Aaron Carroll
  2013-04-12  7:12                                 ` Aaron Carroll
@ 2013-04-12  7:16                                 ` Jens Axboe
  2013-04-12  7:22                                   ` Aaron Carroll
  1 sibling, 1 reply; 24+ messages in thread
From: Jens Axboe @ 2013-04-12  7:16 UTC (permalink / raw)
  To: Aaron Carroll; +Cc: Krishnamurthy, Anush, fio

On Fri, Apr 12 2013, Aaron Carroll wrote:
> On 12 April 2013 17:00, Jens Axboe <axboe@kernel.dk> wrote:
> > On Fri, Apr 12 2013, Aaron Carroll wrote:
> >> tuff
> >> > should be basic enough that it isn't a lot of trouble to carry it. At
> >> > least when we figure out why the Android NDK doesn't like the current
> >> > restraints :-)
> >>
> >> Digging around the GCC headers seems to have helped.  If you change
> >> the constraint on ebx to:
> >>         : "=a" (*eax), "=r" (*ebx), "=c" (*ecx), "=d" (*edx)
> >> then it builds.
> >
> > But it doesn't work, we lose the output :-)
> 
> Ahh, I missed some important stuff.  The ASM from cpuid.h looks like
> this on my Android/x86 GCC:
> 
> #define __cpuid(level, a, b, c, d)          \
>   __asm__ ("xchg{l}\t{%%}ebx, %1\n\t"           \
>        "cpuid\n\t"                  \
>        "xchg{l}\t{%%}ebx, %1\n\t"           \
>        : "=a" (a), "=r" (b), "=c" (c), "=d" (d) \
>        : "0" (level))
> 
> Hopefully someone who knows what they're doing can turn that into an fio fix :)

How about this?

diff --git a/arch/arch-x86-common.h b/arch/arch-x86-common.h
index 78fd40c..179572d 100644
--- a/arch/arch-x86-common.h
+++ b/arch/arch-x86-common.h
@@ -3,15 +3,6 @@
 
 #include <string.h>
 
-static inline void do_cpuid(unsigned int *eax, unsigned int *ebx,
-			    unsigned int *ecx, unsigned int *edx)
-{
-	asm volatile("cpuid"
-		: "=a" (*eax), "=b" (*ebx), "=c" (*ecx), "=d" (*edx)
-		: "0" (*eax), "2" (*ecx)
-		: "memory");
-}
-
 static inline void cpuid(unsigned int op,
 			 unsigned int *eax, unsigned int *ebx,
 			 unsigned int *ecx, unsigned int *edx)
diff --git a/arch/arch-x86.h b/arch/arch-x86.h
index 69cf60b..49e64dd 100644
--- a/arch/arch-x86.h
+++ b/arch/arch-x86.h
@@ -1,6 +1,15 @@
 #ifndef ARCH_X86_H
 #define ARCH_X86_H
 
+static inline void do_cpuid(unsigned int *eax, unsigned int *ebx,
+			    unsigned int *ecx, unsigned int *edx)
+{
+	asm volatile("xchgl %%ebx, %1\ncpuid\nxchgl %%ebx, %1"
+		: "=a" (*eax), "=r" (*ebx), "=c" (*ecx), "=d" (*edx)
+		: "0" (*eax)
+		: "memory");
+}
+
 #include "arch-x86-common.h"
 
 #define FIO_ARCH	(arch_i386)
diff --git a/arch/arch-x86_64.h b/arch/arch-x86_64.h
index cea0451..8bdf01e 100644
--- a/arch/arch-x86_64.h
+++ b/arch/arch-x86_64.h
@@ -1,6 +1,15 @@
 #ifndef ARCH_X86_64_h
 #define ARCH_X86_64_h
 
+static inline void do_cpuid(unsigned int *eax, unsigned int *ebx,
+			    unsigned int *ecx, unsigned int *edx)
+{
+	asm volatile("cpuid"
+		: "=a" (*eax), "=b" (*ebx), "=r" (*ecx), "=d" (*edx)
+		: "0" (*eax), "2" (*ecx)
+		: "memory");
+}
+
 #include "arch-x86-common.h"
 
 #define FIO_ARCH	(arch_x86_64)

> > Patch is garbled?
> 
> Ok, so gmail sucks for dev work.  Sorry.  The Android bit follows inline.
> 
> diff --git a/os/os-android.h b/os/os-android.h
> index b844982..df22333 100644
> --- a/os/os-android.h
> +++ b/os/os-android.h
> @@ -13,6 +13,7 @@
>  #include <sched.h>
>  #include <linux/unistd.h>
>  #include <linux/major.h>
> +#include <asm/byteorder.h>
> 
>  #include "binject.h"
>  #include "../file.h"

Applied! That just leaves the cgroup problems:

cgroup.c: In function 'find_cgroup_mnt':
cgroup.c:29:2: warning: implicit declaration of function 'setmntent'
[-Wimplicit-function-declaration]
cgroup.c:29:4: warning: assignment makes pointer from integer without a
cast [enabled by default]
cgroup.c:35:2: warning: implicit declaration of function 'getmntent_r'
[-Wimplicit-function-declaration]
cgroup.c:35:14: warning: assignment makes pointer from integer without a
cast [enabled by default]
cgroup.c:46:2: warning: implicit declaration of function 'endmntent'
[-Wimplicit-function-declaration]
cgroup.c: At top level:
cgroup.c:78:6: error: redefinition of 'cgroup_kill'
cgroup.h:24:20: note: previous definition of 'cgroup_kill' was here
cgroup.c:147:5: error: redefinition of 'cgroup_setup'
cgroup.h:13:19: note: previous definition of 'cgroup_setup' was here
cgroup.c:189:6: error: redefinition of 'cgroup_shutdown'
cgroup.h:20:20: note: previous definition of 'cgroup_shutdown' was here
make: *** [cgroup.o] Error 1

-- 
Jens Axboe


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

* Re: Make FIO for Android
  2013-04-12  7:16                                 ` Jens Axboe
@ 2013-04-12  7:22                                   ` Aaron Carroll
  2013-04-12  8:04                                     ` Jens Axboe
  0 siblings, 1 reply; 24+ messages in thread
From: Aaron Carroll @ 2013-04-12  7:22 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Krishnamurthy, Anush, fio

On 12 April 2013 17:16, Jens Axboe <axboe@kernel.dk> wrote:
> Applied! That just leaves the cgroup problems:
>
> cgroup.c: In function 'find_cgroup_mnt':
> cgroup.c:29:2: warning: implicit declaration of function 'setmntent'
> [-Wimplicit-function-declaration]
> cgroup.c:29:4: warning: assignment makes pointer from integer without a
> cast [enabled by default]
> cgroup.c:35:2: warning: implicit declaration of function 'getmntent_r'
> [-Wimplicit-function-declaration]
> cgroup.c:35:14: warning: assignment makes pointer from integer without a
> cast [enabled by default]
> cgroup.c:46:2: warning: implicit declaration of function 'endmntent'
> [-Wimplicit-function-declaration]
> cgroup.c: At top level:
> cgroup.c:78:6: error: redefinition of 'cgroup_kill'
> cgroup.h:24:20: note: previous definition of 'cgroup_kill' was here
> cgroup.c:147:5: error: redefinition of 'cgroup_setup'
> cgroup.h:13:19: note: previous definition of 'cgroup_setup' was here
> cgroup.c:189:6: error: redefinition of 'cgroup_shutdown'
> cgroup.h:20:20: note: previous definition of 'cgroup_shutdown' was here
> make: *** [cgroup.o] Error 1

What compiler generates that?  As I said I'm now getting clean builds
for Android.


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

* Re: Make FIO for Android
  2013-04-12  7:22                                   ` Aaron Carroll
@ 2013-04-12  8:04                                     ` Jens Axboe
  2013-04-13  3:47                                       ` Aaron Carroll
  0 siblings, 1 reply; 24+ messages in thread
From: Jens Axboe @ 2013-04-12  8:04 UTC (permalink / raw)
  To: Aaron Carroll; +Cc: Krishnamurthy, Anush, fio

On Fri, Apr 12 2013, Aaron Carroll wrote:
> s pointer from integer without a
> > cast [enabled by default]
> > cgroup.c:46:2: warning: implicit declaration of function 'endmntent'
> > [-Wimplicit-function-declaration]
> > cgroup.c: At top level:
> > cgroup.c:78:6: error: redefinition of 'cgroup_kill'
> > cgroup.h:24:20: note: previous definition of 'cgroup_kill' was here
> > cgroup.c:147:5: error: redefinition of 'cgroup_setup'
> > cgroup.h:13:19: note: previous definition of 'cgroup_setup' was here
> > cgroup.c:189:6: error: redefinition of 'cgroup_shutdown'
> > cgroup.h:20:20: note: previous definition of 'cgroup_shutdown' was here
> > make: *** [cgroup.o] Error 1
> 
> What compiler generates that?  As I said I'm now getting clean builds
> for Android.

I grabbed the 32-bit NDK from the page you referenced.

-- 
Jens Axboe


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

* Re: Make FIO for Android
  2013-04-12  8:04                                     ` Jens Axboe
@ 2013-04-13  3:47                                       ` Aaron Carroll
  2013-04-13 18:05                                         ` Jens Axboe
  0 siblings, 1 reply; 24+ messages in thread
From: Aaron Carroll @ 2013-04-13  3:47 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Krishnamurthy, Anush, fio

On 12 April 2013 18:04, Jens Axboe <axboe@kernel.dk> wrote:
> On Fri, Apr 12 2013, Aaron Carroll wrote:
>> s pointer from integer without a
>> > cast [enabled by default]
>> > cgroup.c:46:2: warning: implicit declaration of function 'endmntent'
>> > [-Wimplicit-function-declaration]
>> > cgroup.c: At top level:
>> > cgroup.c:78:6: error: redefinition of 'cgroup_kill'
>> > cgroup.h:24:20: note: previous definition of 'cgroup_kill' was here
>> > cgroup.c:147:5: error: redefinition of 'cgroup_setup'
>> > cgroup.h:13:19: note: previous definition of 'cgroup_setup' was here
>> > cgroup.c:189:6: error: redefinition of 'cgroup_shutdown'
>> > cgroup.h:20:20: note: previous definition of 'cgroup_shutdown' was here
>> > make: *** [cgroup.o] Error 1
>>
>> What compiler generates that?  As I said I'm now getting clean builds
>> for Android.
>
> I grabbed the 32-bit NDK from the page you referenced.

I'm using that exact NDK and don't get that error. Weird.


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

* Re: Make FIO for Android
  2013-04-13  3:47                                       ` Aaron Carroll
@ 2013-04-13 18:05                                         ` Jens Axboe
  2013-04-14  5:28                                           ` Aaron Carroll
  0 siblings, 1 reply; 24+ messages in thread
From: Jens Axboe @ 2013-04-13 18:05 UTC (permalink / raw)
  To: Aaron Carroll; +Cc: Krishnamurthy, Anush, fio

On Sat, Apr 13 2013, Aaron Carroll wrote:
> On 12 April 2013 18:04, Jens Axboe <axboe@kernel.dk> wrote:
> > On Fri, Apr 12 2013, Aaron Carroll wrote:
> >> s pointer from integer without a
> >> > cast [enabled by default]
> >> > cgroup.c:46:2: warning: implicit declaration of function 'endmntent'
> >> > [-Wimplicit-function-declaration]
> >> > cgroup.c: At top level:
> >> > cgroup.c:78:6: error: redefinition of 'cgroup_kill'
> >> > cgroup.h:24:20: note: previous definition of 'cgroup_kill' was here
> >> > cgroup.c:147:5: error: redefinition of 'cgroup_setup'
> >> > cgroup.h:13:19: note: previous definition of 'cgroup_setup' was here
> >> > cgroup.c:189:6: error: redefinition of 'cgroup_shutdown'
> >> > cgroup.h:20:20: note: previous definition of 'cgroup_shutdown' was here
> >> > make: *** [cgroup.o] Error 1
> >>
> >> What compiler generates that?  As I said I'm now getting clean builds
> >> for Android.
> >
> > I grabbed the 32-bit NDK from the page you referenced.
> 
> I'm using that exact NDK and don't get that error. Weird.

What about the mntent related ones? Looking at mntent.h in
sysroot/usr/include/, it contains:

----

#ifndef _MNTENT_H_
#define _MNTENT_H_

#include <stdio.h>

#define MNTTYPE_IGNORE "ignore"

struct mntent
{
    char* mnt_fsname;
    char* mnt_dir;
    char* mnt_type;
    char* mnt_opts;
    int mnt_freq;
    int mnt_passno;
};


__BEGIN_DECLS


struct mntent* getmntent(FILE*);

__END_DECLS

#endif

----

So bits missing... The cgroup stuff I didn't look at. You are using the
32-bit variant as well, not the 64-bit one?

-- 
Jens Axboe


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

* Re: Make FIO for Android
  2013-04-13 18:05                                         ` Jens Axboe
@ 2013-04-14  5:28                                           ` Aaron Carroll
  2013-04-14  8:13                                             ` Jens Axboe
  0 siblings, 1 reply; 24+ messages in thread
From: Aaron Carroll @ 2013-04-14  5:28 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Krishnamurthy, Anush, fio

On 14 April 2013 04:05, Jens Axboe <axboe@kernel.dk> wrote:
> On Sat, Apr 13 2013, Aaron Carroll wrote:
>> On 12 April 2013 18:04, Jens Axboe <axboe@kernel.dk> wrote:
>> > On Fri, Apr 12 2013, Aaron Carroll wrote:
>> >> s pointer from integer without a
>> >> > cast [enabled by default]
>> >> > cgroup.c:46:2: warning: implicit declaration of function 'endmntent'
>> >> > [-Wimplicit-function-declaration]
>> >> > cgroup.c: At top level:
>> >> > cgroup.c:78:6: error: redefinition of 'cgroup_kill'
>> >> > cgroup.h:24:20: note: previous definition of 'cgroup_kill' was here
>> >> > cgroup.c:147:5: error: redefinition of 'cgroup_setup'
>> >> > cgroup.h:13:19: note: previous definition of 'cgroup_setup' was here
>> >> > cgroup.c:189:6: error: redefinition of 'cgroup_shutdown'
>> >> > cgroup.h:20:20: note: previous definition of 'cgroup_shutdown' was here
>> >> > make: *** [cgroup.o] Error 1
>> >>
>> >> What compiler generates that?  As I said I'm now getting clean builds
>> >> for Android.
>> >
>> > I grabbed the 32-bit NDK from the page you referenced.
>>
>> I'm using that exact NDK and don't get that error. Weird.
>
> What about the mntent related ones? Looking at mntent.h in
> sysroot/usr/include/, it contains:
> [..]
> So bits missing... The cgroup stuff I didn't look at. You are using the
> 32-bit variant as well, not the 64-bit one?

Hi Jens,

Yes, 32-bit NDK generated with arch=x86 platform=android-14.
Something seems weird with your build... cgroup.c should not be
compiled at all for Android.

$ git pull
$ make clean
$ make CROSS_COMPILE=~/dev/android-toolchains-r8e/x86-4.6/bin/i686-linux-android-
Makefile:12: config-host.mak: No such file or directory
FIO_VERSION = fio-2.0.15-460-ge903
Running configure for you...
Operating system              Android
CPU                           i386
Big endian                    no
Compiler
/home/aaronc/dev/android-toolchains-r8e/x86-4.6/bin/i686-linux-android-gcc
Cross compile                 yes
 ...
    CC fio.o
    LINK fio
$

No warnings or errors.



  -- Aaron


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

* Re: Make FIO for Android
  2013-04-14  5:28                                           ` Aaron Carroll
@ 2013-04-14  8:13                                             ` Jens Axboe
  0 siblings, 0 replies; 24+ messages in thread
From: Jens Axboe @ 2013-04-14  8:13 UTC (permalink / raw)
  To: Aaron Carroll; +Cc: Krishnamurthy, Anush, fio

On Sun, Apr 14 2013, Aaron Carroll wrote:
> On 14 April 2013 04:05, Jens Axboe <axboe@kernel.dk> wrote:
> > On Sat, Apr 13 2013, Aaron Carroll wrote:
> >> On 12 April 2013 18:04, Jens Axboe <axboe@kernel.dk> wrote:
> >> > On Fri, Apr 12 2013, Aaron Carroll wrote:
> >> >> s pointer from integer without a
> >> >> > cast [enabled by default]
> >> >> > cgroup.c:46:2: warning: implicit declaration of function 'endmntent'
> >> >> > [-Wimplicit-function-declaration]
> >> >> > cgroup.c: At top level:
> >> >> > cgroup.c:78:6: error: redefinition of 'cgroup_kill'
> >> >> > cgroup.h:24:20: note: previous definition of 'cgroup_kill' was here
> >> >> > cgroup.c:147:5: error: redefinition of 'cgroup_setup'
> >> >> > cgroup.h:13:19: note: previous definition of 'cgroup_setup' was here
> >> >> > cgroup.c:189:6: error: redefinition of 'cgroup_shutdown'
> >> >> > cgroup.h:20:20: note: previous definition of 'cgroup_shutdown' was here
> >> >> > make: *** [cgroup.o] Error 1
> >> >>
> >> >> What compiler generates that?  As I said I'm now getting clean builds
> >> >> for Android.
> >> >
> >> > I grabbed the 32-bit NDK from the page you referenced.
> >>
> >> I'm using that exact NDK and don't get that error. Weird.
> >
> > What about the mntent related ones? Looking at mntent.h in
> > sysroot/usr/include/, it contains:
> > [..]
> > So bits missing... The cgroup stuff I didn't look at. You are using the
> > 32-bit variant as well, not the 64-bit one?
> 
> Hi Jens,
> 
> Yes, 32-bit NDK generated with arch=x86 platform=android-14.
> Something seems weird with your build... cgroup.c should not be
> compiled at all for Android.
> 
> $ git pull
> $ make clean
> $ make CROSS_COMPILE=~/dev/android-toolchains-r8e/x86-4.6/bin/i686-linux-android-

That works for me. Perhaps a small paragraph in the README under the
Building section mentioning how to build for android would be a good
idea?

-- 
Jens Axboe


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

end of thread, other threads:[~2013-04-14  8:13 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-11 17:57 Make FIO for Android Krishnamurthy, Anush
     [not found] ` <CAKCZDgnM85AcwD6Ss5YWNjXwY-OE7QFQh22nFdEFHkta_N0hRA@mail.gmail.com>
2013-04-12  1:20   ` Krishnamurthy, Anush
2013-04-12  2:48     ` Aaron Carroll
2013-04-12  3:17       ` Krishnamurthy, Anush
2013-04-12  3:28         ` Aaron Carroll
2013-04-12  3:37           ` Aaron Carroll
2013-04-12  5:58             ` Jens Axboe
2013-04-12  6:10               ` Aaron Carroll
2013-04-12  6:18                 ` Jens Axboe
2013-04-12  6:24                   ` Aaron Carroll
2013-04-12  6:30                     ` Jens Axboe
2013-04-12  6:34                       ` Aaron Carroll
2013-04-12  6:38                         ` Jens Axboe
2013-04-12  6:51                           ` Aaron Carroll
2013-04-12  7:00                             ` Jens Axboe
2013-04-12  7:10                               ` Aaron Carroll
2013-04-12  7:12                                 ` Aaron Carroll
2013-04-12  7:16                                 ` Jens Axboe
2013-04-12  7:22                                   ` Aaron Carroll
2013-04-12  8:04                                     ` Jens Axboe
2013-04-13  3:47                                       ` Aaron Carroll
2013-04-13 18:05                                         ` Jens Axboe
2013-04-14  5:28                                           ` Aaron Carroll
2013-04-14  8:13                                             ` Jens Axboe

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.