History

ACPICA: Preserve memory opregion mappings

The ACPICA's strategy with respect to the handling of memory mappings associated with memory operation regions is to avoid mapping the entire region at once which may be problematic at least in principle (for example, it may lead to conflicts with overlapping mappings having different attributes created by drivers). It may also be wasteful, because memory opregions on some systems take up vast chunks of address space while the fields in those regions actually accessed by AML are sparsely distributed. For this reason, a one-page "window" is mapped for a given opregion on the first memory access through it and if that "window" does not cover an address range accessed through that opregion subsequently, it is unmapped and a new "window" is mapped to replace it. Next, if the new "window" is not sufficient to acess memory through the opregion in question in the future, it will be replaced with yet another "window" and so on. That may lead to a suboptimal sequence of memory mapping and unmapping operations, for example if two fields in one opregion separated from each other by a sufficiently wide chunk of unused address space are accessed in an alternating pattern. The situation may still be suboptimal if the deferred unmapping introduced previously is supported by the OS layer. For instance, the alternating memory access pattern mentioned above may produce a relatively long list of mappings to release with substantial duplication among the entries in it, which could be avoided if acpi_ex_system_memory_space_handler() did not release the mapping used by it previously as soon as the current access was not covered by it. In order to improve that, modify acpi_ex_system_memory_space_handler() to preserve all of the memory mappings created by it until the memory regions associated with them go away. Accordingly, update acpi_ev_system_memory_region_setup() to unmap all memory associated with memory opregions that go away.

Rafael J. Wysocki committed 6 years ago

Commit b8fcd0e1 parent 17576593 files · +63 −27Browse files

Showing the changes to include (1 of 3 files). Show all

Unified · Split

include/acpi/actypes.h+9−3
@@ -1201,12 +1201,18 @@ struct acpi_pci_id { · 1200 unmodified lines
1201 u16 function;1201 u16 function;
1202};1202};
1203 1203
1204struct acpi_mem_mapping {
1205 acpi_physical_address physical_address;
1206 u8 *logical_address;
1207 acpi_size length;
1208 struct acpi_mem_mapping *next_mm;
1209};
1210
1204struct acpi_mem_space_context {1211struct acpi_mem_space_context {
1205 u32 length;1212 u32 length;
1206 acpi_physical_address address;1213 acpi_physical_address address;
1207 acpi_physical_address mapped_physical_address;1214 struct acpi_mem_mapping *cur_mm;
1208 u8 *mapped_logical_address;1215 struct acpi_mem_mapping *first_mm;
1209 acpi_size mapped_length;
1210};1216};
1211 1217
1212/*1218/*

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t