From patchwork Wed Mar 6 07:11:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve French X-Patchwork-Id: 1908567 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=efc7E9tH; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=147.75.48.161; helo=sy.mirrors.kernel.org; envelope-from=linux-cifs+bounces-1403-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TqNs352S7z1yX3 for ; Wed, 6 Mar 2024 18:11:35 +1100 (AEDT) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 05114B2388A for ; Wed, 6 Mar 2024 07:11:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 993491B7FF; Wed, 6 Mar 2024 07:11:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="efc7E9tH" X-Original-To: linux-cifs@vger.kernel.org Received: from mail-lj1-f171.google.com (mail-lj1-f171.google.com [209.85.208.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BE3AD5BAEA for ; Wed, 6 Mar 2024 07:11:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709709089; cv=none; b=TGcaqaiKlyCHw8QtyKBw4tbKb7/GichEnAFMeDmVNDxSBrzCdZdZZQWGcJbZVJOrhyRsiJY/OWnW8d8dmW4rhcmIzeFw5VcEJBBIRKuwS39M77c6EQl9NqG3YNJWh7ow8BBmlz8XyppCqB2krVmncQl6L1GC+sIQKYLAcw6tW20= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709709089; c=relaxed/simple; bh=MX8gRFsiH0PC3cSA3oXE/j6ZLY/xwh3uHCeUt64jUKg=; h=MIME-Version:From:Date:Message-ID:Subject:To:Cc:Content-Type; b=gWvmHm4ex0hHHoaHLQVCEOAvnnT1EH3q2wHHVAYX4bV58MJTz9xGXWXFGSoUJzqhzA/JN2MOw/pKL5jKl1Kx6+HZwzvOByM7tRWPzw5woG+rCFlhPqBupQMnpi+yBHJDyaD0FND33nZYdwB4JPjEwnKZoMlfkzTJJLLoHrcEqwU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=efc7E9tH; arc=none smtp.client-ip=209.85.208.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lj1-f171.google.com with SMTP id 38308e7fff4ca-2d29aad15a5so83539651fa.3 for ; Tue, 05 Mar 2024 23:11:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709709085; x=1710313885; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=8J3DkEstVgcwqYqRiZthYww5Y5k2vKqSegj5AlFKN5o=; b=efc7E9tHUOLPeS9FAptHkv7+j/3OKhFNIXL6UwoQDWajtJxrTfBEHIxklO6ASS7KH4 FT9bRGs02G3XGQXbGTnk958//mFUkGq7V0wYMsOTbMssdR1v5n6ajYdJILkNEQOOen/3 t9ytdG2+AYmz07rKm7Bk8Mcza9vhzAu1IQFDwC+JJT+WC4jtz7zdsVP8viniP7IHwTqR F+1OoH0GDMdUHZXO3IV6CF7ZWrLB/6xW9MeC2HWV3mFttlfusnHvqMaGhXThz0CosKC0 hQo/IJiff2HLrVpBNgmrrx//xveX+2vk1Cv1Jc7x+k20mcDXO6NU89eTJRQ66Vwgmucl Rryw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709709085; x=1710313885; h=cc:to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=8J3DkEstVgcwqYqRiZthYww5Y5k2vKqSegj5AlFKN5o=; b=lU6FjpR9WMJNSqwOKeQoXT87is4IxyzEJng5ynMCLwFvS7vMpMyJEc8meSS8ht/XYB K4hujYXcXcfGDoPQlhCs4FbhZD8CvCYQ82n0zL+6Yfis/xx2gj2M13T5iMv1rncs2SSh mRwdKXZ2atyFA7b2ZCq0E/LgGtDf+kVgQ4DcycdxwFVlvsJyiSlMNAb5QLOgykgO7bvY 6YJi/DaMYzP9fYGiJCMuW/T3F3Ftlf6wTLiVOHMLVPyFLndHNDvQlhf3NWRqtRRBBM/y cXfovm65VJ06i0K6SyYrsrHldpD3TWjoMzHM1dWgHx3GHU1dQ69H1fBNtuSDm9PrmfNY BDPw== X-Gm-Message-State: AOJu0YzZBOG82iW4rOT/RQXdMItFrJsXW2QaYm4o27U2luWBbr63XuwN D0B5DFceU+4LjLKqPinjxQ9B1Q4tjElUgWJRh6sDKiyyIguenxxa7Y2DoLxzl8rcSoNombxeii1 b5dB9U3cXXqY1ABWk4IRDHl1mpCNd17BiG3cLRw== X-Google-Smtp-Source: AGHT+IHZPTphlt7ACCBZ6PGXWtHW5k15WJS4AcznYYtRMH4Rq4mrg0fBivLbXbHGfoDowSU2LLXB0kQlAcf/KA35448= X-Received: by 2002:a2e:99d5:0:b0:2d3:f095:ff2a with SMTP id l21-20020a2e99d5000000b002d3f095ff2amr2610543ljj.47.1709709085297; Tue, 05 Mar 2024 23:11:25 -0800 (PST) Precedence: bulk X-Mailing-List: linux-cifs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Steve French Date: Wed, 6 Mar 2024 01:11:13 -0600 Message-ID: Subject: [PATCH][SMB3 client] add dynamic trace point for ioctl To: CIFS Cc: Bharath S M smb3: add dynamic trace point for ioctls It can be helpful in debugging to know which ioctls are called to better correlate them with smb3 fsctls (and opens). Add a dynamic trace point to trace ioctls into cifs.ko (see attached) Here is sample output: TASK-PID CPU# ||||| TIMESTAMP FUNCTION | | | ||||| | | new-inotify-ioc-90418 [001] ..... 142157.397024: smb3_ioctl: xid=18 fid=0x0 ioctl cmd=0xc009cf0b new-inotify-ioc-90457 [007] ..... 142217.943569: smb3_ioctl: xid=22 fid=0x389bf5b6 ioctl cmd=0xc009cf0b From 89dfc2e3a49bfd7a75f1398ab194a998f9d554da Mon Sep 17 00:00:00 2001 From: Steve French Date: Wed, 6 Mar 2024 01:03:59 -0600 Subject: [PATCH] smb3: add dynamic trace point for ioctls It can be helpful in debugging to know which ioctls are called to better correlate them with smb3 fsctls (and opens). Add a dynamic trace point to trace ioctls into cifs.ko Here is sample output: TASK-PID CPU# ||||| TIMESTAMP FUNCTION | | | ||||| | | new-inotify-ioc-90418 [001] ..... 142157.397024: smb3_ioctl: xid=18 fid=0x0 ioctl cmd=0xc009cf0b new-inotify-ioc-90457 [007] ..... 142217.943569: smb3_ioctl: xid=22 fid=0x389bf5b6 ioctl cmd=0xc009cf0b Signed-off-by: Steve French --- fs/smb/client/ioctl.c | 5 +++++ fs/smb/client/trace.h | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/fs/smb/client/ioctl.c b/fs/smb/client/ioctl.c index e2f92c21fff5..c012dfdba80d 100644 --- a/fs/smb/client/ioctl.c +++ b/fs/smb/client/ioctl.c @@ -345,6 +345,11 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg) xid = get_xid(); cifs_dbg(FYI, "cifs ioctl 0x%x\n", command); + if (pSMBFile == NULL) + trace_smb3_ioctl(xid, 0, command); + else + trace_smb3_ioctl(xid, pSMBFile->fid.persistent_fid, command); + switch (command) { case FS_IOC_GETFLAGS: if (pSMBFile == NULL) diff --git a/fs/smb/client/trace.h b/fs/smb/client/trace.h index ce90ae0d77f8..f9c1fd32d0b8 100644 --- a/fs/smb/client/trace.h +++ b/fs/smb/client/trace.h @@ -1032,6 +1032,38 @@ DEFINE_EVENT(smb3_ses_class, smb3_##name, \ DEFINE_SMB3_SES_EVENT(ses_not_found); +DECLARE_EVENT_CLASS(smb3_ioctl_class, + TP_PROTO(unsigned int xid, + __u64 fid, + unsigned int command), + TP_ARGS(xid, fid, command), + TP_STRUCT__entry( + __field(unsigned int, xid) + __field(__u64, fid) + __field(unsigned int, command) + ), + TP_fast_assign( + __entry->xid = xid; + __entry->fid = fid; + __entry->command = command; + ), + TP_printk("xid=%u fid=0x%llx ioctl cmd=0x%x", + __entry->xid, __entry->fid, __entry->command) +) + +#define DEFINE_SMB3_IOCTL_EVENT(name) \ +DEFINE_EVENT(smb3_ioctl_class, smb3_##name, \ + TP_PROTO(unsigned int xid, \ + __u64 fid, \ + unsigned int command), \ + TP_ARGS(xid, fid, command)) + +DEFINE_SMB3_IOCTL_EVENT(ioctl); + + + + + DECLARE_EVENT_CLASS(smb3_credit_class, TP_PROTO(__u64 currmid, __u64 conn_id, -- 2.40.1