From nobody Thu Apr 2 20:17:58 2026 Received: from bali.collaboradmins.com (bali.collaboradmins.com [148.251.105.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 794CD35DD0B; Thu, 12 Feb 2026 16:24:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.251.105.195 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770913442; cv=none; b=Rc7Dq1CRUq5bTWU5MeDkoAVaTYpWShAzPG8Ev+ReIdHRIBv/RLSs2D1OO+TnQO6Fe9cJuTogEStNfWbq8luoMDHvxRfZ+lP1+6+jPylh6VtDIRGGKooDpP/yiriAYewT4xiWkFGCfzIdH9BpJV6MrStep7wlFyfONYbHiTggJPw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770913442; c=relaxed/simple; bh=D4Esu0PX9a6jwM8oltCOxAHVyCzKfA22p67UJYulAA4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fo0ZxljENR9PMz04ZD1pvoa7f9IXhA44Dscb8lGDFU7FjR7YdHDEe0aYhECBzkxDJ8ktWzKUgMLwSMJBSQTHxRxiPCiG/lZgTU4y10MdF0P7OMmrK/zNIveixd57B9eX6dG38tezwUvhx1g/k0bDWVwUQ8f4v25dnNG6x8Ja1rg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=HJ7OxUhE; arc=none smtp.client-ip=148.251.105.195 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="HJ7OxUhE" 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 *fil= e, void *arg) { - return ops->vidioc_streamon(file, NULL, *(unsigned int *)arg); + struct v4l2_fh *fh =3D file_to_v4l2_fh(file); + int err; + + err =3D ops->vidioc_streamon(file, NULL, *(unsigned int *)arg); + + if (!err) + trace_v4l2_streamon(fh->tgid, fh->fd); + + return err; } =20 static int v4l_streamoff(const struct v4l2_ioctl_ops *ops, struct file *fi= le, void *arg) { - return ops->vidioc_streamoff(file, NULL, *(unsigned int *)arg); + struct v4l2_fh *fh =3D file_to_v4l2_fh(file); + int err; + + err =3D ops->vidioc_streamoff(file, NULL, *(unsigned int *)arg); + + if (!err) + trace_v4l2_streamoff(fh->tgid, fh->fd); + + return err; } =20 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) ); =20 +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 =3D tgid; + __entry->fd =3D fd; + ), + + TP_printk("tgid =3D %u, fd =3D %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) */ =20 /* This part must be outside protection */ --=20 2.53.0