Received: by 10.223.164.221 with SMTP id h29csp2050972wrb; Thu, 2 Nov 2017 05:13:30 -0700 (PDT) X-Google-Smtp-Source: ABhQp+SG7HX/wyooGq38t64YY0ucjqBU7M0Z7mdvvY/QCkDPa2UDrPtna4XuBAl47ifxS+LlvnET X-Received: by 10.101.82.8 with SMTP id o8mr3411357pgp.422.1509624810476; Thu, 02 Nov 2017 05:13:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509624810; cv=none; d=google.com; s=arc-20160816; b=zHOrcl2QK8DCAKLI84xlzwWVtzXuOn0hLX2Bw2g8vd9/dMt3/ip9lpWTRHOOzYIbaq EiCrnBNG97wS10RTFn01yGqe9cItPJTHMc76W5SOLUWUFAf632PNmkeHRmjalP3VVMwg neki4LEpbyT6MiLnTmAbBr+YdX/MxPkVi4i3ApasvIFZ/BtNW8G1ABfqI5niVmkmbJ1+ KPeNfmwGIDkpaxe814dr0qBVawvm+nxuw6L3WRJ9h+yuLgnJLI7LZcRyzvW1As7hw0Lv hvWpMTVocVPyUv40GENW6fO4XJoEV47WylujU8ij9S1riOqivFtzSRRC2bjxRvbEp+1b ZkFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=Y08KqvodGEkBfTEF19F0ZRnvKJz854BugKo8PXcbCck=; b=qoTzTd7Qn7DjWpM7Sf+hGN8kZ3sjTw5jssw00xbUEYsXZN5u5cYoJyT0ohVog+PlNS gt5Re8DsHEEHJbMbzLkkTLD7bBYu23Z9Jga/XAcEBlk/ssX336fUOQseQUZvlEGX+u5h ZqiBFuUeBxz4lEaxyvCGlAPhpfAVBdZBh3sOStNh/y5D706DJLaaBJgxxvlLxcQ4O67V fZUMDHnJ/mOULhEnZ8w+KuFmreDRywDUXtnrH8TuwVHaUEOQ+M4PMtPw3eW+mb6zlpQw VAIX4GwPdfpi+60bYqIzUlccm9i2YEvA2GnDv2KcpPvdFBxz7viIjJdXxPNKMkM8RmH+ up0A== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m5si3664249pfg.275.2017.11.02.05.13.16; Thu, 02 Nov 2017 05:13:30 -0700 (PDT) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754053AbdKBMMh (ORCPT + 96 others); Thu, 2 Nov 2017 08:12:37 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:36726 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751370AbdKBMMg (ORCPT ); Thu, 2 Nov 2017 08:12:36 -0400 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id vA2C9Q7F125868 for ; Thu, 2 Nov 2017 08:12:35 -0400 Received: from e06smtp14.uk.ibm.com (e06smtp14.uk.ibm.com [195.75.94.110]) by mx0b-001b2d01.pphosted.com with ESMTP id 2e01g1p7nf-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 02 Nov 2017 08:12:35 -0400 Received: from localhost by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 2 Nov 2017 12:12:33 -0000 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 2 Nov 2017 12:12:30 -0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id vA2CCTOR9175268; Thu, 2 Nov 2017 12:12:29 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E743911C05B; Thu, 2 Nov 2017 12:07:34 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7228311C04C; Thu, 2 Nov 2017 12:07:33 +0000 (GMT) Received: from xenial-xerus.in.ibm.com (unknown [9.124.210.7]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 2 Nov 2017 12:07:33 +0000 (GMT) From: Anju T Sudhakar To: mpe@ellerman.id.au Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, maddy@linux.vnet.ibm.com, anju@linux.vnet.ibm.com Subject: [PATCH v2] powerpc/perf: Fix core-imc hotplug callback failure during imc initialization Date: Thu, 2 Nov 2017 17:42:26 +0530 X-Mailer: git-send-email 2.7.4 X-TM-AS-GCONF: 00 x-cbid: 17110212-0016-0000-0000-000004FCBD15 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17110212-0017-0000-0000-000028384D5D Message-Id: <1509624746-5632-1-git-send-email-anju@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-11-02_03:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1711020157 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Madhavan Srinivasan Call trace observed during boot: [ 0.750749] PCI: CLS 0 bytes, default 128 [ 0.750855] Unpacking initramfs... [ 1.570445] Freeing initrd memory: 23168K [ 1.571090] rtas_flash: no firmware flash support [ 1.573873] nest_capp0_imc performance monitor hardware support registered [ 1.574006] nest_capp1_imc performance monitor hardware support registered [ 1.579616] core_imc memory allocation for cpu 56 failed [ 1.579730] Unable to handle kernel paging request for data at address 0xffa400010 [ 1.579797] Faulting instruction address: 0xc000000000bf3294 0:mon> e cpu 0x0: Vector: 300 (Data Access) at [c000000ff38ff8d0] pc: c000000000bf3294: mutex_lock+0x34/0x90 lr: c000000000bf3288: mutex_lock+0x28/0x90 sp: c000000ff38ffb50 msr: 9000000002009033 dar: ffa400010 dsisr: 80000 current = 0xc000000ff383de00 paca = 0xc000000007ae0000 softe: 0 irq_happened: 0x01 pid = 13, comm = cpuhp/0 Linux version 4.11.0-39.el7a.ppc64le (mockbuild@ppc-058.build.eng.bos.redhat.com) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC) ) #1 SMP Tue Oct 3 07:42:44 EDT 2017 0:mon> t [c000000ff38ffb80] c0000000002ddfac perf_pmu_migrate_context+0xac/0x470 [c000000ff38ffc40] c00000000011385c ppc_core_imc_cpu_offline+0x1ac/0x1e0 [c000000ff38ffc90] c000000000125758 cpuhp_invoke_callback+0x198/0x5d0 [c000000ff38ffd00] c00000000012782c cpuhp_thread_fun+0x8c/0x3d0 [c000000ff38ffd60] c0000000001678d0 smpboot_thread_fn+0x290/0x2a0 [c000000ff38ffdc0] c00000000015ee78 kthread+0x168/0x1b0 [c000000ff38ffe30] c00000000000b368 ret_from_kernel_thread+0x5c/0x74 While registering the cpuhoplug callbacks for core-imc, if we fails in the cpuhotplug online path for any random core (either because opal call to initialize the core-imc counters fails or because memory allocation fails for that core), ppc_core_imc_cpu_offline() will get invoked for other cpus who successfully returned from cpuhotplug online path. But in the ppc_core_imc_cpu_offline() path we are trying to migrate the event context, when core-imc counters are not even initialized. Thus creating the above stack dump. Add a check to see if core-imc counters are enabled or not in the cpuhotplug offline path before migrating the context to handle this failing scenario. Signed-off-by: Madhavan Srinivasan Signed-off-by: Anju T Sudhakar --- arch/powerpc/perf/imc-pmu.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/arch/powerpc/perf/imc-pmu.c b/arch/powerpc/perf/imc-pmu.c index 8812624..a7a1db4 100644 --- a/arch/powerpc/perf/imc-pmu.c +++ b/arch/powerpc/perf/imc-pmu.c @@ -607,6 +607,20 @@ static int ppc_core_imc_cpu_offline(unsigned int cpu) if (!cpumask_test_and_clear_cpu(cpu, &core_imc_cpumask)) return 0; + /* + * Check whether core_imc is registered. We could end up here + * if the cpuhotplug callback registration fails. i.e, callback + * invokes the offline path for all sucessfully registered cpus. + * At this stage, core_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 inturn will call the cleanup routine. + */ + if (!core_imc_pmu->pmu.event_init) + return 0; + /* Find any online cpu in that core except the current "cpu" */ ncpu = cpumask_any_but(cpu_sibling_mask(cpu), cpu); -- 2.7.4 From 1582943609547497807@xxx Thu Nov 02 08:51:04 +0000 2017 X-GM-THRID: 1582766204567645963 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread