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

[PATCH v3] xen/sched: rtds: assert replq is empty on timer (re-)init


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Oleksii Moisieiev <Oleksii_Moisieiev@xxxxxxxx>
  • Date: Mon, 4 May 2026 13:40:44 +0000
  • Accept-language: en-US
  • 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=JbrAVut94sJ6tMqG9N+0US2Yjz7n+raoSKn/WWaiOuc=; b=cKFoIWwFGZZSYwEzroloyp/izkuLTGKXmoaaT8Yv3oNh5x7t5GB0ST5YhlNlZ7Tnj2A9hsLDfzX/EGmk3On9m+gWMAST+0m2hfLehlRdt69qRsMVSmh8hdgu+t1bArMbNwMstldBrYRKvKGmj/uUBb05qh6laL9oEWAEcJJZYqCVRcwil6+A9fJAmlXR46+zLIyPgKaEoSQZq0FR7bMOaRM0tuVCaKo4vA7lMRZ5D79h51RGDrewUp/BybqF+pHPWD9fmyW7nwVx/LhhWp1t9gbY5leyy0Mt4xKJCuoIvWtxJwM78FuoJlGU4CuSb7tx0W3d59WQxj3D+oqucSL/nQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=KnpLMBPYLUMp8lFyGBUJVAcoDoDpxi1dJHF2LfZ71SoMZ2b4eI8p2vorjT+pcudW2pKFrE6hkuPOTsqVFF+XAT2yUiU4+JLOmmjfvbsrlrOe+nLfE01eTbLAAXafEdIO+64Yj4Vq81D0PUZkfig62er9HxcSyXNgmlU5bDWDxsUPk49TwF/hjuWZHpc3fquDCY4kshXfLGoqYXGgr6fg+RvS0aoY2JTJFg3BABLaMgaoWTG6IjtIa5OOWZ0t8hDKvd+h1M55Sg5qutV2QMAb+60aqw9M59vb34V8oOYiQFpsRnTTt/LIasDtuRBMM1qHiwjootDmVOZMdIShw4DEEA==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=epam.com header.i="@epam.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:x-ms-exchange-senderadcheck"
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com;
  • Cc: Dario Faggioli <dfaggioli@xxxxxxxx>, George Dunlap <gwd@xxxxxxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Meng Xu <mengxu@xxxxxxxxxxxxx>, Oleksii Moisieiev <Oleksii_Moisieiev@xxxxxxxx>
  • Delivery-date: Mon, 04 May 2026 13:40:58 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHc28ubWcgbGgaJskq0Bya4iIMSqw==
  • Thread-topic: [PATCH v3] xen/sched: rtds: assert replq is empty on timer (re-)init

In RTDS, removing the last eligible pCPU kills repl_timer. When a pCPU
is later re-added, rt_switch_sched() reinitializes the timer object.

cpupool_unassign_cpu_start() refuses to remove the last pCPU from a
populated cpupool: if any domain is still alive while the system is
active it returns -EBUSY, otherwise all domains are first moved to
cpupool0. Consequently, by the time the killed-timer branch runs, no
units remain in the pool and replq is guaranteed to be empty.

Document this invariant by asserting list_empty(replq) right after
init_timer(). This catches any future regression in cpupool semantics
that would leave pending replenishment events behind across a
TIMER_STATUS_killed -> init_timer() transition, where the timer would
otherwise stay disarmed until an unrelated event reprogrammed it.

Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@xxxxxxxx>
---

Changes in v3:
- rework patch according to the comments. Since cpupools functionality
rejects last pCPU from removing so re-arm functionality doesn't make
sence. So patch was reworked to check that replq is empty after timer init.

Changes in v2:
- update commit description, remove unneeded paragraph

 xen/common/sched/rt.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/xen/common/sched/rt.c b/xen/common/sched/rt.c
index 7b1f64a779..4b643eda30 100644
--- a/xen/common/sched/rt.c
+++ b/xen/common/sched/rt.c
@@ -743,6 +743,14 @@ rt_switch_sched(struct scheduler *new_ops, unsigned int 
cpu,
     {
         init_timer(&prv->repl_timer, repl_timer_handler, (void *)new_ops, cpu);
         dprintk(XENLOG_DEBUG, "RTDS: timer initialized on cpu %u\n", cpu);
+
+        /*
+         * cpupool_unassign_cpu_start() refuses to remove the last pCPU from
+         * a populated cpupool, so by the time this path runs (timer was
+         * killed because all RTDS pCPUs were removed) the pool must have
+         * been empty of domains, which implies replq is empty too.
+         */
+        ASSERT(list_empty(rt_replq(new_ops)));
     }
 
     sched_idle_unit(cpu)->priv = vdata;
-- 
2.43.0

base-commit: 680da952ac1ddfc94f9d1cd4dfa1815badae5302
branch: amoi_rtds_rearmv3


 


Rackspace

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