On Thu, Jul 10, 2025 at 10:06:10PM +0800, Xiaoyao Li wrote:
> On 7/10/2025 7:40 PM, Xiaoyao Li wrote:
> > On 7/10/2025 11:55 AM, Zhenzhong Duan wrote:
> > > Gpa is defined in QAPI but never reported to monitor because has_gpa is
> > > never set to ture.
> > >
> > > Fix it by setting has_gpa to ture when TDX_REPORT_FATAL_ERROR_GPA_VALID
> > > is set in error_code.
> >
> > Hi Zhenzhong,
> >
> > I would like to understand what the problem is without panic_info-
> > >u.tdx.has_gpa being set?
>
> Never mind, I figure it out.
>
> qapi_event_send_guest_panicked() in qemu_system_guest_panicked will send the
> event and data. Libvirt tries to parse the data, but find the .has_data
> field is not set correctly.
Close, but not quite.
The "has_" fields are only present in the QEMU internal data structures,
never on the wire in the JSON messages that libvirt receives.
The problem is with QEMU's struct -> JSON serialization - if the 'has_gpa'
field is not set to 'true', then QEMU will *never* emit the 'gpa' field
in the JSON it sends to the client app.
So what libvirt receives is this:
{"timestamp": {"seconds": 1752156518, "microseconds": 809325},
"event": "GUEST_PANICKED",
"data": {"action": "pause", "info": {
"error-code": 0,
"message": "TD misconfiguration: SEPT #VE has to be disabled",
"type": "tdx"}}}
which has no 'gpa' present.
> My original patch used (gpa == -1) as the indicator for whether gpa is
> valid, this needs to be cleaned up. I will send the cleanup patch.
The value you assign to 'gpa' doesn't matter when 'has_gpa' is false,
as it'll never get into the JSON event, so having it be '-1' is not
significantly different from leaving it on 0.
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|