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

RE: [PATCH] arinc653: move next_switch_time access under lock


  • To: Jan Beulich <jbeulich@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Nathan Studer <Nathan.Studer@xxxxxxxxxxxxxxx>
  • Date: Tue, 18 Mar 2025 15:39:26 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=dornerworks.com; dmarc=pass action=none header.from=dornerworks.com; dkim=pass header.d=dornerworks.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=F3b561ubURSglaEGA8jGAZ/fGubCHDnLCjrFm1MgkQo=; b=EBxq7KbjnZDT2BXuTDUqKjBZp+3X1CZt0yyIZWNAp1i/98ptdTRrja5DAIqFNMmWNWudfLFKgbkSl38r9lijxCgnbqcK+8FX7/TfTnxgdt5/G9KxpekWe5vQeo+cuvEHp834X5WdIYfxQ3Ix0fvWfKSy7eg/1/XpVzfPQX9P4kZSXRknubswXDU+mWBpG+L5/G0CPYjFxzrUaQ5U5BH7P+04gBU/CDPvjndVomh1uPUe7FUQ4NEQd8qGIXjBsavv20eM0BBSM0DMHML4VAkZtusz4MVsu6KoGvTeLVbHcWEFFCCay+iomtj4LtW7p5jSrheu4urvEEyCb05r83raog==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector5401; d=microsoft.com; cv=none; b=b34jXU0JnZYACLsoA5De6RPujc9cdkUY+2bNfFip4ZvbUknPIIfhsus23XuJziKyYrGAcL7EJQWtwsWrBybhZr+C9m/lFRDanN234eMzRBpsbJIOSr0b9hd1POc8mWVnGVssxZ+5rD8rpdkhni1ljhIIpccYibceSwcEmxQxUE7vGnMZo4CZIwO9FxsJ7W19TqjV6iRM+c+pvT2LfHpaimMzvS6WwFsB1/Ge6YSMCOsFktz8p8OwfnqAPifGuCVcHj9H6eCiSPzDbpzO1ImSJwm5jEmDJnCDDoC9HjkTSCeExFuxhahKK94ygbgz4WZqqBYYsLEbWQA+1oalaaOqWA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=dornerworks.com;
  • Cc: Stewart Hildebrand <stewart@xxxxxxx>
  • Delivery-date: Tue, 18 Mar 2025 15:40:01 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHblx9ZXx8iZV2D30elmjmYWo3xErN5ANvQ
  • Thread-topic: [PATCH] arinc653: move next_switch_time access under lock

On 17/03/25 05:31, Jan Beulich wrote:
> Even before its recent movement to the scheduler's private data structure it 
> looks
> to have been wrong to update the field under lock, but then read it with the 
> lock
> no longer held.
> 
> Coverity-ID: 1644500
> Fixes: 9f0c658baedc ("arinc: add cpu-pool support to scheduler")
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
> ---
> The Fixes: tag references where the locking was added; I can't exclude there 
> was
> an issue here already before that.
> 
> --- a/xen/common/sched/arinc653.c
> +++ b/xen/common/sched/arinc653.c
> @@ -579,6 +579,9 @@ a653sched_do_schedule(
>       */
>      BUG_ON(now >= sched_priv->next_major_frame);
> 
> +    prev->next_time = sched_priv->next_switch_time - now;
> +
> +    /* Return the amount of time the next domain has to run. */

This could be pushed up to immediately after next_switch_time is set, but here 
is
good enough.  However, did you mean to put the comment after the assignment
separated by whitespace?

        Nate

>      spin_unlock_irqrestore(&sched_priv->lock, flags);
> 
>      /* Tasklet work (which runs in idle UNIT context) overrides all else. */ 
> @@ -
> 590,11 +593,7 @@ a653sched_do_schedule(
>           && (sched_unit_master(new_task) != cpu) )
>          new_task = IDLETASK(cpu);
> 
> -    /*
> -     * Return the amount of time the next domain has to run and the address
> -     * of the selected task's UNIT structure.
> -     */
> -    prev->next_time = sched_priv->next_switch_time - now;
> +    /* Also return the address of the selected task's UNIT structure.
> + */
>      prev->next_task = new_task;
>      new_task->migrated = false;


 


Rackspace

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