From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B9F1DC43381 for ; Tue, 26 Mar 2019 16:58:05 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 82B492070D for ; Tue, 26 Mar 2019 16:58:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="iF3r5x/n" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 82B492070D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ymFi4DS5n9y0l8CmJp432+PG+IGOlvMUdKYc7ZIfLM4=; b=iF3r5x/nc9L0Rppjx+KlOnrE8 ETWRY5bCUZRjdUw1pYXzT5XIX9qmTD37gD3Ayf2qPIoiNV2uB0+YpirCxilhVawerbII/rlBUACc7 uUNI41a3l9ALjsFuIdL9gq0gbICiVvuud9JPWBv7zRzHQd7mRZUvu9yaa1A4admlvXgC8hiFtBZGV CnEQowEO7dwAfOd7kub9CR6ZR7a63RHjvR330+M4nCffbIa2syf1/BUOnypr8zjt/y5G1+t8BPpOx msyHspFvauG8YN7T4iu2WADpgtafyl6knHg4O4W9GnyzUa6zp0w+l91bEUG7R+6jn7eBKtuX9yjKr G3fN/yCqQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h8pOg-0008Dc-KS; Tue, 26 Mar 2019 16:57:58 +0000 Received: from foss.arm.com ([217.140.101.70]) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h8pOY-0008Cz-KA for linux-arm-kernel@lists.infradead.org; Tue, 26 Mar 2019 16:57:56 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E30D7374; Tue, 26 Mar 2019 09:57:46 -0700 (PDT) Received: from [10.1.196.75] (e110467-lin.cambridge.arm.com [10.1.196.75]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 55A393F614; Tue, 26 Mar 2019 09:57:44 -0700 (PDT) Subject: Re: [PATCH v7 2/4] perf/smmuv3: Add arm64 smmuv3 pmu driver To: Shameer Kolothum , lorenzo.pieralisi@arm.com References: <20190326151753.19384-1-shameerali.kolothum.thodi@huawei.com> <20190326151753.19384-3-shameerali.kolothum.thodi@huawei.com> From: Robin Murphy Message-ID: Date: Tue, 26 Mar 2019 16:57:42 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 In-Reply-To: <20190326151753.19384-3-shameerali.kolothum.thodi@huawei.com> Content-Language: en-GB X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190326_095750_687672_07FFB502 X-CRM114-Status: GOOD ( 19.57 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, vkilari@codeaurora.org, neil.m.leeder@gmail.com, jean-philippe.brucker@arm.com, pabba@codeaurora.org, john.garry@huawei.com, will.deacon@arm.com, rruigrok@codeaurora.org, linuxarm@huawei.com, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, guohanjun@huawei.com, andrew.murray@arm.com, linux-arm-kernel@lists.infradead.org Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Shameer, On 26/03/2019 15:17, Shameer Kolothum wrote: [...] > +static int smmu_pmu_apply_event_filter(struct smmu_pmu *smmu_pmu, > + struct perf_event *event, int idx) > +{ > + u32 span, sid; > + unsigned int num_ctrs = smmu_pmu->num_counters; > + bool filter_en = !!get_filter_enable(event); > + > + span = filter_en ? get_filter_span(event) : > + SMMU_PMCG_DEFAULT_FILTER_SPAN; > + sid = filter_en ? get_filter_stream_id(event) : > + SMMU_PMCG_DEFAULT_FILTER_SID; > + > + /* Support individual filter settings */ > + if (!smmu_pmu->global_filter) { > + smmu_pmu_set_event_filter(event, idx, span, sid); > + return 0; > + } > + > + /* Requested settings same as current global settings*/ > + if (span == smmu_pmu->global_filter_span && > + sid == smmu_pmu->global_filter_sid) > + return 0; > + > + if (!bitmap_empty(smmu_pmu->used_counters, num_ctrs)) > + return -EAGAIN; > + > + if (idx == 0) { > + smmu_pmu_set_event_filter(event, idx, span, sid); > + smmu_pmu->global_filter_span = span; > + smmu_pmu->global_filter_sid = sid; > + return 0; > + } When I suggested dropping the check of idx, I did mean removing it entirely, not just moving it further down ;) Nothing to worry about though, I'll just leave this here for Will to consider applying on top or squashing. Thanks, Robin. ----->8----- From: Robin Murphy Subject: [PATCH] perf/smmuv3: Relax global filter constraint a little Although the current behaviour of smmu_pmu_get_event_idx() effectively ensures that the first-allocated counter will be counter 0, there's no need to strictly enforce that in smmu_pmu_apply_event_filter(). All that matters is that we only ever touch the global filter settings in SMMU_PMCG_SMR0 and SMMU_PMCG_EVTYPER0 while no counters are active. Signed-off-by: Robin Murphy --- drivers/perf/arm_smmuv3_pmu.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/perf/arm_smmuv3_pmu.c b/drivers/perf/arm_smmuv3_pmu.c index 6b3c0ed7ad71..23045ead6de1 100644 --- a/drivers/perf/arm_smmuv3_pmu.c +++ b/drivers/perf/arm_smmuv3_pmu.c @@ -286,14 +286,11 @@ static int smmu_pmu_apply_event_filter(struct smmu_pmu *smmu_pmu, if (!bitmap_empty(smmu_pmu->used_counters, num_ctrs)) return -EAGAIN; - if (idx == 0) { - smmu_pmu_set_event_filter(event, idx, span, sid); - smmu_pmu->global_filter_span = span; - smmu_pmu->global_filter_sid = sid; - return 0; - } + smmu_pmu_set_event_filter(event, 0, span, sid); + smmu_pmu->global_filter_span = span; + smmu_pmu->global_filter_sid = sid; - return -EAGAIN; + return 0; } static int smmu_pmu_get_event_idx(struct smmu_pmu *smmu_pmu, -- 2.20.1.dirty _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel