From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: Yicong Yang <yangyicong@huawei.com>
Cc: <mathieu.poirier@linaro.org>, <suzuki.poulose@arm.com>,
<corbet@lwn.net>, <linux-kernel@vger.kernel.org>,
<linux-doc@vger.kernel.org>, <alexander.shishkin@linux.intel.com>,
<helgaas@kernel.org>, <linux-pci@vger.kernel.org>,
<prime.zeng@huawei.com>, <linuxarm@huawei.com>
Subject: Re: [PATCH 2/4] hwtracing: hisi_ptt: Add support for dynamically updating the filter list
Date: Tue, 28 Mar 2023 17:51:53 +0100 [thread overview]
Message-ID: <20230328175153.00002938@Huawei.com> (raw)
In-Reply-To: <20230315094316.26772-3-yangyicong@huawei.com>
On Wed, 15 Mar 2023 17:43:14 +0800
Yicong Yang <yangyicong@huawei.com> wrote:
> From: Yicong Yang <yangyicong@hisilicon.com>
>
> The PCIe devices supported by the PTT trace can be removed/rescanned by
> hotplug or through sysfs. Add support for dynamically updating the
> available filter list by registering a PCI bus notifier block. Then user
> can always get latest information about available tracing filters and
> driver can block the invalid filters of which related devices no longer
> exist in the system.
>
> Signed-off-by: Yicong Yang <yangyicong@hisilicon.com>
> ---
Just a few trivial comments on this.
With those tidied up
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
...
> diff --git a/drivers/hwtracing/ptt/hisi_ptt.c b/drivers/hwtracing/ptt/hisi_ptt.c
> index 0a10c7ec46ad..010cdbc3c172 100644
> --- a/drivers/hwtracing/ptt/hisi_ptt.c
> +++ b/drivers/hwtracing/ptt/hisi_ptt.c
> +/*
> + * A PCI bus notifier is used here for dynamically updating the filter
> + * list.
> + */
> +static int hisi_ptt_notifier_call(struct notifier_block *nb, unsigned long action,
> + void *data)
> +{
> + struct hisi_ptt *hisi_ptt = container_of(nb, struct hisi_ptt, hisi_ptt_nb);
> + struct hisi_ptt_filter_update_info info;
> + struct device *dev = data;
> + struct pci_dev *pdev = to_pci_dev(dev);
This local variable doesn't add anything over
info.pdev = to_pci_dev(dev);
> +
> + info.pdev = pdev;
> +
> + switch (action) {
> + case BUS_NOTIFY_ADD_DEVICE:
> + info.is_add = true;
> + break;
> + case BUS_NOTIFY_DEL_DEVICE:
> + info.is_add = false;
> + break;
> + default:
> + return 0;
> + }
> +
> + hisi_ptt_update_fifo_in(hisi_ptt, &info);
> +
> + return 0;
> +}
> +
> diff --git a/drivers/hwtracing/ptt/hisi_ptt.h b/drivers/hwtracing/ptt/hisi_ptt.h
> index 5beb1648c93a..b1ba638fe7ea 100644
> --- a/drivers/hwtracing/ptt/hisi_ptt.h
> +++ b/drivers/hwtracing/ptt/hisi_ptt.h
> @@ -11,12 +11,15 @@
> /**
> * struct hisi_ptt_pmu_buf - Descriptor of the AUX buffer of PTT trace
> * @length: size of the AUX buffer
> @@ -170,10 +188,15 @@ struct hisi_ptt_pmu_buf {
> * @lower_bdf: the lower BDF range of the PCI devices managed by this PTT device
> * @port_filters: the filter list of root ports
> * @req_filters: the filter list of requester ID
> + * @filter_lock: lock to protect the filters
> * @port_mask: port mask of the managed root ports
> + * @work: delayed work for filter updating
> + * @filter_update_lock: spinlock to protect the filter update fifo
> + * @filter_update_fifo: fifo of the filters waiting to update the filter list
> */
> struct hisi_ptt {
> struct hisi_ptt_trace_ctrl trace_ctrl;
> + struct notifier_block hisi_ptt_nb;
Docs update for this one?
> struct hlist_node hotplug_node;
> struct pmu hisi_ptt_pmu;
> void __iomem *iobase;
> @@ -192,7 +215,19 @@ struct hisi_ptt {
> */
> struct list_head port_filters;
> struct list_head req_filters;
> + struct mutex filter_lock;
> u16 port_mask;
> +
> + /*
> + * We use a delayed work here to avoid indefinitely waiting for
> + * the hisi_ptt->mutex which protecting the filter list. The
> + * work will be delayed only if the mutex can not be held,
> + * otherwise no delay will be applied.
> + */
> + struct delayed_work work;
> + spinlock_t filter_update_lock;
> + DECLARE_KFIFO(filter_update_kfifo, struct hisi_ptt_filter_update_info,
> + HISI_PTT_FILTER_UPDATE_FIFO_SIZE);
> };
>
> #define to_hisi_ptt(pmu) container_of(pmu, struct hisi_ptt, hisi_ptt_pmu)
next prev parent reply other threads:[~2023-03-28 16:52 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-15 9:43 [PATCH 0/4] Improve PTT filter interface and some fixes Yicong Yang
2023-03-15 9:43 ` [PATCH 1/4] hwtracing: hisi_ptt: Make cpumask only present online CPUs Yicong Yang
2023-03-28 16:24 ` Jonathan Cameron
2023-03-30 3:53 ` Yicong Yang
2023-03-30 8:34 ` Jonathan Cameron
2023-03-15 9:43 ` [PATCH 2/4] hwtracing: hisi_ptt: Add support for dynamically updating the filter list Yicong Yang
2023-03-28 16:51 ` Jonathan Cameron [this message]
2023-03-29 12:52 ` Yicong Yang
2023-03-15 9:43 ` [PATCH 3/4] hwtracing: hisi_ptt: Export available filters through sysfs Yicong Yang
2023-03-28 17:02 ` Jonathan Cameron
2023-03-29 12:54 ` Yicong Yang
2023-03-15 9:43 ` [PATCH 4/4] hwtracing: hisi_ptt: Advertise PERF_PMU_CAP_NO_EXCLUDE for PTT PMU Yicong Yang
2023-03-28 16:53 ` Jonathan Cameron
2023-03-27 10:49 ` [PATCH 0/4] Improve PTT filter interface and some fixes 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=20230328175153.00002938@Huawei.com \
--to=jonathan.cameron@huawei.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=corbet@lwn.net \
--cc=helgaas@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=mathieu.poirier@linaro.org \
--cc=prime.zeng@huawei.com \
--cc=suzuki.poulose@arm.com \
--cc=yangyicong@huawei.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.