Re: [Xen-devel] [PATCH v2 3/4] x86/smp: check APIC ID on AP bringup

2019-12-03 Thread Jan Beulich
On 29.11.2019 12:28, Roger Pau Monne wrote:
> --- a/xen/arch/x86/smpboot.c
> +++ b/xen/arch/x86/smpboot.c
> @@ -1317,6 +1317,13 @@ int __cpu_up(unsigned int cpu)
>  if ( (apicid = x86_cpu_to_apicid[cpu]) == BAD_APICID )
>  return -ENODEV;
>  
> +if ( (!x2apic_enabled || !iommu_intremap) && (apicid >> 8) )
> +{
> +printk("Processor with APIC ID %u cannot be onlined in xAPIC mode "
> +   "or without interrupt remapping\n", apicid);

Please log the APIC ID in hex, to match how it gets logged e.g.
by the ACPI table parsing code. I'd also prefer if the message
could be shortened a little: I don't think the "or" is needed,
"Processor" could become "CPU", and slight re-wording could
save even a little more: "Cannot online CPU with APIC ID %#x in
xAPIC mode w/o interrupt remapping".

Then again this isn't fully correct: We could bring such a
CPU online in x2APIC mode but without interrupt remapping.
There would be a restriction on which CPUs physical interrupts
could be delivered to. So perhaps "Unsupported: APIC ID %#x in
xAPIC mode w/o interrupt remapping" or some such?

Jan

___
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

[Xen-devel] [PATCH v2 3/4] x86/smp: check APIC ID on AP bringup

2019-11-29 Thread Roger Pau Monne
Check that the processor to be woken up APIC ID is addressable in the
current APIC mode.

Note that in practice systems with APIC IDs > 255 should already have
x2APIC enabled by the firmware, and hence this is mostly a safety
belt.

Signed-off-by: Roger Pau Monné 
---
 xen/arch/x86/smpboot.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index fa691b6ba0..484d344c44 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -1317,6 +1317,13 @@ int __cpu_up(unsigned int cpu)
 if ( (apicid = x86_cpu_to_apicid[cpu]) == BAD_APICID )
 return -ENODEV;
 
+if ( (!x2apic_enabled || !iommu_intremap) && (apicid >> 8) )
+{
+printk("Processor with APIC ID %u cannot be onlined in xAPIC mode "
+   "or without interrupt remapping\n", apicid);
+return -EINVAL;
+}
+
 if ( (ret = do_boot_cpu(apicid, cpu)) != 0 )
 return ret;
 
-- 
2.24.0


___
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel