xen/domain: Idle domain creation improvements
cover xen/domain: Idle domain creation improvements
domain_create() has some unnecessary complexity for constructing the idle domain. Rearrange x86's needs, to simplify the common logic.
https://cirrus-ci.com/build/5234584097390592
https://gitlab.com/xen-project/people/andyhhp/xen/-/pipelines/1379531597
Andrew Cooper (4):
xen/domain: Introduce arch_init_idle_domain()
x86/domain: Implement arch_init_idle_domain()
xen/domain: Simpliy domain_create() now the idle domain is complete
earlier
arch/domain: Clean up the idle domain remnants in arch_domain_create()
xen/arch/arm/domain.c | 6 -- xen/arch/x86/domain.c | 34 +++----- xen/arch/x86/include/asm/domain.h | 3 + xen/common/domain.c | 130 +++++++++++++++--------------- xen/include/xen/sched.h | 5 ++ 5 files changed, 82 insertions(+), 96 deletions(-)
base-commit: 57338346f29cea7b183403561bdc5f407163b846
Signature · 1 line
2.39.2
PATCH 1/4 xen/domain: Introduce arch_init_idle_domain()
The idle domain causes a large amount of complexity in domain_create() because of x86's need to initialise d->arch.ctxt_switch in arch_domain_create().
In order to address this, introduce an optional hook to perform extra initialisation of the idle domain.
No functional change.
---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>
CC: Volodymyr Babchuk <[email protected]>
CC: Bertrand Marquis <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Oleksii Kurochko <[email protected]>
--- xen/common/domain.c | 3 +++ xen/include/xen/sched.h | 5 +++++ 2 files changed, 8 insertions(+)
xen/common/domain.c +3 -0
@@ -685,6 +685,9 @@ struct domain *domain_create(domid_t domid,rangeset_domain_initialise (d); +if (is_idle_domain (d) ) +arch_init_idle_domain (d); +/* DOMID_{XEN,IO,etc} (other than IDLE) are sufficiently constructed. */ if (is_system_domain (d) && !is_idle_domain (d) )return d;
xen/include/xen/sched.h +5 -0
@@ -728,6 +728,11 @@ struct domain *domain_create(domid_t domid,struct xen_domctl_createdomain *config, unsigned int flags); +#ifndef arch_init_idle_domain +/* Optional, if there's any construction necessary for DOMID_IDLE */ +static inline void arch_init_idle_domain (struct domain *d) {} +#endif +/* * rcu_lock_domain_by_id() is more efficient than get_domain_by_id(). * This is the preferred function if the returned domain reference
Signature · 1 line
2.39.2
Re: [PATCH 1/4] xen/domain: Introduce arch_init_idle_domain()
Quoted 9 lines · Andrew Cooper
The idle domain causes a large amount of complexity in
domain_create()because of x86's need to initialised->arch.ctxt_switchinarch_domain_create().In order to address this, introduce an optional hook to perform extra initialisation of the idle domain.
No functional change.
Signed-off-by Andrew Cooper <[email protected]>
Quoted 47 lines
---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>
CC: Volodymyr Babchuk <[email protected]>
CC: Bertrand Marquis <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Oleksii Kurochko <[email protected]>--- xen/common/domain.c | 3 +++ xen/include/xen/sched.h | 5 +++++ 2 files changed, 8 insertions(+)xen/common/domain.c +3
-0@@ -685,6 +685,9 @@ struct domain *domain_create(domid_t domid,rangeset_domain_initialise (d); +if (is_idle_domain (d) ) +arch_init_idle_domain (d); +/* DOMID_{XEN,IO,etc} (other than IDLE) are sufficiently constructed. */ if (is_system_domain (d) && !is_idle_domain (d) )return d;xen/include/xen/sched.h +5
-0@@ -728,6 +728,11 @@ struct domain *domain_create(domid_t domid,struct xen_domctl_createdomain *config, unsigned int flags); +#ifndef arch_init_idle_domain +/* Optional, if there's any construction necessary for DOMID_IDLE */ +static inline void arch_init_idle_domain (struct domain *d) {} +#endif +/* * rcu_lock_domain_by_id() is more efficient than get_domain_by_id(). * This is the preferred function if the returned domain reference Signature · 1 line
2.39.2
PATCH 2/4 x86/domain: Implement arch_init_idle_domain()
In reply to Andrew CooperThe idle domain needs d->arch.ctxt_switch initialised on x86. Implement the new arch_init_idle_domain() in order to do this.
Right now this double-initalises the ctxt_switch pointer, but it's safe and will stop happening when domain_create() is cleaned up as a consequence.
No practical change.
---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>
CC: Volodymyr Babchuk <[email protected]>
CC: Bertrand Marquis <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Oleksii Kurochko <[email protected]>
--- xen/arch/x86/domain.c | 19 ++++++++++++------- xen/arch/x86/include/asm/domain.h | 3 +++ 2 files changed, 15 insertions(+), 7 deletions(-)
xen/arch/x86/domain.c +12 -7
@@ -768,6 +768,17 @@ static bool emulation_flags_ok(const struct domain *d, uint32_t emflags)return true; } +void __init arch_init_idle_domain (struct domain *d) +{ +static const struct arch_csw idle_csw = { + .from = paravirt_ctxt_switch_from, + .to = paravirt_ctxt_switch_to, + .tail = idle_loop, + }; + + d->arch.ctxt_switch = &idle_csw; +} +int arch_domain_create (struct domain *d,struct xen_domctl_createdomain *config,unsigned int flags)
@@ -783,13 +794,7 @@ int arch_domain_create(struct domain *d,/* Minimal initialisation for the idle domain. */ if (unlikely (is_idle_domain (d)) ) { -static const struct arch_csw idle_csw = { - .from = paravirt_ctxt_switch_from, - .to = paravirt_ctxt_switch_to, - .tail = idle_loop, - }; - - d->arch.ctxt_switch = &idle_csw; +arch_init_idle_domain (d); d->arch.cpu_policy =ZERO_BLOCK_PTR ;/* Catch stray misuses. */
xen/arch/x86/include/asm/domain.h +3 -0
@@ -779,6 +779,9 @@ struct arch_vcpu_io {/* Maxphysaddr supportable by the paging infrastructure. */ unsigned int domain_max_paddr_bits (const struct domain *d); +#define arch_init_idle_domain arch_init_idle_domain +void arch_init_idle_domain (struct domain *d); +#endif /* __ASM_DOMAIN_H__ */ /*
Signature · 1 line
2.39.2
Re: [PATCH 2/4] x86/domain: Implement arch_init_idle_domain()
Quoted 47 lines · Andrew Cooper
The idle domain needs
d->arch.ctxt_switchinitialised on x86. Implement the newarch_init_idle_domain()in order to do this.Right now this double-initalises the
ctxt_switchpointer, but it's safe and will stop happening whendomain_create()is cleaned up as a consequence.No practical change.
Signed-off-by Andrew Cooper <[email protected]>---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>
CC: Volodymyr Babchuk <[email protected]>
CC: Bertrand Marquis <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Oleksii Kurochko <[email protected]>--- xen/arch/x86/domain.c | 19 ++++++++++++------- xen/arch/x86/include/asm/domain.h | 3 +++ 2 files changed, 15 insertions(+), 7 deletions(-)xen/arch/x86/domain.c +11
-0@@ -768,6 +768,17 @@ static bool emulation_flags_ok(const struct domain *d, uint32_t emflags)return true; } +void __init arch_init_idle_domain (struct domain *d) +{ +static const struct arch_csw idle_csw = { + .from = paravirt_ctxt_switch_from, + .to = paravirt_ctxt_switch_to, + .tail = idle_loop, + }; + + d->arch.ctxt_switch = &idle_csw; +} +int arch_domain_create (struct domain *d,struct xen_domctl_createdomain *config,unsigned int flags)@@ -783,13 +794,7 @@ int arch_domain_create(struct domain *d,/* Minimal initialisation for the idle domain. */
xen/arch/x86/domain.c int arch_domain_create(struct domain *d, · line 797
Quoted 10 lines
xen/arch/x86/domain.c +1
-7if (unlikely (is_idle_domain (d)) ) { -static const struct arch_csw idle_csw = { - .from = paravirt_ctxt_switch_from, - .to = paravirt_ctxt_switch_to, - .tail = idle_loop, - }; - - d->arch.ctxt_switch = &idle_csw; +arch_init_idle_domain (d);
I don't understand why you need this call to arch_init_idle_domain(d) here given the other call to arch_init_idle_domain added by patch #1.
Also I am not sure why you didn't move the line below (cpu_policy = ZERO_BLOCK_PTR) to arch_init_idle_domain as well but I admit I don't know this code
I realize you are removing all this code in patch #4... but still why the line below is not needed anymore? And why do we need to add an extra call to arch_init_idle_domain temporarily in this patch?
Quoted 19 lines
xen/arch/x86/domain.c +0
-0d->arch.cpu_policy =ZERO_BLOCK_PTR ;/* Catch stray misuses. */ xen/arch/x86/include/asm/domain.h +3
-0@@ -779,6 +779,9 @@ struct arch_vcpu_io {/* Maxphysaddr supportable by the paging infrastructure. */ unsigned int domain_max_paddr_bits (const struct domain *d); +#define arch_init_idle_domain arch_init_idle_domain +void arch_init_idle_domain (struct domain *d); +#endif /* __ASM_DOMAIN_H__ */ /* Signature · 1 line
2.39.2
Re: [PATCH 2/4] x86/domain: Implement arch_init_idle_domain()
Quoted 52 lines · Stefano Stabellini
Quoted 51 lines · Andrew Cooper
The idle domain needs
d->arch.ctxt_switchinitialised on x86. Implement the newarch_init_idle_domain()in order to do this.Right now this double-initalises the
ctxt_switchpointer, but it's safe and will stop happening whendomain_create()is cleaned up as a consequence.No practical change.
Signed-off-by Andrew Cooper <[email protected]>---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>
CC: Volodymyr Babchuk <[email protected]>
CC: Bertrand Marquis <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Oleksii Kurochko <[email protected]>--- xen/arch/x86/domain.c | 19 ++++++++++++------- xen/arch/x86/include/asm/domain.h | 3 +++ 2 files changed, 15 insertions(+), 7 deletions(-)xen/arch/x86/domain.c +11
-2@@ -768,6 +768,17 @@ static bool emulation_flags_ok(const struct domain *d, uint32_t emflags)return true; } +void __init arch_init_idle_domain (struct domain *d) +{ +static const struct arch_csw idle_csw = { + .from = paravirt_ctxt_switch_from, + .to = paravirt_ctxt_switch_to, + .tail = idle_loop, + }; + + d->arch.ctxt_switch = &idle_csw; +} +int arch_domain_create (struct domain *d,struct xen_domctl_createdomain *config,unsigned int flags)@@ -783,13 +794,7 @@ int arch_domain_create(struct domain *d,/* Minimal initialisation for the idle domain. */ if (unlikely (is_idle_domain (d)) ) { -static const struct arch_csw idle_csw = { - .from = paravirt_ctxt_switch_from,
Quoted 8 lines
xen/arch/x86/domain.c int arch_domain_create(struct domain *d, · line 797
Quoted 6 lines
xen/arch/x86/domain.c +1
-5- .to = paravirt_ctxt_switch_to, - .tail = idle_loop, - }; - - d->arch.ctxt_switch = &idle_csw; +arch_init_idle_domain (d);I don't understand why you need this call to
arch_init_idle_domain(d)here given the other call toarch_init_idle_domainadded by patch #1.
It's stale from an older version of the series. I'll drop it, which will reduce the churn in this as well as patch 4.
Quoted 3 lines
Also I am not sure why you didn't move the line below (
cpu_policy=ZERO_BLOCK_PTR) toarch_init_idle_domainas well but I admit I don't know this code.
See the thread on patch 4 with Jan. It's intentional.
This was a safety check which is dubious (it's not special enough to warrant it on its own), and has never tripped.
I'll note it's intentional omission in the commit message.
~Andrew
PATCH 3/4 xen/domain: Simpliy domain_create() now the idle domain is complete earlier
In reply to Andrew CooperWith x86 implementing arch_init_idle_domain(), there is no longer any need to call arch_domain_create() with the idle domain.
Have the idle domain exit early with all other system domains. Move the static-analysis ASSERT() earlier. Then, remove the !is_idle_domain() protections around the majority of domain_create() and remove one level of indentation.
No practical change.
---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>
CC: Volodymyr Babchuk <[email protected]>
CC: Bertrand Marquis <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Oleksii Kurochko <[email protected]>
--- xen/common/domain.c | 127 +++++++++++++++++++++----------------------- 1 file changed, 60 insertions(+), 67 deletions(-)
xen/common/domain.c +60 -67
@@ -688,95 +688,88 @@ struct domain *domain_create(domid_t domid,if (is_idle_domain (d) )arch_init_idle_domain (d); -/* DOMID_{XEN,IO,etc} (other than IDLE) are sufficiently constructed. */ -if (is_system_domain (d) && !is_idle_domain (d) ) +/* DOMID_{XEN,IO,IDLE,etc} are sufficiently constructed. */ +if (is_system_domain (d) )return d; +/* +* The assertion helps static analysis tools infer that config cannot be +* NULL in this branch, which in turn means that it can be safely +* dereferenced. Therefore, this assertion is not redundant. +*/ +ASSERT (config); +#ifdef CONFIG_HAS_PIRQ -if ( !is_idle_domain (d) ) - { -if ( !is_hardware_domain (d) ) - d->nr_pirqs = nr_static_irqs + extra_domU_irqs; -else - d->nr_pirqs = extra_hwdom_irqs ? nr_static_irqs + extra_hwdom_irqs - :arch_hwdom_irqs (d); - d->nr_pirqs =min (d->nr_pirqs, nr_irqs); +if ( !is_hardware_domain (d) ) + d->nr_pirqs = nr_static_irqs + extra_domU_irqs; +else + d->nr_pirqs = extra_hwdom_irqs ? nr_static_irqs + extra_hwdom_irqs + :arch_hwdom_irqs (d); + d->nr_pirqs =min (d->nr_pirqs, nr_irqs); -radix_tree_init (&d->pirq_tree); - } +radix_tree_init (&d->pirq_tree);#endif if ( (err =arch_domain_create (d, config, flags)) !=0 ) goto fail; init_status |= INIT_arch; -if ( !is_idle_domain (d) ) - { -/* -* The assertion helps static analysis tools infer that config cannot -* be NULL in this branch, which in turn means that it can be safely -* dereferenced. Therefore, this assertion is not redundant. -*/ -ASSERT (config); - -watchdog_domain_init (d); - init_status |= INIT_watchdog; +watchdog_domain_init (d); + init_status |= INIT_watchdog; - err = -ENOMEM ; - d->iomem_caps =rangeset_new (d,"I/O Memory" , RANGESETF_prettyprint_hex); - d->irq_caps =rangeset_new (d,"Interrupts" ,0 ); -if ( !d->iomem_caps || !d->irq_caps ) - goto fail; + err = -ENOMEM ; + d->iomem_caps =rangeset_new (d,"I/O Memory" , RANGESETF_prettyprint_hex); + d->irq_caps =rangeset_new (d,"Interrupts" ,0 ); +if ( !d->iomem_caps || !d->irq_caps ) + goto fail; -if ( (err =xsm_domain_create (XSM_HOOK , d, config->ssidref)) !=0 ) - goto fail; +if ( (err =xsm_domain_create (XSM_HOOK , d, config->ssidref)) !=0 ) + goto fail; - d->controller_pause_count =1 ; -atomic_inc (&d->pause_count); + d->controller_pause_count =1 ; +atomic_inc (&d->pause_count); -if ( (err =evtchn_init (d, config->max_evtchn_port)) !=0 ) - goto fail; - init_status |= INIT_evtchn; +if ( (err =evtchn_init (d, config->max_evtchn_port)) !=0 ) + goto fail; + init_status |= INIT_evtchn; -if ( (err =grant_table_init (d, config->max_grant_frames, - config->max_maptrack_frames, - config->grant_opts)) !=0 ) - goto fail; - init_status |= INIT_gnttab; +if ( (err =grant_table_init (d, config->max_grant_frames, + config->max_maptrack_frames, + config->grant_opts)) !=0 ) + goto fail; + init_status |= INIT_gnttab; -if ( (err =argo_init (d)) !=0 ) - goto fail; +if ( (err =argo_init (d)) !=0 ) + goto fail; - err = -ENOMEM ; + err = -ENOMEM ; + d->pbuf =xzalloc_array (char,DOMAIN_PBUF_SIZE ); +if ( !d->pbuf ) + goto fail; - d->pbuf =xzalloc_array (char,DOMAIN_PBUF_SIZE ); -if ( !d->pbuf ) - goto fail; +if ( (err =sched_init_domain (d, config->cpupool_id)) !=0 ) + goto fail; -if ( (err =sched_init_domain (d, config->cpupool_id)) !=0 ) - goto fail; +if ( (err =late_hwdom_init (d)) !=0 ) + goto fail; -if ( (err =late_hwdom_init (d)) !=0 ) - goto fail; +/* +* Must not fail beyond this point, as our caller doesn't know whether +* the domain has been entered into domain_list or not. +*/ -/* -* Must not fail beyond this point, as our caller doesn't know whether -* the domain has been entered into domain_list or not. -*/ +spin_lock (&domlist_update_lock); + pd = &domain_list;/* NB. domain_list maintained in order of domid. */ +for ( pd = &domain_list; *pd !=NULL ; pd = &(*pd)->next_in_list ) +if ( (*pd)->domain_id > d->domain_id ) +break ; + d->next_in_list = *pd; + d->next_in_hashbucket = domain_hash[DOMAIN_HASH (domid)]; +rcu_assign_pointer (*pd, d); +rcu_assign_pointer (domain_hash[DOMAIN_HASH (domid)], d); +spin_unlock (&domlist_update_lock); -spin_lock (&domlist_update_lock); - pd = &domain_list;/* NB. domain_list maintained in order of domid. */ -for ( pd = &domain_list; *pd !=NULL ; pd = &(*pd)->next_in_list ) -if ( (*pd)->domain_id > d->domain_id ) -break ; - d->next_in_list = *pd; - d->next_in_hashbucket = domain_hash[DOMAIN_HASH (domid)]; -rcu_assign_pointer (*pd, d); -rcu_assign_pointer (domain_hash[DOMAIN_HASH (domid)], d); -spin_unlock (&domlist_update_lock); - -memcpy (d->handle, config->handle,sizeof (d->handle)); - } +memcpy (d->handle, config->handle,sizeof (d->handle));return d;
Signature · 1 line
2.39.2
Re: [PATCH 3/4] xen/domain: Simpliy domain_create() now the idle domain is complete earlier
Quoted 11 lines · Andrew Cooper
With x86 implementing
arch_init_idle_domain(), there is no longer any need to callarch_domain_create()with the idle domain.Have the idle domain exit early with all other system domains. Move the static-analysis
ASSERT()earlier. Then, remove the !is_idle_domain() protections around the majority ofdomain_create()and remove one level of indentation.No practical change.
Signed-off-by Andrew Cooper <[email protected]>
PATCH 4/4 arch/domain: Clean up the idle domain remnants in arch_domain_create()
In reply to Andrew CooperWith arch_domain_create() no longer being called with the idle domain, drop the last remaining logic.
No functional change.
---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>
CC: Volodymyr Babchuk <[email protected]>
CC: Bertrand Marquis <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Oleksii Kurochko <[email protected]>
--- xen/arch/arm/domain.c | 6 ------ xen/arch/x86/domain.c | 17 ----------------- 2 files changed, 23 deletions(-)
xen/arch/arm/domain.c +0 -6
@@ -706,12 +706,6 @@ int arch_domain_create(struct domain *d,BUILD_BUG_ON (GUEST_MAX_VCPUS <MAX_VIRT_CPUS ); -/* Idle domains do not need this setup */ -if (is_idle_domain (d) ) -return 0 ; - -ASSERT (config !=NULL ); -#ifdef CONFIG_IOREQ_SERVER ioreq_domain_init (d);#endif
xen/arch/x86/domain.c +0 -17
@@ -791,23 +791,6 @@ int arch_domain_create(struct domain *d,spin_lock_init (&d->arch.e820_lock); -/* Minimal initialisation for the idle domain. */ -if (unlikely (is_idle_domain (d)) ) - { -arch_init_idle_domain (d); - - d->arch.cpu_policy =ZERO_BLOCK_PTR ;/* Catch stray misuses. */ - -return 0 ; - } - -if ( !config ) - { -/* Only IDLE is allowed with no config. */ -ASSERT_UNREACHABLE (); -return -EINVAL ; - } -if ( d->domain_id &&cpu_has_amd_erratum (&boot_cpu_data,AMD_ERRATUM_121 ) ) {if ( !opt_allow_unsafe )
Signature · 1 line
2.39.2
Re: [PATCH 4/4] arch/domain: Clean up the idle domain remnants in arch_domain_create()
xen/arch/x86/domain.c int arch_domain_create(struct domain *d, · line 799
Quoted 12 lines · Andrew Cooper
xen/arch/x86/domain.c +0
-6@@ -791,23 +791,6 @@ int arch_domain_create(struct domain *d,spin_lock_init (&d->arch.e820_lock); -/* Minimal initialisation for the idle domain. */ -if (unlikely (is_idle_domain (d)) ) - { -arch_init_idle_domain (d); - - d->arch.cpu_policy =ZERO_BLOCK_PTR ;/* Catch stray misuses. */
This line looks to be lost in the process. Already in an earlier patch it should move to arch_init_idle_domain(), shouldn't it? With that adjustment for the entire series:
Jan
Re: [PATCH 4/4] arch/domain: Clean up the idle domain remnants in arch_domain_create()
Quoted 16 lines · Jan Beulich
xen/arch/x86/domain.c int arch_domain_create(struct domain *d, · line 799
Quoted 12 lines · Andrew Cooper
xen/arch/x86/domain.c +0
-6@@ -791,23 +791,6 @@ int arch_domain_create(struct domain *d,spin_lock_init (&d->arch.e820_lock); -/* Minimal initialisation for the idle domain. */ -if (unlikely (is_idle_domain (d)) ) - { -arch_init_idle_domain (d); - - d->arch.cpu_policy =ZERO_BLOCK_PTR ;/* Catch stray misuses. */ This line looks to be lost in the process. Already in an earlier patch it should move to
arch_init_idle_domain(), shouldn't it? With that adjustment for the entire series:
Quoted 1 line
Reviewed-by Jan Beulich <[email protected]>
It was semi-intentional. cpu_policy is just one of many pointers, and I don't see a good reason for it to be treated specially.
It's been around for years now, and never one triggered, not to mention the fact that there's a dwindling set of machines where a dereference of 0 isn't instantly fatal anyway.
~Andrew
Re: [PATCH 4/4] arch/domain: Clean up the idle domain remnants in arch_domain_create()
Quoted 19 lines · Andrew Cooper
Quoted 16 lines · Jan Beulich
xen/arch/x86/domain.c int arch_domain_create(struct domain *d, · line 799
Quoted 12 lines · Andrew Cooper
xen/arch/x86/domain.c +0
-6@@ -791,23 +791,6 @@ int arch_domain_create(struct domain *d,spin_lock_init (&d->arch.e820_lock); -/* Minimal initialisation for the idle domain. */ -if (unlikely (is_idle_domain (d)) ) - { -arch_init_idle_domain (d); - - d->arch.cpu_policy =ZERO_BLOCK_PTR ;/* Catch stray misuses. */ This line looks to be lost in the process. Already in an earlier patch it should move to
arch_init_idle_domain(), shouldn't it? With that adjustment for the entire series:Quoted 1 line
Reviewed-by Jan Beulich <[email protected]>
Quoted 6 lines
It was semi-intentional.
cpu_policyis just one of many pointers, and I don't see a good reason for it to be treated specially.It's been around for years now, and never one triggered, not to mention the fact that there's a dwindling set of machines where a dereference of 0 isn't instantly fatal anyway.
Okay, yet would you mind mentioning this removal as intentional then in the description?
Jan
Re: [PATCH 4/4] arch/domain: Clean up the idle domain remnants in arch_domain_create()
In reply to Andrew CooperQuoted 6 lines · Andrew Cooper
With
arch_domain_create()no longer being called with the idle domain, drop the last remaining logic.No functional change.
Signed-off-by Andrew Cooper <[email protected]>
but one question below
Quoted 36 lines
---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>
CC: Volodymyr Babchuk <[email protected]>
CC: Bertrand Marquis <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Oleksii Kurochko <[email protected]>--- xen/arch/arm/domain.c | 6 ------ xen/arch/x86/domain.c | 17 ----------------- 2 files changed, 23 deletions(-)xen/arch/arm/domain.c +0
-6@@ -706,12 +706,6 @@ int arch_domain_create(struct domain *d,BUILD_BUG_ON (GUEST_MAX_VCPUS <MAX_VIRT_CPUS ); -/* Idle domains do not need this setup */ -if (is_idle_domain (d) ) -return 0 ; - -ASSERT (config !=NULL ); -#ifdef CONFIG_IOREQ_SERVER ioreq_domain_init (d);#endif xen/arch/x86/domain.c +0
-0
xen/arch/x86/domain.c int arch_domain_create(struct domain *d, · line 799
Quoted 9 lines
xen/arch/x86/domain.c +0
-6@@ -791,23 +791,6 @@ int arch_domain_create(struct domain *d,spin_lock_init (&d->arch.e820_lock); -/* Minimal initialisation for the idle domain. */ -if (unlikely (is_idle_domain (d)) ) - { -arch_init_idle_domain (d); - - d->arch.cpu_policy =ZERO_BLOCK_PTR ;/* Catch stray misuses. */
Are you sure you don't want to keep it?
Quoted 16 lines
xen/arch/x86/domain.c +0
-10-return 0 ; - } - -if ( !config ) - { -/* Only IDLE is allowed with no config. */ -ASSERT_UNREACHABLE (); -return -EINVAL ; - } -if ( d->domain_id &&cpu_has_amd_erratum (&boot_cpu_data,AMD_ERRATUM_121 ) ) {if ( !opt_allow_unsafe )Signature · 1 line
2.39.2