qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] tcg: handle EXCP_ATOMIC exception properly


From: Pranith Kumar
Subject: Re: [Qemu-devel] [PATCH] tcg: handle EXCP_ATOMIC exception properly
Date: Thu, 9 Feb 2017 23:54:24 -0500

On Thu, Feb 9, 2017 at 8:45 PM, Pranith Kumar <address@hidden> wrote:
>
> The current method of executing atomic code in a guest uses
> cpu_exec_step_atomic() from the outermost loop. This causes an abort()
> when single stepping over atomic code since debug exception longjmp
> will point to the the setlongjmp in cpu_exec(). Another issue with
> this mechanism is that the flags which were set in atomic execution
> will be lost since we do not call cpu_exec_enter().
>
> The following patch moves atomic exception handling to the exception
> handler where all these issues are taken care of. The change in
> start_exclusive() is necessary since now the cpu in atomic execution
> will have its running flag set, but we do not want to count it as
> pending.
>
> Thanks to Alex for helping me debug the issue.
>
> CC: Alex Bennée <address@hidden>
> CC: Richard Henderson <address@hidden>
> CC: Paolo Bonzini <address@hidden>
> Signed-off-by: Pranith Kumar <address@hidden>
> ---
>  cpu-exec.c    | 2 ++
>  cpus-common.c | 2 +-
>  cpus.c        | 4 ----
>  3 files changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/cpu-exec.c b/cpu-exec.c
> index b0ddada8c1..dceacfc5dd 100644
> --- a/cpu-exec.c
> +++ b/cpu-exec.c
> @@ -427,6 +427,8 @@ static inline bool cpu_handle_exception(CPUState *cpu, 
> int *ret)
>              *ret = cpu->exception_index;
>              if (*ret == EXCP_DEBUG) {
>                  cpu_handle_debug_exception(cpu);
> +            } else if (*ret == EXCP_ATOMIC) {
> +                cpu_exec_step_atomic(cpu);
>              }
>              cpu->exception_index = -1;
>              return true;


Looks like this is going to be a problem since we should not call
start_exclusive() from cpu_exec() (doh', I just read the comment for
this :-/).

It'll be great if we can make it callable from there. Thoughts?

Thanks,
-- 
Pranith



reply via email to

[Prev in Thread] Current Thread [Next in Thread]