Atsushi SAKAI
2006-Apr-21 01:31 UTC
[Xen-devel] [PATCH]Check the values of MAX_VIRT_CPUS and NR_CPUS for SMP
Hi, All This is a patch for checking # of CPUs consistency. This patch compares the values of MAX_VIRT_CPU and NR_CPUS. The object of this patch is to avoid boot error for SMP case. Reason for the need of this patch When we were testing SMP system, Boot sequence was failed in the case of using BVT scheduler. Each CPU assumed to have idle_vcpu in scheduler. But these two values inconsistency makes the cpus which is not assigned idle_vcpu. This case is occurred MAX_VIRT_CPUS is less than # of Real CPU. (for example MAX_VIRT_CPUS = 4 and Real CPU = 8 4Real CPUs are not assigned to idle_vcpu) Currently, no check routine exists in scheduler for this problem. To solve this problem, I added check routine in xen/sched.h. Current situations This problem is currently solved in IA64 by CSET;9495 patch by expanding both CPUS value to 64. (Previously MAX_VIRT_CPUS = 8 and NR_CPUS = 4) #define MAX_VIRT_CPUS 64 in xen/include/public/arch-ia64.h and #define NR_CPUS 64 in xen/include/asm-ia64/config.h But the logical limit of the IA64 Max CPU is larger than 64. If someone change these values, some possibility make this error again. To avoid this problem, I believe this check code should be exists. Signed-off-by: Atsushi SAKAI <sakaia@jp.fujitsu.com> Atsushi SAKAI _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser
2006-Apr-21 06:41 UTC
Re: [Xen-devel] [PATCH]Check the values of MAX_VIRT_CPUS and NR_CPUS for SMP
On 21 Apr 2006, at 02:31, Atsushi SAKAI wrote:> But the logical limit of the IA64 Max CPU is larger than 64. > If someone change these values, some possibility make this error again. > > To avoid this problem, I believe this check code should be exists.See how we solve this on x86 near the top of do_boot_cpu() in arch/x86/smpboot.c. Essentially we allocate extra idle domains on demand to give us enough idle vcpus for one per physical cpu. -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Tristan Gingold
2006-Apr-21 07:10 UTC
Re: [Xen-devel] [PATCH]Check the values of MAX_VIRT_CPUS and NR_CPUS for SMP
Le Vendredi 21 Avril 2006 03:31, Atsushi SAKAI a écrit :> Hi, All > > This is a patch for checking # of CPUs consistency. > This patch compares the values of MAX_VIRT_CPU and NR_CPUS. > The object of this patch is to avoid boot error for SMP case. > > Reason for the need of this patch > > When we were testing SMP system, Boot sequence was failed > in the case of using BVT scheduler. > Each CPU assumed to have idle_vcpu in scheduler. > But these two values inconsistency makes the cpus which is not assigned > idle_vcpu. This case is occurred MAX_VIRT_CPUS is less than # of Real CPU. > (for example MAX_VIRT_CPUS = 4 and Real CPU = 8 > 4Real CPUs are not assigned to idle_vcpu) > Currently, no check routine exists in scheduler for this problem. > To solve this problem, I added check routine in xen/sched.h. > > > > Current situations > > This problem is currently solved in IA64 by CSET;9495 patch by > expanding both CPUS value to 64. > (Previously MAX_VIRT_CPUS = 8 and NR_CPUS = 4) > > #define MAX_VIRT_CPUS 64 in xen/include/public/arch-ia64.h > and > #define NR_CPUS 64 in xen/include/asm-ia64/config.h > > But the logical limit of the IA64 Max CPU is larger than 64. > If someone change these values, some possibility make this error again. > > To avoid this problem, I believe this check code should be exists.Please also note that this problem is currently worked around in xen/ia64: /* A vcpu is created for the idle domain on every physical cpu. Limit the number of cpus to the maximum number of vcpus. */ if (max_cpus > MAX_VIRT_CPUS) max_cpus = MAX_VIRT_CPUS; Of course, the Keir method is better! Tristan. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser
2006-Apr-21 07:46 UTC
Re: [Xen-devel] [PATCH]Check the values of MAX_VIRT_CPUS and NR_CPUS for SMP
On 21 Apr 2006, at 08:10, Tristan Gingold wrote:>> But the logical limit of the IA64 Max CPU is larger than 64. >> If someone change these values, some possibility make this error >> again. >> >> To avoid this problem, I believe this check code should be exists. > Please also note that this problem is currently worked around in > xen/ia64: > /* A vcpu is created for the idle domain on every physical cpu. > Limit the number of cpus to the maximum number of vcpus. */ > if (max_cpus > MAX_VIRT_CPUS) > max_cpus = MAX_VIRT_CPUS; > > Of course, the Keir method is better!Rather than cut-and-pasting that code into arch/ia64 I would like to see a patch which moves the definition of the idle_vcpu array, and the code from the top of x86''s do_boot_cpu(), into common/domain.c (maybe call the function alloc_idle_vcpu()). Passed a physical cpu number, it would use the x86 alloc logic, fill in idle_vcpu[], and return the vcpu that was allocated. -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel