Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp4468315img; Tue, 26 Mar 2019 09:58:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqyFtzgZ3o4kBSLSiN1bEVIjZkZGBMnGkB9/dI4A0cO8AglKXEJht/t2a9spQm+9EXgJlmE7 X-Received: by 2002:a17:902:2c83:: with SMTP id n3mr33128678plb.281.1553619528176; Tue, 26 Mar 2019 09:58:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553619528; cv=none; d=google.com; s=arc-20160816; b=M92ePEGZYEPxyOqbiC31GPC/0+2QOYouSJQqBB2Io6C4Z4f8K0wbPDC1K1/IppXx44 ZS0Y6HKwKv36yS1XcEcD1r4Pj4CBpr6o+Ub8b9r0to+Nd82cuZt6HwVibIlSZUJAlrOL n2OdnUmZ+MxtesqsCQTuOT9wojESON0N2wm2oJF6v07piiPURB24VEEc9dCmFpYN0VUU PP5TliHSWy3ZlEwageu5I9Us8YiUFxWR3kg/T1Z6pxtFr8L8JcAhaffrqEr7q0ziugkF SBo7S5f49wm/1kayCrxN3//+wduOUWwq4OLYCebWZpuXTu11Uuqm/pRWb+dWACRnidKQ Ai6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=4/K0gbU/sz2+WpdSFauQBg7jn16N9kvbn2oCn+AAubU=; b=LNB17jt1gFHWYxtFKKLq/v+YqzPjYZwcyLXy4qnzmb4Bf/iOHyWFlqQJCcq4efGisL KfKxDu9CGVZZPy0PBU9gvwTia5GMVE6UvKhKrCflQ8pKaJaicVf2epZQwoS/5D1oueY+ Z/evjBIi2mTFHnlAF9tf3Nm655z9NLpH9ir5Cy6ZXOgpredMR0fuxUEqH6M2giCWOTto M/Svfv/+/jMct2AkYxREl7vJcq5SLUijXBz+0ZM3AkiPAYi7fCs6g89DULzTeDIki/fu DhpF/JkrhJl5c1bk7Bn5fWxDqVjoyb1jyYLf2aL+x6IdKhkWBnj5ZfGeo0tFF3f5xAH2 sgjw== 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 o7si16364123pgh.273.2019.03.26.09.58.32; Tue, 26 Mar 2019 09:58:48 -0700 (PDT) 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 S1731519AbfCZQ5s (ORCPT + 99 others); Tue, 26 Mar 2019 12:57:48 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:40828 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727492AbfCZQ5r (ORCPT ); Tue, 26 Mar 2019 12:57:47 -0400 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 Cc: andrew.murray@arm.com, jean-philippe.brucker@arm.com, will.deacon@arm.com, mark.rutland@arm.com, guohanjun@huawei.com, john.garry@huawei.com, pabba@codeaurora.org, vkilari@codeaurora.org, rruigrok@codeaurora.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linuxarm@huawei.com, neil.m.leeder@gmail.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-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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