Skip to content

Commit e610a46

Browse files
nathanlynchmpe
authored andcommitted
powerpc/pseries/mobility: rebuild cacheinfo hierarchy post-migration
It's common for the platform to replace the cache device nodes after a migration. Since the cacheinfo code is never informed about this, it never drops its references to the source system's cache nodes, causing it to wind up in an inconsistent state resulting in warnings and oopses as soon as CPU online/offline occurs after the migration, e.g. cache for /cpus/l3-cache@3113(Unified) refers to cache for /cpus/l2-cache@200d(Unified) WARNING: CPU: 15 PID: 86 at arch/powerpc/kernel/cacheinfo.c:176 release_cache+0x1bc/0x1d0 [...] NIP release_cache+0x1bc/0x1d0 LR release_cache+0x1b8/0x1d0 Call Trace: release_cache+0x1b8/0x1d0 (unreliable) cacheinfo_cpu_offline+0x1c4/0x2c0 unregister_cpu_online+0x1b8/0x260 cpuhp_invoke_callback+0x114/0xf40 cpuhp_thread_fun+0x270/0x310 smpboot_thread_fn+0x2c8/0x390 kthread+0x1b8/0x1c0 ret_from_kernel_thread+0x5c/0x68 Using device tree notifiers won't work since we want to rebuild the hierarchy only after all the removals and additions have occurred and the device tree is in a consistent state. Call cacheinfo_teardown() before processing device tree updates, and rebuild the hierarchy afterward. Fixes: 410bccf ("powerpc/pseries: Partition migration in the kernel") Signed-off-by: Nathan Lynch <nathanl@linux.ibm.com> Reviewed-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
1 parent e59a175 commit e610a46

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

‎arch/powerpc/platforms/pseries/mobility.c‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <asm/machdep.h>
2424
#include <asm/rtas.h>
2525
#include "pseries.h"
26+
#include "../../kernel/cacheinfo.h"
2627

2728
static struct kobject *mobility_kobj;
2829

@@ -345,11 +346,20 @@ void post_mobility_fixup(void)
345346
*/
346347
cpus_read_lock();
347348

349+
/*
350+
* It's common for the destination firmware to replace cache
351+
* nodes. Release all of the cacheinfo hierarchy's references
352+
* before updating the device tree.
353+
*/
354+
cacheinfo_teardown();
355+
348356
rc = pseries_devicetree_update(MIGRATION_SCOPE);
349357
if (rc)
350358
printk(KERN_ERR "Post-mobility device tree update "
351359
"failed: %d\n", rc);
352360

361+
cacheinfo_rebuild();
362+
353363
cpus_read_unlock();
354364

355365
/* Possibly switch to a new RFI flush type */

0 commit comments

Comments
 (0)