From nobody Sun Apr 12 16:50:01 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A5C78C4332F for ; Fri, 23 Dec 2022 12:03:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236284AbiLWMDX (ORCPT ); Fri, 23 Dec 2022 07:03:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236145AbiLWMCF (ORCPT ); Fri, 23 Dec 2022 07:02:05 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2675CB56 for ; Fri, 23 Dec 2022 04:00:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1671796844; 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: in-reply-to:in-reply-to:references:references; bh=IBvIYEhqC61vkE5nifbl8b7iyDDJW0GAVBa85A8kwRA=; b=UMVjG91+Ylr7xvkotCOSJ4MRa7xYu9Ie2ZvZs4tC6Y4xZTb83KH1X73iD+JBzGIuIXZM8E GQGgpwxYQnvLeGqLIyOU9YNfAkf+BDrMQoHfChoKIS3MkmbGqvwUPjcutQv83QjIBU0MM8 wKr06oyJZGyI5s/P0ckt3oJGwWi09o4= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-441-TWDXdZkKPeK0AUiXpW3twA-1; Fri, 23 Dec 2022 07:00:41 -0500 X-MC-Unique: TWDXdZkKPeK0AUiXpW3twA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CDEEF3C0F688; Fri, 23 Dec 2022 12:00:39 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.96]) by smtp.corp.redhat.com (Postfix) with ESMTP id 200E62166B33; Fri, 23 Dec 2022 12:00:39 +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 Subject: [PATCH net-next 06/19] rxrpc: Only disconnect calls in the I/O thread From: David Howells To: netdev@vger.kernel.org Cc: Marc Dionne , linux-afs@lists.infradead.org, dhowells@redhat.com, linux-afs@lists.infradead.org, linux-kernel@vger.kernel.org Date: Fri, 23 Dec 2022 12:00:38 +0000 Message-ID: <167179683853.2516210.903291442538570624.stgit@warthog.procyon.org.uk> In-Reply-To: <167179679960.2516210.10739247907156079872.stgit@warthog.procyon.org.uk> References: <167179679960.2516210.10739247907156079872.stgit@warthog.procyon.org.uk> User-Agent: StGit/1.5 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Only perform call disconnection in the I/O thread to reduce the locking requirement. Signed-off-by: David Howells cc: Marc Dionne cc: linux-afs@lists.infradead.org --- include/trace/events/rxrpc.h | 1 + net/rxrpc/call_event.c | 14 +++++++++++++- net/rxrpc/call_object.c | 9 +-------- net/rxrpc/input.c | 6 ------ net/rxrpc/recvmsg.c | 1 + 5 files changed, 16 insertions(+), 15 deletions(-) diff --git a/include/trace/events/rxrpc.h b/include/trace/events/rxrpc.h index c44cc01de750..eac513668e33 100644 --- a/include/trace/events/rxrpc.h +++ b/include/trace/events/rxrpc.h @@ -18,6 +18,7 @@ */ #define rxrpc_call_poke_traces \ EM(rxrpc_call_poke_abort, "Abort") \ + EM(rxrpc_call_poke_complete, "Compl") \ EM(rxrpc_call_poke_error, "Error") \ EM(rxrpc_call_poke_idle, "Idle") \ EM(rxrpc_call_poke_start, "Start") \ diff --git a/net/rxrpc/call_event.c b/net/rxrpc/call_event.c index a8b5dff09999..bf6858e69187 100644 --- a/net/rxrpc/call_event.c +++ b/net/rxrpc/call_event.c @@ -347,6 +347,13 @@ void rxrpc_input_call_event(struct rxrpc_call *call, s= truct sk_buff *skb) if (call->state =3D=3D RXRPC_CALL_COMPLETE) goto out; =20 + if (!call->conn) { + printk("\n"); + printk("\n"); + kdebug("no conn %u", call->state); + printk("\n"); + } + abort_code =3D smp_load_acquire(&call->send_abort); if (abort_code) rxrpc_abort_call(call->send_abort_why, call, 0, call->send_abort, @@ -479,8 +486,13 @@ void rxrpc_input_call_event(struct rxrpc_call *call, s= truct sk_buff *skb) } =20 out: - if (call->state =3D=3D RXRPC_CALL_COMPLETE) + if (call->state =3D=3D RXRPC_CALL_COMPLETE) { del_timer_sync(&call->timer); + if (!test_bit(RXRPC_CALL_DISCONNECTED, &call->flags)) + rxrpc_disconnect_call(call); + if (call->security) + call->security->free_call_crypto(call); + } if (call->acks_hard_ack !=3D call->tx_bottom) rxrpc_shrink_call_tx_buffer(call); _leave(""); diff --git a/net/rxrpc/call_object.c b/net/rxrpc/call_object.c index 8d3d2e058827..3db85d09c4b4 100644 --- a/net/rxrpc/call_object.c +++ b/net/rxrpc/call_object.c @@ -50,7 +50,7 @@ void rxrpc_poke_call(struct rxrpc_call *call, enum rxrpc_= call_poke_trace what) struct rxrpc_local *local =3D call->local; bool busy; =20 - if (call->state < RXRPC_CALL_COMPLETE) { + if (!test_bit(RXRPC_CALL_DISCONNECTED, &call->flags)) { spin_lock_bh(&local->lock); busy =3D !list_empty(&call->attend_link); trace_rxrpc_poke_call(call, busy, what); @@ -531,13 +531,10 @@ void rxrpc_release_call(struct rxrpc_sock *rx, struct= rxrpc_call *call) trace_rxrpc_call(call->debug_id, refcount_read(&call->ref), call->flags, rxrpc_call_see_release); =20 - ASSERTCMP(call->state, =3D=3D, RXRPC_CALL_COMPLETE); - if (test_and_set_bit(RXRPC_CALL_RELEASED, &call->flags)) BUG(); =20 rxrpc_put_call_slot(call); - del_timer_sync(&call->timer); =20 /* Make sure we don't get any more notifications */ write_lock(&rx->recvmsg_lock); @@ -570,10 +567,6 @@ void rxrpc_release_call(struct rxrpc_sock *rx, struct = rxrpc_call *call) =20 _debug("RELEASE CALL %p (%d CONN %p)", call, call->debug_id, conn); =20 - if (conn && !test_bit(RXRPC_CALL_DISCONNECTED, &call->flags)) - rxrpc_disconnect_call(call); - if (call->security) - call->security->free_call_crypto(call); _leave(""); } =20 diff --git a/net/rxrpc/input.c b/net/rxrpc/input.c index 1f03a286620d..bb4beb445325 100644 --- a/net/rxrpc/input.c +++ b/net/rxrpc/input.c @@ -997,8 +997,6 @@ void rxrpc_input_call_packet(struct rxrpc_call *call, s= truct sk_buff *skb) */ void rxrpc_implicit_end_call(struct rxrpc_call *call, struct sk_buff *skb) { - struct rxrpc_connection *conn =3D call->conn; - switch (READ_ONCE(call->state)) { case RXRPC_CALL_SERVER_AWAIT_ACK: rxrpc_call_completed(call); @@ -1012,8 +1010,4 @@ void rxrpc_implicit_end_call(struct rxrpc_call *call,= struct sk_buff *skb) } =20 rxrpc_input_call_event(call, skb); - - spin_lock(&conn->bundle->channel_lock); - __rxrpc_disconnect_call(conn, call); - spin_unlock(&conn->bundle->channel_lock); } diff --git a/net/rxrpc/recvmsg.c b/net/rxrpc/recvmsg.c index 3d6ba7e464b4..2b68ac990ed4 100644 --- a/net/rxrpc/recvmsg.c +++ b/net/rxrpc/recvmsg.c @@ -201,6 +201,7 @@ static void rxrpc_end_rx_phase(struct rxrpc_call *call,= rxrpc_serial_t serial) case RXRPC_CALL_CLIENT_RECV_REPLY: __rxrpc_call_completed(call); write_unlock(&call->state_lock); + rxrpc_poke_call(call, rxrpc_call_poke_complete); break; =20 case RXRPC_CALL_SERVER_RECV_REQUEST: