Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp841210ybl; Fri, 24 Jan 2020 10:29:40 -0800 (PST) X-Google-Smtp-Source: APXvYqwRNHtHG1tt2TRGLZ1JGc/gXJimE6uxeakev76vEPlqELTU/On537q8akNBo10EWTJM0Zhw X-Received: by 2002:a9d:67d2:: with SMTP id c18mr3625756otn.362.1579890579766; Fri, 24 Jan 2020 10:29:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579890579; cv=none; d=google.com; s=arc-20160816; b=J3EZbGZVSCzbkNfObJoUnG6hxMqnMUFGLroLQqyLw1DbShCFX/bSyie9jy212OlDXg jnXzrXOuhnfTgOv0zSRnNjzGM0lj/cxMO4Xe9PnE6GH7MokMPDGeEDPZyi+kxe52T+O4 C9yDiqyamKLIWGIXwfjrV9Xg2/7eINjOc6V6mqxPTpS9Bj8fnl9OsWPoFQGUDvxgmrmB Fio938pdjY8T0YTl6EZIjz7T5Vv7apb4hdsbiwBn2Ww1E1eDTBDM/kyDYcKkssEi1fsK xAtZtUGdSrYECZvHx5LcIfoauqLYlqzmiWxF8lJYkWqS/DMJTWL2zLvthaJ5DOPwVLsm l/YQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4akXGN5m+BJjOsGqnBPeo+OKY5XkDmNjTiw6XK/iXIA=; b=GledsnHu4cmCCN8mHAiVPq/rliuZGJ6O/bXvw6mrDAlQNcBtLofWwsNFXRzis9XdRy 9YzsVUS/WKVAYteXGozwLFxk8f6AHrT58zakCBnYeQDawKjiuVHUGpP7o8g2jb947miO G4IIT57SMAfmA3wo9ICj0A/qjQwofNUdQR4D5eYfJkUef9S/gydMZrEjMrK3speUfpIx QUAidZNxtij+7y++J/nXp9nRkd29LVIJBrMaCBhM6HH8+BRrfb/JMpD+ZTEBe2XAx5VI J6MoexmbbyyWXwGxf0Jitq5y+5GhnZ4ex04SHbcKfdm0b8kzwfTp9STxSdm66GNt5QYw 4sng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=S6QAEop3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r82si167576oia.36.2020.01.24.10.29.27; Fri, 24 Jan 2020 10:29:39 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=S6QAEop3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387739AbgAXLYc (ORCPT + 99 others); Fri, 24 Jan 2020 06:24:32 -0500 Received: from mail.kernel.org ([198.145.29.99]:37916 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729635AbgAXLY3 (ORCPT ); Fri, 24 Jan 2020 06:24:29 -0500 Received: from localhost (ip-213-127-102-57.ip.prioritytelecom.net [213.127.102.57]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0A95620718; Fri, 24 Jan 2020 11:24:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579865068; bh=0M8wbBcq8ZoY45k6pcaYMDnGfdysss6JAKqWK7Awf8w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S6QAEop3vv8P4xWnzExy3pqJZfuS66VG3ctRaZJ2dgw9FD+7PW+H0SnkQkE+GrM5P qqSj75sVxj3xaK1MhDtQ/f3G4BqW3mgIafZQf8Kr2tK7lUY9LLQoFenJyP1ulP7cRY RZMTnjJSvwDCYOswnsctL5VGYW0DrYSMA/JhCkgI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nathan Lynch , "Gautham R. Shenoy" , Michael Ellerman , Sasha Levin Subject: [PATCH 4.19 431/639] powerpc/pseries/mobility: rebuild cacheinfo hierarchy post-migration Date: Fri, 24 Jan 2020 10:30:01 +0100 Message-Id: <20200124093141.001203486@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200124093047.008739095@linuxfoundation.org> References: <20200124093047.008739095@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nathan Lynch [ Upstream commit e610a466d16a086e321f0bd421e2fc75cff28605 ] 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: 410bccf97881 ("powerpc/pseries: Partition migration in the kernel") Signed-off-by: Nathan Lynch Reviewed-by: Gautham R. Shenoy Signed-off-by: Michael Ellerman Signed-off-by: Sasha Levin --- arch/powerpc/platforms/pseries/mobility.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/powerpc/platforms/pseries/mobility.c b/arch/powerpc/platforms/pseries/mobility.c index e4ea713833832..70744b4fbd9ed 100644 --- a/arch/powerpc/platforms/pseries/mobility.c +++ b/arch/powerpc/platforms/pseries/mobility.c @@ -24,6 +24,7 @@ #include #include #include "pseries.h" +#include "../../kernel/cacheinfo.h" static struct kobject *mobility_kobj; @@ -360,11 +361,20 @@ void post_mobility_fixup(void) */ cpus_read_lock(); + /* + * It's common for the destination firmware to replace cache + * nodes. Release all of the cacheinfo hierarchy's references + * before updating the device tree. + */ + cacheinfo_teardown(); + rc = pseries_devicetree_update(MIGRATION_SCOPE); if (rc) printk(KERN_ERR "Post-mobility device tree update " "failed: %d\n", rc); + cacheinfo_rebuild(); + cpus_read_unlock(); /* Possibly switch to a new RFI flush type */ -- 2.20.1