diff mbox series

[v1,3/4] accel/tcg: only USE_STATIC_CODE_GEN_BUFFER on 32 bit hosts

Message ID 20200226181020.19592-4-alex.bennee@linaro.org
State Superseded
Headers show
Series Fix codegen translation cache size | expand

Commit Message

Alex Bennée Feb. 26, 2020, 6:10 p.m. UTC
There is no particular reason to use a static codegen buffer on 64 bit
hosts as we have address space to burn. Allow the common CONFIG_USER
case to use the mmap'ed buffers like SoftMMU.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

---
 accel/tcg/translate-all.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

-- 
2.20.1

Comments

Richard Henderson Feb. 26, 2020, 10:50 p.m. UTC | #1
On 2/26/20 10:10 AM, Alex Bennée wrote:
> There is no particular reason to use a static codegen buffer on 64 bit

> hosts as we have address space to burn. Allow the common CONFIG_USER

> case to use the mmap'ed buffers like SoftMMU.

> 

> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

> ---

>  accel/tcg/translate-all.c | 11 ++++++-----

>  1 file changed, 6 insertions(+), 5 deletions(-)


Reviewed-by: Richard Henderson <richard.henderson@linaro.org>



r~
Philippe Mathieu-Daudé Feb. 27, 2020, 10:55 a.m. UTC | #2
On 2/26/20 7:10 PM, Alex Bennée wrote:
> There is no particular reason to use a static codegen buffer on 64 bit

> hosts as we have address space to burn. Allow the common CONFIG_USER

> case to use the mmap'ed buffers like SoftMMU.

> 

> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

> ---

>   accel/tcg/translate-all.c | 11 ++++++-----

>   1 file changed, 6 insertions(+), 5 deletions(-)

> 

> diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c

> index 5b66af783b5..4ce5d1b3931 100644

> --- a/accel/tcg/translate-all.c

> +++ b/accel/tcg/translate-all.c

> @@ -892,11 +892,12 @@ static void page_lock_pair(PageDesc **ret_p1, tb_page_addr_t phys1,

>       }

>   }

>   

> -#if defined(CONFIG_USER_ONLY)

> -/* Currently it is not recommended to allocate big chunks of data in

> -   user mode. It will change when a dedicated libc will be used.  */

> -/* ??? 64-bit hosts ought to have no problem mmaping data outside the

> -   region in which the guest needs to run.  Revisit this.  */

> +#if defined(CONFIG_USER_ONLY) && TCG_TARGET_REG_BITS == 32

> +/*

> + * For user mode on smaller 32 bit systems we may run into trouble

> + * allocating big chunks of data in the right place. On these systems

> + * we utilise a static code generation buffer directly in the binary.

> + */

>   #define USE_STATIC_CODE_GEN_BUFFER

>   #endif

>   

> 


Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Niek Linnenbank Feb. 27, 2020, 7:20 p.m. UTC | #3
On Wed, Feb 26, 2020 at 7:12 PM Alex Bennée <alex.bennee@linaro.org> wrote:

> There is no particular reason to use a static codegen buffer on 64 bit

> hosts as we have address space to burn. Allow the common CONFIG_USER

> case to use the mmap'ed buffers like SoftMMU.

>

> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

> ---

>  accel/tcg/translate-all.c | 11 ++++++-----

>  1 file changed, 6 insertions(+), 5 deletions(-)

>

> diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c

> index 5b66af783b5..4ce5d1b3931 100644

> --- a/accel/tcg/translate-all.c

> +++ b/accel/tcg/translate-all.c

> @@ -892,11 +892,12 @@ static void page_lock_pair(PageDesc **ret_p1,

> tb_page_addr_t phys1,

>      }

>  }

>

> -#if defined(CONFIG_USER_ONLY)

> -/* Currently it is not recommended to allocate big chunks of data in

> -   user mode. It will change when a dedicated libc will be used.  */

> -/* ??? 64-bit hosts ought to have no problem mmaping data outside the

> -   region in which the guest needs to run.  Revisit this.  */

> +#if defined(CONFIG_USER_ONLY) && TCG_TARGET_REG_BITS == 32

> +/*

> + * For user mode on smaller 32 bit systems we may run into trouble

> + * allocating big chunks of data in the right place. On these systems

> + * we utilise a static code generation buffer directly in the binary.

> + */

>  #define USE_STATIC_CODE_GEN_BUFFER

>  #endif

>

> --

> 2.20.1

>

>

> Reviewed-by: Niek Linnenbank <nieklinnenbank@gmail.com>


-- 
Niek Linnenbank
<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Feb 26, 2020 at 7:12 PM Alex Bennée &lt;<a href="mailto:alex.bennee@linaro.org">alex.bennee@linaro.org</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">There is no particular reason to use a static codegen buffer on 64 bit<br>
hosts as we have address space to burn. Allow the common CONFIG_USER<br>
case to use the mmap&#39;ed buffers like SoftMMU.<br>
<br>
Signed-off-by: Alex Bennée &lt;<a href="mailto:alex.bennee@linaro.org" target="_blank">alex.bennee@linaro.org</a>&gt;<br>

---<br>
 accel/tcg/translate-all.c | 11 ++++++-----<br>
 1 file changed, 6 insertions(+), 5 deletions(-)<br>
<br>
diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c<br>
index 5b66af783b5..4ce5d1b3931 100644<br>
--- a/accel/tcg/translate-all.c<br>
+++ b/accel/tcg/translate-all.c<br>
@@ -892,11 +892,12 @@ static void page_lock_pair(PageDesc **ret_p1, tb_page_addr_t phys1,<br>
     }<br>
 }<br>
<br>
-#if defined(CONFIG_USER_ONLY)<br>
-/* Currently it is not recommended to allocate big chunks of data in<br>
-   user mode. It will change when a dedicated libc will be used.  */<br>
-/* ??? 64-bit hosts ought to have no problem mmaping data outside the<br>
-   region in which the guest needs to run.  Revisit this.  */<br>
+#if defined(CONFIG_USER_ONLY) &amp;&amp; TCG_TARGET_REG_BITS == 32<br>
+/*<br>
+ * For user mode on smaller 32 bit systems we may run into trouble<br>
+ * allocating big chunks of data in the right place. On these systems<br>
+ * we utilise a static code generation buffer directly in the binary.<br>
+ */<br>
 #define USE_STATIC_CODE_GEN_BUFFER<br>
 #endif<br>
<br>
-- <br>
2.20.1<br>
<br>
<br>
</blockquote></div>Reviewed-by: Niek Linnenbank &lt;<a href="mailto:nieklinnenbank@gmail.com">nieklinnenbank@gmail.com</a>&gt;<br clear="all"><div><br>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Niek Linnenbank<br><br></div></div></div></div></div>
diff mbox series

Patch

diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
index 5b66af783b5..4ce5d1b3931 100644
--- a/accel/tcg/translate-all.c
+++ b/accel/tcg/translate-all.c
@@ -892,11 +892,12 @@  static void page_lock_pair(PageDesc **ret_p1, tb_page_addr_t phys1,
     }
 }
 
-#if defined(CONFIG_USER_ONLY)
-/* Currently it is not recommended to allocate big chunks of data in
-   user mode. It will change when a dedicated libc will be used.  */
-/* ??? 64-bit hosts ought to have no problem mmaping data outside the
-   region in which the guest needs to run.  Revisit this.  */
+#if defined(CONFIG_USER_ONLY) && TCG_TARGET_REG_BITS == 32
+/*
+ * For user mode on smaller 32 bit systems we may run into trouble
+ * allocating big chunks of data in the right place. On these systems
+ * we utilise a static code generation buffer directly in the binary.
+ */
 #define USE_STATIC_CODE_GEN_BUFFER
 #endif