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

Re: Discussion on the delayed start of major frame with ARINC653 scheduler


  • To: "Choi, Anderson" <Anderson.Choi@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
  • Date: Tue, 8 Jul 2025 14:21:00 -0400
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=boeing.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • 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=/eaqeWCZj7fbY+GezRrdfaMbQF5uimZQR4yDvQ3EZEI=; b=jdtnhLL6zWEFiWLXEEAQbitDxSlpQja3qFmLvyXOYd7V118nnYFKrQPJXEBYJ6rOVbCp07TVhNmqsOfBVW9VjiZvj9iYFalQw/cJbc5RtSqrlQbGpuHOx4lP4x9PrkVs+7JY9rDWVgfhR7Kp/r6KPBfw6BQKvqoqIU93vRedZfC1j5nEyl/o9Gum+ZnjqjFqldzV1K1Y/E2NrqhVUD5O2DgBamliCW5SL11SBcKp4JiqUl4ZqPv08vpMH8Ztd8n8RULBOhm979wx+nxBW9rgQNxbZfNWiVVNweCDcHejaMPrGRck3Q2roWM8usmgzjIHndhsCrOSxLM1bLSHpcNjbQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=XdixqD8e/4oAHpgu5vLRcRzYtz0CwOfLSoRbEnQmXSEoy6ViEAQNHlXuZlPACL2BCT+SzISIslfXKW3QPZGe0Ab12ge3dawXwCjQYeMruRo4b0Vl8DSbr1ZRVoH0C6rfrHuZWcPsm23t0AMWZn3Zuf7aNT9le2OlbT16teNd9sCKuMXb25IGQkyoWtC18np8TZEPPIIkg5e9WRTT1WByAbwkTxVuwJ4Xr7RpBp7Lf07jun9C8/+80sJ25KdcwsxLLUwIw/p9ELZUxW/dLSmcRqmYML0hg/tAlSVbtTXQ7C42eaRK2y2ErRjEm8AFU1ZFIep4wPEoI0FIfSa8nsh74w==
  • Cc: "nathan.studer@xxxxxxxxxxxxxxx" <nathan.studer@xxxxxxxxxxxxxxx>, "stewart@xxxxxxx" <stewart@xxxxxxx>, "Weber (US), Matthew L" <matthew.l.weber3@xxxxxxxxxx>, "Whitehead (US), Joshua C" <joshua.c.whitehead@xxxxxxxxxx>
  • Delivery-date: Tue, 08 Jul 2025 18:21:19 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 6/25/25 23:50, Choi, Anderson wrote:
> We are observing a slight delay in the start of major frame with the current 
> implementation of ARINC653 scheduler, which breaks the determinism in the 
> periodic execution of domains.
> 
> This seems to result from the logic where the variable "next_major_frame" is 
> calculated based on the current timestamp "now" at a653sched_do_schedule().
> 
> static void cf_check
> a653sched_do_schedule(
> <snip>
>     else if ( now >= sched_priv->next_major_frame )
>     {
>         /* time to enter a new major frame
>          * the first time this function is called, this will be true */
>         /* start with the first domain in the schedule */
>         sched_priv->sched_index = 0;
>         sched_priv->next_major_frame = now + sched_priv->major_frame;
>         sched_priv->next_switch_time = now + sched_priv->schedule[0].runtime;
>     }
> 
> Therefore, the inherent delta between "now" and the previous 
> "next_major_frame" is added to the next start of major frame represented by 
> the variable "next_major_frame".
> 
> And I think the issue can be fixed with the following change to use 
> "next_major_frame" as the base of calculation.
> 
> diff --git a/xen/common/sched/arinc653.c b/xen/common/sched/arinc653.c index 
> 930361fa5c..15affad3a3 100644
> --- a/xen/common/sched/arinc653.c
> +++ b/xen/common/sched/arinc653.c
> @@ -534,8 +534,11 @@ a653sched_do_schedule(
>           * the first time this function is called, this will be true */
>          /* start with the first domain in the schedule */
>          sched_priv->sched_index = 0;
> -        sched_priv->next_major_frame = now + sched_priv->major_frame;
> -        sched_priv->next_switch_time = now + sched_priv->schedule[0].runtime;
> +
> +        do {
> +            sched_priv->next_switch_time = sched_priv->next_major_frame + 
> sched_priv->schedule[0].runtime;
> +            sched_priv->next_major_frame += sched_priv->major_frame;
> +        } while ((now >= sched_priv->next_major_frame) || (now >= 
> sched_priv->next_switch_time));
>      }
>      Else
> 
> Can I get your advice on this subject?

The drift you're observing is a known issue with the scheduler. The next
major frame shouldn't be calculated with the "now" variable. It should
rather be calculated by adding the major frame period. Also, as your
code suggests, it should take into account edge cases where "now" may be
in the far future. There is another instance of next_major_frame being
calculated using "now" just above. Are you willing to submit a patch?



 


Rackspace

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