Patchwork [RFC,v2,4/4] configure: add CONFIG_QEMU_LDST_OPTIMIZATION for TCG qemu_ld/st optimization

login
register
mail settings
Submitter YeongKyoon Lee
Date July 5, 2012, 1:23 p.m.
Message ID <1341494619-4714-5-git-send-email-yeongkyoon.lee@samsung.com>
Download mbox | patch
Permalink /patch/169167/
State New
Headers show

Comments

YeongKyoon Lee - July 5, 2012, 1:23 p.m.
Add an option "--enable-ldst-optimization" to enable CONFIG_QEMU_LDST_OPTIMIZATION macro for TCG qemu_ld/st optimization. It only works with CONFIG_SOFTMMU and doesn't work with CONFIG_TCG_PASS_AREG0.

Signed-off-by: Yeongkyoon Lee <yeongkyoon.lee@samsung.com>
---
 configure |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
Andreas Färber - July 5, 2012, 1:55 p.m.
Am 05.07.2012 15:23, schrieb Yeongkyoon Lee:
> Add an option "--enable-ldst-optimization" to enable CONFIG_QEMU_LDST_OPTIMIZATION macro for TCG qemu_ld/st optimization. It only works with CONFIG_SOFTMMU and doesn't work with CONFIG_TCG_PASS_AREG0.
> 
> Signed-off-by: Yeongkyoon Lee <yeongkyoon.lee@samsung.com>
> ---
>  configure |   15 +++++++++++++++
>  1 files changed, 15 insertions(+), 0 deletions(-)
> 
> diff --git a/configure b/configure
> index 9f071b7..2b364cc 100755
> --- a/configure
> +++ b/configure
[...]
> @@ -3463,6 +3466,11 @@ echo "EXESUF=$EXESUF" >> $config_host_mak
>  echo "LIBS_QGA+=$libs_qga" >> $config_host_mak
>  echo "POD2MAN=$POD2MAN" >> $config_host_mak
>  
> +if [ "$ldst_optimization" = "yes" -a "$cpu" != "i386" -a "$cpu" != "x86_64" ] ; then
> +  echo "ERROR: qemu_ld/st optimization is only available on i386 or x86_64 hosts"
> +  exit 1
> +fi
[snip]

I assume that Samsung is interested in optimizing the Exynos emulation.
I think there was already a patchset posted converting target-arm to
CONFIG_PASS_TCG_AREG0, only with some slowdowns to be investigated...
What is the obstacle for supporting AREG0 mode in your optimization?

Regards,
Andreas

> +
>  # generate list of library paths for linker script
>  
>  $ld --verbose -v 2> /dev/null | grep SEARCH_DIR > ${config_host_ld}
> @@ -3696,11 +3704,18 @@ fi
>  symlink "$source_path/Makefile.target" "$target_dir/Makefile"
>  
>  
> +target_ldst_optimization="$ldst_optimization"
> +
>  case "$target_arch2" in
>    alpha | sparc* | xtensa* | ppc*)
>      echo "CONFIG_TCG_PASS_AREG0=y" >> $config_target_mak
> +    # qemu_ld/st optimization is not available with CONFIG_TCG_PASS_AREG0
> +    target_ldst_optimization="no"
>    ;;
>  esac
> +if [ "$target_ldst_optimization" = "yes" -a "$target_softmmu" = "yes" ] ; then
> +    echo "CONFIG_QEMU_LDST_OPTIMIZATION=y" >> $config_target_mak
> +fi
>  
>  echo "TARGET_SHORT_ALIGNMENT=$target_short_alignment" >> $config_target_mak
>  echo "TARGET_INT_ALIGNMENT=$target_int_alignment" >> $config_target_mak
Peter Maydell - July 5, 2012, 2:06 p.m.
On 5 July 2012 14:23, Yeongkyoon Lee <yeongkyoon.lee@samsung.com> wrote:
> Add an option "--enable-ldst-optimization" to enable CONFIG_QEMU_LDST_OPTIMIZATION macro for TCG qemu_ld/st optimization. It only works with CONFIG_SOFTMMU and doesn't work with CONFIG_TCG_PASS_AREG0.

This shouldn't be a user settable config option -- we should
just identify what the optimal setting is for the guest/target
combination and use it.

>  case "$target_arch2" in
>    alpha | sparc* | xtensa* | ppc*)
>      echo "CONFIG_TCG_PASS_AREG0=y" >> $config_target_mak
> +    # qemu_ld/st optimization is not available with CONFIG_TCG_PASS_AREG0
> +    target_ldst_optimization="no"

PASS_AREG0 is the way of the future -- you need to fix the ldst
optimization to work with it.

-- PMM
Laurent Desnogues - July 5, 2012, 2:26 p.m.
On Thu, Jul 5, 2012 at 4:06 PM, Peter Maydell <peter.maydell@linaro.org> wrote:
[...]
>>  case "$target_arch2" in
>>    alpha | sparc* | xtensa* | ppc*)
>>      echo "CONFIG_TCG_PASS_AREG0=y" >> $config_target_mak
>> +    # qemu_ld/st optimization is not available with CONFIG_TCG_PASS_AREG0
>> +    target_ldst_optimization="no"
>
> PASS_AREG0 is the way of the future -- you need to fix the ldst
> optimization to work with it.

Agreed.  But what's the point of speeding up on one side and
losing speed on the other side?  AREG0 slowdown would be
acceptable if the ARM target was using less helpers, until this
happens I don't think it is a good idea to push AREG0,
hence I'm not sure it is a prerequisite that Yeongkyoon Lee's
patch supports it.  By the way, it's also a good reason to have
CONFIG_QEMU_LDST_OPTIMIZATION, which you
commented on in patch 3.

Basically, and in my humble opinion, this is not a good
enough reason to reject the patch :-)  Of course the support
should be added as soon as possible once the rest has
been discussed.


Laurent
Evgeny Voevodin - July 6, 2012, 3:13 a.m.
On 05.07.2012 17:55, Andreas Färber wrote:
> Am 05.07.2012 15:23, schrieb Yeongkyoon Lee:
>> Add an option "--enable-ldst-optimization" to enable CONFIG_QEMU_LDST_OPTIMIZATION macro for TCG qemu_ld/st optimization. It only works with CONFIG_SOFTMMU and doesn't work with CONFIG_TCG_PASS_AREG0.
>>
>> Signed-off-by: Yeongkyoon Lee <yeongkyoon.lee@samsung.com>
>> ---
>>   configure |   15 +++++++++++++++
>>   1 files changed, 15 insertions(+), 0 deletions(-)
>>
>> diff --git a/configure b/configure
>> index 9f071b7..2b364cc 100755
>> --- a/configure
>> +++ b/configure
> [...]
>> @@ -3463,6 +3466,11 @@ echo "EXESUF=$EXESUF" >> $config_host_mak
>>   echo "LIBS_QGA+=$libs_qga" >> $config_host_mak
>>   echo "POD2MAN=$POD2MAN" >> $config_host_mak
>>   
>> +if [ "$ldst_optimization" = "yes" -a "$cpu" != "i386" -a "$cpu" != "x86_64" ] ; then
>> +  echo "ERROR: qemu_ld/st optimization is only available on i386 or x86_64 hosts"
>> +  exit 1
>> +fi
> [snip]
>
> I assume that Samsung is interested in optimizing the Exynos emulation.

Nope ) Originally it's from x86 Tizen emulator )

> I think there was already a patchset posted converting target-arm to
> CONFIG_PASS_TCG_AREG0, only with some slowdowns to be investigated...
> What is the obstacle for supporting AREG0 mode in your optimization?
>
> Regards,
> Andreas
>
>> +
>>   # generate list of library paths for linker script
>>   
>>   $ld --verbose -v 2> /dev/null | grep SEARCH_DIR > ${config_host_ld}
>> @@ -3696,11 +3704,18 @@ fi
>>   symlink "$source_path/Makefile.target" "$target_dir/Makefile"
>>   
>>   
>> +target_ldst_optimization="$ldst_optimization"
>> +
>>   case "$target_arch2" in
>>     alpha | sparc* | xtensa* | ppc*)
>>       echo "CONFIG_TCG_PASS_AREG0=y" >> $config_target_mak
>> +    # qemu_ld/st optimization is not available with CONFIG_TCG_PASS_AREG0
>> +    target_ldst_optimization="no"
>>     ;;
>>   esac
>> +if [ "$target_ldst_optimization" = "yes" -a "$target_softmmu" = "yes" ] ; then
>> +    echo "CONFIG_QEMU_LDST_OPTIMIZATION=y" >> $config_target_mak
>> +fi
>>   
>>   echo "TARGET_SHORT_ALIGNMENT=$target_short_alignment" >> $config_target_mak
>>   echo "TARGET_INT_ALIGNMENT=$target_int_alignment" >> $config_target_mak
YeongKyoon Lee - July 6, 2012, 11:43 a.m.
On 2012년 07월 05일 23:06, Peter Maydell wrote:
> On 5 July 2012 14:23, Yeongkyoon Lee <yeongkyoon.lee@samsung.com> wrote:
>> Add an option "--enable-ldst-optimization" to enable CONFIG_QEMU_LDST_OPTIMIZATION macro for TCG qemu_ld/st optimization. It only works with CONFIG_SOFTMMU and doesn't work with CONFIG_TCG_PASS_AREG0.
> This shouldn't be a user settable config option -- we should
> just identify what the optimal setting is for the guest/target
> combination and use it.

It looks better remove the option after it is confirmed that it works 
well for all the guest target architectures.

>>   case "$target_arch2" in
>>     alpha | sparc* | xtensa* | ppc*)
>>       echo "CONFIG_TCG_PASS_AREG0=y" >> $config_target_mak
>> +    # qemu_ld/st optimization is not available with CONFIG_TCG_PASS_AREG0
>> +    target_ldst_optimization="no"
> PASS_AREG0 is the way of the future -- you need to fix the ldst
> optimization to work with it.

There are two reasons to prevent working with PASS_AREG0.
The first one is I'm not sure the history and future PASS_AREG0 and have 
not tested PASS_AREG0 which is only enabled for some guest architectures..
The second is a problem of too many conditional paths in sources.
I think it is not late to combine the ldst optimization with PASS_AREG0 
after the ldst optimization agreed as default.
Blue Swirl - July 7, 2012, 7:51 a.m.
On Fri, Jul 6, 2012 at 11:43 AM, Yeongkyoon Lee
<yeongkyoon.lee@samsung.com> wrote:
> On 2012년 07월 05일 23:06, Peter Maydell wrote:
>>
>> On 5 July 2012 14:23, Yeongkyoon Lee <yeongkyoon.lee@samsung.com> wrote:
>>>
>>> Add an option "--enable-ldst-optimization" to enable
>>> CONFIG_QEMU_LDST_OPTIMIZATION macro for TCG qemu_ld/st optimization. It only
>>> works with CONFIG_SOFTMMU and doesn't work with CONFIG_TCG_PASS_AREG0.
>>
>> This shouldn't be a user settable config option -- we should
>> just identify what the optimal setting is for the guest/target
>> combination and use it.
>
>
> It looks better remove the option after it is confirmed that it works well
> for all the guest target architectures.
>
>
>>>   case "$target_arch2" in
>>>     alpha | sparc* | xtensa* | ppc*)
>>>       echo "CONFIG_TCG_PASS_AREG0=y" >> $config_target_mak
>>> +    # qemu_ld/st optimization is not available with
>>> CONFIG_TCG_PASS_AREG0
>>> +    target_ldst_optimization="no"
>>
>> PASS_AREG0 is the way of the future -- you need to fix the ldst
>> optimization to work with it.
>
>
> There are two reasons to prevent working with PASS_AREG0.
> The first one is I'm not sure the history and future PASS_AREG0 and have not
> tested PASS_AREG0 which is only enabled for some guest architectures..
> The second is a problem of too many conditional paths in sources.
> I think it is not late to combine the ldst optimization with PASS_AREG0
> after the ldst optimization agreed as default.

It looks like you already support PASS_AREG0, the slow path code just
passes AREG0 as the first call argument.
YeongKyoon Lee - July 8, 2012, 8:35 a.m.
On 2012년 07월 07일 16:51, Blue Swirl wrote:
> On Fri, Jul 6, 2012 at 11:43 AM, Yeongkyoon Lee
> <yeongkyoon.lee@samsung.com> wrote:
>> On 2012년 07월 05일 23:06, Peter Maydell wrote:
>>> On 5 July 2012 14:23, Yeongkyoon Lee <yeongkyoon.lee@samsung.com> wrote:
>>>> Add an option "--enable-ldst-optimization" to enable
>>>> CONFIG_QEMU_LDST_OPTIMIZATION macro for TCG qemu_ld/st optimization. It only
>>>> works with CONFIG_SOFTMMU and doesn't work with CONFIG_TCG_PASS_AREG0.
>>> This shouldn't be a user settable config option -- we should
>>> just identify what the optimal setting is for the guest/target
>>> combination and use it.
>>
>> It looks better remove the option after it is confirmed that it works well
>> for all the guest target architectures.
>>
>>
>>>>    case "$target_arch2" in
>>>>      alpha | sparc* | xtensa* | ppc*)
>>>>        echo "CONFIG_TCG_PASS_AREG0=y" >> $config_target_mak
>>>> +    # qemu_ld/st optimization is not available with
>>>> CONFIG_TCG_PASS_AREG0
>>>> +    target_ldst_optimization="no"
>>> PASS_AREG0 is the way of the future -- you need to fix the ldst
>>> optimization to work with it.
>>
>> There are two reasons to prevent working with PASS_AREG0.
>> The first one is I'm not sure the history and future PASS_AREG0 and have not
>> tested PASS_AREG0 which is only enabled for some guest architectures..
>> The second is a problem of too many conditional paths in sources.
>> I think it is not late to combine the ldst optimization with PASS_AREG0
>> after the ldst optimization agreed as default.
> It looks like you already support PASS_AREG0, the slow path code just
> passes AREG0 as the first call argument.
>
>

The code in slow path is currently dead code just for future PASS_AREG0 
porting.
It needs some porting for actual working.

Patch

diff --git a/configure b/configure
index 9f071b7..2b364cc 100755
--- a/configure
+++ b/configure
@@ -171,6 +171,7 @@  bsd="no"
 linux="no"
 solaris="no"
 profiler="no"
+ldst_optimization="no"
 cocoa="no"
 softmmu="yes"
 linux_user="no"
@@ -714,6 +715,8 @@  for opt do
   ;;
   --enable-profiler) profiler="yes"
   ;;
+  --enable-ldst-optimization) ldst_optimization="yes"
+  ;;
   --disable-cocoa) cocoa="no"
   ;;
   --enable-cocoa)
@@ -3463,6 +3466,11 @@  echo "EXESUF=$EXESUF" >> $config_host_mak
 echo "LIBS_QGA+=$libs_qga" >> $config_host_mak
 echo "POD2MAN=$POD2MAN" >> $config_host_mak
 
+if [ "$ldst_optimization" = "yes" -a "$cpu" != "i386" -a "$cpu" != "x86_64" ] ; then
+  echo "ERROR: qemu_ld/st optimization is only available on i386 or x86_64 hosts"
+  exit 1
+fi
+
 # generate list of library paths for linker script
 
 $ld --verbose -v 2> /dev/null | grep SEARCH_DIR > ${config_host_ld}
@@ -3696,11 +3704,18 @@  fi
 symlink "$source_path/Makefile.target" "$target_dir/Makefile"
 
 
+target_ldst_optimization="$ldst_optimization"
+
 case "$target_arch2" in
   alpha | sparc* | xtensa* | ppc*)
     echo "CONFIG_TCG_PASS_AREG0=y" >> $config_target_mak
+    # qemu_ld/st optimization is not available with CONFIG_TCG_PASS_AREG0
+    target_ldst_optimization="no"
   ;;
 esac
+if [ "$target_ldst_optimization" = "yes" -a "$target_softmmu" = "yes" ] ; then
+    echo "CONFIG_QEMU_LDST_OPTIMIZATION=y" >> $config_target_mak
+fi
 
 echo "TARGET_SHORT_ALIGNMENT=$target_short_alignment" >> $config_target_mak
 echo "TARGET_INT_ALIGNMENT=$target_int_alignment" >> $config_target_mak