From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754810AbbLJPmp (ORCPT ); Thu, 10 Dec 2015 10:42:45 -0500 Received: from eu-smtp-delivery-143.mimecast.com ([207.82.80.143]:39359 "EHLO eu-smtp-delivery-143.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752050AbbLJPmo convert rfc822-to-8bit (ORCPT ); Thu, 10 Dec 2015 10:42:44 -0500 Subject: Re: [PATCHv3 3/5] arm-cci: Add routines to enable/disable all counters To: Mark Rutland References: <1447783407-18027-1-git-send-email-suzuki.poulose@arm.com> <1447783407-18027-4-git-send-email-suzuki.poulose@arm.com> <20151210153222.GE495@leverpostej> Cc: linux-arm-kernel@lists.infradead.org, punit.agrawal@arm.com, arm@kernel.org, linux-kernel@vger.kernel.org From: "Suzuki K. Poulose" Message-ID: <56699D71.3070006@arm.com> Date: Thu, 10 Dec 2015 15:42:41 +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: <20151210153222.GE495@leverpostej> X-OriginalArrivalTime: 10 Dec 2015 15:42:41.0464 (UTC) FILETIME=[67AC3B80:01D13361] X-MC-Unique: NixQHdwGRnCfwhcfDM1hMg-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:32, Mark Rutland wrote: > On Tue, Nov 17, 2015 at 06:03:25PM +0000, Suzuki K. Poulose wrote: >> +static void __maybe_unused >> +pmu_disable_counters(struct cci_pmu *cci_pmu, unsigned long *mask) >> +{ >> + int i; >> + >> + for (i = 0; i < cci_pmu->num_cntrs; i++) { >> + if (pmu_counter_is_enabled(cci_pmu, i)) { >> + set_bit(i, mask); >> + pmu_disable_counter(cci_pmu, i); >> + } else >> + clear_bit(i, mask); > > Can we not assume a clean mask to begin with? If we force the caller to pass a clean mask, yes we could. I am fine with either approach. > >> + } >> +} >> + >> +/* >> + * Restore the status of the counters. Reversal of the pmu_disable_counters(). >> + * For each counter set in the mask, enable the counter back. >> + */ >> +static void __maybe_unused >> +pmu_restore_counters(struct cci_pmu *cci_pmu, unsigned long *mask) > > This would probably be better with s/restore/enable/ for consistency > with pmu_disable_counters. I had thought as well, but then chose restore as we don't enable all the counters. Given that we pass a mask argument, it is fine to change it to enable and will do that in the next one. > > Other than that this looks fine to me. Thanks for the review. Cheers Suzuki