|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v2] xen: handle domain_shutdown() return values
Hi Jan,
Thank you for the review.
On Mon, Nov 23, 2026 at 10:19 AM Jan Beulich <jbeulich@xxxxxxxx> wrote:
>
> On 20.11.2026 17:08, Mykola Kvach wrote:
> > --- a/xen/arch/x86/compat.c
> > +++ b/xen/arch/x86/compat.c
> > @@ -39,14 +39,11 @@ long do_sched_op_compat(int cmd, unsigned long arg)
> > case SCHEDOP_shutdown:
> > TRACE_TIME(TRC_SCHED_SHUTDOWN,
> > current->domain->domain_id, current->vcpu_id, arg);
> > - domain_shutdown(current->domain, (u8)arg);
> > - break;
> > + return domain_shutdown(current->domain, (u8)arg);
> >
> > default:
> > return -ENOSYS;
> > }
> > -
> > - return 0;
> > }
>
> I'm not quite sure whether we ought to alter the behavior of this (very)
> legacy hypercall. The case you mention in the description (shim) post-
> dates this hypercall's replacement by many years.
I tested a cancelled suspend through the legacy hypercall with PV32
and PV64 test guests. Without the shim, both saw 1. With the shim,
they saw 0 before v2 and 1 with v2. I haven't found a released guest
that relies on this, so the change is only for consistency: the newer
sched_op already returns this value in shim mode.
If you prefer, I can drop this hunk, or limit it to passing through
the result for SHUTDOWN_suspend.
>
> > @@ -1750,12 +1754,16 @@ void hvm_triple_fault(void)
> > struct vcpu *v = current;
> > struct domain *d = v->domain;
> > u8 reason = d->arch.hvm.params[HVM_PARAM_TRIPLE_FAULT_REASON];
> > + int rc;
> >
> > gprintk(XENLOG_ERR,
> > "Triple fault - invoking HVM shutdown action %d\n",
> > reason);
> > vcpu_show_execution_state(v);
> > - domain_shutdown(d, reason);
> > + rc = domain_shutdown(d, reason);
> > + if ( unlikely(rc < 0) )
> > + gprintk(XENLOG_ERR, "Failed to shut down after triple fault: %d\n",
> > + rc);
> > }
>
> Here and ...
>
> > --- a/xen/common/sched/core.c
> > +++ b/xen/common/sched/core.c
> > @@ -1588,6 +1588,7 @@ static void cf_check domain_watchdog_timeout(void
> > *data)
> > */
> > struct domain *d = _p((unsigned long)data & PAGE_MASK);
> > unsigned int id = (unsigned long)data & ~PAGE_MASK;
> > + int rc;
> >
> > BUILD_BUG_ON(alignof(*d) < PAGE_SIZE);
> >
> > @@ -1595,7 +1596,10 @@ static void cf_check domain_watchdog_timeout(void
> > *data)
> > return;
> >
> > printk("Watchdog timer %u fired for %pd\n", id, d);
> > - domain_shutdown(d, SHUTDOWN_watchdog);
> > + rc = domain_shutdown(d, SHUTDOWN_watchdog);
> > + if ( unlikely(rc) )
> > + printk(XENLOG_G_ERR "Watchdog timer %u failed to shut down %pd:
> > %d\n",
> > + id, d, rc);
> > }
>
> ... here I wonder whether we shouldn't go farther than merely logging a
> message. If the domain can't be "shut down", maybe it should be crashed?
domain_shutdown() can only fail in PV shim mode, where it forwards the
request to L0. domain_crash() calls domain_shutdown() with
SHUTDOWN_crash, which uses the same forwarding. So it would be a retry,
not a separate fallback.
For the watchdog, I agree that a failed shutdown can leave the guest
running. But a crash would make xl use on_crash instead of
on_watchdog.
So I'd keep the log. If you still prefer a crash here, I'll add it.
Best regards,
Mykola
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |