From: "Alex Bennée" <alex.bennee@linaro.org>
To: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
Cc: qemu-devel@nongnu.org, pbonzini@redhat.com, den@openvz.org,
kvm@vger.kernel.org
Subject: Re: [PATCH] kvm: emit GUEST_PANICKED event in case of abnormal KVM exit
Date: Fri, 09 Feb 2024 17:46:32 +0000 [thread overview]
Message-ID: <875xyxledj.fsf@draig.linaro.org> (raw)
In-Reply-To: <20231101152311.181817-1-andrey.drobyshev@virtuozzo.com> (Andrey Drobyshev's message of "Wed, 1 Nov 2023 17:23:11 +0200")
Andrey Drobyshev <andrey.drobyshev@virtuozzo.com> writes:
(Add kvm@vger to CC for wider review)
> Currently we emit GUEST_PANICKED event in case kvm_vcpu_ioctl() returns
> KVM_EXIT_SYSTEM_EVENT with the event type KVM_SYSTEM_EVENT_CRASH. Let's
> extend this scenario and emit GUEST_PANICKED in case of an abnormal KVM
> exit. That's a natural thing to do since in this case guest is no
> longer operational anyway.
>
> Signed-off-by: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
> Acked-by: Denis V. Lunev <den@virtuozzo.com>
> ---
> accel/kvm/kvm-all.c | 19 +++++++++++++++----
> 1 file changed, 15 insertions(+), 4 deletions(-)
>
> diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
> index e39a810a4e..d74b3f0b0e 100644
> --- a/accel/kvm/kvm-all.c
> +++ b/accel/kvm/kvm-all.c
> @@ -2816,6 +2816,14 @@ static void kvm_eat_signals(CPUState *cpu)
> } while (sigismember(&chkset, SIG_IPI));
> }
>
> +static void kvm_emit_guest_crash(CPUState *cpu)
> +{
> + kvm_cpu_synchronize_state(cpu);
> + qemu_mutex_lock_iothread();
> + qemu_system_guest_panicked(cpu_get_crash_info(cpu));
> + qemu_mutex_unlock_iothread();
> +}
> +
> int kvm_cpu_exec(CPUState *cpu)
> {
> struct kvm_run *run = cpu->kvm_run;
> @@ -2969,21 +2977,24 @@ int kvm_cpu_exec(CPUState *cpu)
> ret = EXCP_INTERRUPT;
> break;
> case KVM_SYSTEM_EVENT_CRASH:
> - kvm_cpu_synchronize_state(cpu);
> - qemu_mutex_lock_iothread();
> - qemu_system_guest_panicked(cpu_get_crash_info(cpu));
> - qemu_mutex_unlock_iothread();
> + kvm_emit_guest_crash(cpu);
> ret = 0;
> break;
> default:
> DPRINTF("kvm_arch_handle_exit\n");
> ret = kvm_arch_handle_exit(cpu, run);
> + if (ret < 0) {
> + kvm_emit_guest_crash(cpu);
> + }
> break;
> }
> break;
> default:
> DPRINTF("kvm_arch_handle_exit\n");
> ret = kvm_arch_handle_exit(cpu, run);
> + if (ret < 0) {
> + kvm_emit_guest_crash(cpu);
> + }
> break;
> }
> } while (ret == 0);
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
prev parent reply other threads:[~2024-02-09 17:47 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-01 15:23 [PATCH] kvm: emit GUEST_PANICKED event in case of abnormal KVM exit Andrey Drobyshev
2023-11-01 16:13 ` Denis V. Lunev
2023-11-22 12:17 ` Andrey Drobyshev
2024-01-11 13:15 ` Andrey Drobyshev
2024-01-25 16:36 ` Andrey Drobyshev
2024-02-08 18:32 ` Andrey Drobyshev
2024-02-09 17:46 ` Alex Bennée [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=875xyxledj.fsf@draig.linaro.org \
--to=alex.bennee@linaro.org \
--cc=andrey.drobyshev@virtuozzo.com \
--cc=den@openvz.org \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.