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

Re: [PATCH 08/16] xen/arm: add watchdog domain suspend/resume helpers


  • To: Mykola Kvach <xakep.amatop@xxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Grygorii Strashko <grygorii_strashko@xxxxxxxx>
  • Date: Thu, 20 Mar 2025 13:25:07 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=lNYP+musNCoEqqt1o2a6ZEl2BLOXj/7sxsEi7H4Ue78=; b=o2sTax+MC7/82JMpG1+RTQPOVcgE9L36aiCNng9nroyGFA4S+sWnSek2QXjCrP8Pz8umDC9DeKbdnaCDIDlb14zXmBgkWyHJzjHT/FB4qXqZOR2sIpidoLRpUhCvC4euY3hUOISbuHh9j+nPwnCLmROidPpkAYnH9lbTRmRjT2l6LB/7XVsaAM2Ep4SR/xTe+snj0y+VRpuK8zyXsvTsxLimWu1XBXB6y5guDFQAC9nr4jQXncHFT8n2330/cjEYC/vNVynTEznG7n0VjdRzjJMkGTQhojClES+0QwPw/B/8xj8iMm1093c2xKM2RjUsFGBPvTxBKpVphnfEEDGSTw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=kYf+Wq/XXYoCngktOIppaQIdVOAGdtrafRiflBqTHemLgoQ6F/gLlWjcWXzsVDMcvfFkgRsktEgK0N2ZCPx2bvY/fHZQ0mE2elJyFSprezZMU7gSm7A5MeT1ye9Hc4y6AZMT13ez8TBO2996i3xkqUnYtZHEecvjCwGJDXd2Y4ZWSuUI/Oq0XYIT7Z5/10Q7kGtp3j3mSqsyZYD/EHf/swlvcAMDI+Z6J8DJpZu8Gtpq6am0reylTxzLc4k8ulfWMQoALm26xrBIAXXUcDakT2ShKBzSNcXoqtNBq5XpH2Cfv6UxcbDjV71hgXHO0+mENXuLont78pPDeg3UUiRLXg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com;
  • Cc: Mykola Kvach <mykola_kvach@xxxxxxxx>, Dario Faggioli <dfaggioli@xxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, George Dunlap <gwd@xxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Mirela Simonovic <mirela.simonovic@xxxxxxxxxx>, Saeed Nowshadi <saeed.nowshadi@xxxxxxxxxx>, Mykyta Poturai <mykyta_poturai@xxxxxxxx>
  • Delivery-date: Thu, 20 Mar 2025 11:25:28 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>



On 05.03.25 11:11, Mykola Kvach wrote:
From: Mykola Kvach <mykola_kvach@xxxxxxxx>

This patch implements suspend/resume helpers for the watchdog.
While a domain is suspended its watchdogs must be paused. Otherwise,
if the domain stays in the suspend state for a longer period of time
compared to the watchdog period, the domain would be shutdown on resume.
Proper solution to this problem is to stop (suspend) the watchdog timers
after the domain suspends and to restart (resume) the watchdog timers
before the domain resumes. The suspend/resume of watchdog timers is done
in Xen and is invisible to the guests.

Signed-off-by: Mirela Simonovic <mirela.simonovic@xxxxxxxxxx>
Signed-off-by: Saeed Nowshadi <saeed.nowshadi@xxxxxxxxxx>
Signed-off-by: Mykyta Poturai <mykyta_poturai@xxxxxxxx>
Signed-off-by: Mykola Kvach <mykola_kvach@xxxxxxxx>
---
Changes in v3:
- cover the code with CONFIG_SYSTEM_SUSPEND

Changes in v2:
- drop suspended field from timer structure
- drop the call of watchdog_domain_resume from ctxt_switch_to
---
  xen/common/sched/core.c | 39 +++++++++++++++++++++++++++++++++++++++
  xen/include/xen/sched.h |  9 +++++++++
  2 files changed, 48 insertions(+)

diff --git a/xen/common/sched/core.c b/xen/common/sched/core.c
index b1c6b6b9fa..6c2231826a 100644
--- a/xen/common/sched/core.c
+++ b/xen/common/sched/core.c
@@ -1605,6 +1605,45 @@ void watchdog_domain_destroy(struct domain *d)
          kill_timer(&d->watchdog_timer[i].timer);
  }
+#ifdef CONFIG_SYSTEM_SUSPEND
+
+void watchdog_domain_suspend(struct domain *d)
+{
+    unsigned int i;
+
+    spin_lock(&d->watchdog_lock);
+
+    for ( i = 0; i < NR_DOMAIN_WATCHDOG_TIMERS; i++ )
+    {
+        if ( test_bit(i, &d->watchdog_inuse_map) )
+        {
+            stop_timer(&d->watchdog_timer[i].timer);
+        }
+    }
+
+    spin_unlock(&d->watchdog_lock);
+}
+
+void watchdog_domain_resume(struct domain *d)
+{
+    unsigned int i;
+
+    spin_lock(&d->watchdog_lock);
+
+    for ( i = 0; i < NR_DOMAIN_WATCHDOG_TIMERS; i++ )
+    {
+        if ( test_bit(i, &d->watchdog_inuse_map) )
+        {
+            set_timer(&d->watchdog_timer[i].timer,
+                      NOW() + SECONDS(d->watchdog_timer[i].timeout));
+        }
+    }
+
+    spin_unlock(&d->watchdog_lock);
+}
+
+#endif /* CONFIG_SYSTEM_SUSPEND */

My understanding is that domain's watchdogs support are not mandatory 
requirement
for enabling basic System suspend2ram feature, as they are not enabled 
automatically.
So, domain's watchdog patches can be separated and posted after basic 
functionality
is in place.

[...]

--
Best regards,
-grygorii



 


Rackspace

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