[PATCH v2 1/3] arinc653: overwrite entire .dom_handle[] for Dom0 slots

Jan Beulich posted 3 patches 1 week, 1 day ago
[PATCH v2 1/3] arinc653: overwrite entire .dom_handle[] for Dom0 slots
Posted by Jan Beulich 1 week, 1 day ago
When that code still lived in a653sched_init(), it was redundant with the
earlier memset() / xzalloc(). Once moved, the full structure field needs
setting, as dom_handle_cmp() uses memcmp(). Rather than implying the
handle to be all zero, copy the handle out of the domain structure.

Fixes: 9f0c658baedc ("arinc: add cpu-pool support to scheduler")
Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
v2: Copy handle rather than clearing it.

--- a/xen/common/sched/arinc653.c
+++ b/xen/common/sched/arinc653.c
@@ -420,7 +420,9 @@ a653sched_alloc_udata(const struct sched
 
         if ( entry < ARINC653_MAX_DOMAINS_PER_SCHEDULE )
         {
-            sched_priv->schedule[entry].dom_handle[0] = '\0';
+            memcpy(sched_priv->schedule[entry].dom_handle,
+                   unit->domain->handle,
+                   sizeof(sched_priv->schedule->dom_handle));
             sched_priv->schedule[entry].unit_id = unit->unit_id;
             sched_priv->schedule[entry].runtime = DEFAULT_TIMESLICE;
             sched_priv->schedule[entry].unit = unit;
Re: [PATCH v2 1/3] arinc653: overwrite entire .dom_handle[] for Dom0 slots
Posted by Jürgen Groß 1 week, 1 day ago
On 25.03.26 13:53, Jan Beulich wrote:
> When that code still lived in a653sched_init(), it was redundant with the
> earlier memset() / xzalloc(). Once moved, the full structure field needs
> setting, as dom_handle_cmp() uses memcmp(). Rather than implying the
> handle to be all zero, copy the handle out of the domain structure.
> 
> Fixes: 9f0c658baedc ("arinc: add cpu-pool support to scheduler")
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Juergen Gross <jgross@suse.com>


Juergen
Re: [PATCH v2 1/3] arinc653: overwrite entire .dom_handle[] for Dom0 slots
Posted by Stewart Hildebrand 1 week, 1 day ago
On 3/25/26 09:51, Jürgen Groß wrote:
> On 25.03.26 13:53, Jan Beulich wrote:
>> When that code still lived in a653sched_init(), it was redundant with the
>> earlier memset() / xzalloc(). Once moved, the full structure field needs
>> setting, as dom_handle_cmp() uses memcmp().

Nit: perhaps also mention that the concern is the dom_handle being clobbered by
arinc653_sched_set()

>> Rather than implying the
>> handle to be all zero, copy the handle out of the domain structure.
>>
>> Fixes: 9f0c658baedc ("arinc: add cpu-pool support to scheduler")
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 
> Reviewed-by: Juergen Gross <jgross@suse.com>

With or without the adjustment to the commit message:
Reviewed-by: Stewart Hildebrand <stewart@stew.dk>

Thanks!