From nobody Sun Feb 8 11:44:32 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 4845720FA86 for ; Mon, 24 Feb 2025 23:42:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740440565; cv=none; b=iSzSvhdpBn2TNytd8YXxwmvHEauyqjy4BVI1sDSkaO4uM+/y2ZjSz3ZhvpWvJFFcKekS900lzwh6j0ol+uW8iwhtYc9MdPQn+n7FqK/++wgoWwzQhmnPyLjvGwrlHecw6T/jM9EbWn8sAvY9FeYGSogLDyUXAFRaT3bpts+Wrto= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740440565; c=relaxed/simple; bh=uWeiT+1xVVDMPmHbQYp+hU7kEdI797i6pjlm/t6kV4s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GLx+sU8DejfcD40Hr1P5XFxrL2yO6VQg2zmKpk/s6xmeq4bqB5aI1/6ZQfWcIxRBptOiqdNkomiTysmvhuZvB+8MJ0W3vPgSirSqXSqEH97Gss9fJtD38F83MU0qTGBNwPx4gaocFFWcPdd3Yd8KuXTvZ5BGmsAzWFBy6HVg4qE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Q6gW0LWw; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Q6gW0LWw" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1740440562; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pEjw7fxonTaV44564ll+XhxsCuf1s5tZ1MB5XWAbMQQ=; b=Q6gW0LWwB68TKlMNLmBGeBj9JA4SVGmYxz1EPOPP1VmyCn+xQveY1Ag6gco+qH/ZIvqW6a 6axKy83YtpuvU7JTkrMR5DW7Ffwrah4py3p99rUQsTuMLH6b8gF4jsP5kBlsD6dR/mrtUA d9rvV1rJZiaBjFLF6XT5e2iX8Fi8Og8= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-501-o3JMLdP-PBqvP9jONwGEvg-1; Mon, 24 Feb 2025 18:42:38 -0500 X-MC-Unique: o3JMLdP-PBqvP9jONwGEvg-1 X-Mimecast-MFC-AGG-ID: o3JMLdP-PBqvP9jONwGEvg_1740440557 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 2A25519783B2; Mon, 24 Feb 2025 23:42:37 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.9]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 6642A180035E; Mon, 24 Feb 2025 23:42:34 +0000 (UTC) From: David Howells To: netdev@vger.kernel.org Cc: David Howells , Marc Dionne , Jakub Kicinski , "David S. Miller" , Eric Dumazet , Paolo Abeni , Christian Brauner , linux-afs@lists.infradead.org, linux-kernel@vger.kernel.org, Simon Horman Subject: [PATCH net-next 08/15] afs: Improve afs_volume tracing to display a debug ID Date: Mon, 24 Feb 2025 23:41:45 +0000 Message-ID: <20250224234154.2014840-9-dhowells@redhat.com> In-Reply-To: <20250224234154.2014840-1-dhowells@redhat.com> References: <20250224234154.2014840-1-dhowells@redhat.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 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 Content-Type: text/plain; charset="utf-8" Improve the tracing of afs_volume objects to include displaying a debug ID so that different instances of volumes with the same "vid" can be distinguished. Also be consistent about displaying the volume's refcount (and not the cell's). Signed-off-by: David Howells cc: Marc Dionne cc: Jakub Kicinski cc: "David S. Miller" cc: Eric Dumazet cc: Paolo Abeni cc: Simon Horman cc: linux-afs@lists.infradead.org cc: netdev@vger.kernel.org --- fs/afs/internal.h | 1 + fs/afs/volume.c | 15 +++++++++------ include/trace/events/afs.h | 18 +++++++++++------- 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/fs/afs/internal.h b/fs/afs/internal.h index 89be1014968d..bbd550d496a7 100644 --- a/fs/afs/internal.h +++ b/fs/afs/internal.h @@ -623,6 +623,7 @@ struct afs_volume { afs_volid_t vid; /* The volume ID of this volume */ afs_volid_t vids[AFS_MAXTYPES]; /* All associated volume IDs */ refcount_t ref; + unsigned int debug_id; /* Debugging ID for traces */ time64_t update_at; /* Time at which to next update */ struct afs_cell *cell; /* Cell to which belongs (pins ref) */ struct rb_node cell_node; /* Link in cell->volumes */ diff --git a/fs/afs/volume.c b/fs/afs/volume.c index af3a3f57c1b3..0efff3d25133 100644 --- a/fs/afs/volume.c +++ b/fs/afs/volume.c @@ -10,6 +10,7 @@ #include "internal.h" =20 static unsigned __read_mostly afs_volume_record_life =3D 60 * 60; +static atomic_t afs_volume_debug_id; =20 static void afs_destroy_volume(struct work_struct *work); =20 @@ -59,7 +60,7 @@ static void afs_remove_volume_from_cell(struct afs_volume= *volume) struct afs_cell *cell =3D volume->cell; =20 if (!hlist_unhashed(&volume->proc_link)) { - trace_afs_volume(volume->vid, refcount_read(&cell->ref), + trace_afs_volume(volume->debug_id, volume->vid, refcount_read(&volume->r= ef), afs_volume_trace_remove); write_seqlock(&cell->volume_lock); hlist_del_rcu(&volume->proc_link); @@ -84,6 +85,7 @@ static struct afs_volume *afs_alloc_volume(struct afs_fs_= context *params, if (!volume) goto error_0; =20 + volume->debug_id =3D atomic_inc_return(&afs_volume_debug_id); volume->vid =3D vldb->vid[params->type]; volume->update_at =3D ktime_get_real_seconds() + afs_volume_record_life; volume->cell =3D afs_get_cell(params->cell, afs_cell_trace_get_vol); @@ -115,7 +117,7 @@ static struct afs_volume *afs_alloc_volume(struct afs_f= s_context *params, =20 *_slist =3D slist; rcu_assign_pointer(volume->servers, slist); - trace_afs_volume(volume->vid, 1, afs_volume_trace_alloc); + trace_afs_volume(volume->debug_id, volume->vid, 1, afs_volume_trace_alloc= ); return volume; =20 error_1: @@ -247,7 +249,7 @@ static void afs_destroy_volume(struct work_struct *work) afs_remove_volume_from_cell(volume); afs_put_serverlist(volume->cell->net, slist); afs_put_cell(volume->cell, afs_cell_trace_put_vol); - trace_afs_volume(volume->vid, refcount_read(&volume->ref), + trace_afs_volume(volume->debug_id, volume->vid, refcount_read(&volume->re= f), afs_volume_trace_free); kfree_rcu(volume, rcu); =20 @@ -262,7 +264,7 @@ bool afs_try_get_volume(struct afs_volume *volume, enum= afs_volume_trace reason) int r; =20 if (__refcount_inc_not_zero(&volume->ref, &r)) { - trace_afs_volume(volume->vid, r + 1, reason); + trace_afs_volume(volume->debug_id, volume->vid, r + 1, reason); return true; } return false; @@ -278,7 +280,7 @@ struct afs_volume *afs_get_volume(struct afs_volume *vo= lume, int r; =20 __refcount_inc(&volume->ref, &r); - trace_afs_volume(volume->vid, r + 1, reason); + trace_afs_volume(volume->debug_id, volume->vid, r + 1, reason); } return volume; } @@ -290,12 +292,13 @@ struct afs_volume *afs_get_volume(struct afs_volume *= volume, void afs_put_volume(struct afs_volume *volume, enum afs_volume_trace reaso= n) { if (volume) { + unsigned int debug_id =3D volume->debug_id; afs_volid_t vid =3D volume->vid; bool zero; int r; =20 zero =3D __refcount_dec_and_test(&volume->ref, &r); - trace_afs_volume(vid, r - 1, reason); + trace_afs_volume(debug_id, vid, r - 1, reason); if (zero) schedule_work(&volume->destructor); } diff --git a/include/trace/events/afs.h b/include/trace/events/afs.h index c19132605f41..cf94bf1e8286 100644 --- a/include/trace/events/afs.h +++ b/include/trace/events/afs.h @@ -1539,25 +1539,29 @@ TRACE_EVENT(afs_server, ); =20 TRACE_EVENT(afs_volume, - TP_PROTO(afs_volid_t vid, int ref, enum afs_volume_trace reason), + TP_PROTO(unsigned int debug_id, afs_volid_t vid, int ref, + enum afs_volume_trace reason), =20 - TP_ARGS(vid, ref, reason), + TP_ARGS(debug_id, vid, ref, reason), =20 TP_STRUCT__entry( + __field(unsigned int, debug_id) __field(afs_volid_t, vid) __field(int, ref) __field(enum afs_volume_trace, reason) ), =20 TP_fast_assign( - __entry->vid =3D vid; - __entry->ref =3D ref; - __entry->reason =3D reason; + __entry->debug_id =3D debug_id; + __entry->vid =3D vid; + __entry->ref =3D ref; + __entry->reason =3D reason; ), =20 - TP_printk("V=3D%llx %s ur=3D%d", - __entry->vid, + TP_printk("V=3D%08x %s vid=3D%llx r=3D%d", + __entry->debug_id, __print_symbolic(__entry->reason, afs_volume_traces), + __entry->vid, __entry->ref) );