From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755554AbbLKL2v (ORCPT ); Fri, 11 Dec 2015 06:28:51 -0500 Received: from eu-smtp-delivery-143.mimecast.com ([146.101.78.143]:56974 "EHLO eu-smtp-delivery-143.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755115AbbLKL2t convert rfc822-to-8bit (ORCPT ); Fri, 11 Dec 2015 06:28:49 -0500 Subject: Re: [PATCHv3 5/5] arm-cci: CCI-500: Work around PMU counter writes To: Mark Rutland References: <1447783407-18027-1-git-send-email-suzuki.poulose@arm.com> <1447783407-18027-6-git-send-email-suzuki.poulose@arm.com> <20151210154251.GG495@leverpostej> Cc: linux-arm-kernel@lists.infradead.org, punit.agrawal@arm.com, arm@kernel.org, linux-kernel@vger.kernel.org, Peter Zijlstra From: "Suzuki K. Poulose" Message-ID: <566AB36D.9050209@arm.com> Date: Fri, 11 Dec 2015 11:28:45 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <20151210154251.GG495@leverpostej> X-OriginalArrivalTime: 11 Dec 2015 11:28:45.0423 (UTC) FILETIME=[18B29FF0:01D13407] X-MC-Unique: hv-yPgb6TAqwmwVwqx2v5A-1 Content-Type: text/plain; charset=WINDOWS-1252; format=flowed Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/12/15 15:42, Mark Rutland wrote: > On Tue, Nov 17, 2015 at 06:03:27PM +0000, Suzuki K. Poulose wrote: >> The CCI PMU driver sets the event counter to the half of the maximum >> value(2^31) it can count before we start the counters via >> pmu_event_set_period(). This is done to give us the best chance to >> handle the overflow interrupt, taking care of extreme interrupt latencies. > > This should work, but it seems very heavyweight given we do it for each > write. > > Can we not amortize this by using the {start,commit,cancel}_txn hooks? > > Either we can handle 1-4 and 6-8 in those, or we can copy everything > into a shadow state and apply it all in one go at commit_txn time. I took a look at it. The only worrying part is, if pmu->add() will be called outside *_txn(). from linux/perf_event.h: /* * Adds/Removes a counter to/from the PMU, can be done inside a * transaction, see the ->*_txn() methods. * As of now it is only called within the transactions, but the comment somehow doesn't look like enforces it. Thoughts ? Suzuki