[PATCH 2/2] cpu: ensure we don't call start_exclusive from cpu_exec

Pierrick Bouvier posted 2 patches 1 month ago
There is a newer version of this series
[PATCH 2/2] cpu: ensure we don't call start_exclusive from cpu_exec
Posted by Pierrick Bouvier 1 month ago
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
 cpu-common.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/cpu-common.c b/cpu-common.c
index 6b262233a3b..c979138fce9 100644
--- a/cpu-common.c
+++ b/cpu-common.c
@@ -194,6 +194,9 @@ void start_exclusive(void)
     CPUState *other_cpu;
     int running_cpus;
 
+    /* Ensure we are not running, or start_exclusive will be blocked. */
+    g_assert(!current_cpu || !current_cpu->running);
+
     if (current_cpu->exclusive_context_count) {
         current_cpu->exclusive_context_count++;
         return;
-- 
2.39.5
Re: [PATCH 2/2] cpu: ensure we don't call start_exclusive from cpu_exec
Posted by Richard Henderson 4 weeks, 1 day ago
On 10/23/24 23:20, Pierrick Bouvier wrote:
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
>   cpu-common.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/cpu-common.c b/cpu-common.c
> index 6b262233a3b..c979138fce9 100644
> --- a/cpu-common.c
> +++ b/cpu-common.c
> @@ -194,6 +194,9 @@ void start_exclusive(void)
>       CPUState *other_cpu;
>       int running_cpus;
>   
> +    /* Ensure we are not running, or start_exclusive will be blocked. */
> +    g_assert(!current_cpu || !current_cpu->running);
> +
>       if (current_cpu->exclusive_context_count) {
>           current_cpu->exclusive_context_count++;
>           return;

Actually, current_cpu had better be non-null from the very next line.


r~
Re: [PATCH 2/2] cpu: ensure we don't call start_exclusive from cpu_exec
Posted by Richard Henderson 4 weeks, 1 day ago
On 10/23/24 23:20, Pierrick Bouvier wrote:
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
>   cpu-common.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/cpu-common.c b/cpu-common.c
> index 6b262233a3b..c979138fce9 100644
> --- a/cpu-common.c
> +++ b/cpu-common.c
> @@ -194,6 +194,9 @@ void start_exclusive(void)
>       CPUState *other_cpu;
>       int running_cpus;
>   
> +    /* Ensure we are not running, or start_exclusive will be blocked. */
> +    g_assert(!current_cpu || !current_cpu->running);
> +
>       if (current_cpu->exclusive_context_count) {
>           current_cpu->exclusive_context_count++;
>           return;

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

r~