From patchwork Wed Nov 15 17:15:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 165513 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp2686035vqg; Wed, 15 Nov 2023 09:16:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IGMAo8nBvQUrGcEJl43MJKce/olkmYvjYJnrLOTgwa8CIcinXP29m6HxVHcu/oIm0MN7Z7e X-Received: by 2002:a17:902:ced1:b0:1cc:1e16:e998 with SMTP id d17-20020a170902ced100b001cc1e16e998mr6818824plg.51.1700068570104; Wed, 15 Nov 2023 09:16:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700068570; cv=none; d=google.com; s=arc-20160816; b=rXaNuRl23+PYd4ZBao3eHN8/VJBWOg3nmsrCPnWmWjnGk2wv/a54zJOp4pC79tUOKy 7RRldL5M+IrXrNJaSWZYNhMiIVNX+YCydFkq2IW0vlrly0v+L5v0tyDbf+6YakJ6t629 A5I+uj2aKItuNNYQmP7Yi9kppLW2tP4ExpxOA6uz6njVA4viLnDbzGiS2MZqLet/gD/5 WYZQmoCHfs3jn3PTljv0iSQOahkmRxz5u5AxnRkfKutjK+/Thhkj6R1SbVWJijAiTrM/ cBjOFz221BJm2bNXSjP2tZeAzk+PzOUcyuGhdJ1D+9dO+L38zafC5sRIJLPqnxHmDbkT eE2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:content-transfer-encoding :content-id:mime-version:subject:cc:to:from:organization :dkim-signature; bh=l0183wfb6QQa7Dify3mlCQ9wLvW15z5Q/GXKekFiQGQ=; fh=R53BNol5gttsC8sHkxK5xW6DkH4Gze00u3bi++HSWzU=; b=q2dACEIIdUDNlUyOT5AOv8sURAgxp8ggy1AzRwebRxvCJtMfSfLsNmBQLQ/64K0v4f Lkf8KWj9TEovJVpqnimXBN1zZLXG5LEUNfvndulg9LnEEIxocMLKStu4EgTh+6xbYWjR HaxZa4cak9NJM4/ooUSnlouvP0hhHKNiZkUhol6WuVDstJnd/fGhMc96SHbN6es9vIXI igJNlkJev1yAcSjYSr7YZyf6+4234LYWWt+3Q4bryFr5Ep9auHuMlHUeGTpHgwW/6FxO 3IqKYi16iP4Hsr9YJ1M194qLrYkd8HBz6uyJWnB2hynGs4ZqhOg9eT/XDOQdGkWCT8Xo +c1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=DRQrYT71; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id b1-20020a170902d30100b001cc2ed18253si10012166plc.15.2023.11.15.09.16.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 09:16:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=DRQrYT71; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id A0D6A8026AA9; Wed, 15 Nov 2023 09:16:07 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229630AbjKORPv (ORCPT + 29 others); Wed, 15 Nov 2023 12:15:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229504AbjKORPt (ORCPT ); Wed, 15 Nov 2023 12:15:49 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0B6EFA for ; Wed, 15 Nov 2023 09:15:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700068545; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=l0183wfb6QQa7Dify3mlCQ9wLvW15z5Q/GXKekFiQGQ=; b=DRQrYT71KL2udeptzx5bNi3MiWtEcbfqU9wCxrhOQqc42Xqzu1i8iu8CyitbF39Z4+IABN S3frCR+SfWxr+xNOoiwSTBTAVlyjgUdQrdcmNz4YytkYkuQk2Ltao2Y3PPC7M24HUoxuLp olAF0U3I2v/dF7VNKCqE7ooLV0yq0n8= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-186-NuvpSifpOSqIylCwNS7D0A-1; Wed, 15 Nov 2023 12:15:42 -0500 X-MC-Unique: NuvpSifpOSqIylCwNS7D0A-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (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 mimecast-mx02.redhat.com (Postfix) with ESMTPS id 02E2F3C000AA; Wed, 15 Nov 2023 17:15:42 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.42.28.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id D4BBA1121306; Wed, 15 Nov 2023 17:15:40 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells To: netdev@vger.kernel.org cc: dhowells@redhat.com, Marc Dionne , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-afs@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH net] rxrpc: Fix some minor issues with bundle tracing MIME-Version: 1.0 Content-ID: <3939792.1700068540.1@warthog.procyon.org.uk> Date: Wed, 15 Nov 2023 17:15:40 +0000 Message-ID: <3939793.1700068540@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Spam-Status: No, score=-1.0 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 15 Nov 2023 09:16:07 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782651100806285220 X-GMAIL-MSGID: 1782651100806285220 Fix some superficial issues with the tracing of rxrpc_bundle structs, including: (1) Set the debug_id when the bundle is allocated rather than when it is set up so that the "NEW" trace line displays the correct bundle ID. (2) Show the refcount when emitting the "FREE" traceline. Signed-off-by: David Howells cc: Marc Dionne cc: "David S. Miller" cc: Eric Dumazet cc: Jakub Kicinski cc: Paolo Abeni cc: linux-afs@lists.infradead.org cc: netdev@vger.kernel.org --- net/rxrpc/conn_client.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/net/rxrpc/conn_client.c b/net/rxrpc/conn_client.c index 981ca5b98bcb..1d95f8bc769f 100644 --- a/net/rxrpc/conn_client.c +++ b/net/rxrpc/conn_client.c @@ -73,6 +73,7 @@ static void rxrpc_destroy_client_conn_ids(struct rxrpc_local *local) static struct rxrpc_bundle *rxrpc_alloc_bundle(struct rxrpc_call *call, gfp_t gfp) { + static atomic_t rxrpc_bundle_id; struct rxrpc_bundle *bundle; bundle = kzalloc(sizeof(*bundle), gfp); @@ -85,6 +86,7 @@ static struct rxrpc_bundle *rxrpc_alloc_bundle(struct rxrpc_call *call, bundle->upgrade = test_bit(RXRPC_CALL_UPGRADE, &call->flags); bundle->service_id = call->dest_srx.srx_service; bundle->security_level = call->security_level; + bundle->debug_id = atomic_inc_return(&rxrpc_bundle_id); refcount_set(&bundle->ref, 1); atomic_set(&bundle->active, 1); INIT_LIST_HEAD(&bundle->waiting_calls); @@ -105,7 +107,8 @@ struct rxrpc_bundle *rxrpc_get_bundle(struct rxrpc_bundle *bundle, static void rxrpc_free_bundle(struct rxrpc_bundle *bundle) { - trace_rxrpc_bundle(bundle->debug_id, 1, rxrpc_bundle_free); + trace_rxrpc_bundle(bundle->debug_id, refcount_read(&bundle->ref), + rxrpc_bundle_free); rxrpc_put_peer(bundle->peer, rxrpc_peer_put_bundle); key_put(bundle->key); kfree(bundle); @@ -239,7 +242,6 @@ static bool rxrpc_may_reuse_conn(struct rxrpc_connection *conn) */ int rxrpc_look_up_bundle(struct rxrpc_call *call, gfp_t gfp) { - static atomic_t rxrpc_bundle_id; struct rxrpc_bundle *bundle, *candidate; struct rxrpc_local *local = call->local; struct rb_node *p, **pp, *parent; @@ -306,7 +308,6 @@ int rxrpc_look_up_bundle(struct rxrpc_call *call, gfp_t gfp) } _debug("new bundle"); - candidate->debug_id = atomic_inc_return(&rxrpc_bundle_id); rb_link_node(&candidate->local_node, parent, pp); rb_insert_color(&candidate->local_node, &local->client_bundles); call->bundle = rxrpc_get_bundle(candidate, rxrpc_bundle_get_client_call);