diff mbox series

[v3,05/28] tcg: Split out tcg_region_initial_alloc

Message ID 20210502231844.1977630-6-richard.henderson@linaro.org
State Superseded
Headers show
Series tcg: Clean up code_gen_buffer allocation | expand

Commit Message

Richard Henderson May 2, 2021, 11:18 p.m. UTC
This has only one user, and currently needs an ifdef,
but will make more sense after some code motion.

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

---
 tcg/tcg.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

-- 
2.25.1

Comments

Alex Bennée June 8, 2021, 11:45 a.m. UTC | #1
Richard Henderson <richard.henderson@linaro.org> writes:

> This has only one user, and currently needs an ifdef,

> but will make more sense after some code motion.

>

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


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


> ---

>  tcg/tcg.c | 13 ++++++++++---

>  1 file changed, 10 insertions(+), 3 deletions(-)

>

> diff --git a/tcg/tcg.c b/tcg/tcg.c

> index 8b57e93ca2..df78c89673 100644

> --- a/tcg/tcg.c

> +++ b/tcg/tcg.c

> @@ -729,6 +729,15 @@ static void tcg_region_initial_alloc__locked(TCGContext *s)

>      g_assert(!err);

>  }

>  

> +#ifndef CONFIG_USER_ONLY

> +static void tcg_region_initial_alloc(TCGContext *s)

> +{

> +    qemu_mutex_lock(&region.lock);

> +    tcg_region_initial_alloc__locked(s);

> +    qemu_mutex_unlock(&region.lock);

> +}

> +#endif

> +

>  /* Call from a safe-work context */

>  void tcg_region_reset_all(void)

>  {

> @@ -962,9 +971,7 @@ void tcg_register_thread(void)

>      }

>  

>      tcg_ctx = s;

> -    qemu_mutex_lock(&region.lock);

> -    tcg_region_initial_alloc__locked(s);

> -    qemu_mutex_unlock(&region.lock);

> +    tcg_region_initial_alloc(s);

>  }

>  #endif /* !CONFIG_USER_ONLY */



-- 
Alex Bennée
Luis Fernando Fujita Pires June 9, 2021, 2:57 p.m. UTC | #2
From: Richard Henderson <richard.henderson@linaro.org>

> This has only one user, and currently needs an ifdef, but will make more sense

> after some code motion.

> 

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

> ---

>  tcg/tcg.c | 13 ++++++++++---

>  1 file changed, 10 insertions(+), 3 deletions(-)


Reviewed-by: Luis Pires <luis.pires@eldorado.org.br>


--
Luis Pires
Instituto de Pesquisas ELDORADO
Aviso Legal - Disclaimer <https://www.eldorado.org.br/disclaimer.html>
diff mbox series

Patch

diff --git a/tcg/tcg.c b/tcg/tcg.c
index 8b57e93ca2..df78c89673 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -729,6 +729,15 @@  static void tcg_region_initial_alloc__locked(TCGContext *s)
     g_assert(!err);
 }
 
+#ifndef CONFIG_USER_ONLY
+static void tcg_region_initial_alloc(TCGContext *s)
+{
+    qemu_mutex_lock(&region.lock);
+    tcg_region_initial_alloc__locked(s);
+    qemu_mutex_unlock(&region.lock);
+}
+#endif
+
 /* Call from a safe-work context */
 void tcg_region_reset_all(void)
 {
@@ -962,9 +971,7 @@  void tcg_register_thread(void)
     }
 
     tcg_ctx = s;
-    qemu_mutex_lock(&region.lock);
-    tcg_region_initial_alloc__locked(s);
-    qemu_mutex_unlock(&region.lock);
+    tcg_region_initial_alloc(s);
 }
 #endif /* !CONFIG_USER_ONLY */