Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp1082702ybx; Thu, 7 Nov 2019 07:03:11 -0800 (PST) X-Google-Smtp-Source: APXvYqx98XWQ7cQ9QdLLUOQxJsN88vq3vHRrTpLQq0Lzdq2iIDnpnJ4Bc37LfIlnPpn30X/T88r6 X-Received: by 2002:aa7:c716:: with SMTP id i22mr4013257edq.237.1573138991170; Thu, 07 Nov 2019 07:03:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573138991; cv=none; d=google.com; s=arc-20160816; b=gDep0hmHTIykfdAZjLYh4cA9a+jC34RA0KWSd0rxyyOcUPudOtanIH4ngw7C4cJ+/D Lhi+VYUGtZDNyT4lhRKlx7cFtyEE/2F2F5irqaM64nDwkY2QZDfcEC3t+uBNH0gqkjdt WwIl1A7W6m2eFG+0Fp5wgCPd9wfo/PAe7LrChy6QTcFWrnGQtE0ajjD65VGFumSqPvHQ HpdT71zZLqF19EbP6iYDMF0WsMjF1RX+y2tNrpmReEb1SuXmDtEixUePB3mNQpHq6qYt /i059i86+u8nM0+TR5u29vNyTcSNDOq49lfWnDHXBv7oUZwvQPx9SpUOZ7Zrm/o1dZzi i4MA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=RFcVn7haLvJb0dEahgUuzfhnGBBagxrl5R7J//QAafM=; b=pjAiIBHd4tcYJJP4AZ9ryZ44aviYmb4MUy6bfk8+DFJOQo0l740AHpIsNkNCZM5gdN WxAIFMpCWVESXA4LdpYNzmLDQGFDbROJwYxYM2OUxG+SRbdqxuF8+RPdQicozkeDuVR+ /KBjQBEGZLvOM0EWp1EczpglWN3UfZJXbfRGwSo3nikkssw7xJdp2FEjSEtC6P+UwP4+ A0bDT8l6zHRFXsmyPIHiJARRG/uWJR7K4CJ22eojK5xOOgsj27+wF5CKC1686kN9CSpe iqiismJqie0bCZsmUVF0M/kmCw25hPwUKvhoig0cmUOm8MdrwVAXWcGp1tWz67K90g4V Kl1w== 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 t17si1698284ejg.44.2019.11.07.07.02.23; Thu, 07 Nov 2019 07:03:11 -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 S1731032AbfKGOwS (ORCPT + 99 others); Thu, 7 Nov 2019 09:52:18 -0500 Received: from foss.arm.com ([217.140.110.172]:57500 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729450AbfKGOwS (ORCPT ); Thu, 7 Nov 2019 09:52:18 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7742731B; Thu, 7 Nov 2019 06:52:17 -0800 (PST) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3DD573F71A; Thu, 7 Nov 2019 06:52:16 -0800 (PST) Date: Thu, 7 Nov 2019 14:52:14 +0000 From: Mark Rutland To: Ganapatrao Kulkarni Cc: Ganapatrao Prabhakerrao Kulkarni , "linux-doc@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "peterz@infradead.org" , "mingo@redhat.com" , "will@kernel.org" , "corbet@lwn.net" Subject: Re: [PATCH 1/2] perf/core: Adding capability to disable PMUs event multiplexing Message-ID: <20191107145213.GB6888@lakrids.cambridge.arm.com> References: <1573002091-9744-1-git-send-email-gkulkarni@marvell.com> <1573002091-9744-2-git-send-email-gkulkarni@marvell.com> <20191106112810.GA50610@lakrids.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.1+11 (2f07cb52) (2018-12-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 06, 2019 at 03:28:46PM -0800, Ganapatrao Kulkarni wrote: > Hi Peter, Mark, > > On Wed, Nov 6, 2019 at 3:28 AM Mark Rutland wrote: > > > > On Wed, Nov 06, 2019 at 01:01:40AM +0000, Ganapatrao Prabhakerrao Kulkarni wrote: > > > When PMUs are registered, perf core enables event multiplexing > > > support by default. There is no provision for PMUs to disable > > > event multiplexing, if PMUs want to disable due to unavoidable > > > circumstances like hardware errata etc. > > > > > > Adding PMU capability flag PERF_PMU_CAP_NO_MUX_EVENTS and support > > > to allow PMUs to explicitly disable event multiplexing. > > > > Even without multiplexing, this PMU activity can happen when switching > > tasks, or when creating/destroying events, so as-is I don't think this > > makes much sense. > > > > If there's an erratum whereby heavy access to the PMU can lockup the > > core, and it's possible to workaround that by minimzing accesses, that > > should be done in the back-end PMU driver. > > As said in errata, If there are heavy access to memory like stream > application running and along with that if PMU control registers are > also accessed frequently, then CPU lockup is seen. Ok. So the issue is the frequency of access to those registers. Which registers does that apply to? Is this the case for only reads, only writes, or both? Does the frequency of access actually matter, or is is just more likely that we see the issue with a greater number of accesses? i.e the increased frequency increases the probability of hitting the issue. I'd really like a better description of the HW issue here. > I ran perf stat with 4 events of thuderx2 PMU as well as with 6 events > for stream application. > For 4 events run, there is no event multiplexing, where as for 6 > events run the events are multiplexed. > > For 4 event run: > No of times pmu->add is called: 10 > No of times pmu->del is called: 10 > No of times pmu->read is called: 310 > > For 6 events run: > No of times pmu->add is called: 5216 > No of times pmu->del is called: 5216 > No of times pmu->read is called: 5216 > > Issue happens when the add and del are called too many times as seen > with 6 event case. Sure, but I can achieve similar by creating/destroying events in a loop. Multiplexing is _one_ way to cause this behaviour, but it's not the _only_ way. > The PMU hardware control registers are programmed when add and del > functions are called. > For pmu->read no issues since no h/w issue with the data path. As above, can you please describe the hardware conditions more thoroughly? > This is UNCORE driver, not sure context switch has any influence on this? I believe that today it's possible for this to happen for cgroup events, as non-sensical as it may be to have a cgroup-bound uncore PMU event. > Please suggest me, how can we fix this in back-end PMU driver without > any perf core help? In order to do so, I need a better explanation of the underlying hardware issue. Thanks, Mark.