[PATCH v2] system/runstate.c: Add a newline character to correctly log guest errors

xpahos@gmail.com posted 1 patch 1 month, 1 week ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20251004-add-newline-guest-error-log-v1-1-a61df1599936@gmail.com
Maintainers: Paolo Bonzini <pbonzini@redhat.com>
system/runstate.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
[PATCH v2] system/runstate.c: Add a newline character to correctly log guest errors
Posted by xpahos@gmail.com 1 month, 1 week ago
From: Alexander Gryanko <xpahos@gmail.com>

The pvpanic handler calls the qemu_system_guest_panicked
function with a NULL parameter, which results in the absence
of a newline character in the guest error log.
The qemu_system_guest_crashloaded function has no additional
logic, but also omits the newline character.
The qemu_system_guest_pvshutdown has no reporting in the
guest error log.

Signed-off-by: Alexander Gryanko <xpahos@gmail.com>
---
 system/runstate.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/system/runstate.c b/system/runstate.c
index 6178b0091a..8b4bf75cd6 100644
--- a/system/runstate.c
+++ b/system/runstate.c
@@ -674,18 +674,21 @@ void qemu_system_guest_panicked(GuestPanicInformation *info)
         }
 
         qapi_free_GuestPanicInformation(info);
+    } else {
+        qemu_log_mask(LOG_GUEST_ERROR, "\n");
     }
 }
 
 void qemu_system_guest_crashloaded(GuestPanicInformation *info)
 {
-    qemu_log_mask(LOG_GUEST_ERROR, "Guest crash loaded");
+    qemu_log_mask(LOG_GUEST_ERROR, "Guest crash loaded\n");
     qapi_event_send_guest_crashloaded(GUEST_PANIC_ACTION_RUN, info);
     qapi_free_GuestPanicInformation(info);
 }
 
 void qemu_system_guest_pvshutdown(void)
 {
+    qemu_log_mask(LOG_GUEST_ERROR, "Guest shutdown requested\n");
     qapi_event_send_guest_pvshutdown();
     qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN);
 }

---
base-commit: 81e3121bef89bcd3ccb261899e5a36246199065d
change-id: 20251004-add-newline-guest-error-log-62d68638b28c

Best regards,
-- 
Alexander Gryanko <xpahos@gmail.com>