Re: [PATCH v2] ACPI: Drop rcu usage for MMIO mappings
From: Dan Williams
Date: Fri Jun 05 2020 - 12:39:57 EST
On Fri, Jun 5, 2020 at 9:22 AM Rafael J. Wysocki <rafael@xxxxxxxxxx> wrote:
[..]
> > The fix we are looking at now is to pre-map operation regions in a
> > similar manner as the way APEI resources are pre-mapped. The
> > pre-mapping would arrange for synchronize_rcu_expedited() to be elided
> > on each dynamic mapping attempt. The other piece is to arrange for
> > operation-regions to be mapped at their full size at once rather than
> > a page at a time.
>
> However, if the RCU usage in ACPI OSL can be replaced with an rwlock,
> some of the ACPICA changes above may not be necessary anymore (even
> though some of them may still be worth making).
I don't think you can replace the RCU usage in ACPI OSL and still
maintain NMI lookups in a dynamic list.
However, there are 3 solutions I see:
- Prevent acpi_os_map_cleanup() from triggering at high frequency by
pre-mapping and never unmapping operation-regions resources (internal
discussion in progress)
- Prevent walks of the 'acpi_ioremaps' list (acpi_map_lookup_virt())
from NMI context by re-writing the physical addresses in the APEI
tables with pre-mapped virtual address, i.e. remove rcu_read_lock()
and list_for_each_entry_rcu() from NMI context.
- Split operation-region resources into a separate mapping mechanism
than APEI resources so that typical locking can be used for the
sleepable resources and let the NMI accessible resources be managed
separately.
That last one is one we have not discussed internally, but it occurred
to me when you mentioned replacing RCU.