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

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


  • To: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: "Choi, Anderson" <Anderson.Choi@xxxxxxxxxx>
  • Date: Wed, 9 Jul 2025 00:18:28 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=boeing.com; dmarc=pass action=none header.from=boeing.com; dkim=pass header.d=boeing.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector5401; 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=NJhMUKmgXRm7rG9wDak+cZZvg3maGhU5bn/MU/R2Ynw=; b=yfH1Wn9WcLQah6zz8QRcJiHYjmVQiIsJbGSOB1zCq8fNO/7orNK7ZLszVYtamSPiigqb64FFcvtcjJXCEB7jwPhek1xXiH5VoL+gWP1WDscHQ7VwltDkPu7Ndcw0eC9xdBBvx2FuiUwjUD57WorGfKnO0KWr5rsLKzFxTGIe807rnjEOLm8E+gfffvyi0/f/L4caLmmbtvP/jJO5C+6gpJDgcxHF1PPVRDqzqUmzIBgSC0GZ4cFQ2CP2EYcVrQ+VEcNMUVuCulWx/gQUUGj/UaSpu1Dshd18TMDsEqAhRpJIeay7QtrVWwSi3/7Sgglgw1Y7kpxM00EXwN6A1GXBnw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector5401; d=microsoft.com; cv=none; b=d94tez8U7f4guBBraljpvsvESGBsiPq2acHRWa8MGlPc96MGFjh8tq16WymJeKfK/NNwGQaSBwHvJZSfUdWJOJuhGOjBNUFd6FfVjLuewNOjc7zmhzBnHfy38PWi9INsq0pFUS15Lkx3yXOBEuUzDOuDHRBjFOVFgPh4SaomrqDgY2dE3j7SBKS5jCroWdDgk3117MxoDGmGBANrvZQZ8N6lBduLP0rUyIWrjjUDyc/DTtCKdoNlAkc3drL7v8J3y3yzMQtUu6j74D4NHEhGB5CpcL8+EuV3rnmFJ0kmKTd0HF/ESG5lCgOACM2bGMTJcLMSV/xLSrkksD5xfxELJg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=boeing.com;
  • 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: Wed, 09 Jul 2025 00:18:48 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHb8Gb+1Qk//soDH0aTpVQu4kB81A==
  • Thread-topic: Re: Discussion on the delayed start of major frame with ARINC653 scheduler

Stewart,

> 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?

I appreciate your feedback on this subject. Here's the link to the patch I have 
submitted.

https://patchwork.kernel.org/project/xen-devel/patch/26f4fb409f03cb221a98692c4f291756d9cc26ae.1751948342.git.anderson.choi@xxxxxxxxxx/

Could you review the patch?

Thanks,
Anderson



 


Rackspace

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