Skip to contentSkip to conversation

acpi: Switch to dynamic mapping at SYS_STATE_boot

PATCH Superseded Boris Ostrovsky 2 participants 6 messages Jan 30, 2017 – Jan 31, 2017

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 acpi: Switch to dynamic mapping at SYS_STATE_boot

We can switch ACPI from using fixmap to dynamic mapping as soon as the system enters SYS_STATE_boot. This will allow us, for example, to map MADT on systems with large number of processors where the table might not fit into NUM_FIXMAP_ACPI_PAGES (currently set to 4).

---
 xen/drivers/acpi/osl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
xen/drivers/acpi/osl.c +2 -2
index 3616dfd..7199047 100644
@@ -89,7 +89,7 @@ acpi_physical_address __init acpi_os_get_root_pointer(void)
 void __iomem *
 acpi_os_map_memory(acpi_physical_address phys, acpi_size size)
 {
-	if (system_state >= SYS_STATE_active) {
+	if (system_state >= SYS_STATE_boot) {
 		mfn_t mfn = _mfn(PFN_DOWN(phys));
 		unsigned int offs = phys & (PAGE_SIZE - 1);
 
@@ -104,7 +104,7 @@ acpi_os_map_memory(acpi_physical_address phys, acpi_size size)
 
 void acpi_os_unmap_memory(void __iomem * virt, acpi_size size)
 {
-	if (system_state >= SYS_STATE_active)
+	if (system_state >= SYS_STATE_boot)
 		vunmap((void *)((unsigned long)virt & PAGE_MASK));
 }
 
Signature · 7 lines
1.8.3.1


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#1 lore raw
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 30.01.17 at 19:26, <[email protected]> wrote:

We can switch ACPI from using fixmap to dynamic mapping as soon as the system enters SYS_STATE_boot. This will allow us, for example, to map MADT on systems with large number of processors where the table might not fit into NUM_FIXMAP_ACPI_PAGES (currently set to 4).

I think this needs a little more care. While ARM switches to SYS_STATE_boot after having called vm_init(), that's not the case on x86. Granted there's no ACPI code being invoked in between, but this would still be a latent bug (as soon as someone inserts any code there).

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#2 lore raw
Quoted 10 lines · Jan Beulich
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 30.01.17 at 19:26, <[email protected]> wrote:

We can switch ACPI from using fixmap to dynamic mapping as soon as the system enters SYS_STATE_boot. This will allow us, for example, to map MADT on systems with large number of processors where the table might not fit into NUM_FIXMAP_ACPI_PAGES (currently set to 4).

I think this needs a little more care. While ARM switches to SYS_STATE_boot after having called vm_init(), that's not the case on x86. Granted there's no ACPI code being invoked in between, but this would still be a latent bug (as soon as someone inserts any code there).

Then acpi_os_map_memory() shouldn't rely on system_state at all.

How about adding something like

static bool_t vm_ready()

{
    return !!vm_base[VMAP_DEFAULT];
}

-boris

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#3 lore raw
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 31.01.17 at 16:52, <[email protected]> wrote:
Quoted 5 lines · Jan Beulich
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 30.01.17 at 19:26, <[email protected]> wrote:

We can switch ACPI from using fixmap to dynamic mapping as soon as the system enters SYS_STATE_boot. This will allow us, for example, to map MADT on systems with large number of processors where the table might not fit into NUM_FIXMAP_ACPI_PAGES (currently set to 4).

Quoted 7 lines
Quoted 5 lines

I think this needs a little more care. While ARM switches to SYS_STATE_boot after having called vm_init(), that's not the case on x86. Granted there's no ACPI code being invoked in between, but this would still be a latent bug (as soon as someone inserts any code there).

Then acpi_os_map_memory() shouldn't rely on system_state at all.

Why?

Quoted 6 lines

How about adding something like

static bool_t vm_ready()

{
    return !!vm_base[VMAP_DEFAULT];
}

What's wrong with just swapping the order of the two things in x86's setup.c?

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#4 lore raw
Quoted 7 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 31.01.17 at 16:52, <[email protected]> wrote:
Quoted 5 lines · Jan Beulich
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 30.01.17 at 19:26, <[email protected]> wrote:

We can switch ACPI from using fixmap to dynamic mapping as soon as the system enters SYS_STATE_boot. This will allow us, for example, to map MADT on systems with large number of processors where the table might not fit into NUM_FIXMAP_ACPI_PAGES (currently set to 4).

Quoted 7 lines
Quoted 6 lines
Quoted 5 lines

I think this needs a little more care. While ARM switches to SYS_STATE_boot after having called vm_init(), that's not the case on x86. Granted there's no ACPI code being invoked in between, but this would still be a latent bug (as soon as someone inserts any code there).

Then acpi_os_map_memory() shouldn't rely on system_state at all.

Why?

Because it really is only interested in whether vm_init() has been called, nor what the overall system state is (even if vmap status can be implied from the state).

But I can swap the two if you prefer that.

-boris

Quoted 9 lines
Quoted 7 lines

How about adding something like

static bool_t vm_ready()

{
    return !!vm_base[VMAP_DEFAULT];
}

What's wrong with just swapping the order of the two things in x86's setup.c?

I

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#5 lore raw
Quoted 14 lines
Quoted 1 line
Quoted 1 line · On 31.01.17 at 17:05, <[email protected]> wrote:
Quoted 12 lines · Jan Beulich
Quoted 12 lines
Quoted 1 line
Quoted 1 line · On 31.01.17 at 16:52, <[email protected]> wrote:
Quoted 10 lines · Jan Beulich
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 30.01.17 at 19:26, <[email protected]> wrote:

We can switch ACPI from using fixmap to dynamic mapping as soon as the system enters SYS_STATE_boot. This will allow us, for example, to map MADT on systems with large number of processors where the table might not fit into NUM_FIXMAP_ACPI_PAGES (currently set to 4).

I think this needs a little more care. While ARM switches to SYS_STATE_boot after having called vm_init(), that's not the case on x86. Granted there's no ACPI code being invoked in between, but this would still be a latent bug (as soon as someone inserts any code there).

Quoted 8 lines
Quoted 2 lines
Quoted 1 line

Then acpi_os_map_memory() shouldn't rely on system_state at all.

Why?

Because it really is only interested in whether vm_init() has been called, nor what the overall system state is (even if vmap status can be implied from the state).

But I can swap the two if you prefer that.

Seems better to me than introducing vm_ready(). But perhaps others are of differing opinion...

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel