arinc653: misc small adjustments
v2 cover arinc653: misc small adjustments
1: overwrite entire .dom_handle[] for Dom0 slots
2: don't assume Dom0 is the control domain
3: avoid array overrun
Jan
PATCH v2 1/3 arinc653: overwrite entire .dom_handle[] for Dom0 slots
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.
---
v2: Copy handle rather than clearing it.
xen/common/sched/arinc653.c +3 -1
@@ -420,7 +420,9 @@ a653sched_alloc_udata(const struct schedif ( 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
Quoted 7 lines · Jan Beulich
When that code still lived in
a653sched_init(), it was redundant with the earliermemset()/xzalloc(). Once moved, the full structure field needs setting, asdom_handle_cmp()usesmemcmp(). 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 <[email protected]>
Juergen
Stewart Hildebrand
Reviewed-byRe: [PATCH v2 1/3] arinc653: overwrite entire .dom_handle[] for Dom0 slots
Quoted 4 lines · Jürgen Groß
Quoted 3 lines · Jan Beulich
When that code still lived in
a653sched_init(), it was redundant with the earliermemset()/xzalloc(). Once moved, the full structure field needs setting, asdom_handle_cmp()usesmemcmp().
Nit: perhaps also mention that the concern is the dom_handle being clobbered by arinc653_sched_set()
Quoted 7 lines
Quoted 5 lines
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 <[email protected]>Reviewed-by Juergen Gross <[email protected]>
With or without the adjustment to the commit message:
Thanks!
PATCH v2 2/3 arinc653: don't assume Dom0 is the control domain
In reply to Jan BeulichLeaving aside highly disaggregated environments, the control domain is what will invoke XEN_SYSCTL_SCHEDOP_putinfo. Its vCPU-s therefore need to be able to run unconditionally, not those of the domain with ID 0 (which may not exist at all).
---
There being no "else" to the if(), what about other control domain vCPU-s? And why are they added to all scheduler instances?
---
v2: New.
xen/common/sched/arinc653.c +3 -3
@@ -411,10 +411,10 @@ a653sched_alloc_udata(const struct schedspin_lock_irqsave (&sched_priv->lock, flags);/* -* Add every one of dom0's units to the schedule, as long as there are -* slots available. +* Add every one of the control domain's units to the schedule, as long as +* there are slots available. */ -if ( unit->domain->domain_id ==0 ) +if (is_control_domain (unit->domain) ) { entry = sched_priv->num_schedule_entries;
Re: [PATCH v2 2/3] arinc653: don't assume Dom0 is the control domain
Quoted 7 lines · Jan Beulich
Leaving aside highly disaggregated environments, the control domain is what will invoke
XEN_SYSCTL_SCHEDOP_putinfo. Its vCPU-s therefore need to be able to run unconditionally, not those of the domain with ID 0 (which may not exist at all).Fixes 9f0c658baedc ("arinc: add cpu-pool support to scheduler")Signed-off-by Jan Beulich <[email protected]>
Quoted 2 lines
---
There being no "else" to theif(), what about other control domain vCPU-s?
a653sched_alloc_udata() is called for all units of a domain.
Quoted 1 line
And why are they added to all scheduler instances?
What do you mean with "added to all scheduler instances"?
a653sched_alloc_udata() will be called only for the units of a domain being in the instance (i.e. cpupool) designated by the ops parameter.
Quoted 18 lines
---
v2: New.xen/common/sched/arinc653.c +3
-3@@ -411,10 +411,10 @@ a653sched_alloc_udata(const struct schedspin_lock_irqsave (&sched_priv->lock, flags);/* -* Add every one of dom0's units to the schedule, as long as there are -* slots available. +* Add every one of the control domain's units to the schedule, as long as +* there are slots available. */ -if ( unit->domain->domain_id ==0 ) +if (is_control_domain (unit->domain) ) { entry = sched_priv->num_schedule_entries;
Re: [PATCH v2 2/3] arinc653: don't assume Dom0 is the control domain
Quoted 10 lines · Jürgen Groß
Quoted 7 lines · Jan Beulich
Leaving aside highly disaggregated environments, the control domain is what will invoke
XEN_SYSCTL_SCHEDOP_putinfo. Its vCPU-s therefore need to be able to run unconditionally, not those of the domain with ID 0 (which may not exist at all).Fixes 9f0c658baedc ("arinc: add cpu-pool support to scheduler")Signed-off-by Jan Beulich <[email protected]>Reviewed-by Juergen Gross <[email protected]>
Thanks.
Quoted 4 lines
Quoted 2 lines
---
There being no "else" to theif(), what about other control domain vCPU-s?
a653sched_alloc_udata()is called for all units of a domain.
Yes, and what if for the last few no vacant slot is available? With one vCPU per unit and Dom0 having 65 vCPU-s, this would already be a problem aiui. And ARINC653_MAX_DOMAINS_PER_SCHEDULE can't even be changed easily, as it's baked into the sysctl public header (when such an upper bound should really be an implementation detail, maybe a Kconfig setting). Yet then even the "DOMAINS" in the name is confusing, when it limits the number of units which can be dealt with.
Imo at the very, very least not being able to deal with all Dom0 / ctldom vCPU-s should be logged.
Quoted 6 lines
Quoted 1 line
And why are they added to all scheduler instances?
What do you mean with "added to all scheduler instances"?
a653sched_alloc_udata()will be called only for the units of a domain being in the instance (i.e. cpupool) designated by the ops parameter.
Perhaps the question is a result of me being confused. My understanding was that a653sched_alloc_udata() is supposed to be setting up per-unit data, not per-scheduler instance stuff. Yet the latter is what looks to be happening in the Dom0 (now control-domain) specific block of code.
Jan
Re: [PATCH v2 2/3] arinc653: don't assume Dom0 is the control domain
Quoted 19 lines · Jan Beulich
Quoted 10 lines · Jürgen Groß
Quoted 7 lines · Jan Beulich
Leaving aside highly disaggregated environments, the control domain is what will invoke
XEN_SYSCTL_SCHEDOP_putinfo. Its vCPU-s therefore need to be able to run unconditionally, not those of the domain with ID 0 (which may not exist at all).Fixes 9f0c658baedc ("arinc: add cpu-pool support to scheduler")Signed-off-by Jan Beulich <[email protected]>Reviewed-by Juergen Gross <[email protected]>Thanks.
Quoted 4 lines
Quoted 2 lines
---
There being no "else" to theif(), what about other control domain vCPU-s?
a653sched_alloc_udata()is called for all units of a domain.
Quoted 7 lines
Yes, and what if for the last few no vacant slot is available? With one vCPU per unit and Dom0 having 65 vCPU-s, this would already be a problem aiui. And
ARINC653_MAX_DOMAINS_PER_SCHEDULEcan't even be changed easily, as it's baked into the sysctl public header (when such an upper bound should really be an implementation detail, maybe aKconfigsetting). Yet then even the "DOMAINS" in the name is confusing, when it limits the number of units which can be dealt with.
AFAIUI the arinc653 scheduler is meant to serve a single physical cpu only. With core scheduling this can be extended to a core or a socket, but this won't increase the number of units, of course.
I agree that there should be safety checks added to ensure this assumption isn't violated, but OTOH the arinc653 scheduler is for very special setups only.
Quoted 3 lines
Imo at the very, very least not being able to deal with all Dom0 / ctldom vCPU-s should be logged.
I agree.
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
And why are they added to all scheduler instances?
What do you mean with "added to all scheduler instances"?
Quoted 7 lines
Quoted 2 lines
a653sched_alloc_udata()will be called only for the units of a domain being in the instance (i.e. cpupool) designated by the ops parameter.Perhaps the question is a result of me being confused. My understanding was that
a653sched_alloc_udata()is supposed to be setting up per-unit data, not per-scheduler instance stuff. Yet the latter is what looks to be happening in the Dom0 (now control-domain) specific block of code.
I don't think so.
Dom0 is special, as it needs to be functional without someone having uploaded the scheduling table. In case dom0 isn't in the cpupool of the arinc653 scheduler, there won't be any dom0-specific entries.
Juergen
Re: [PATCH v2 2/3] arinc653: don't assume Dom0 is the control domain
In reply to Jan BeulichQuoted 9 lines · Jan Beulich
Leaving aside highly disaggregated environments, the control domain is what will invoke
XEN_SYSCTL_SCHEDOP_putinfo. Its vCPU-s therefore need to be able to run unconditionally, not those of the domain with ID 0 (which may not exist at all).Fixes 9f0c658baedc ("arinc: add cpu-pool support to scheduler")Signed-off-by Jan Beulich <[email protected]>---
There being no "else" to theif(), what about other control domain vCPU-s?
I wonder if a panic() is appropriate in the else case. If not, at least a warning or error message should be logged.
Quoted 7 lines
And why are they added to all scheduler instances?
---
v2: New.
xen/common/sched/arinc653.c a653sched_alloc_udata(const struct sched · line 417
Quoted 10 lines
xen/common/sched/arinc653.c +3
-3@@ -411,10 +411,10 @@ a653sched_alloc_udata(const struct schedspin_lock_irqsave (&sched_priv->lock, flags);/* -* Add every one of dom0's units to the schedule, as long as there are -* slots available. +* Add every one of the control domain's units to the schedule, as long as +* there are slots available. */ -if ( unit->domain->domain_id ==0 ) +if (is_control_domain (unit->domain) )
Sorry, I didn't realize before that is_control_domain() includes the idle domain. We don't want to include the idle domain in the default schedule here.
I suggest adding '&& !is_idle_domain(unit->domain)' or similar.
Quoted 5 lines
xen/common/sched/arinc653.c +0
-0{ entry = sched_priv->num_schedule_entries;
Re: [PATCH v2 2/3] arinc653: don't assume Dom0 is the control domain
Quoted 6 lines · Stewart Hildebrand
Quoted 5 lines · Jan Beulich
xen/common/sched/arinc653.c +0
-0@@ -411,10 +411,10 @@ a653sched_alloc_udata(const struct schedspin_lock_irqsave (&sched_priv->lock, flags);
Quoted 11 lines
xen/common/sched/arinc653.c a653sched_alloc_udata(const struct sched · line 417
Quoted 8 lines
xen/common/sched/arinc653.c +3
-3/* -* Add every one of dom0's units to the schedule, as long as there are -* slots available. +* Add every one of the control domain's units to the schedule, as long as +* there are slots available. */ -if ( unit->domain->domain_id ==0 ) +if (is_control_domain (unit->domain) )Sorry, I didn't realize before that
is_control_domain()includes the idle domain. We don't want to include the idle domain in the default schedule here.
Hmm, I didn't recall that either (yet seeing xsm_set_system_active() I now remember having been involved). Will add the extra check, albeit it'll matter only during boot (i.e. if ARINC is the default scheduler or when BOOT_TIME_CPUPOOLS=y, aiui).
Jan
PATCH v2 3/3 arinc653: avoid array overrun
In reply to Jan BeulichIncrementing ->sched_index between bounds check and array access may result in accessing one past the array when that is fully filled (->num_schedule_entries == ARINC653_MAX_DOMAINS_PER_SCHEDULE).
---
Jürgen, provided I understood him correctly, suggests that something like
while ( now >= sched_priv->next_switch_time )
{
sched_priv->sched_index++;
ASSERT(sched_priv->sched_index < sched_priv->num_schedule_entries);
sched_priv->next_switch_time +=
sched_priv->schedule[sched_priv->sched_index].runtime;
}should also be valid to move to, due to constraints applied by arinc653_sched_set(). I'm hesitant to make such a change though, not really knowing the scheduler; the change here looks more obviously correct to me. Albeit the Fixes: tag may thus want dropping.
---
v2: New.
xen/common/sched/arinc653.c +1 -4
@@ -552,12 +552,9 @@ a653sched_do_schedule(/* Switch minor frame or find correct minor frame after a miss */ while ( (now >= sched_priv->next_switch_time) && - (sched_priv->sched_index < sched_priv->num_schedule_entries) ) - { - sched_priv->sched_index++; + (++sched_priv->sched_index < sched_priv->num_schedule_entries) ) sched_priv->next_switch_time += sched_priv->schedule[sched_priv->sched_index].runtime; - }/* * If we exhausted the domains in the schedule and still have time left
Re: [PATCH v2 3/3] arinc653: avoid array overrun
Quoted 7 lines · Jan Beulich
Incrementing ->sched_index between bounds check and array access may result in accessing one past the array when that is fully filled (->num_schedule_entries ==
ARINC653_MAX_DOMAINS_PER_SCHEDULE).Fixes 22787f2e107c ("ARINC 653 scheduler")Reported-by Kamil Frankowicz <[email protected]>Signed-off-by Jan Beulich <[email protected]>
with ...
Quoted 11 lines
---
Jürgen, provided I understood him correctly, suggests that something likewhile ( now >= sched_priv->next_switch_time ) { sched_priv->sched_index++; ASSERT(sched_priv->sched_index < sched_priv->num_schedule_entries); sched_priv->next_switch_time += sched_priv->schedule[sched_priv->sched_index].runtime; }
Quoted 4 lines
should also be valid to move to, due to constraints applied by
arinc653_sched_set(). I'm hesitant to make such a change though, not really knowing the scheduler; the change here looks more obviously correct to me. Albeit the Fixes: tag may thus want dropping.
the Fixes: tag dropped, as the constraints mentioned are IMO really enough to avoid an issue.
I agree that the current code is far from obviously correct, so your patch is definitively an improvement.
Juergen
Stewart Hildebrand
Reviewed-byRe: [PATCH v2 3/3] arinc653: avoid array overrun
Quoted 10 lines · Jürgen Groß
Quoted 7 lines · Jan Beulich
Incrementing ->sched_index between bounds check and array access may result in accessing one past the array when that is fully filled (->num_schedule_entries ==
ARINC653_MAX_DOMAINS_PER_SCHEDULE).Fixes 22787f2e107c ("ARINC 653 scheduler")Reported-by Kamil Frankowicz <[email protected]>Signed-off-by Jan Beulich <[email protected]>Reviewed-by Juergen Gross <[email protected]>
Thanks for this.
Quoted 16 lines
with ...
Quoted 13 lines
---
Jürgen, provided I understood him correctly, suggests that something likewhile ( now >=
sched_priv->next_switch_time)
{
sched_priv->sched_index++;ASSERT(sched_priv->sched_index < sched_priv->num_schedule_entries);sched_priv->next_switch_time+= sched_priv->schedule[sched_priv->sched_index].runtime; }should also be valid to move to, due to constraints applied by
arinc653_sched_set().
Not quite, because major_frame is allowed to be larger than the sum of the runtimes, and in that case the ASSERT would trigger during the idle period.
Quoted 6 lines
Quoted 3 lines
I'm hesitant to make such a change though, not
really knowing the scheduler; the change here looks more obviously correct to me. Albeit the Fixes: tag may thus want dropping.the Fixes: tag dropped, as the constraints mentioned are IMO really enough to avoid an issue.
No, the constraints aren't enough, the out-of-bounds access would occur during an idle period of a fully filled schedule. I suggest keeping the Fixes: tag.
Quoted 6 lines
I agree that the current code is far from obviously correct, so your patch is definitively an improvement.
Juergen
Re: [PATCH v2 3/3] arinc653: avoid array overrun
Quoted 40 lines · Stewart Hildebrand
Quoted 10 lines · Jürgen Groß
Quoted 7 lines · Jan Beulich
Incrementing ->sched_index between bounds check and array access may result in accessing one past the array when that is fully filled (->num_schedule_entries ==
ARINC653_MAX_DOMAINS_PER_SCHEDULE).Fixes 22787f2e107c ("ARINC 653 scheduler")Reported-by Kamil Frankowicz <[email protected]>Signed-off-by Jan Beulich <[email protected]>Reviewed-by Juergen Gross <[email protected]>Reviewed-by Stewart Hildebrand <[email protected]>Thanks for this.
Quoted 16 lines
with ...
Quoted 13 lines
---
Jürgen, provided I understood him correctly, suggests that something likewhile ( now >=
sched_priv->next_switch_time)
{
sched_priv->sched_index++;ASSERT(sched_priv->sched_index < sched_priv->num_schedule_entries);sched_priv->next_switch_time+= sched_priv->schedule[sched_priv->sched_index].runtime; }should also be valid to move to, due to constraints applied by
arinc653_sched_set().Not quite, because
major_frameis allowed to be larger than the sum of the runtimes, and in that case the ASSERT would trigger during the idle period.Quoted 4 lines
Quoted 3 lines
I'm hesitant to make such a change though, not
really knowing the scheduler; the change here looks more obviously correct to me. Albeit the Fixes: tag may thus want dropping.
Quoted 5 lines
Quoted 2 lines
the Fixes: tag dropped, as the constraints mentioned are IMO really enough to avoid an issue.
No, the constraints aren't enough, the out-of-bounds access would occur during an idle period of a fully filled schedule. I suggest keeping the Fixes: tag.
Jürgen, am I okay to keep your R-b with Fixes: re-added?
Jan
Re: [PATCH v2 3/3] arinc653: avoid array overrun
Quoted 41 lines · Jan Beulich
Quoted 40 lines · Stewart Hildebrand
Quoted 10 lines · Jürgen Groß
Quoted 7 lines · Jan Beulich
Incrementing ->sched_index between bounds check and array access may result in accessing one past the array when that is fully filled (->num_schedule_entries ==
ARINC653_MAX_DOMAINS_PER_SCHEDULE).Fixes 22787f2e107c ("ARINC 653 scheduler")Reported-by Kamil Frankowicz <[email protected]>Signed-off-by Jan Beulich <[email protected]>Reviewed-by Juergen Gross <[email protected]>Reviewed-by Stewart Hildebrand <[email protected]>Thanks for this.
Quoted 16 lines
with ...
Quoted 13 lines
---
Jürgen, provided I understood him correctly, suggests that something likewhile ( now >=
sched_priv->next_switch_time)
{
sched_priv->sched_index++;ASSERT(sched_priv->sched_index < sched_priv->num_schedule_entries);sched_priv->next_switch_time+= sched_priv->schedule[sched_priv->sched_index].runtime; }should also be valid to move to, due to constraints applied by
arinc653_sched_set().Not quite, because
major_frameis allowed to be larger than the sum of the runtimes, and in that case the ASSERT would trigger during the idle period.Quoted 4 lines
Quoted 3 lines
I'm hesitant to make such a change though, not
really knowing the scheduler; the change here looks more obviously correct to me. Albeit the Fixes: tag may thus want dropping.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
the Fixes: tag dropped, as the constraints mentioned are IMO really enough to avoid an issue.
No, the constraints aren't enough, the out-of-bounds access would occur during an idle period of a fully filled schedule. I suggest keeping the Fixes: tag.
Jürgen, am I okay to keep your R-b with Fixes: re-added?
Yes, of course.
Juergen
PATCH v3 1/1 arinc653: don't assume Dom0 is the control domain
In reply to Jan BeulichLeaving aside highly disaggregated environments, the control domain is what will invoke XEN_SYSCTL_SCHEDOP_putinfo. Its vCPU-s therefore need to be able to run unconditionally, not those of the domain with ID 0 (which may not exist at all).
---
There being no "else" to the if(), what about other control domain vCPU-s?
---
v3: Don't mistakenly include the idle domain.
v2: New.
xen/common/sched/arinc653.c +3 -3
@@ -411,10 +411,10 @@ a653sched_alloc_udata(const struct schedspin_lock_irqsave (&sched_priv->lock, flags);/* -* Add every one of dom0's units to the schedule, as long as there are -* slots available. +* Add every one of the control domain's units to the schedule, as long as +* there are slots available. */ -if ( unit->domain->domain_id ==0 ) +if (is_control_domain (unit->domain) && !is_idle_domain (unit->domain) ) { entry = sched_priv->num_schedule_entries;
Re: [PATCH v3] arinc653: don't assume Dom0 is the control domain
Quoted 9 lines · Jan Beulich
Leaving aside highly disaggregated environments, the control domain is what will invoke
XEN_SYSCTL_SCHEDOP_putinfo. Its vCPU-s therefore need to be able to run unconditionally, not those of the domain with ID 0 (which may not exist at all).Fixes 9f0c658baedc ("arinc: add cpu-pool support to scheduler")Signed-off-by Jan Beulich <[email protected]>---
There being no "else" to theif(), what about other control domain vCPU-s?
I guess this is a stale leftover. Doesn't matter for committing anyway.
Quoted 10 lines
---
v3: Don't mistakenly include the idle domain.
v2: New.xen/common/sched/arinc653.c +0
-0@@ -411,10 +411,10 @@ a653sched_alloc_udata(const struct schedspin_lock_irqsave (&sched_priv->lock, flags);/*
xen/common/sched/arinc653.c a653sched_alloc_udata(const struct sched · line 420
Quoted 10 lines
xen/common/sched/arinc653.c +3
-3-* Add every one of dom0's units to the schedule, as long as there are -* slots available. +* Add every one of the control domain's units to the schedule, as long as +* there are slots available. */ -if ( unit->domain->domain_id ==0 ) +if (is_control_domain (unit->domain) && !is_idle_domain (unit->domain) ) { entry = sched_priv->num_schedule_entries;
Hmm, is it really the control domain only which wants to be scheduled initially? I would think that at least the hardware domain and probably a Xenstore domain would want to be included, too.
In the end it might even be that other domains created via dom0less would want to be able to run initially. They could be part of a mandatory infrastructure. Why would they need to be created at boot if they are NOT important?
The question is whether the arinc653 scheduler is really meant for such setups. OTOH just modifying the test to:
if ( system_state < SYS_STATE_active &&
unit->domain->domain_id < DOMID_FIRST_RESERVED )seems to be fine for catching all those cases.
With or without this modification:
Juergen
Re: [PATCH v3] arinc653: don't assume Dom0 is the control domain
Quoted 38 lines · Jürgen Groß
Quoted 9 lines · Jan Beulich
Leaving aside highly disaggregated environments, the control domain is what will invoke
XEN_SYSCTL_SCHEDOP_putinfo. Its vCPU-s therefore need to be able to run unconditionally, not those of the domain with ID 0 (which may not exist at all).Fixes 9f0c658baedc ("arinc: add cpu-pool support to scheduler")Signed-off-by Jan Beulich <[email protected]>---
There being no "else" to theif(), what about other control domain vCPU-s?I guess this is a stale leftover. Doesn't matter for committing anyway.
Quoted 10 lines
---
v3: Don't mistakenly include the idle domain.
v2: New.xen/common/sched/arinc653.c +0
-0@@ -411,10 +411,10 @@ a653sched_alloc_udata(const struct schedspin_lock_irqsave (&sched_priv->lock, flags);/* xen/common/sched/arinc653.c a653sched_alloc_udata(const struct sched · line 420
Quoted 10 lines
xen/common/sched/arinc653.c +3
-3-* Add every one of dom0's units to the schedule, as long as there are -* slots available. +* Add every one of the control domain's units to the schedule, as long as +* there are slots available. */ -if ( unit->domain->domain_id ==0 ) +if (is_control_domain (unit->domain) && !is_idle_domain (unit->domain) ) { entry = sched_priv->num_schedule_entries;Hmm, is it really the control domain only which wants to be scheduled initially? I would think that at least the hardware domain and probably a Xenstore domain would want to be included, too.
Quoted 3 lines
In the end it might even be that other domains created via dom0less would want to be able to run initially. They could be part of a mandatory infrastructure. Why would they need to be created at boot if they are NOT important?
This part is easy to answer: Because in a dom0less setup you simply may have no toolstack at all. (At which point there may also be nothing to set a schedule, yes.)
Quoted 11 lines
The question is whether the arinc653 scheduler is really meant for such setups. OTOH just modifying the test to:
if ( system_state < SYS_STATE_active && unit->domain->domain_id < DOMID_FIRST_RESERVED )seems to be fine for catching all those cases.
With or without this modification:
Reviewed-by Juergen Gross <[email protected]>
Thanks, yet I'll have to leave to the maintainers to decide which form it should ultimately take. One remark: A restartable control domain wouldn't pass that conditional. Granted that's looking far into the future.
Jan
Re: [PATCH v3] arinc653: don't assume Dom0 is the control domain
Quoted 39 lines · Jan Beulich
Quoted 38 lines · Jürgen Groß
Quoted 9 lines · Jan Beulich
Leaving aside highly disaggregated environments, the control domain is what will invoke
XEN_SYSCTL_SCHEDOP_putinfo. Its vCPU-s therefore need to be able to run unconditionally, not those of the domain with ID 0 (which may not exist at all).Fixes 9f0c658baedc ("arinc: add cpu-pool support to scheduler")Signed-off-by Jan Beulich <[email protected]>---
There being no "else" to theif(), what about other control domain vCPU-s?I guess this is a stale leftover. Doesn't matter for committing anyway.
Quoted 10 lines
---
v3: Don't mistakenly include the idle domain.
v2: New.xen/common/sched/arinc653.c +0
-0@@ -411,10 +411,10 @@ a653sched_alloc_udata(const struct schedspin_lock_irqsave (&sched_priv->lock, flags);/* xen/common/sched/arinc653.c a653sched_alloc_udata(const struct sched · line 420
Quoted 10 lines
xen/common/sched/arinc653.c +3
-3-* Add every one of dom0's units to the schedule, as long as there are -* slots available. +* Add every one of the control domain's units to the schedule, as long as +* there are slots available. */ -if ( unit->domain->domain_id ==0 ) +if (is_control_domain (unit->domain) && !is_idle_domain (unit->domain) ) { entry = sched_priv->num_schedule_entries;Hmm, is it really the control domain only which wants to be scheduled initially? I would think that at least the hardware domain and probably a Xenstore domain would want to be included, too.
Quoted 7 lines
Quoted 3 lines
In the end it might even be that other domains created via dom0less would want to be able to run initially. They could be part of a mandatory infrastructure. Why would they need to be created at boot if they are NOT important?
This part is easy to answer: Because in a dom0less setup you simply may have no toolstack at all. (At which point there may also be nothing to set a schedule, yes.)
This is a known limitation. In a dom0less/hyperlaunch scenario, as future work, I would like to see the ability to configure the ARINC653 schedule in device tree, which would likely extend the existing boot time cpu pool work.
Quoted 8 lines
Quoted 8 lines
The question is whether the arinc653 scheduler is really meant for such setups. OTOH just modifying the test to:
if ( system_state < SYS_STATE_active && unit->domain->domain_id < DOMID_FIRST_RESERVED )seems to be fine for catching all those cases.
Quoted 7 lines
Quoted 3 lines
With or without this modification:
Reviewed-by Juergen Gross <[email protected]>Thanks, yet I'll have to leave to the maintainers to decide which form it should ultimately take. One remark: A restartable control domain wouldn't pass that conditional. Granted that's looking far into the future.
It may not be desirable to schedule domUs until the control domain has had a say in the matter, considering that the default schedule is unlikely to contain the desired minor frame runtimes. It's less clear whether to include hardware and xenstore domains in the default schedule, though I'm leaning toward only including the domain with ability to invoke XEN_SYSCTL_SCHEDOP_putinfo for now (i.e. the control domain).
Hm, the suggested 'system_state < SYS_STATE_active' check is possibly a good addition. This reinforces that the default schedule's purpose is merely to get a system booting until a user-provided schedule can be installed. Without this check, restarting the control domain could result in new entries being added while old entries remain, possibly ending up with duplicates and/or exhausting the schedule. However, the restarted domain would need to retain its uuid if it expects to be scheduled after restart.
Lastly, we may consider restricting the default schedule to Pool-0, and eventually we may want a mechanism to disable the default schedule altogether (e.g. when boot time cpupools are in use), but I don't think it's necessary to conflate those with the current patch.
Re: [PATCH v3] arinc653: don't assume Dom0 is the control domain
Quoted 83 lines · Stewart Hildebrand
Quoted 39 lines · Jan Beulich
Quoted 38 lines · Jürgen Groß
Quoted 9 lines · Jan Beulich
Leaving aside highly disaggregated environments, the control domain is what will invoke
XEN_SYSCTL_SCHEDOP_putinfo. Its vCPU-s therefore need to be able to run unconditionally, not those of the domain with ID 0 (which may not exist at all).Fixes 9f0c658baedc ("arinc: add cpu-pool support to scheduler")Signed-off-by Jan Beulich <[email protected]>---
There being no "else" to theif(), what about other control domain vCPU-s?I guess this is a stale leftover. Doesn't matter for committing anyway.
Quoted 10 lines
---
v3: Don't mistakenly include the idle domain.
v2: New.xen/common/sched/arinc653.c +0
-0@@ -411,10 +411,10 @@ a653sched_alloc_udata(const struct schedspin_lock_irqsave (&sched_priv->lock, flags);/* xen/common/sched/arinc653.c a653sched_alloc_udata(const struct sched · line 420
Quoted 10 lines
xen/common/sched/arinc653.c +3
-3-* Add every one of dom0's units to the schedule, as long as there are -* slots available. +* Add every one of the control domain's units to the schedule, as long as +* there are slots available. */ -if ( unit->domain->domain_id ==0 ) +if (is_control_domain (unit->domain) && !is_idle_domain (unit->domain) ) { entry = sched_priv->num_schedule_entries;Hmm, is it really the control domain only which wants to be scheduled initially? I would think that at least the hardware domain and probably a Xenstore domain would want to be included, too.
Quoted 7 lines
Quoted 3 lines
In the end it might even be that other domains created via dom0less would want to be able to run initially. They could be part of a mandatory infrastructure. Why would they need to be created at boot if they are NOT important?
This part is easy to answer: Because in a dom0less setup you simply may have no toolstack at all. (At which point there may also be nothing to set a schedule, yes.)
This is a known limitation. In a dom0less/hyperlaunch scenario, as future work, I would like to see the ability to configure the ARINC653 schedule in device tree, which would likely extend the existing boot time cpu pool work.
Quoted 8 lines
Quoted 8 lines
The question is whether the arinc653 scheduler is really meant for such setups. OTOH just modifying the test to:
if ( system_state < SYS_STATE_active && unit->domain->domain_id < DOMID_FIRST_RESERVED )seems to be fine for catching all those cases.
Quoted 7 lines
Quoted 3 lines
With or without this modification:
Reviewed-by Juergen Gross <[email protected]>Thanks, yet I'll have to leave to the maintainers to decide which form it should ultimately take. One remark: A restartable control domain wouldn't pass that conditional. Granted that's looking far into the future.
It may not be desirable to schedule domUs until the control domain has had a say in the matter, considering that the default schedule is unlikely to contain the desired minor frame runtimes. It's less clear whether to include hardware and xenstore domains in the default schedule, though I'm leaning toward only including the domain with ability to invoke
XEN_SYSCTL_SCHEDOP_putinfofor now (i.e. the control domain).Hm, the suggested '
system_state<SYS_STATE_active' check is possibly a good addition. This reinforces that the default schedule's purpose is merely to get a system booting until a user-provided schedule can be installed. Without this check, restarting the control domain could result in new entries being added while old entries remain, possibly ending up with duplicates and/or exhausting the schedule. However, the restarted domain would need to retain its uuid if it expects to be scheduled after restart.
Quoted 4 lines
Lastly, we may consider restricting the default schedule to Pool-0, and eventually we may want a mechanism to disable the default schedule altogether (e.g. when boot time cpupools are in use), but I don't think it's necessary to conflate those with the current patch.
So what does all of this mean for the patch here? Should I switch to Jürgen's suggestion? Should I merely add the system_state check, but otherwise keep as is? Or should I not change anything?
Jan
Re: [PATCH v3] arinc653: don't assume Dom0 is the control domain
Quoted 84 lines · Jan Beulich
Quoted 83 lines · Stewart Hildebrand
Quoted 39 lines · Jan Beulich
Quoted 38 lines · Jürgen Groß
Quoted 9 lines · Jan Beulich
Leaving aside highly disaggregated environments, the control domain is what will invoke
XEN_SYSCTL_SCHEDOP_putinfo. Its vCPU-s therefore need to be able to run unconditionally, not those of the domain with ID 0 (which may not exist at all).Fixes 9f0c658baedc ("arinc: add cpu-pool support to scheduler")Signed-off-by Jan Beulich <[email protected]>---
There being no "else" to theif(), what about other control domain vCPU-s?I guess this is a stale leftover. Doesn't matter for committing anyway.
Quoted 10 lines
---
v3: Don't mistakenly include the idle domain.
v2: New.xen/common/sched/arinc653.c +0
-0@@ -411,10 +411,10 @@ a653sched_alloc_udata(const struct schedspin_lock_irqsave (&sched_priv->lock, flags);/* xen/common/sched/arinc653.c a653sched_alloc_udata(const struct sched · line 420
Quoted 10 lines
xen/common/sched/arinc653.c +3
-3-* Add every one of dom0's units to the schedule, as long as there are -* slots available. +* Add every one of the control domain's units to the schedule, as long as +* there are slots available. */ -if ( unit->domain->domain_id ==0 ) +if (is_control_domain (unit->domain) && !is_idle_domain (unit->domain) ) { entry = sched_priv->num_schedule_entries;Hmm, is it really the control domain only which wants to be scheduled initially? I would think that at least the hardware domain and probably a Xenstore domain would want to be included, too.
Quoted 7 lines
Quoted 3 lines
In the end it might even be that other domains created via dom0less would want to be able to run initially. They could be part of a mandatory infrastructure. Why would they need to be created at boot if they are NOT important?
This part is easy to answer: Because in a dom0less setup you simply may have no toolstack at all. (At which point there may also be nothing to set a schedule, yes.)
This is a known limitation. In a dom0less/hyperlaunch scenario, as future work, I would like to see the ability to configure the ARINC653 schedule in device tree, which would likely extend the existing boot time cpu pool work.
Quoted 8 lines
Quoted 8 lines
The question is whether the arinc653 scheduler is really meant for such setups. OTOH just modifying the test to:
if ( system_state < SYS_STATE_active && unit->domain->domain_id < DOMID_FIRST_RESERVED )seems to be fine for catching all those cases.
Quoted 7 lines
Quoted 3 lines
With or without this modification:
Reviewed-by Juergen Gross <[email protected]>Thanks, yet I'll have to leave to the maintainers to decide which form it should ultimately take. One remark: A restartable control domain wouldn't pass that conditional. Granted that's looking far into the future.
It may not be desirable to schedule domUs until the control domain has had a say in the matter, considering that the default schedule is unlikely to contain the desired minor frame runtimes. It's less clear whether to include hardware and xenstore domains in the default schedule, though I'm leaning toward only including the domain with ability to invoke
XEN_SYSCTL_SCHEDOP_putinfofor now (i.e. the control domain).Hm, the suggested '
system_state<SYS_STATE_active' check is possibly a good addition. This reinforces that the default schedule's purpose is merely to get a system booting until a user-provided schedule can be installed. Without this check, restarting the control domain could result in new entries being added while old entries remain, possibly ending up with duplicates and/or exhausting the schedule. However, the restarted domain would need to retain its uuid if it expects to be scheduled after restart.
Quoted 8 lines
Quoted 4 lines
Lastly, we may consider restricting the default schedule to Pool-0, and eventually we may want a mechanism to disable the default schedule altogether (e.g. when boot time cpupools are in use), but I don't think it's necessary to conflate those with the current patch.
So what does all of this mean for the patch here? Should I switch to Jürgen's suggestion? Should I merely add the
system_statecheck, but otherwise keep as is? Or should I not change anything?
I think the patch is good as is, but I just want to give it a few more days to give Nate or others a chance to chime in. I'll follow up next week if there's no further discussion.
Re: [PATCH v3] arinc653: don't assume Dom0 is the control domain
Quoted 3 lines · Stewart Hildebrand
I think the patch is good as is, but I just want to give it a few more days to give Nate or others a chance to chime in. I'll follow up next week if there's no further discussion.
Ping.
Jan
Stewart Hildebrand
Reviewed-byRe: [PATCH v3] arinc653: don't assume Dom0 is the control domain
Quoted 6 lines · Jan Beulich
Quoted 3 lines · Stewart Hildebrand
I think the patch is good as is, but I just want to give it a few more days to give Nate or others a chance to chime in. I'll follow up next week if there's no further discussion.
Ping.
Thanks.
With the patch in its current form: