Received: by 10.223.185.116 with SMTP id b49csp1058400wrg; Fri, 23 Feb 2018 11:08:53 -0800 (PST) X-Google-Smtp-Source: AH8x226dRmVEe3NvCuL23IcsUEMX2tH+9Yp9kNzUuLQMMzZcBibv52LZqjVNisWoJHHEmyvCvUTf X-Received: by 10.99.64.196 with SMTP id n187mr2181583pga.147.1519412933551; Fri, 23 Feb 2018 11:08:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519412933; cv=none; d=google.com; s=arc-20160816; b=KDxiAwXN/MF1jMmzud9j9QERaWFAsPfir7vEoQ2+sk1L74z23s3xsjZxN6SP4r7Hhn /wZ+/lHJb7Yk/6xcDd9LVP2v63TCp32DxFlCmKCvz4E+8FwkICBwnT12KM/dKkBO9MLo bSfb1z2n6AredxLN+hSuyfJzxuun64CXvRS82AcrODFQL18LB406yQSeI86AtUNfuQEb hQq2sySPLtzsh8I6UJkFeCDzMpBuaVCEHVGMazamkacVEh9p+wY0pPvtATWGR2G2bm+Z rgoKFxVkR+Pc5JNzJqfOSRdiVSmznEqS93AekW330a/KjTHyRD8flrltLpzqNAbYENOB uCHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=RJbd7PaQ4joVNTcKtNqf3QcPbPSQQVxDj5LJEFNjKOY=; b=hv6qpBkKIAOqvrvKcpagLz6Y3dbhxiKS6rOlKVFk4eBf2/VE8G2Ml2AUpCodgWHtS6 FApUqFWbhCoYm5NzfngVvbHQoBpA9WzUaSzMoMxQU5hw/1pASSMAImKFt+zHs4Rftb/C 6X8PBuXmC918xR9e/43tB/d9ADvtG34aEJJA6yMcVJmIRXjSPf2mI/9LEIswsDeMcuM/ Nv/geW5IdxGRWNYDB8NDdDTNQ9Q5J1LrX4O33t1NZktyIVqb+mVxOpVw9q0dQNfQl74G bC4mgfFD2Irhwcz745SIMxDQjqpAVPI4MDBeiJU6c6+OGEnwFzJwBH4/SHGry9MF0b3m Wo1g== ARC-Authentication-Results: i=1; mx.google.com; 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 l2si1848884pgu.691.2018.02.23.11.08.38; Fri, 23 Feb 2018 11:08:53 -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; 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 S965352AbeBWS5T (ORCPT + 99 others); Fri, 23 Feb 2018 13:57:19 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:50070 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965312AbeBWS5Q (ORCPT ); Fri, 23 Feb 2018 13:57:16 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id D9739AD9; Fri, 23 Feb 2018 18:57:02 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Anju T Sudhakar , Madhavan Srinivasan , Michael Ellerman , Sasha Levin Subject: [PATCH 4.14 152/159] powerpc/perf/imc: Fix nest-imc cpuhotplug callback failure Date: Fri, 23 Feb 2018 19:27:40 +0100 Message-Id: <20180223170801.356982256@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180223170743.086611315@linuxfoundation.org> References: <20180223170743.086611315@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Anju T Sudhakar [ Upstream commit ad2b6e01024ef23bddc3ce0bcb115ecd8c520b7e ] Oops is observed during boot: Faulting instruction address: 0xc000000000248340 cpu 0x0: Vector: 380 (Data Access Out of Range) at [c000000ff66fb850] pc: c000000000248340: event_function_call+0x50/0x1f0 lr: c00000000024878c: perf_remove_from_context+0x3c/0x100 sp: c000000ff66fbad0 msr: 9000000000009033 dar: 7d20e2a6f92d03c0 pid = 14, comm = cpuhp/0 While registering the cpuhotplug callbacks for nest-imc, if we fail in the cpuhotplug online path for any random node in a multi node system (because the opal call to stop nest-imc counters fails for that node), ppc_nest_imc_cpu_offline() will get invoked for other nodes who successfully returned from cpuhotplug online path. This call trace is generated since in the ppc_nest_imc_cpu_offline() path we are trying to migrate the event context, when nest-imc counters are not even initialized. Patch to add a check to ensure that nest-imc is registered before migrating the event context. Fixes: 885dcd709ba9 ("powerpc/perf: Add nest IMC PMU support") Signed-off-by: Anju T Sudhakar Reviewed-by: Madhavan Srinivasan Signed-off-by: Michael Ellerman Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/perf/imc-pmu.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) --- a/arch/powerpc/perf/imc-pmu.c +++ b/arch/powerpc/perf/imc-pmu.c @@ -309,6 +309,19 @@ static int ppc_nest_imc_cpu_offline(unsi return 0; /* + * Check whether nest_imc is registered. We could end up here if the + * cpuhotplug callback registration fails. i.e, callback invokes the + * offline path for all successfully registered nodes. At this stage, + * nest_imc pmu will not be registered and we should return here. + * + * We return with a zero since this is not an offline failure. And + * cpuhp_setup_state() returns the actual failure reason to the caller, + * which in turn will call the cleanup routine. + */ + if (!nest_pmus) + return 0; + + /* * Now that this cpu is one of the designated, * find a next cpu a) which is online and b) in same chip. */