From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758650AbcAKKs1 (ORCPT ); Mon, 11 Jan 2016 05:48:27 -0500 Received: from foss.arm.com ([217.140.101.70]:54238 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750813AbcAKKs0 (ORCPT ); Mon, 11 Jan 2016 05:48:26 -0500 Subject: Re: [PATCH v5 03/11] arm-cci: Group writes to counter To: Mark Rutland References: <1451908490-2615-1-git-send-email-suzuki.poulose@arm.com> <1451908490-2615-4-git-send-email-suzuki.poulose@arm.com> <20160104190353.GC17127@leverpostej> <568BA043.2020302@arm.com> <20160111104407.GD6499@leverpostej> Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, arm@kernel.org, punit.agrawal@arm.com, peterz@infradead.org From: "Suzuki K. Poulose" Message-ID: <56938877.4060103@arm.com> Date: Mon, 11 Jan 2016 10:48:23 +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: <20160111104407.GD6499@leverpostej> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/01/16 10:44, Mark Rutland wrote: > On Tue, Jan 05, 2016 at 10:51:47AM +0000, Suzuki K. Poulose wrote: >> On 04/01/16 19:03, Mark Rutland wrote: >>> On Mon, Jan 04, 2016 at 11:54:42AM +0000, Suzuki K. Poulose wrote: >>>> Add a helper to group the writes to PMU counter, this will be >>>> used to delay setting the event period to pmu::pmu_enable() >>>> >> >>>> +/* Write a value to a given set of counters */ >>>> +static void __pmu_write_counters(struct cci_pmu *cci_pmu, unsigned long *mask, u32 value) >>>> +{ >>>> + int i; >>>> + >>>> + for_each_set_bit(i, mask, cci_pmu->num_cntrs) >>>> + __pmu_write_counter(cci_pmu, value, i); >>>> +} >>> >>> I don't understand this as-is. Why do all the counters have the same >>> value? >> >> The only value we write to the counters is the period. This routine writes >> a given value to a set of counters specified by the mask (not to be confused >> with the PMU->hw_events->mask). This will help to group the writes to the counters, >> especially since preparatory steps to write to a single counter itself is costly. >> So, we do all the preparation only once for a batch of counters. >> >> The other option is to use hw_events->prev_count (which should be set before calling >> the function) for each counter specified in the mask. I am fine with either of the >> two. > > I think this would be clearer using prev_count. > > I guess it doesn't matter since we won't support sampling, but it would > match the shape of other PMU drivers. OK, will use that. Thanks Suzuki