Skip to contentSkip to conversation

ACPI, APEI: Add RAM mapping support to ACPI

PATCH Thomas Renninger 4 participants 4 messages Jan 23, 2012 – Jan 29, 2012 ACPI

lore
Share & tools
lore

Thomas Renninger

author Reviewed-by
#0 lore raw

Hi,

Please ignore my previous mail, my mailer wrongly formatted it with html tags and it got filtered out from the lists.

Firstly: This has to get in quickly if it shouldn't miss 3.3 (again). Tiny adjustings (I don't see any, beside the issue Bjorn brought up) can still be done later, but I guess this rather big one gets rejected by Linus after the merge window closed.

Here again:

Quoted 2 lines · Bjorn Helgaas

+cc Tony, linux-ia64

...

Quoted 7 lines
Quoted 7 lines

Review acpi_os_map_memory(acpi_physical_address phys, acpi_size size) · line 388

Quoted 7 lines

{

(quoted diff) +1 -1
@@ -353,7 +385,7 @@ acpi_os_map_memory(acpi_physical_address phys, acpi_size size)
 
       pg_off = round_down(phys, PAGE_SIZE);
       pg_sz = round_up(phys + size, PAGE_SIZE) - pg_off;
-       virt = acpi_os_ioremap(pg_off, pg_sz);
+       virt = acpi_map(pg_off, pg_sz);

Ok, that worked before, also on IA64.
That means that typically/normally/always io mem is tried to be mapped.

It's due to the new APEI infrastructure/features that ram could get mapped via acpi_os_map_memory.

Is there any Itanium out there implementing any APEI table? Will there ever be one?
Even if, isn't it a BIOS bug if such stuff is declared in ram and not in reserved memory (also on X86)?
Especially on an Enterprise Itanium platform,
I guess the vendor should or better has to fix it up.

I'd do:
can_use_ioremap(pfn) instead of should_use_kmap(pfn) and let it return false in ram + ia64 case, something like:
#ifdef IA64
#define can_use_ioremap(pfn) !page_is_ram(pfn)
#endif

Pass the error upwards and APEI should get disabled on IA64, if any ACPI code tries to ioremap real memory early (when the APEI table parsing happens).
A nice FW_BUG message could be added as well (also on X86?).

Don't forget to use:
iounmap(vaddr);
only in acpi_unmap() then.

FWIW I even grepped for APEI tables on the most recent IA machine we have -> no APEI tables.

If the rest is functionally the same as the patch series you've send some months ago, feel free to add:

I had a rather close look at those patches.

Thomas

#1 lore raw
Quoted 10 lines · Thomas Renninger

Hi,

Please ignore my previous mail, my mailer wrongly formatted it with html tags and it got filtered out from the lists.

Firstly: This has to get in quickly if it shouldn't miss 3.3 (again). Tiny adjustings (I don't see any, beside the issue Bjorn brought up) can still be done later, but I guess this rather big one gets rejected by Linus after the merge window closed.

Yes, I believe the obsolescence of atomicio.c from having taken the conversion patch (patch 3/4 of the series) was inadvertent. As such I was trying to help by producing a series that addresses the two recent additions to atomicio.c that needed ported over to osl.c so that we would not loose such functionality with atomicio's obsolence as fast as possible. Linus may not allow such now that the 3.3 merge window is closed but I think we all are thinking we should at least attempt to get the regressions resolved immediately if possible.

Quoted 34 lines

Here again:

Quoted 2 lines · Bjorn Helgaas

+cc Tony, linux-ia64

...

Quoted 7 lines
Quoted 7 lines

Review acpi_os_map_memory(acpi_physical_address phys, acpi_size size) · line 388

Quoted 7 lines

{

(quoted diff) +1 -1
@@ -353,7 +385,7 @@ acpi_os_map_memory(acpi_physical_address phys, acpi_size size)
 
       pg_off = round_down(phys, PAGE_SIZE);
       pg_sz = round_up(phys + size, PAGE_SIZE) - pg_off;
-       virt = acpi_os_ioremap(pg_off, pg_sz);
+       virt = acpi_map(pg_off, pg_sz);

Ok, that worked before, also on IA64.
That means that typically/normally/always io mem is tried to be mapped.

It's due to the new APEI infrastructure/features that ram could get mapped via acpi_os_map_memory.

Is there any Itanium out there implementing any APEI table? Will there ever be one?
Even if, isn't it a BIOS bug if such stuff is declared in ram and not in reserved memory (also on X86)?
Especially on an Enterprise Itanium platform,
I guess the vendor should or better has to fix it up.

I'd do:
can_use_ioremap(pfn) instead of should_use_kmap(pfn) and let it return false in ram + ia64 case, something like:
#ifdef IA64
#define can_use_ioremap(pfn) !page_is_ram(pfn)
#endif

Quoted 8 lines

Pass the error upwards and APEI should get disabled on IA64, if any ACPI code tries to ioremap real memory early (when the APEI table parsing happens).
A nice FW_BUG message could be added as well (also on X86?).

Don't forget to use:
iounmap(vaddr);
only in acpi_unmap() then.

I must admit, while I understand the reason and concept related to handling RAM for APEI, I do not understand memory management well enough understand the details of the original implementation. I was just trying to cross-port the functionality over. In doing such, I too, was concerned as to the asymmetric nature of the paths (mapping vs. unmapping) with respect to x86 as it just *felt* wrong.

Len - please let me know if you want me to adjust the patch with Thomas' suggestions.

Quoted 10 lines

FWIW I even grepped for APEI tables on the most recent IA machine we have -> no APEI tables.

If the rest is functionally the same as the patch series you've send some months ago, feel free to add:

I had a rather close look at those patches.

Thanks Thomas - yes, the removal patch - 3/3 - is the same.

Myron

Quoted 2 lines

Thomas

#2 lore raw
In reply to Thomas Renninger
Quoted 2 lines

Is there any Itanium out there implementing any APEI table? Will there ever be one?

With respect to the EINJ table - the answer is definitely no. Itanium has a PAL mechanism for injecting errors, so there is no need to implement EINJ.

-Tony

#3 lore raw
In reply to Thomas Renninger

Hi, Thomas,

Sorry for late. Just return from Chinese new year holiday.

Quoted 30 lines · Thomas Renninger

Hi,

Please ignore my previous mail, my mailer wrongly formatted it with html tags and it got filtered out from the lists.

Firstly: This has to get in quickly if it shouldn't miss 3.3 (again). Tiny adjustings (I don't see any, beside the issue Bjorn brought up) can still be done later, but I guess this rather big one gets rejected by Linus after the merge window closed.

Here again:

Quoted 2 lines · Bjorn Helgaas

+cc Tony, linux-ia64

...

Quoted 7 lines
Quoted 7 lines

Review acpi_os_map_memory(acpi_physical_address phys, acpi_size size) · line 388

Quoted 7 lines

{

(quoted diff) +1 -1
@@ -353,7 +385,7 @@ acpi_os_map_memory(acpi_physical_address phys, acpi_size size)
 
       pg_off = round_down(phys, PAGE_SIZE);
       pg_sz = round_up(phys + size, PAGE_SIZE) - pg_off;
-       virt = acpi_os_ioremap(pg_off, pg_sz);
+       virt = acpi_map(pg_off, pg_sz);

Ok, that worked before, also on IA64.
That means that typically/normally/always io mem is tried to be mapped.

It's due to the new APEI infrastructure/features that ram could get mapped via acpi_os_map_memory.

Quoted 6 lines

Is there any Itanium out there implementing any APEI table? Will there ever be one?
Even if, isn't it a BIOS bug if such stuff is declared in ram and not in reserved memory (also on X86)?
Especially on an Enterprise Itanium platform,
I guess the vendor should or better has to fix it up.

The reason for this patch can be found in description of my original patch:

ACPI, Add RAM mapping support to ACPI atomic IO support

On one of our testing machine, the following EINJ command lines:

# echo 0x10000000 > param1
# echo 0xfffffffffffff000 > param2
# echo 0x8 > error_type
# echo 1 > error_inject

Will get:

echo: write error: Input/output error

The EIO comes from:

rc = apei_exec_pre_map_gars(&trigger_ctx);

The root cause is as follow. Normally, ACPI atomic IO support is used to access IO memory. But in EINJ of that machine, it is used to access RAM to trigger the injected error. And the ioremap() called by apei_exec_pre_map_gars() can not map the RAM.

This patch add RAM mapping support to ACPI atomic IO support to satisfy EINJ requirement.

I think that is reasonable to access the injected address to trigger some memory error. So it is hard to say this is a BIOS bug.

Best Regards,
Huang Ying