mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yicong Yang <yangyicong@huawei.com>
To: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
Cc: <yangyicong@hisilicon.com>, <will@kernel.org>,
	<mark.rutland@arm.com>, <hejunhao3@huawei.com>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>, <prime.zeng@hisilicon.com>,
	<fanghao11@huawei.com>, <linuxarm@huawei.com>
Subject: Re: [PATCH 1/7] drivers/perf: hisi_pcie: Introduce hisi_pcie_pmu_get_filter()
Date: Wed, 21 Feb 2024 17:39:11 +0800	[thread overview]
Message-ID: <68d4382d-7b1a-f23e-3b33-c2fca708deaf@huawei.com> (raw)
In-Reply-To: <20240208121800.000057a2@huawei.com>

On 2024/2/8 20:18, Jonathan Cameron wrote:
> On Thu, 8 Feb 2024 12:06:43 +0000
> Jonathan Cameron <Jonathan.Cameron@Huawei.com> wrote:
> 
>> On Sun, 4 Feb 2024 15:45:21 +0800
>> Yicong Yang <yangyicong@huawei.com> wrote:
>>
>>> From: Yicong Yang <yangyicong@hisilicon.com>
>>>
>>> Factor out retrieving of the register value for the
>>> corresponding event from hisi_pcie_config_filter() into a
>>> new function hisi_pcie_pmu_get_filter() allowing future reuse.
>>>
>>> Signed-off-by: Yicong Yang <yangyicong@hisilicon.com>  
>>
>> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> On second thoughts, this might benefit from a clearer name.
> Perhaps just call it exactly what it is
> hisi_pcie_pmu_get_ctrl_reg_val_to_set()
> 
> It incorporates the event code as well as the filter.
> Maybe we want to rename pmu_config_filter() as well to
> pmu_config_counter() which I think is the real meaning?
> 

make sense to me. we can simply use the reg name as the suffix,
it'll be more clearer:

hisi_pcie_pmu_get_event_ctrl_val()
hisi_pcie_pmu_config_event_ctrl()

> 
>>
>>> ---
>>>  drivers/perf/hisilicon/hisi_pcie_pmu.c | 13 ++++++++++---
>>>  1 file changed, 10 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/drivers/perf/hisilicon/hisi_pcie_pmu.c b/drivers/perf/hisilicon/hisi_pcie_pmu.c
>>> index b90ba8aca3fa..11a819cd07f2 100644
>>> --- a/drivers/perf/hisilicon/hisi_pcie_pmu.c
>>> +++ b/drivers/perf/hisilicon/hisi_pcie_pmu.c
>>> @@ -216,10 +216,8 @@ static void hisi_pcie_pmu_writeq(struct hisi_pcie_pmu *pcie_pmu, u32 reg_offset,
>>>  	writeq_relaxed(val, pcie_pmu->base + offset);
>>>  }
>>>  
>>> -static void hisi_pcie_pmu_config_filter(struct perf_event *event)
>>> +static u64 hisi_pcie_pmu_get_filter(struct perf_event *event)
>>>  {
>>> -	struct hisi_pcie_pmu *pcie_pmu = to_pcie_pmu(event->pmu);
>>> -	struct hw_perf_event *hwc = &event->hw;
>>>  	u64 port, trig_len, thr_len, len_mode;
>>>  	u64 reg = HISI_PCIE_INIT_SET;
>>>  
>>> @@ -256,6 +254,15 @@ static void hisi_pcie_pmu_config_filter(struct perf_event *event)
>>>  	else
>>>  		reg |= FIELD_PREP(HISI_PCIE_LEN_M, HISI_PCIE_LEN_M_DEFAULT);
>>>  
>>> +	return reg;
>>> +}
>>> +
>>> +static void hisi_pcie_pmu_config_filter(struct perf_event *event)
>>> +{
>>> +	struct hisi_pcie_pmu *pcie_pmu = to_pcie_pmu(event->pmu);
>>> +	struct hw_perf_event *hwc = &event->hw;
>>> +	u64 reg = hisi_pcie_pmu_get_filter(event);
>>> +
>>>  	hisi_pcie_pmu_writeq(pcie_pmu, HISI_PCIE_EVENT_CTRL, hwc->idx, reg);
>>>  }
>>>    
>>
>>
>> _______________________________________________
>> linux-arm-kernel mailing list
>> linux-arm-kernel@lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 
> .
> 

  reply	other threads:[~2024-02-21  9:39 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-04  7:45 [PATCH 0/7] Several updates for HiSilicon PCIe PMU driver Yicong Yang
2024-02-04  7:45 ` [PATCH 1/7] drivers/perf: hisi_pcie: Introduce hisi_pcie_pmu_get_filter() Yicong Yang
2024-02-08 12:06   ` Jonathan Cameron
2024-02-08 12:18     ` Jonathan Cameron
2024-02-21  9:39       ` Yicong Yang [this message]
2024-02-04  7:45 ` [PATCH 2/7] drivers/perf: hisi_pcie: Fix incorrect counting under metric mode Yicong Yang
2024-02-08 12:19   ` Jonathan Cameron
2024-02-04  7:45 ` [PATCH 3/7] drivers/perf: hisi_pcie: Add more events for counting TLP bandwidth Yicong Yang
2024-02-08 12:20   ` Jonathan Cameron
2024-02-21  9:40     ` Yicong Yang
2024-02-04  7:45 ` [PATCH 4/7] drivers/perf: hisi_pcie: Check the target filter properly Yicong Yang
2024-02-08 12:29   ` Jonathan Cameron
2024-02-21  9:46     ` Yicong Yang
2024-02-22  1:21       ` hejunhao
2024-02-22  1:29     ` hejunhao
2024-02-04  7:45 ` [PATCH 5/7] drivers/perf: hisi_pcie: Relax the check on related events Yicong Yang
2024-02-04  7:45 ` [PATCH 6/7] drivers/perf: hisi_pcie: Merge find_related_event() and get_event_idx() Yicong Yang
2024-02-08 12:39   ` Jonathan Cameron
2024-02-22  3:00     ` hejunhao
2024-02-04  7:45 ` [PATCH 7/7] docs: perf: Update usage for target filter of hisi-pcie-pmu Yicong Yang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=68d4382d-7b1a-f23e-3b33-c2fca708deaf@huawei.com \
    --to=yangyicong@huawei.com \
    --cc=Jonathan.Cameron@Huawei.com \
    --cc=fanghao11@huawei.com \
    --cc=hejunhao3@huawei.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=mark.rutland@arm.com \
    --cc=prime.zeng@hisilicon.com \
    --cc=will@kernel.org \
    --cc=yangyicong@hisilicon.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®