From bf12f48c2788215915387c8f1ce2f95fb82f5f20 Mon Sep 17 00:00:00 2001 From: Philip Romano Date: Wed, 22 Oct 2025 15:46:05 -0700 Subject: [PATCH] Adjust task priorities to fit within supported platform priority ranges (#4337) * Adjust task priorities to fit in supported platforms' priority ranges Darwin's task priority range is most restrictive (15-47); adjusted priorities to reside within that range. * Add comment clarifying TASK_PRIORITY_DEFAULT and TASK_DEFAULT * Adjust relative task priorities for uplink and downlink This moves uplink tasks to higher priority than downlink tasks and places consumer tasks at higher priority than producer tasks. --- Os/Task.hpp | 10 ++++++++++ Ref/Top/RefTopology.cpp | 2 +- Ref/Top/instances.fpp | 14 +++++++------- .../CdhCore/CdhCoreConfig/CdhCoreConfig.fpp | 8 ++++---- .../ComCcsds/ComCcsdsConfig/ComCcsdsConfig.fpp | 4 ++-- .../ComFprime/ComFprimeConfig/ComFprimeConfig.fpp | 2 +- .../ComLoggerTeeConfig/ComLoggerTeeConfig.fpp | 2 +- .../DataProductsConfig/DataProductsConfig.fpp | 8 ++++---- .../FileHandlingConfig/FileHandlingConfig.fpp | 8 ++++---- 9 files changed, 34 insertions(+), 24 deletions(-) diff --git a/Os/Task.hpp b/Os/Task.hpp index bf92351d22..f09a8feed0 100644 --- a/Os/Task.hpp +++ b/Os/Task.hpp @@ -34,8 +34,18 @@ class TaskHandle {}; class TaskInterface { public: + //! Sentinel value to use a default value for the task argument to which this is supplied. + //! + //! Implementations of TaskInterface::start() should make a special case to use some default value that is + //! valid for the target platform. static constexpr FwSizeType TASK_DEFAULT = std::numeric_limits::max(); + + //! Sentinel value to use a default priority for the task. + //! + //! Implementations of TaskInterface::start() should make a special case to use some default task priority + //! that is valid for the target platform. static constexpr FwTaskPriorityType TASK_PRIORITY_DEFAULT = std::numeric_limits::max(); + enum Status { OP_OK, //!< message sent/received okay INVALID_HANDLE, //!< Task handle invalid diff --git a/Ref/Top/RefTopology.cpp b/Ref/Top/RefTopology.cpp index 81d0e51680..6d18f751d0 100644 --- a/Ref/Top/RefTopology.cpp +++ b/Ref/Top/RefTopology.cpp @@ -32,7 +32,7 @@ U32 rateGroup2Context[Svc::ActiveRateGroup::CONNECTION_COUNT_MAX] = {}; U32 rateGroup3Context[Svc::ActiveRateGroup::CONNECTION_COUNT_MAX] = {}; enum TopologyConstants { - COMM_PRIORITY = 100, + COMM_PRIORITY = 34, }; /** diff --git a/Ref/Top/instances.fpp b/Ref/Top/instances.fpp index 3f8bb1246e..aa3bd7326b 100644 --- a/Ref/Top/instances.fpp +++ b/Ref/Top/instances.fpp @@ -29,39 +29,39 @@ module Ref { instance blockDrv: Ref.BlockDriver base id 0x10000000 \ queue size Default.QUEUE_SIZE \ stack size Default.STACK_SIZE \ - priority 140 + priority 47 instance rateGroup1Comp: Svc.ActiveRateGroup base id 0x10001000 \ queue size Default.QUEUE_SIZE \ stack size Default.STACK_SIZE \ - priority 120 + priority 43 instance rateGroup2Comp: Svc.ActiveRateGroup base id 0x10002000 \ queue size Default.QUEUE_SIZE \ stack size Default.STACK_SIZE \ - priority 119 + priority 42 instance rateGroup3Comp: Svc.ActiveRateGroup base id 0x10003000 \ queue size Default.QUEUE_SIZE \ stack size Default.STACK_SIZE \ - priority 118 + priority 41 instance pingRcvr: Ref.PingReceiver base id 0x10004000 \ queue size Default.QUEUE_SIZE \ stack size Default.STACK_SIZE \ - priority 100 + priority 23 instance typeDemo: Ref.TypeDemo base id 0x10005000 instance cmdSeq: Svc.CmdSequencer base id 0x10006000 \ queue size Default.QUEUE_SIZE \ stack size Default.STACK_SIZE \ - priority 97 + priority 20 instance dpDemo: Ref.DpDemo base id 0x0A10 \ queue size Default.QUEUE_SIZE \ stack size Default.STACK_SIZE \ - priority 96 + priority 19 # ---------------------------------------------------------------------- # Queued component instances diff --git a/Svc/Subtopologies/CdhCore/CdhCoreConfig/CdhCoreConfig.fpp b/Svc/Subtopologies/CdhCore/CdhCoreConfig/CdhCoreConfig.fpp index a40dbfaf0d..ecd0676537 100644 --- a/Svc/Subtopologies/CdhCore/CdhCoreConfig/CdhCoreConfig.fpp +++ b/Svc/Subtopologies/CdhCore/CdhCoreConfig/CdhCoreConfig.fpp @@ -17,10 +17,10 @@ module CdhCoreConfig { } module Priorities { - constant cmdDisp = 102 - constant $health = 101 - constant events = 100 - constant tlmSend = 99 + constant cmdDisp = 35 + constant $health = 24 + constant events = 23 + constant tlmSend = 22 } } diff --git a/Svc/Subtopologies/ComCcsds/ComCcsdsConfig/ComCcsdsConfig.fpp b/Svc/Subtopologies/ComCcsds/ComCcsdsConfig/ComCcsdsConfig.fpp index ebf131777f..f7cf1d8143 100644 --- a/Svc/Subtopologies/ComCcsds/ComCcsdsConfig/ComCcsdsConfig.fpp +++ b/Svc/Subtopologies/ComCcsds/ComCcsdsConfig/ComCcsdsConfig.fpp @@ -13,8 +13,8 @@ module ComCcsdsConfig { } module Priorities { - constant comQueue = 101 - constant aggregator = 100 + constant aggregator = 30 + constant comQueue = 29 } # Queue configuration constants diff --git a/Svc/Subtopologies/ComFprime/ComFprimeConfig/ComFprimeConfig.fpp b/Svc/Subtopologies/ComFprime/ComFprimeConfig/ComFprimeConfig.fpp index 6cc2ca960b..18799b8085 100644 --- a/Svc/Subtopologies/ComFprime/ComFprimeConfig/ComFprimeConfig.fpp +++ b/Svc/Subtopologies/ComFprime/ComFprimeConfig/ComFprimeConfig.fpp @@ -11,7 +11,7 @@ module ComFprimeConfig { } module Priorities { - constant comQueue = 101 + constant comQueue = 29 } # Queue configuration constants diff --git a/Svc/Subtopologies/ComLoggerTee/ComLoggerTeeConfig/ComLoggerTeeConfig.fpp b/Svc/Subtopologies/ComLoggerTee/ComLoggerTeeConfig/ComLoggerTeeConfig.fpp index 783a60c0b3..ee80c619b8 100644 --- a/Svc/Subtopologies/ComLoggerTee/ComLoggerTeeConfig/ComLoggerTeeConfig.fpp +++ b/Svc/Subtopologies/ComLoggerTee/ComLoggerTeeConfig/ComLoggerTeeConfig.fpp @@ -9,6 +9,6 @@ module ComLoggerTeeConfig { } module Priorities { - constant comLog = 95 + constant comLog = 18 } } diff --git a/Svc/Subtopologies/DataProducts/DataProductsConfig/DataProductsConfig.fpp b/Svc/Subtopologies/DataProducts/DataProductsConfig/DataProductsConfig.fpp index 99e7bec3b3..017976cdba 100644 --- a/Svc/Subtopologies/DataProducts/DataProductsConfig/DataProductsConfig.fpp +++ b/Svc/Subtopologies/DataProducts/DataProductsConfig/DataProductsConfig.fpp @@ -18,10 +18,10 @@ module DataProductsConfig { } module Priorities { - constant dpCat = 101 - constant dpMgr = 100 - constant dpWriter = 99 - constant dpBufferManager = 98 + constant dpCat = 24 + constant dpMgr = 23 + constant dpWriter = 22 + constant dpBufferManager = 21 } # Buffer management constants diff --git a/Svc/Subtopologies/FileHandling/FileHandlingConfig/FileHandlingConfig.fpp b/Svc/Subtopologies/FileHandling/FileHandlingConfig/FileHandlingConfig.fpp index 3e77f4a4e3..0bd7058770 100644 --- a/Svc/Subtopologies/FileHandling/FileHandlingConfig/FileHandlingConfig.fpp +++ b/Svc/Subtopologies/FileHandling/FileHandlingConfig/FileHandlingConfig.fpp @@ -17,10 +17,10 @@ module FileHandlingConfig { } module Priorities { - constant fileUplink = 101 - constant fileDownlink = 100 - constant fileManager = 99 - constant prmDb = 98 + constant fileUplink = 24 + constant fileDownlink = 23 + constant fileManager = 22 + constant prmDb = 21 } # File downlink configuration constants