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/*: Signal shutdown cause on QEMU #1019

Closed

Conversation

mschlumpp
Copy link
Member

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

Description of changes

This uses the isa-debug-exit device to pass an exit code to QEMU. By default this device is not available but can be enabled using the -device isa-debug-exit switch on the QEMU command-line.

@craciunoiuc @nderjung

@mschlumpp mschlumpp requested review from a team as code owners August 3, 2023 09:48
@mschlumpp mschlumpp linked an issue Aug 3, 2023 that may be closed by this pull request
@mschlumpp mschlumpp force-pushed the mschlumpp/fix/qemu-exit-code branch from 20c5662 to 7594d1a Compare August 3, 2023 11:06
@razvand razvand removed request for a team August 3, 2023 11:34
@razvand razvand self-assigned this Aug 3, 2023
@razvand razvand requested a review from mogasergiu August 3, 2023 11:35
@razvand razvand added plat/kvm Unikraft for KVM kind/quick-fix Issue is a quick fix lang/c Issues or PRs to do with C/C++ arch/x86_64 bug/runtime Bug occurs during runtime labels Aug 3, 2023
@razvand razvand added this to the v0.14.0 (Prometheus) milestone Aug 3, 2023
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.

Hi, @mschlumpp, this looks good. Lemme test it. I left some minor comments.

*/
static void qemu_debug_exit(int value)
{
outw(0x501, value);
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it make sense to have a macro for 0x501 - this doesn't tell me anything?

* will be 85 ('S', 42 << 1 | 1).
*/
if (request == UKPLAT_CRASH)
qemu_debug_exit(42);
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it make sense to have a macro for 42 - this doesn't tell me anything? Why 42? What magic is this?

*/
outw(0x501, 41);
qemu_debug_exit(41);
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it make sense to have a macro for 41 - this doesn't tell me anything? Why 41? What magic is this?

@craciunoiuc
Copy link
Member

@razvand thinks he can hear what numbers say to him, it's that bad

This uses the `isa-debug-exit` device to pass an exit code to QEMU. By
default this device is not available but can be enabled using the
`-device isa-debug-exit` switch on the QEMU command-line.

Github-Fixes: unikraft#1018
Signed-off-by: Marco Schlumpp <marco@unikraft.io>
@mschlumpp mschlumpp force-pushed the mschlumpp/fix/qemu-exit-code branch from 7594d1a to def271c Compare August 3, 2023 12:40
@unikraft-bot unikraft-bot added arch/arm arch/arm64 area/plat Unikraft Patform plat/common Common to all platforms labels Aug 3, 2023
Copy link
Member

@mogasergiu mogasergiu left a comment

Choose a reason for hiding this comment

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

LGTM!!!!!!

Reviewed-by: Sergiu Moga sergiu@unikraft.io

@razvand razvand self-requested a review August 3, 2023 13:13
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.

Thanks, @mschlumpp.

Reviewed-by: Razvan Deaconescu razvand@unikraft.io
Approved-by: Razvan Deaconescu razvand@unikraft.io

@unikraft-bot unikraft-bot added the ci/merged Merged by CI label Aug 3, 2023
@mschlumpp mschlumpp deleted the mschlumpp/fix/qemu-exit-code branch August 3, 2023 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch/arm arch/arm64 arch/x86_64 area/plat Unikraft Patform bug/runtime Bug occurs during runtime ci/merged Merged by CI kind/quick-fix Issue is a quick fix lang/c Issues or PRs to do with C/C++ plat/common Common to all platforms plat/kvm Unikraft for KVM
Projects
Status: Done!
Development

Successfully merging this pull request may close these issues.

Update system_off to include the shutdown cause
5 participants