Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5326785rdb; Wed, 13 Dec 2023 05:52:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IECDvff4fdBXpG4Zp/PS41huDynV+VQk/N5MXNefrHDLudjWcwv7/jtdO+pq+d2hbea97B1 X-Received: by 2002:a05:6a20:3942:b0:18b:d3db:7048 with SMTP id r2-20020a056a20394200b0018bd3db7048mr11185743pzg.23.1702475560502; Wed, 13 Dec 2023 05:52:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702475560; cv=none; d=google.com; s=arc-20160816; b=ZlnrrZ5Ie7LXUzaNKBzcl69sKAoz4U+edSgRppCYVyyQUEoRHOOU1FrORgqtWNxVWg +UB6tlO2wAEzY0EX4vZPTLPQtfz/vvSE2pyR7MM6lJNi8wYFZBhOsUeDCwTOM3Q9llz5 Xkz7J0cwmrnrxtGMP8ovKz9BrzHD62j3vdAuBzWZWWHh9xFu9xPVx7upUwJhJpP9cT7b y/mjw4wScbyIg/wzZDt93uF5ixS7A5Fl8SE6XJGCX9WreN8F38HseSFew7j2JkfsJ3lX nHFXCPvhdLGHyVjIHUlUxAD12A1RG0QxkPMf6o/7lmv2cxfeHAszMCe6lEFmE9JR7LDh qjhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=0G9cfB/SMcsuQUP6NSXMvLH/gTThJ4V8NgpcMlTJhZ4=; fh=9hT4l0EMR1D2zdgUoRXiqFwsybSJyrmM/FC/blQlPsI=; b=priS9y1dPzRb3qtxt2+GOFtvlaKKASrM1N4w407wE7+qvQSDh8FZ1Et58InRE63H1K 2IapCyk06qKtuAFQpwIW1/zrLCVqMq43xXJ+14wDz3W6s8ta779KhAvtYskILTJxjZJf /KrZlhPacKE+6RRkzwfOJ4dYCntNgJxRTlR/fzhYODdcRzbnQvnbRguOfzNECvrZ5GMy Iej9Q3jHWcHl0ZjHi/GYnrGGrHROEPHQFFeyFEcKUIHK/vhESbUnedHGvGWz5qFJIgib vWNoPLzT/unyHroteGVuGKnz1FfpD6X6L+K8R/5jCIoGgtq594w9ehe7zXBzoiDc2FQi OMnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=aH2PyinF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id x1-20020a056a00188100b006cb63513372si9824917pfh.12.2023.12.13.05.52.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 05:52:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=aH2PyinF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id 8356A80C5926; Wed, 13 Dec 2023 05:52:39 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379100AbjLMNwL (ORCPT + 99 others); Wed, 13 Dec 2023 08:52:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379316AbjLMNvR (ORCPT ); Wed, 13 Dec 2023 08:51:17 -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 A4E0EEA for ; Wed, 13 Dec 2023 05:50:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1702475455; 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=0G9cfB/SMcsuQUP6NSXMvLH/gTThJ4V8NgpcMlTJhZ4=; b=aH2PyinF6UOUhs8mnrGTnJFmkfEvnPeG7/Ma3KJLZQNbhHX2lkcgbSOcnob0+jorXbZs3Q c6PYvHmJ06JCWnH7IhtFfyfWF2NUPrPIwcLi0vAdg9N3Cwt9Waoo7OVTkEmQo/hJ8Cg/hk NbS+8INlR37pT1/rCcL/2LbslH9RNl4= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-385-FYgpMzeqMsCvhG2fnYPSqw-1; Wed, 13 Dec 2023 08:50:48 -0500 X-MC-Unique: FYgpMzeqMsCvhG2fnYPSqw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (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 259D483718B; Wed, 13 Dec 2023 13:50:48 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.2]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5C96D3C25; Wed, 13 Dec 2023 13:50:47 +0000 (UTC) From: David Howells To: Marc Dionne Cc: David Howells , linux-afs@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 26/40] afs: Dispatch fileserver probes in priority order Date: Wed, 13 Dec 2023 13:49:48 +0000 Message-ID: <20231213135003.367397-27-dhowells@redhat.com> In-Reply-To: <20231213135003.367397-1-dhowells@redhat.com> References: <20231213135003.367397-1-dhowells@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.1 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, 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 lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Wed, 13 Dec 2023 05:52:39 -0800 (PST) When probing all the addresses for a fileserver, dispatch them in order of descending priority to try and get back highest priority one first. Also add a tracepoint to show the transmission and completion of the probes. Signed-off-by: David Howells cc: Marc Dionne cc: linux-afs@lists.infradead.org --- fs/afs/fs_probe.c | 25 +++++++++++++++++++++++-- include/trace/events/afs.h | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 2 deletions(-) diff --git a/fs/afs/fs_probe.c b/fs/afs/fs_probe.c index 8008d3ecabab..c5702698b18b 100644 --- a/fs/afs/fs_probe.c +++ b/fs/afs/fs_probe.c @@ -102,7 +102,7 @@ void afs_fileserver_probe_result(struct afs_call *call) struct afs_address *addr = &alist->addrs[call->probe_index]; struct afs_server *server = call->server; unsigned int index = call->probe_index; - unsigned int rtt_us = 0, cap0; + unsigned int rtt_us = -1, cap0; int ret = call->error; _enter("%pU,%u", &server->uuid, index); @@ -182,6 +182,7 @@ void afs_fileserver_probe_result(struct afs_call *call) out: spin_unlock(&server->probe_lock); + trace_afs_fs_probe(server, false, alist, index, call->error, call->abort_code, rtt_us); _debug("probe %pU [%u] %pISpc rtt=%d ret=%d", &server->uuid, index, rxrpc_kernel_remote_addr(alist->addrs[index].peer), rtt_us, ret); @@ -207,6 +208,8 @@ void afs_fs_probe_fileserver(struct afs_net *net, struct afs_server *server, afs_get_addrlist(alist, afs_alist_trace_get_probe); read_unlock(&server->fs_lock); + afs_get_address_preferences(net, alist); + server->probed_at = jiffies; atomic_set(&server->probe_outstanding, all ? alist->nr_addrs : 1); memset(&server->probe, 0, sizeof(server->probe)); @@ -217,10 +220,28 @@ void afs_fs_probe_fileserver(struct afs_net *net, struct afs_server *server, all = true; if (all) { - for (index = 0; index < alist->nr_addrs; index++) + unsigned long unprobed = (1UL << alist->nr_addrs) - 1; + unsigned int i; + int best_prio; + + while (unprobed) { + best_prio = -1; + index = 0; + for (i = 0; i < alist->nr_addrs; i++) { + if (test_bit(i, &unprobed) && + alist->addrs[i].prio > best_prio) { + index = i; + best_prio = alist->addrs[i].prio; + } + } + __clear_bit(index, &unprobed); + + trace_afs_fs_probe(server, true, alist, index, 0, 0, 0); if (!afs_fs_get_capabilities(net, server, alist, index, key)) afs_fs_probe_not_done(net, server, alist, index); + } } else { + trace_afs_fs_probe(server, true, alist, index, 0, 0, 0); if (!afs_fs_get_capabilities(net, server, alist, index, key)) afs_fs_probe_not_done(net, server, alist, index); } diff --git a/include/trace/events/afs.h b/include/trace/events/afs.h index 0f68d67f52c8..81eb87fbcfa7 100644 --- a/include/trace/events/afs.h +++ b/include/trace/events/afs.h @@ -1387,6 +1387,39 @@ TRACE_EVENT(afs_alist, __entry->ref) ); +TRACE_EVENT(afs_fs_probe, + TP_PROTO(struct afs_server *server, bool tx, struct afs_addr_list *alist, + unsigned int addr_index, int error, s32 abort_code, unsigned int rtt_us), + + TP_ARGS(server, tx, alist, addr_index, error, abort_code, rtt_us), + + TP_STRUCT__entry( + __field(unsigned int, server) + __field(bool, tx) + __field(u16, addr_index) + __field(short, error) + __field(s32, abort_code) + __field(unsigned int, rtt_us) + __field_struct(struct sockaddr_rxrpc, srx) + ), + + TP_fast_assign( + __entry->server = server->debug_id; + __entry->tx = tx; + __entry->addr_index = addr_index; + __entry->error = error; + __entry->abort_code = abort_code; + __entry->rtt_us = rtt_us; + memcpy(&__entry->srx, rxrpc_kernel_remote_srx(alist->addrs[addr_index].peer), + sizeof(__entry->srx)); + ), + + TP_printk("s=%08x %s ax=%u e=%d ac=%d rtt=%d %pISpc", + __entry->server, __entry->tx ? "tx" : "rx", __entry->addr_index, + __entry->error, __entry->abort_code, __entry->rtt_us, + &__entry->srx.transport) + ); + #endif /* _TRACE_AFS_H */ /* This part must be outside protection */