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

Re: [PATCH v10 05/13] xen/arm: gic-v3: add ITS suspend/resume support


  • To: Luca Fancellu <Luca.Fancellu@xxxxxxx>
  • From: Mykola Kvach <xakep.amatop@xxxxxxxxx>
  • Date: Wed, 3 Jun 2026 08:56:28 +0300
  • Arc-authentication-results: i=1; mx.google.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=QJsA3hNz+HCuhdRc6PMUcY2k6K+YaAI45jWEO2782fc=; fh=URHEk7klKxjqc5bXwxtPgt12zwbJaOVjsCphaVnE7cw=; b=F9nW/GEleuTeNxsUnCa0vPeP4tklLpGF19LFg31LWomvdP+2uopVom30tOqnRq0YW0 w+MvF7/QXVpjeeATmRya8lH6jf0vr0XRgEeUeAOYZEnUa3otA09c86+D/GeTBtElJ24Y nBh6ti6HEVhahYCXh20PM347fwRNvYZsMvtTY4T/TCo7Ov00beifswJS0f+qsYP+p/Gg PeB/PjjAxETTUnd5u8qCOTEnO1RlTX8HdMNYRsSKEyxrbpVeI6XjQiESIqsWGwqN+3XV qXXYZEQ0YJiO4iVXyGfNkzFFucGWGLOs71GIKa+28B8blCuGTeufgjL/ZKIx4XRRJMmy d/gA==; darn=lists.xenproject.org
  • Arc-seal: i=1; a=rsa-sha256; t=1780466199; cv=none; d=google.com; s=arc-20240605; b=SySGmzCeO9NVSW5osx+mrbeClHeHczGp3Wdv25n9DVmZIr6atVmT1wzjtB1FaUbHfA SnvJb6QURbOdb+dw0R/v/4ShlGS2Uy5vGbNt18EfQeziU8LFbjjs6R3PD8AgZYq7iAMI 8AARdnQBDpvqHX0bKiZrvaTJZu+k8qSOP3qry9Um/hC4M+C8QRJCbxe5QA2vzXaTka1q 2PByIr4LIctGMysxEF8/bmgGmJ3U24gA62WOsRGtdJFtJBVJo3TbF63qSxbJJVuzGz4r d2GNHGRlUdFRM7Hq4P3piQt5Bqh9c8wdP+WJ1f++q6Ip4IT1m6XXXwfTVb3rdBjQR3If ZlmA==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=20251104 header.d=gmail.com header.i="@gmail.com" header.h="Content-Transfer-Encoding:Cc:To:Subject:Message-ID:Date:From:In-Reply-To:References:MIME-Version"
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Mykola Kvach <mykola_kvach@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Wed, 03 Jun 2026 05:56:45 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Hi Luca,

Thank you for the review.

On Thu, May 28, 2026 at 9:12 PM Luca Fancellu <Luca.Fancellu@xxxxxxx> wrote:
>
> Hi Mykola,
>
> >
> > +#ifdef CONFIG_SYSTEM_SUSPEND
> > +int gicv3_its_suspend(void)
> > +{
> > +    struct host_its *its;
> > +    int ret;
> > +
> > +    list_for_each_entry( its, &host_its_list, entry )
> > +    {
> > +        unsigned int i;
> > +        void __iomem *base = its->its_base;
> > +
> > +        /*
> > +         * By the time Xen reaches gic_suspend(), every domain is already 
> > in
> > +         * SHUTDOWN_suspend, so ITS-targeting interrupt sources are 
> > expected
> > +         * to have been quiesced by the owning OS before SYSTEM_SUSPEND.
> > +         */
> > +        /* Preserve saved GITS_CTLR state, excluding read-only QUIESCENT. 
> > */
> > +        its->suspend_ctx.ctlr = readl_relaxed(base + GITS_CTLR) &
> > +                                ~GITS_CTLR_QUIESCENT;
> > +        ret = gicv3_disable_its(its);
> > +        if ( ret )
> > +        {
> > +            writel_relaxed(its->suspend_ctx.ctlr, base + GITS_CTLR);
>
> This is writing enable from 0 to 1, while quiescent is still 0, which is 
> unpredictable,
> however it’s the same happening on Linux, so I would leave it to the 
> maintainer preference.

I think you are right, thanks for spotting this.

After gicv3_disable_its() times out, the ITS has already had
GITS_CTLR.Enabled cleared, but GITS_CTLR.Quiescent is still 0. Writing back
the saved CTLR may set Enabled from 0 to 1 while Quiescent is 0, which is
UNPREDICTABLE according to the spec.

So restoring GITS_CTLR in this error path does not look safe. We could extend
the quiesce timeout if the current 100ms is considered too short, but once the
wait has failed there is no architecturally safe way to restore the ITS state.
In that case I think the suspend path should panic.

This would also let us drop the reverse rollback loop from this patch. The
definition of list_for_each_entry_continue_reverse() can then be moved to the
later SMMUv3 patch, where it is still needed.

What do you think?

Best regards,
Mykola



 


Rackspace

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