[libvirt] [PATCH] libxl: add support for soft reset

Michal Privoznik mprivozn at redhat.com
Tue Oct 30 09:18:16 UTC 2018


On 10/30/2018 03:17 AM, Jim Fehlig wrote:
> On 10/29/18 7:26 PM, Jim Fehlig wrote:
>> The pvops Linux kernel implements machine_ops.crash_shutdown as
>>
>> static void xen_hvm_crash_shutdown(struct pt_regs *regs)
>> {
>>          native_machine_crash_shutdown(regs);
>>          xen_reboot(SHUTDOWN_soft_reset);
>> }
>>
>> but currently the libxl driver does not handle the soft reset
>> shutdown event. As a result, the guest domain never proceeds
>> past xen_reboot(), making it impossible for HVM domains to save
>> a crash dump using kexec.
>>
>> This patch adds support for handling the soft reset event by
>> calling libxl_domain_soft_reset() and re-enabling domain death
>> events, which is similar to the xl tool handling of soft reset
>> shutdown event.
>>
>> Signed-off-by: Jim Fehlig <jfehlig at suse.com>
>> ---
>>   src/libxl/libxl_domain.c | 30 ++++++++++++++++++++++++++++++
>>   1 file changed, 30 insertions(+)
>>
>> diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
>> index 0032b9dd11..295ec04a85 100644
>> --- a/src/libxl/libxl_domain.c
>> +++ b/src/libxl/libxl_domain.c
>> @@ -447,8 +447,10 @@ libxlDomainShutdownThread(void *opaque)
>>       virObjectEventPtr dom_event = NULL;
>>       libxl_shutdown_reason xl_reason =
>> ev->u.domain_shutdown.shutdown_reason;
>>       libxlDriverConfigPtr cfg;
>> +    libxl_domain_config d_config;
>>         cfg = libxlDriverConfigGet(driver);
>> +    libxl_domain_config_init(&d_config);
>>         vm = virDomainObjListFindByID(driver->domains, ev->domid);
>>       if (!vm) {
>> @@ -532,6 +534,33 @@ libxlDomainShutdownThread(void *opaque)
>>            * after calling libxl_domain_suspend() are handled by it's
>> callers.
>>            */
>>           goto endjob;
>> +    } else if (xl_reason == LIBXL_SHUTDOWN_REASON_SOFT_RESET) {
>> +        libxlDomainObjPrivatePtr priv = vm->privateData;
>> +        int res;
> 
> I'm not sure why I have this useless local. I've squashed the below diff
> into my local branch.

ACK

Michal




More information about the libvir-list mailing list