From: Simon Horman <horms@kernel.org>
To: Xabier Marquiegui <reibax@gmail.com>
Cc: netdev@vger.kernel.org, richardcochran@gmail.com,
tglx@linutronix.de, jstultz@google.com,
chrony-dev@chrony.tuxfamily.org, mlichvar@redhat.com,
ntp-lists@mattcorallo.com, vinicius.gomes@intel.com,
alex.maftei@amd.com, davem@davemloft.net, rrameshbabu@nvidia.com,
shuah@kernel.org
Subject: Re: [PATCH net-next v4 4/6] ptp: support event queue reader channel masks
Date: Fri, 6 Oct 2023 13:01:23 +0200 [thread overview]
Message-ID: <ZR/pA46huaSGgatd@kernel.org> (raw)
In-Reply-To: <5525d56c5feff9b28c6caa93e03d8f198d7412ce.1696511486.git.reibax@gmail.com>
On Thu, Oct 05, 2023 at 03:53:14PM +0200, Xabier Marquiegui wrote:
> On systems with multiple timestamp event channels, some readers might
> want to receive only a subset of those channels.
>
> This patch adds the necessary modifications to support timestamp event
> channel filtering, including two IOCTL operations:
>
> - Clear all channels
> - Enable one channel
>
> The mask modification operations will be applied exclusively on the
> event queue assigned to the file descriptor used on the IOCTL operation,
> so the typical procedure to have a reader receiving only a subset of the
> enabled channels would be:
>
> - Open device file
> - ioctl: clear all channels
> - ioctl: enable one channel
> - start reading
>
> Calling the enable one channel ioctl more than once will result in
> multiple enabled channels.
>
> Signed-off-by: Xabier Marquiegui <reibax@gmail.com>
> Suggested-by: Richard Cochran <richardcochran@gmail.com>
> Suggested-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
> ---
> v4:
> - split modifications in different patches for improved organization
> - filter modifications exclusive to currently open instance for
> simplicity and security
> - expand mask to 2048 channels
> - remove unnecessary tests
> v3: https://lore.kernel.org/netdev/20230928133544.3642650-4-reibax@gmail.com/
> - filter application by object id, aided by process id
> - friendlier testptp implementation of event queue channel filters
> v2: https://lore.kernel.org/netdev/20230912220217.2008895-3-reibax@gmail.com/
> - fix testptp compilation error: unknown type name 'pid_t'
> - rename mask variable for easier code traceability
> - more detailed commit message with two examples
> v1: https://lore.kernel.org/netdev/20230906104754.1324412-4-reibax@gmail.com/
> ---
> drivers/ptp/ptp_chardev.c | 24 ++++++++++++++++++++++++
> drivers/ptp/ptp_clock.c | 12 ++++++++++--
> drivers/ptp/ptp_private.h | 3 +++
> include/uapi/linux/ptp_clock.h | 2 ++
> 4 files changed, 39 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c
> index abe94bb80cf6..dbbe551a044f 100644
> --- a/drivers/ptp/ptp_chardev.c
> +++ b/drivers/ptp/ptp_chardev.c
> @@ -110,6 +110,10 @@ int ptp_open(struct posix_clock_context *pccontext, fmode_t fmode)
> queue = kzalloc(sizeof(*queue), GFP_KERNEL);
> if (!queue)
> return -EINVAL;
> + queue->mask = bitmap_alloc(PTP_MAX_CHANNELS, GFP_KERNEL);
> + if (!queue->mask)
Hi Xabier,
queue appears to be leaked here.
As flagged by Smatch.
> + return -EINVAL;
> + bitmap_set(queue->mask, 0, PTP_MAX_CHANNELS);
> spin_lock_init(&queue->lock);
> list_add_tail(&queue->qlist, &ptp->tsevqs);
> pccontext->private_clkdata = queue;
next prev parent reply other threads:[~2023-10-06 11:01 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-05 13:53 [PATCH net-next v4 0/6] ptp: Support for multiple filtered timestamp event queue readers Xabier Marquiegui
2023-10-05 13:53 ` [PATCH net-next v4 1/6] posix-clock: introduce posix_clock_context concept Xabier Marquiegui
2023-10-06 11:02 ` Simon Horman
2023-10-05 13:53 ` [PATCH net-next v4 2/6] ptp: Replace timestamp event queue with linked list Xabier Marquiegui
2023-10-05 13:53 ` [PATCH net-next v4 3/6] ptp: support multiple timestamp event readers Xabier Marquiegui
2023-10-05 13:53 ` [PATCH net-next v4 4/6] ptp: support event queue reader channel masks Xabier Marquiegui
2023-10-06 11:01 ` Simon Horman [this message]
2023-10-06 22:05 ` Vinicius Costa Gomes
2023-10-07 3:53 ` Richard Cochran
2023-10-06 23:35 ` Xabier Marquiegui
2023-10-07 0:35 ` Vinicius Costa Gomes
2023-10-05 13:53 ` [PATCH net-next v4 5/6] ptp: add debugfs interface to see applied " Xabier Marquiegui
2023-10-05 13:53 ` [PATCH net-next v4 6/6] ptp: add testptp mask test Xabier Marquiegui
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=ZR/pA46huaSGgatd@kernel.org \
--to=horms@kernel.org \
--cc=alex.maftei@amd.com \
--cc=chrony-dev@chrony.tuxfamily.org \
--cc=davem@davemloft.net \
--cc=jstultz@google.com \
--cc=mlichvar@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=ntp-lists@mattcorallo.com \
--cc=reibax@gmail.com \
--cc=richardcochran@gmail.com \
--cc=rrameshbabu@nvidia.com \
--cc=shuah@kernel.org \
--cc=tglx@linutronix.de \
--cc=vinicius.gomes@intel.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;
as well as URLs for NNTP newsgroup(s).