qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] target/arm: do not use cc->do_interrupt for KVM directly


From: Peter Maydell
Subject: Re: [PATCH] target/arm: do not use cc->do_interrupt for KVM directly
Date: Mon, 7 Dec 2020 18:14:11 +0000

On Mon, 7 Dec 2020 at 18:08, Claudio Fontana <cfontana@suse.de> wrote:
> what about also the existing code with qemu-arm (user mode)?
>
> In that case do_interrupt is not set at all in target/arm/cpu.c, since it's 
> protected by #ifndef CONFIG_USER_ONLY
>
> Did we have a potential NULL pointer trying to be dereferenced there?

No, because in user-mode there are never any interrupts or
exceptions invoked this way. The code in these methods is
strictly system-emulation only.

> Commit 0adf7d3cc3f724e1e9ce5aaa008bd9daeb90f19 says:
>
>  target-arm: do not set do_interrupt handlers for ARM and AArch64 user modes
>
>  User mode emulation should never get interrupts and thus should not
>  use the system emulation exception handler function.
>
> --
>
> But this was 2014. Is the comment above true today?

Yes.

> Looking at this commit in 2017, it does not seem to me to be the case:
>
> commit 17b50b0c299f1266578b01f7134810362418ac2e
> Author: Pavel Dovgaluk <Pavel.Dovgaluk@ispras.ru>
> Date:   Tue Nov 14 11:18:18 2017 +0300
>
>     cpu-exec: avoid cpu_exec_nocache infinite loop with record/replay
>
>     This patch
>     [...]
>     Second, try to cause the exception at the beginning of
>     cpu_handle_exception, and exit immediately if the TB cannot
>     execute.  With this change, interrupts are processed and
>     cpu_exec_nocache can make process.

This code only invokes cc->do_interrupt() in CONFIG_USER_ONLY
if TARGET_I386 is true. i386 does this stuff in a weird way
that's different to all the other target architectures.
(One day we should fix this inconsistency I suppose.)

> Is cc->do_interrupt supposed to be !CONFIG_USER_ONLY or not?

It's !CONFIG_USER_ONLY.

thanks
-- PMM



reply via email to

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