[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 13/22] vixen: Use SCHEDOP_shutdown to shutdown the machine



On Sun, Jan 7, 2018 at 12:27 AM, Roger Pau Monné <roger.pau@xxxxxxxxxx> wrote:
> On Sat, Jan 06, 2018 at 02:54:28PM -0800, Anthony Liguori wrote:
>> From: Jan H. Schönherr <jschoenh@xxxxxxxxx>
>>
>> While the hwdom_shutdown() is able to reboot the system, it fails to
>> properly power it off. With SCHEDOP_shutdown, we delegate the problem.
>>
>> Signed-off-by: Jan H. Schönherr <jschoenh@xxxxxxxxx>
>> Signed-off-by: Anthony Liguori <aliguori@xxxxxxxxxx>
>> ---
>>  xen/common/domain.c | 14 ++++++++++++++
>>  1 file changed, 14 insertions(+)
>>
>> diff --git a/xen/common/domain.c b/xen/common/domain.c
>> index b4d679e..ede377c 100644
>> --- a/xen/common/domain.c
>> +++ b/xen/common/domain.c
>> @@ -42,6 +42,7 @@
>>  #include <xen/trace.h>
>>  #include <xen/tmem.h>
>>  #include <asm/setup.h>
>> +#include <asm/guest/vixen.h>
>>
>>  /* Linux config option: propageted to domain0 */
>>  /* xen_processor_pmbits: xen control Cx, Px, ... */
>> @@ -693,6 +694,17 @@ void __domain_crash_synchronous(void)
>>  }
>>
>>
>> +static void vixen_shutdown(u8 reason)
>> +{
>> +    struct sched_shutdown sched_shutdown = { .reason = reason };
>> +
>> +    if (!opt_noreboot)
>> +        HYPERVISOR_sched_op(SCHEDOP_shutdown, &sched_shutdown);
>> +
>> +    /* Fallback, in case the hypercall fails */
>> +    hwdom_shutdown(reason);
>> +}
>> +
>>  void domain_shutdown(struct domain *d, u8 reason)
>>  {
>>      struct vcpu *v;
>> @@ -703,6 +715,8 @@ void domain_shutdown(struct domain *d, u8 reason)
>>          d->shutdown_code = reason;
>>      reason = d->shutdown_code;
>>
>> +    if ( is_vixen() )
>> +        vixen_shutdown(reason);
>
> What happens with hypervisor triggered shutdowns? For pv-shim we
> translated all hypervisor initiated shutdowns to crash requests, since
> AFAICT they can only come from panics/BUGs/ASSERTs...

If a guest attempts to gracefully shut down (shutdown -h now), then
without this change, the vixen domain will shut down but the
hypervisor will sit in the idle domain.

With this change, the hypervisor powers off (or restarts depending on
the reason).

An internal BUG() will reset the hypervisor.

Regards,

Anthony Liguori

> Roger.
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxxx
> https://lists.xenproject.org/mailman/listinfo/xen-devel

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.