Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3420654rwb; Mon, 19 Sep 2022 22:09:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5JfZk9WACNBTJPd1mN/wVqbGNy+W2t4/Gn5UDBbcMkCFI9QpK7tC+7PSPPLkONVSBLg1uu X-Received: by 2002:a05:6a00:ad4:b0:547:8ed2:e420 with SMTP id c20-20020a056a000ad400b005478ed2e420mr21645658pfl.18.1663650587942; Mon, 19 Sep 2022 22:09:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663650587; cv=none; d=google.com; s=arc-20160816; b=uyn5uOmz9ht0Lq3jBle4WFodUj1YYzZiK3HfYVqEp91a6hvKHRuXwTp9bYh6kSttzD y+xSQ9S1eHB7/Qm+xqpvr0aWyBIuq2w/eeKpjUshp1EBVGgtzvnziM6FQeD2ESSwpPFv rjkL/QWW7ZgPrjngqatPpqevjQnq1o4a92F+IJt9pTfL6hSkllicwtxo9Ibo/BekATad IbEYLvUljCDqpOkIlVISE9Cg/ykQhESQE9bzflIK9sWmn+WSMRCsvW6sj9cBNM6se8DO 1E9oAb0u8UAwxgv9JjMwTZFPtorYyQYhWFsEE5kO0vbSCGVSNhC/SIpfOq+wwSs0+/cc vmow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:reply-to:message-id:subject:cc:to:from:date; bh=nb3NPN/uWgR7vv/eKXj8baaSsgNIle1ndPwBCvOs2Gs=; b=MWhsyWQGV7BW1tybxqF3ceCf9xIIttc5qFVPJuPwRP4uavcMr1N08EvZvna9tZn7It V5YoHrZo7CqamGQGbbF++V4Tl9xVwvgZS1Ah+u5WvYuNetOkAAaWgTHRn/zGBW1E6/xd gCkMNUczFfBsgqig7N8xU/kkimvatq1pOfSpwUoLBS050IUFjSaNWgs5QULzWul0i2MZ rd+/o9MfLVsewF07c7O7plWMIor2Sb4FgTp+zmAAGSIFaHD4O9ZiEG5uMc5PcwByJfwk N8C4KuuRX7wUFrQHq2bJaM5DNBxGd8X8K5ZQgri09ovU5a2MJmZT8N0aBJehkSfv7499 eN3Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k4-20020aa79d04000000b00538147a4b3csi587838pfp.318.2022.09.19.22.09.36; Mon, 19 Sep 2022 22:09:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229782AbiITEz2 (ORCPT + 99 others); Tue, 20 Sep 2022 00:55:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229557AbiITEz0 (ORCPT ); Tue, 20 Sep 2022 00:55:26 -0400 Received: from out30-44.freemail.mail.aliyun.com (out30-44.freemail.mail.aliyun.com [115.124.30.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 003D3422EE; Mon, 19 Sep 2022 21:55:24 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R521e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046050;MF=dust.li@linux.alibaba.com;NM=1;PH=DS;RN=10;SR=0;TI=SMTPD_---0VQHUiMh_1663649720; Received: from localhost(mailfrom:dust.li@linux.alibaba.com fp:SMTPD_---0VQHUiMh_1663649720) by smtp.aliyun-inc.com; Tue, 20 Sep 2022 12:55:21 +0800 Date: Tue, 20 Sep 2022 12:55:20 +0800 From: "dust.li" To: Wen Gu , kgraul@linux.ibm.com, wenjia@linux.ibm.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: linux-s390@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next 1/2] net/smc: Introduce a specific sysctl for TEST_LINK time Message-ID: <20220920045520.GC108825@linux.alibaba.com> Reply-To: dust.li@linux.alibaba.com References: <1663641907-15852-1-git-send-email-guwen@linux.alibaba.com> <1663642434-30035-1-git-send-email-guwen@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1663642434-30035-1-git-send-email-guwen@linux.alibaba.com> X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL autolearn=ham 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 On Tue, Sep 20, 2022 at 10:53:54AM +0800, Wen Gu wrote: >SMC-R tests the viability of link by sending out TEST_LINK LLC >messages over RoCE fabric when connections on link have been >idle for a time longer than keepalive interval (testlink time). > >But using tcp_keepalive_time as testlink time maybe not quite >suitable because it is default no less than two hours[1], which >is too long for single link to find peer dead. The active host >will still use peer-dead link (QP) sending messages, and can't >find out until get IB_WC_RETRY_EXC_ERR error CQEs, which takes >more time than TEST_LINK timeout (SMC_LLC_WAIT_TIME) normally. > >So this patch introduces a independent sysctl for SMC-R to set >link keepalive time, in order to detect link down in time. The >default value is 30 seconds. > >[1] https://www.rfc-editor.org/rfc/rfc1122#page-101 > >Signed-off-by: Wen Gu >--- > Documentation/networking/smc-sysctl.rst | 7 +++++++ > include/net/netns/smc.h | 1 + > net/smc/smc_llc.c | 2 +- > net/smc/smc_llc.h | 1 + > net/smc/smc_sysctl.c | 14 ++++++++++++++ > 5 files changed, 24 insertions(+), 1 deletion(-) > >diff --git a/Documentation/networking/smc-sysctl.rst b/Documentation/networking/smc-sysctl.rst >index 742e90e..f8c3d59 100644 >--- a/Documentation/networking/smc-sysctl.rst >+++ b/Documentation/networking/smc-sysctl.rst >@@ -34,3 +34,10 @@ smcr_buf_type - INTEGER > - 1 - Use virtually contiguous buffers > - 2 - Mixed use of the two types. Try physically contiguous buffers first. > If not available, use virtually contiguous buffers then. >+ >+smcr_testlink_time - INTEGER >+ How frequently SMC-R link sends out TEST_LINK LLC messages to confirm >+ viability, after the last activity of connections on it. The maximum >+ value is (INT_MAX / HZ) seconds, the minimum value is 1 second. >+ >+ Default: 30 seconds. >diff --git a/include/net/netns/smc.h b/include/net/netns/smc.h >index 2adbe2b..d295e2c 100644 >--- a/include/net/netns/smc.h >+++ b/include/net/netns/smc.h >@@ -19,5 +19,6 @@ struct netns_smc { > #endif > unsigned int sysctl_autocorking_size; > unsigned int sysctl_smcr_buf_type; >+ int sysctl_smcr_testlink_time; > }; > #endif >diff --git a/net/smc/smc_llc.c b/net/smc/smc_llc.c >index 175026a..388bd2e 100644 >--- a/net/smc/smc_llc.c >+++ b/net/smc/smc_llc.c >@@ -2127,7 +2127,7 @@ void smc_llc_lgr_init(struct smc_link_group *lgr, struct smc_sock *smc) > init_waitqueue_head(&lgr->llc_flow_waiter); > init_waitqueue_head(&lgr->llc_msg_waiter); > mutex_init(&lgr->llc_conf_mutex); >- lgr->llc_testlink_time = READ_ONCE(net->ipv4.sysctl_tcp_keepalive_time); >+ lgr->llc_testlink_time = READ_ONCE(net->smc.sysctl_smcr_testlink_time) * HZ; > } > > /* called after lgr was removed from lgr_list */ >diff --git a/net/smc/smc_llc.h b/net/smc/smc_llc.h >index 4404e52..1de9a29 100644 >--- a/net/smc/smc_llc.h >+++ b/net/smc/smc_llc.h >@@ -19,6 +19,7 @@ > > #define SMC_LLC_WAIT_FIRST_TIME (5 * HZ) > #define SMC_LLC_WAIT_TIME (2 * HZ) >+#define SMC_LLC_TESTLINK_DEFAULT_TIME 30 I'm wondering why we don't follow the upper to macros using (30 * HZ) ? > > enum smc_llc_reqresp { > SMC_LLC_REQ, >diff --git a/net/smc/smc_sysctl.c b/net/smc/smc_sysctl.c >index 0613868..7f68520 100644 >--- a/net/smc/smc_sysctl.c >+++ b/net/smc/smc_sysctl.c >@@ -16,8 +16,12 @@ > > #include "smc.h" > #include "smc_core.h" >+#include "smc_llc.h" > #include "smc_sysctl.h" > >+static int smcr_testlink_time_min = 1; >+static int smcr_testlink_time_max = (INT_MAX / HZ); >+ > static struct ctl_table smc_table[] = { > { > .procname = "autocorking_size", >@@ -35,6 +39,15 @@ > .extra1 = SYSCTL_ZERO, > .extra2 = SYSCTL_TWO, > }, >+ { >+ .procname = "smcr_testlink_time", >+ .data = &init_net.smc.sysctl_smcr_testlink_time, >+ .maxlen = sizeof(int), >+ .mode = 0644, >+ .proc_handler = proc_dointvec_minmax, >+ .extra1 = &smcr_testlink_time_min, >+ .extra2 = &smcr_testlink_time_max, >+ }, > { } > }; > >@@ -60,6 +73,7 @@ int __net_init smc_sysctl_net_init(struct net *net) > > net->smc.sysctl_autocorking_size = SMC_AUTOCORKING_DEFAULT_SIZE; > net->smc.sysctl_smcr_buf_type = SMCR_PHYS_CONT_BUFS; >+ net->smc.sysctl_smcr_testlink_time = SMC_LLC_TESTLINK_DEFAULT_TIME; > > return 0; > >-- >1.8.3.1