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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 9A387EE3698 for ; Thu, 12 Feb 2026 16:24:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=qPDJ8KvZog4IZrJ0heLDkSzo67AchIfK1BMB4QpSojA=; b=WPPiCWAK1F4WZKOjaJvuQBkn4Z tg+K45dGfX+r7ci9SxK9J6LSsq6EL44/Fs+ulD/hHxNBxtOfu8/TOWEoxJsM3EIro40CXW5L1TZe+ ogIbQujrdAQt/byUNnxajPJRj/vIEj0F4tpugQXjpV8BjFOq4zsk6E0tsioDtPvcfpg6GErYgbyX9 YNb8eJEc4fK0MW0qYwekf+WAv0ny9ZLT16DvO8Re6Xz+eMp3tSbjH6ESATXZNTkSA68VpzY+/C+X1 oJbBTOToFIAGQG+/0urVi2hbCA8Kcnzg2ND15h8A78WjD7dYuryba1/kmAHrm6tuUBXaUdUm4kyyP C0T+qnjA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1vqZU5-00000002LUY-3zRT; Thu, 12 Feb 2026 16:24:05 +0000 Received: from bali.collaboradmins.com ([2a01:4f8:201:9162::2]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1vqZU2-00000002LMe-0cM7; Thu, 12 Feb 2026 16:24:03 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1770913439; bh=D4Esu0PX9a6jwM8oltCOxAHVyCzKfA22p67UJYulAA4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HJ7OxUhEsl1jMv4aiowykMKh945jbIJwEj4X6VXYN5W/I6dFdblBgC5em9D6TdyMZ OCPT6R0B8/CGITxBSdT7GN+exkwlM8siS5PQz8esTCFFZr7vFWJ4FYQxdrX9tfva/B fpevt93xRF/qlCQkd5DAc5h0DWkByTu0GL+LXVM7ePRH1MlGLPffUmAsmgKtWEAqbO 5Ap+0yGYzaGB9dYIWlETIppxChyxs5fAUcbFFDeEMABmvUJW0yu1Pq2DBJ72rS8xJQ bHIr4CkfmdSEsKysrXoEBskoHB1cpjqkMn9RwpwXNEf1X5bKL99xvK6FfcIl0Yn9pR 3QvoQFSAKRr2Q== Received: from trenzalore (modemcable014.2-22-96.mc.videotron.ca [96.22.2.14]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: detlev) by bali.collaboradmins.com (Postfix) with ESMTPSA id A8A1E17E12E2; Thu, 12 Feb 2026 17:23:56 +0100 (CET) From: Detlev Casanova To: linux-kernel@vger.kernel.org Cc: Nicolas Dufresne , Benjamin Gaignard , Philipp Zabel , Mauro Carvalho Chehab , Heiko Stuebner , Daniel Almeida , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Hans Verkuil , Laurent Pinchart , Ricardo Ribalda , Yunke Cao , Detlev Casanova , Sakari Ailus , Pavan Bobba , James Cowgill , Ma Ke , Jacopo Mondi , Daniel Scally , linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-trace-kernel@vger.kernel.org, kernel@collabora.com Subject: [PATCH 07/11] media: Add stream on/off traces and run them in the ioctl Date: Thu, 12 Feb 2026 11:23:24 -0500 Message-ID: <20260212162328.192217-8-detlev.casanova@collabora.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260212162328.192217-1-detlev.casanova@collabora.com> References: <20260212162328.192217-1-detlev.casanova@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260212_082402_371916_CC7F2558 X-CRM114-Status: GOOD ( 11.99 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This will automatically add stream on/off tracing for all v4l2 drivers. Signed-off-by: Detlev Casanova --- drivers/media/v4l2-core/v4l2-ioctl.c | 20 ++++++++++++++++++-- include/trace/events/v4l2.h | 28 ++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 2 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index a3b6df0571d6..fd5193fc722e 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -1963,13 +1963,29 @@ static int v4l_try_fmt(const struct v4l2_ioctl_ops *ops, struct file *file, static int v4l_streamon(const struct v4l2_ioctl_ops *ops, struct file *file, void *arg) { - return ops->vidioc_streamon(file, NULL, *(unsigned int *)arg); + struct v4l2_fh *fh = file_to_v4l2_fh(file); + int err; + + err = ops->vidioc_streamon(file, NULL, *(unsigned int *)arg); + + if (!err) + trace_v4l2_streamon(fh->tgid, fh->fd); + + return err; } static int v4l_streamoff(const struct v4l2_ioctl_ops *ops, struct file *file, void *arg) { - return ops->vidioc_streamoff(file, NULL, *(unsigned int *)arg); + struct v4l2_fh *fh = file_to_v4l2_fh(file); + int err; + + err = ops->vidioc_streamoff(file, NULL, *(unsigned int *)arg); + + if (!err) + trace_v4l2_streamoff(fh->tgid, fh->fd); + + return err; } static int v4l_g_tuner(const struct v4l2_ioctl_ops *ops, struct file *file, diff --git a/include/trace/events/v4l2.h b/include/trace/events/v4l2.h index 248bc09bfc99..bec310eaedc7 100644 --- a/include/trace/events/v4l2.h +++ b/include/trace/events/v4l2.h @@ -262,6 +262,34 @@ DEFINE_EVENT(vb2_v4l2_event_class, vb2_v4l2_qbuf, TP_ARGS(q, vb) ); +DECLARE_EVENT_CLASS(v4l2_stream_class, + TP_PROTO(u32 tgid, u32 fd), + TP_ARGS(tgid, fd), + + TP_STRUCT__entry( + __field(u32, tgid) + __field(u32, fd) + ), + + TP_fast_assign( + __entry->tgid = tgid; + __entry->fd = fd; + ), + + TP_printk("tgid = %u, fd = %u", + __entry->tgid, __entry->fd) +); + +DEFINE_EVENT(v4l2_stream_class, v4l2_streamon, + TP_PROTO(u32 tgid, u32 fd), + TP_ARGS(tgid, fd) +); + +DEFINE_EVENT(v4l2_stream_class, v4l2_streamoff, + TP_PROTO(u32 tgid, u32 fd), + TP_ARGS(tgid, fd) +); + #endif /* if !defined(_TRACE_V4L2_H) || defined(TRACE_HEADER_MULTI_READ) */ /* This part must be outside protection */ -- 2.53.0