Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plat/common: Add support for pvpanic devices for x86 #1022

Conversation

craciunoiuc
Copy link
Member

@craciunoiuc craciunoiuc commented Aug 7, 2023

Prerequisite checklist

  • Read the contribution guidelines regarding submitting new changes to the project;
  • Tested your changes against relevant architectures and platforms;
  • Ran the checkpatch.uk on your commit series before opening this PR;
  • Updated relevant documentation.

Base target

  • Architecture(s): x86_64
  • Platform(s): kvm
  • Application(s): N/A

Additional configuration

Use -device pvpanic when testing with qemu-system-x86_64.

Description of changes

Unikraft already offers exit codes through the ISA device, but these
are only a convention and are not understood by QEMU itself.

When using -device pvpanic, a GUEST_PANICKED event[1] is sent to QEMU
when the unikernel crashes.
This event can be seen when using QMP[1] for example.
The bits corresponding to each even are set as per the documentation[2].

The main usage of this is in kraftkit where unikernels are detached
and exit codes are lost.
Using this can signal when the unikernel crashes.

[1] https://qemu-project.gitlab.io/qemu/interop/qemu-qmp-ref.html#qapidoc-152
[2] https://github.com/qemu/qemu/blob/master/docs/specs/pvpanic.txt

@craciunoiuc craciunoiuc added arch/x86_64 plat/common Common to all platforms labels Aug 7, 2023
@craciunoiuc craciunoiuc requested a review from a team as a code owner August 7, 2023 09:26
plat/common/x86/cpu_native.c Outdated Show resolved Hide resolved
@craciunoiuc craciunoiuc force-pushed the craciunoiuc/add-pvpanic-support branch from 7b2f928 to 1a770ec Compare August 7, 2023 09:38
@craciunoiuc craciunoiuc requested review from mschlumpp and removed request for a team August 7, 2023 09:39
plat/common/x86/cpu_native.c Outdated Show resolved Hide resolved
Unikraft already offers exit codes through the ISA device, but these
are only a convention and are not understood by QEMU itself.

When using `-device pvpanic`, a GUEST_PANICKED event[1] is sent to QEMU
when the unikernel crashes.
This event can be seen when using QMP[1] for example.
The bits corresponding to each even are set as per the documentation[2].

The main usage of this is in kraftkit where unikernels are detached
and exit codes are lost.
Using this can signal when the unikernel crashes.

[1] https://qemu-project.gitlab.io/qemu/interop/qemu-qmp-ref.html#qapidoc-152
[2] https://github.com/qemu/qemu/blob/master/docs/specs/pvpanic.txt

Signed-off-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
Copy link
Member

@mschlumpp mschlumpp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed-by: Marco Schlumpp marco@unikraft.io

Copy link
Contributor

@razvand razvand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved-by: Razvan Deaconescu razvand@unikraft.io

@razvand razvand added this to the v0.14.0 (Prometheus) milestone Aug 7, 2023
@unikraft-bot unikraft-bot added area/plat Unikraft Patform lang/c Issues or PRs to do with C/C++ labels Aug 7, 2023
@unikraft-bot unikraft-bot added the ci/merged Merged by CI label Aug 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch/x86_64 area/plat Unikraft Patform ci/merged Merged by CI lang/c Issues or PRs to do with C/C++ plat/common Common to all platforms
Projects
Status: Done!
Development

Successfully merging this pull request may close these issues.

None yet

4 participants