Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934424AbdIYLwL (ORCPT ); Mon, 25 Sep 2017 07:52:11 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:47678 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933057AbdIYLwJ (ORCPT ); Mon, 25 Sep 2017 07:52:09 -0400 Subject: Re: [PATCH] powerpc/perf: Fix for core/nest imc call trace on cpuhotplug To: Michael Ellerman Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, maddy@linux.vnet.ibm.com, hemant@linux.vnet.ibm.com References: <1505151134-26128-1-git-send-email-anju@linux.vnet.ibm.com> <87r2v0d5zi.fsf@concordia.ellerman.id.au> From: Anju T Sudhakar Date: Mon, 25 Sep 2017 17:22:01 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <87r2v0d5zi.fsf@concordia.ellerman.id.au> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-TM-AS-GCONF: 00 x-cbid: 17092511-8235-0000-0000-00000C51A33D X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007789; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000231; SDB=6.00922123; UDB=6.00463449; IPR=6.00702266; BA=6.00005605; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00017265; XFM=3.00000015; UTC=2017-09-25 11:52:06 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17092511-8236-0000-0000-00003DC954CE Message-Id: <28e408f0-d773-6d91-9282-92aa65ef043e@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-09-25_04:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1709250182 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1781 Lines: 46 Hi mpe, On Thursday 21 September 2017 10:04 AM, Michael Ellerman wrote: > Anju T Sudhakar writes: > >> Nest/core pmu units are enabled only when it is used. A reference count is >> maintained for the events which uses the nest/core pmu units. Currently in >> *_imc_counters_release function a WARN() is used for notification of any >> underflow of ref count. Replace WARN() with a pr_info since it is an overkill. > As discussed elsewhere this is not the right solution. > > If it's OK for the reference count to be negative, then we shouldn't > print anything when it is. > > But I don't understand how it can be OK for the refcount to be negative. > That means someone has a negative number of references to something? > > cheers > Scenario where this happens is in a stress test where perf session is started, followed by offlining of all cpus in a given core. And finally terminate the perf session. So, in cpuhotplug offline path(ppc_core_imc_cpu_offline), function set the ref->count to zero, if the current cpu which is about to offline is the last cpu in a given core and make an OPAL call to disable the engine in that core. And on perf session termination, perf->destory (core_imc_counters_release) will first decrement the ref->count for this core and based on the ref->count value an opal call is made to disable the core-imc engine. Now, since cpuhotplug path already clears the ref->count for core and disabled the engine, perf->destroy() decrementing again at event termination make it negative which in turn fires the WARN_ON. So we do prefer to remove the message as this wont happen in normal operation and the core counters are working as expected. I will send out a patch by removing the message asap. Thanks, Anju