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

[PATCH v2] xen/sched: rtds: re-arm repl_timer after timer re-initialization


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Oleksii Moisieiev <Oleksii_Moisieiev@xxxxxxxx>
  • Date: Fri, 3 Apr 2026 09:29:22 +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=K9e2KZc+muJukT2Hv/BjeYVECVhK83W83VEOsdy6uUk=; b=IwePs3tf7Z9u0Wvr7YEcT5KxNaH87e50Wf11TFdzUfq8LDINskgL6QgWYV5zgUOaDrkWuMry2h/R1HWBYONW85UuGDeVmNKrslFls94pX5uuqwn2wcOpxpIyWexJ1ocQ4T6XPfVEkmAKYhzlaZKmT5N4foElT5+PPBE/pPrD47JEvSEqbXyB63jZPMm2Q7L3sZZb6gbGZjmS3HWgQ9v3El1QsVLc9PQplKZcaa/cRksJUrvMSpKyRB7Z9cB3XvLjghKpKWFG23dGqdCtgRsSGrewK2AjxeVi6K0n8fssW1AENCmB6ekSHHmOxQtYLxh9gxZ53+y6t2GypTpFadRx+Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Tv52o/E/BWwJiHAyX6/kyAOn3JhU05z2KNfdXrQy+OwOJzXoxgSifUoY2GarTQTKQ4t5aZ8NeRi2vQz8rqi9aaBO7mP4cnbhma9aMNO9GbBy2aTwPpTVw1KQ1x1EJTfPIwfPKTv3ZNEy6giqcNgr/XT7CRXw/+xhjXWAACiQyROSgrdx1vSIpSnFajm36M2lDdIdHzZuN9VPPX6Tx1iIAAfRE2qSYHeqeqK1O0v56EJRdD2FHsgE67yarhjKoaNGVD2MZTFDjRJfRC0tunB0CGo78DbM8jFX8MCRwpIrMNW0BOwSGAcWiJH3Yy24hTyT5Ucu+g2jqUdmMfhWChNLeQ==
  • 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: Fri, 03 Apr 2026 09:29:32 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHcw0xaLi1v6OicGUys1RGy4ug5LA==
  • Thread-topic: [PATCH v2] xen/sched: rtds: re-arm repl_timer after timer re-initialization

In RTDS, removing the last eligible pCPU can kill repl_timer.
When a pCPU is later re-added, rt_switch_sched() reinitializes the
timer object, but pending entries may already exist in replq.

Without re-arming from replq head, replenishment can remain inactive
until some unrelated event programs the timer again. This may stall
budget replenishment for non-extratime units.

Fix this by re-arming repl_timer in rt_switch_sched() immediately after
init_timer() when replq is non-empty, using the earliest pending
deadline.

This keeps behavior unchanged when replq is empty.

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

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

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

diff --git a/xen/common/sched/rt.c b/xen/common/sched/rt.c
index 7b1f64a779..59021e1110 100644
--- a/xen/common/sched/rt.c
+++ b/xen/common/sched/rt.c
@@ -741,8 +741,17 @@ rt_switch_sched(struct scheduler *new_ops, unsigned int 
cpu,
     if ( prv->repl_timer.status == TIMER_STATUS_invalid ||
          prv->repl_timer.status == TIMER_STATUS_killed )
     {
+        struct list_head *replq = rt_replq(new_ops);
+
         init_timer(&prv->repl_timer, repl_timer_handler, (void *)new_ops, cpu);
         dprintk(XENLOG_DEBUG, "RTDS: timer initialized on cpu %u\n", cpu);
+
+        /*
+         * When re-adding CPUs after all RTDS CPUs were removed, replq may
+         * already contain pending replenishment events. Re-arm immediately.
+         */
+        if ( !list_empty(replq) )
+            set_timer(&prv->repl_timer, replq_elem(replq->next)->cur_deadline);
     }
 
     sched_idle_unit(cpu)->priv = vdata;
-- 
2.43.0

base-commit: a7bf8ff218ca05eb3674fdfd2817f6cff471e96a


 


Rackspace

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