This patch adds support for flushing potentially dirty
cache lines when memory is hot-plugged/hot-un-plugged.
The support is currently limited to 64 bit systems.
The bug was exposed when mappings for a device were
actually hot-unplugged and plugged in back later.
A similar issue was observed during the development
of memtrace, but memtrace does it's own flushing of
region via a custom routine.
These patches do a flush both on hotplug/unplug to
clear any stale data in the cache w.r.t mappings,
there is a small race window where a clean cache
line may be created again just prior to tearing
down the mapping.
The patches were tested by disabling the flush
routines in memtrace and doing I/O on the trace
file. The system immediately checkstops (quite
reliablly if prior to the hot-unplug of the memtrace
region, we memset the regions we are about to
hot unplug). After these patches no custom flushing
is needed in the memtrace code.
Signed-off-by: Balbir Singh <bsingharora@gmail.com>
---
arch/powerpc/mm/mem.c | 2 ++
1 file changed, 2 insertions(+)
@@ -169,6 +170,7 @@ int __meminit arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap/* Remove htab bolted mappings for this section of memory */start=(unsignedlong)__va(start);+flush_inval_dcache_range(start,start+size);ret=remove_section_mapping(start,start+size);/* Ensure all vmalloc mappings are flushed in case they also
Don't do this via custom code, instead now that we have support
in the arch hotplug/hotunplug code, rely on those routines
to do the right thing.
Fixes: 9d5171a8f248 ("powerpc/powernv: Enable removal of memory for in memory tracing")
because the older code uses ppc64_caches.l1d.size instead of
ppc64_caches.l1d.line_size
Signed-off-by: Balbir Singh <bsingharora@gmail.com>
---
arch/powerpc/platforms/powernv/memtrace.c | 17 -----------------
1 file changed, 17 deletions(-)
This patch adds support for flushing potentially dirty
cache lines when memory is hot-plugged/hot-un-plugged.
The support is currently limited to 64 bit systems.
The bug was exposed when mappings for a device were
actually hot-unplugged and plugged in back later.
A similar issue was observed during the development
of memtrace, but memtrace does it's own flushing of
region via a custom routine.
These patches do a flush both on hotplug/unplug to
clear any stale data in the cache w.r.t mappings,
there is a small race window where a clean cache
line may be created again just prior to tearing
down the mapping.
The patches were tested by disabling the flush
routines in memtrace and doing I/O on the trace
file. The system immediately checkstops (quite
reliablly if prior to the hot-unplug of the memtrace
region, we memset the regions we are about to
hot unplug). After these patches no custom flushing
is needed in the memtrace code.
Signed-off-by: Balbir Singh <bsingharora@gmail.com>
Don't do this via custom code, instead now that we have support
in the arch hotplug/hotunplug code, rely on those routines
to do the right thing.
Fixes: 9d5171a8f248 ("powerpc/powernv: Enable removal of memory for in memory tracing")
because the older code uses ppc64_caches.l1d.size instead of
ppc64_caches.l1d.line_size
Signed-off-by: Balbir Singh <bsingharora@gmail.com>
From: Michael Ellerman <mpe@ellerman.id.au> Date: 2018-04-11 11:05:51
Balbir Singh [off-list ref] writes:
Don't do this via custom code, instead now that we have support
in the arch hotplug/hotunplug code, rely on those routines
to do the right thing.
Fixes: 9d5171a8f248 ("powerpc/powernv: Enable removal of memory for in memory tracing")
That's not really right.
This patch doesn't fix it, the previous patch did.
If I just backport this patch then it's still broken.
So I'll tag patch 1 with the above Fixes: tag and add stable, and then
this just becomes a cleanup.
OK?
cheers
On Wed, Apr 11, 2018 at 9:05 PM, Michael Ellerman [off-list ref] wrote:
Balbir Singh [off-list ref] writes:
quoted
Don't do this via custom code, instead now that we have support
in the arch hotplug/hotunplug code, rely on those routines
to do the right thing.
Fixes: 9d5171a8f248 ("powerpc/powernv: Enable removal of memory for in memory tracing")
That's not really right.
This patch doesn't fix it, the previous patch did.
If I just backport this patch then it's still broken.
So I'll tag patch 1 with the above Fixes: tag and add stable, and then
this just becomes a cleanup.
Fair point, the previous one does indeed fix things. I can do a minimal backport
fixing .size to .line_size if needed.
Cheers,
Balbir
From: Michael Ellerman <hidden> Date: 2018-04-24 03:48:25
On Fri, 2018-04-06 at 05:24:23 UTC, Balbir Singh wrote:
This patch adds support for flushing potentially dirty
cache lines when memory is hot-plugged/hot-un-plugged.
The support is currently limited to 64 bit systems.
The bug was exposed when mappings for a device were
actually hot-unplugged and plugged in back later.
A similar issue was observed during the development
of memtrace, but memtrace does it's own flushing of
region via a custom routine.
These patches do a flush both on hotplug/unplug to
clear any stale data in the cache w.r.t mappings,
there is a small race window where a clean cache
line may be created again just prior to tearing
down the mapping.
The patches were tested by disabling the flush
routines in memtrace and doing I/O on the trace
file. The system immediately checkstops (quite
reliablly if prior to the hot-unplug of the memtrace
region, we memset the regions we are about to
hot unplug). After these patches no custom flushing
is needed in the memtrace code.
Signed-off-by: Balbir Singh <bsingharora@gmail.com>
Acked-by: Reza Arbab <redacted>
Reviewed-by: Rashmica Gupta <redacted>