xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][4.16] x86/x2APIC: defer probe until after IOMMU ACPI table parsing
@ 2021-11-03 14:40 Jan Beulich
  2021-11-04 14:21 ` Roger Pau Monné
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Beulich @ 2021-11-03 14:40 UTC (permalink / raw)
  To: xen-devel; +Cc: Andrew Cooper, Wei Liu, Roger Pau Monné, Ian Jackson

While commit XXXXXXXXXXXX ("x86/IOMMU: mark IOMMU / intremap not in use
when ACPI tables are missing") deals with apic_x2apic_probe() as called
from x2apic_bsp_setup(), the check_x2apic_preenabled() path is similarly
affected: The call needs to occur after acpi_boot_init() (which is what
calls acpi_iommu_init()), such that iommu_intremap getting disabled
there can be properly taken into account by apic_x2apic_probe().

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
Based on code inspection only - I have no affected system and hence no
way to actually test the case.

--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1694,8 +1694,6 @@ void __init noreturn __start_xen(unsigne
 
     dmi_scan_machine();
 
-    generic_apic_probe();
-
     mmio_ro_ranges = rangeset_new(NULL, "r/o mmio ranges",
                                   RANGESETF_prettyprint_hex);
 
@@ -1705,6 +1703,13 @@ void __init noreturn __start_xen(unsigne
 
     acpi_boot_init();
 
+    /*
+     * Requires initial ACPI table parsing to have happened, such that
+     * check_x2apic_preenabled() would be able to observe acpi_iommu_init()'s
+     * findings, in particular it turning off iommu_intremap.
+     */
+    generic_apic_probe();
+
     if ( smp_found_config )
         get_smp_config();
 



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH][4.16] x86/x2APIC: defer probe until after IOMMU ACPI table parsing
  2021-11-03 14:40 [PATCH][4.16] x86/x2APIC: defer probe until after IOMMU ACPI table parsing Jan Beulich
@ 2021-11-04 14:21 ` Roger Pau Monné
  2021-11-04 14:59   ` [PATCH][4.16] x86/x2APIC: defer probe until after IOMMU ACPI table parsing [and 1 more messages] Ian Jackson
  2021-11-04 15:41   ` [PATCH][4.16] x86/x2APIC: defer probe until after IOMMU ACPI table parsing Jan Beulich
  0 siblings, 2 replies; 5+ messages in thread
From: Roger Pau Monné @ 2021-11-04 14:21 UTC (permalink / raw)
  To: Jan Beulich; +Cc: xen-devel, Andrew Cooper, Wei Liu, Ian Jackson

On Wed, Nov 03, 2021 at 03:40:55PM +0100, Jan Beulich wrote:
> While commit XXXXXXXXXXXX ("x86/IOMMU: mark IOMMU / intremap not in use
> when ACPI tables are missing") deals with apic_x2apic_probe() as called
> from x2apic_bsp_setup(), the check_x2apic_preenabled() path is similarly
> affected: The call needs to occur after acpi_boot_init() (which is what
> calls acpi_iommu_init()), such that iommu_intremap getting disabled
> there can be properly taken into account by apic_x2apic_probe().
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

LGTM. I cannot find any dependency between acpi_boot_init and having
initialized the apic.

Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>

Thanks, Roger.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH][4.16] x86/x2APIC: defer probe until after IOMMU ACPI table parsing [and 1 more messages]
  2021-11-04 14:21 ` Roger Pau Monné
@ 2021-11-04 14:59   ` Ian Jackson
  2021-11-04 15:09     ` Jan Beulich
  2021-11-04 15:41   ` [PATCH][4.16] x86/x2APIC: defer probe until after IOMMU ACPI table parsing Jan Beulich
  1 sibling, 1 reply; 5+ messages in thread
From: Ian Jackson @ 2021-11-04 14:59 UTC (permalink / raw)
  To: Roger Pau Monné, Jan Beulich; +Cc: xen-devel, Andrew Cooper, Wei Liu

Jan Beulich writes ("[PATCH][4.16] x86/x2APIC: defer probe until after IOMMU ACPI table parsing"):
> While commit XXXXXXXXXXXX ("x86/IOMMU: mark IOMMU / intremap not in use
> when ACPI tables are missing") deals with apic_x2apic_probe() as called
> from x2apic_bsp_setup(), the check_x2apic_preenabled() path is similarly
> affected: The call needs to occur after acpi_boot_init() (which is what
> calls acpi_iommu_init()), such that iommu_intremap getting disabled
> there can be properly taken into account by apic_x2apic_probe().
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> ---
> Based on code inspection only - I have no affected system and hence no
> way to actually test the case.

Do we have any tests for this ?  I see it's tagged for 4.16 (and I'm
favourably inclined) but I'm not sure I follow the implications.

Roger Pau Monné writes ("Re: [PATCH][4.16] x86/x2APIC: defer probe until after IOMMU ACPI table parsing"):
> LGTM. I cannot find any dependency between acpi_boot_init and having
> initialized the apic.
> 
> Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>

Thanks,
Ian.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH][4.16] x86/x2APIC: defer probe until after IOMMU ACPI table parsing [and 1 more messages]
  2021-11-04 14:59   ` [PATCH][4.16] x86/x2APIC: defer probe until after IOMMU ACPI table parsing [and 1 more messages] Ian Jackson
@ 2021-11-04 15:09     ` Jan Beulich
  0 siblings, 0 replies; 5+ messages in thread
From: Jan Beulich @ 2021-11-04 15:09 UTC (permalink / raw)
  To: Ian Jackson; +Cc: xen-devel, Andrew Cooper, Wei Liu, Roger Pau Monné

On 04.11.2021 15:59, Ian Jackson wrote:
> Jan Beulich writes ("[PATCH][4.16] x86/x2APIC: defer probe until after IOMMU ACPI table parsing"):
>> While commit XXXXXXXXXXXX ("x86/IOMMU: mark IOMMU / intremap not in use
>> when ACPI tables are missing") deals with apic_x2apic_probe() as called
>> from x2apic_bsp_setup(), the check_x2apic_preenabled() path is similarly
>> affected: The call needs to occur after acpi_boot_init() (which is what
>> calls acpi_iommu_init()), such that iommu_intremap getting disabled
>> there can be properly taken into account by apic_x2apic_probe().
>>
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>> ---
>> Based on code inspection only - I have no affected system and hence no
>> way to actually test the case.
> 
> Do we have any tests for this ?

If you mean in osstest, then I'm unaware of any, but I also don't have
a clear view on how much x2APIC-capable hardware we have, and whether
among those there are any where the firmware pre-enables x2APIC.

>  I see it's tagged for 4.16 (and I'm
> favourably inclined) but I'm not sure I follow the implications.

The main aspect here is: This is the other side of the medal as to the
referenced earlier change (which I did commit an hour or so ago).

Jan



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH][4.16] x86/x2APIC: defer probe until after IOMMU ACPI table parsing
  2021-11-04 14:21 ` Roger Pau Monné
  2021-11-04 14:59   ` [PATCH][4.16] x86/x2APIC: defer probe until after IOMMU ACPI table parsing [and 1 more messages] Ian Jackson
@ 2021-11-04 15:41   ` Jan Beulich
  1 sibling, 0 replies; 5+ messages in thread
From: Jan Beulich @ 2021-11-04 15:41 UTC (permalink / raw)
  To: Roger Pau Monné; +Cc: xen-devel, Andrew Cooper, Wei Liu, Ian Jackson

On 04.11.2021 15:21, Roger Pau Monné wrote:
> On Wed, Nov 03, 2021 at 03:40:55PM +0100, Jan Beulich wrote:
>> While commit XXXXXXXXXXXX ("x86/IOMMU: mark IOMMU / intremap not in use
>> when ACPI tables are missing") deals with apic_x2apic_probe() as called
>> from x2apic_bsp_setup(), the check_x2apic_preenabled() path is similarly
>> affected: The call needs to occur after acpi_boot_init() (which is what
>> calls acpi_iommu_init()), such that iommu_intremap getting disabled
>> there can be properly taken into account by apic_x2apic_probe().
>>
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 
> LGTM. I cannot find any dependency between acpi_boot_init and having
> initialized the apic.

Sadly there is, and I've now learned that when believing I would test
the change yesterday I actually didn't (or else I would have spotted
the problem that I've spotted now), and instead I did boot an older
binary: acpi_process_madt() calls clustered_apic_check() and hence
relies on genapic to have got filled before.

I'll have to see if I can come up with some variant avoiding the issue,
but I suspect that's not going to be 4.16 material anymore then. My
first try is likely going to be to simply pull out acpi_iommu_init()
from acpi_boot_init().

Jan



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-11-04 15:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-03 14:40 [PATCH][4.16] x86/x2APIC: defer probe until after IOMMU ACPI table parsing Jan Beulich
2021-11-04 14:21 ` Roger Pau Monné
2021-11-04 14:59   ` [PATCH][4.16] x86/x2APIC: defer probe until after IOMMU ACPI table parsing [and 1 more messages] Ian Jackson
2021-11-04 15:09     ` Jan Beulich
2021-11-04 15:41   ` [PATCH][4.16] x86/x2APIC: defer probe until after IOMMU ACPI table parsing Jan Beulich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).