From patchwork Fri Jan 14 15:47:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haris Iqbal X-Patchwork-Id: 12713792 X-Patchwork-Delegate: jgg@ziepe.ca 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 72FECC433EF for ; Fri, 14 Jan 2022 15:48:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242945AbiANPsI (ORCPT ); Fri, 14 Jan 2022 10:48:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242930AbiANPsH (ORCPT ); Fri, 14 Jan 2022 10:48:07 -0500 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C203CC06173E for ; Fri, 14 Jan 2022 07:48:06 -0800 (PST) Received: by mail-wm1-x32a.google.com with SMTP id w26so6965216wmi.0 for ; Fri, 14 Jan 2022 07:48:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=E23q1MvkuTpRAVr5v2BSE74q9xA9Ne85f+Ym78b7elE=; b=Dps2dX6WRnNYU0n5vlKtAtr0Fi43lMYvq6MrvAucwcPx4ipo7a+5XoO5T/0PQEz/wT SlMyCR5trFZ7u3+3H/OldoZtv+nQDcHNKgoCDkmimm0sdsffjpDnlVMTahxMNk5jp181 WBL0xuHEkyUwToSWwiLXbygU+QOWAr8KjuABB491/tX4LqKwKQgrgr6MpP2QxewnuSfl foD4woXzpI+M0p/u1kkwL8VQEjDo9kil1r5/qMrNvE2BzYROalT7yMhLJY1bDxKoumGi YsP7qz7zrpwsKVBYNh/lvhG+kBTZzTFh9KwH67+QMB4qjnCfLyCF1M8+nHj9vHk4Cwty EUQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=E23q1MvkuTpRAVr5v2BSE74q9xA9Ne85f+Ym78b7elE=; b=1nQqmOvwDCNvt6+0X/bsfr6ZIE+cWjd1AW5GPr/nrw+w8i7vbsjITNKk4miSZubymR 6EQsHI2TD3+tZcyX6/fUQBV7eI4zLtF5pbz/z0k+XDOc6GgqS0kKkPU6OMfrCA7mMN9d v9RDBNRinbtZCWtWBiXGbQe/9E7eXiezG/hYpu3brz/ucfS5v9XPkrOugmnDc0AS2app N/muTO5hLATjJaWoz8uR08VJB7L1EmdVEQxD6B3Tapm2xnPEBzpDmtXti5cE7vHI/KgX oHrqzMUj8sEtjUcXY86luSoqmK5kzFXlGS/FbJAXdWX4MdoTfvJPpPtPLeVGNvZl9C4f KDRw== X-Gm-Message-State: AOAM532wBFooh2wygN+/1E+vKk8zFWY1yGyeq9nJ35+n5UpKk87lAE9W 9z2A4ZEFhlOZkbK6beBduLuplv5Zx3e9aA== X-Google-Smtp-Source: ABdhPJzYZalQKlZ9XfUcWtQNI320SGTAx9GBsuHKRSVwNodyvDpH7ZUaRO5hX+NKoqYhlld4zXp6JQ== X-Received: by 2002:a05:6402:2789:: with SMTP id b9mr9573665ede.329.1642175285366; Fri, 14 Jan 2022 07:48:05 -0800 (PST) Received: from lb01533.fkb.profitbricks.net ([85.214.13.132]) by smtp.gmail.com with ESMTPSA id x20sm2522028edd.28.2022.01.14.07.48.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Jan 2022 07:48:04 -0800 (PST) From: Md Haris Iqbal To: linux-rdma@vger.kernel.org Cc: bvanassche@acm.org, leon@kernel.org, dledford@redhat.com, jgg@ziepe.ca, haris.iqbal@ionos.com, jinpu.wang@ionos.com, Gioh Kim Subject: [PATCH for-next 1/5] RDMA/rtrs: fix CHECK:BRACES type warning Date: Fri, 14 Jan 2022 16:47:49 +0100 Message-Id: <20220114154753.983568-2-haris.iqbal@ionos.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220114154753.983568-1-haris.iqbal@ionos.com> References: <20220114154753.983568-1-haris.iqbal@ionos.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Gioh Kim fix "CHECK:BRACES: Blank lines aren't necessary after an open brace '{'" warning from checkpatch.pl Signed-off-by: Gioh Kim Signed-off-by: Md Haris Iqbal --- drivers/infiniband/ulp/rtrs/rtrs.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/infiniband/ulp/rtrs/rtrs.c b/drivers/infiniband/ulp/rtrs/rtrs.c index 4da889103a5f..60fa0b0160f4 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs.c +++ b/drivers/infiniband/ulp/rtrs/rtrs.c @@ -479,7 +479,6 @@ static int rtrs_str_to_sockaddr(const char *addr, size_t len, */ int sockaddr_to_str(const struct sockaddr *addr, char *buf, size_t len) { - switch (addr->sa_family) { case AF_IB: return scnprintf(buf, len, "gid:%pI6", From patchwork Fri Jan 14 15:47:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haris Iqbal X-Patchwork-Id: 12713793 X-Patchwork-Delegate: jgg@ziepe.ca 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 AD095C433FE for ; Fri, 14 Jan 2022 15:48:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242951AbiANPsJ (ORCPT ); Fri, 14 Jan 2022 10:48:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242938AbiANPsI (ORCPT ); Fri, 14 Jan 2022 10:48:08 -0500 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0F59C061574 for ; Fri, 14 Jan 2022 07:48:07 -0800 (PST) Received: by mail-wm1-x331.google.com with SMTP id p18so6930782wmg.4 for ; Fri, 14 Jan 2022 07:48:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DG/wPzrEZX+cGPa+/ASYMtDjTpVe3vuN81m46Aeu5lk=; b=DBTXRop2kSC3ju0SoDzfn5YxteR1IHjluDzArLSs1JNIVirwOQMoeIGaffcuTfIhIy qqFl3fDgqr4VJwVP4HzsleCYOTjrZ1EwgkMSTgMD5gP29KAvT9sUEF8M4IWT+dNkl0dn Td8RBaIDfOZhM2l6ynoixT2pdj4RXTX3s8h6LBtues862gFTFN/GzP1cHe4KRK4q3+P7 ZefMp4zL8SRfDbDEZVsTmzxd+wah11dzHd4KWbvHuJ54M1Vo7/tZ0EVceXaAYokf2Q8z byM746El3SUjpVRXBl7lnPTwt5yEcgAUzixGTOUaO7pyGAogv0lgZBg5CgvNmrYncqzr 6g6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DG/wPzrEZX+cGPa+/ASYMtDjTpVe3vuN81m46Aeu5lk=; b=o4gFq1CIugjqp4BvDG4kfI0OdjGODvmfrfjJhlDXLUfuJrAl+M2tSeJMSWpb3ZPDjA vM3mcQOGO6NQ2DqQHw4iFPm15DosCb3+qL5uoSXUNO+iXorKM+QYuJ9mkIit7lq0cyA2 YCmBY4TUYLc2Qpy13kJpwwUmbimS/KpGsVAqqx4RtXiHP0RNTolDsko+0kt9qPP6B6kH u15lGbQhxRWBJHOfdOwMv7v4ysSvZZuJY1r5M2IfI/2R3oo5r7I+53B3gU5E2SgCQGvR ggrpkFVkSDHIBuzPHDYw2qFrAHavpMm4Db4hBwGHcKaH5rU6okkBl6ACx0SBePogDgLK 060w== X-Gm-Message-State: AOAM530D1HQHCYQQO3eM1m37diFkFvABqk0meED3iVudjt9TlT6zCarc ooDxI2g0Ua7FRjYtNjbDiI3TZa5wyMeHsg== X-Google-Smtp-Source: ABdhPJwJkMQlPxarSlf6Mrg6FcyPlvCmUnbdkHf9f9Rvx8w25ytNbrXVc5B4or/mtRaJD+roWt80sg== X-Received: by 2002:a17:907:7b8a:: with SMTP id ne10mr7734351ejc.587.1642175286170; Fri, 14 Jan 2022 07:48:06 -0800 (PST) Received: from lb01533.fkb.profitbricks.net ([85.214.13.132]) by smtp.gmail.com with ESMTPSA id x20sm2522028edd.28.2022.01.14.07.48.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Jan 2022 07:48:05 -0800 (PST) From: Md Haris Iqbal To: linux-rdma@vger.kernel.org Cc: bvanassche@acm.org, leon@kernel.org, dledford@redhat.com, jgg@ziepe.ca, haris.iqbal@ionos.com, jinpu.wang@ionos.com, Gioh Kim Subject: [PATCH for-next 2/5] RDMA/rtrs-clt: fix CHECK type warnings Date: Fri, 14 Jan 2022 16:47:50 +0100 Message-Id: <20220114154753.983568-3-haris.iqbal@ionos.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220114154753.983568-1-haris.iqbal@ionos.com> References: <20220114154753.983568-1-haris.iqbal@ionos.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Gioh Kim First this patch removes list_next_or_null_rr_rcu macro to fix below warnings. That macro is used only twice. CHECK:MACRO_ARG_REUSE: Macro argument reuse 'head' - possible side-effects? CHECK:MACRO_ARG_REUSE: Macro argument reuse 'ptr' - possible side-effects? CHECK:MACRO_ARG_REUSE: Macro argument reuse 'memb' - possible side-effects? This patch also fixes below warning: CHECK:SPACING: No space is necessary after a cast Signed-off-by: Gioh Kim Signed-off-by: Md Haris Iqbal --- drivers/infiniband/ulp/rtrs/rtrs-clt.c | 49 ++++++++++++-------------- 1 file changed, 22 insertions(+), 27 deletions(-) diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ulp/rtrs/rtrs-clt.c index 7c3f98e57889..62ba0f17ac9d 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c +++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c @@ -748,26 +748,6 @@ struct path_it { struct rtrs_clt_path *(*next_path)(struct path_it *it); }; -/** - * list_next_or_null_rr_rcu - get next list element in round-robin fashion. - * @head: the head for the list. - * @ptr: the list head to take the next element from. - * @type: the type of the struct this is embedded in. - * @memb: the name of the list_head within the struct. - * - * Next element returned in round-robin fashion, i.e. head will be skipped, - * but if list is observed as empty, NULL will be returned. - * - * This primitive may safely run concurrently with the _rcu list-mutation - * primitives such as list_add_rcu() as long as it's guarded by rcu_read_lock(). - */ -#define list_next_or_null_rr_rcu(head, ptr, type, memb) \ -({ \ - list_next_or_null_rcu(head, ptr, type, memb) ?: \ - list_next_or_null_rcu(head, READ_ONCE((ptr)->next), \ - type, memb); \ -}) - /** * get_next_path_rr() - Returns path in round-robin fashion. * @it: the path pointer @@ -797,10 +777,20 @@ static struct rtrs_clt_path *get_next_path_rr(struct path_it *it) path = list_first_or_null_rcu(&clt->paths_list, typeof(*path), s.entry); else - path = list_next_or_null_rr_rcu(&clt->paths_list, - &path->s.entry, - typeof(*path), - s.entry); + /* + * Next element returned in round-robin fashion, i.e. head will be skipped, + * but if list is observed as empty, NULL will be returned. + * + * This primitive may safely run concurrently with the _rcu list-mutation + * primitives such as list_add_rcu() as long as it's guarded by rcu_read_lock(). + */ + path = list_next_or_null_rcu(&clt->paths_list, + &path->s.entry, + typeof(*path), + s.entry) ?: + list_next_or_null_rcu(&clt->paths_list, + READ_ONCE((&path->s.entry)->next), + typeof(*path), s.entry); rcu_assign_pointer(*ppcpu_path, path); return path; @@ -1863,7 +1853,7 @@ static int rtrs_rdma_conn_established(struct rtrs_clt_con *con, } clt_path->queue_depth = queue_depth; clt_path->s.signal_interval = min_not_zero(queue_depth, - (unsigned short) SERVICE_CON_QUEUE_DEPTH); + (unsigned short)SERVICE_CON_QUEUE_DEPTH); clt_path->max_hdr_size = le32_to_cpu(msg->max_hdr_size); clt_path->max_io_size = le32_to_cpu(msg->max_io_size); clt_path->flags = le32_to_cpu(msg->flags); @@ -2268,8 +2258,13 @@ static void rtrs_clt_remove_path_from_arr(struct rtrs_clt_path *clt_path) * removed. If @sess is the last element, then @next is NULL. */ rcu_read_lock(); - next = list_next_or_null_rr_rcu(&clt->paths_list, &clt_path->s.entry, - typeof(*next), s.entry); + next = list_next_or_null_rcu(&clt->paths_list, + &clt_path->s.entry, + typeof(*next), + s.entry) ?: + list_next_or_null_rcu(&clt->paths_list, + READ_ONCE((&clt_path->s.entry)->next), + typeof(*next), s.entry); rcu_read_unlock(); /* From patchwork Fri Jan 14 15:47:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haris Iqbal X-Patchwork-Id: 12713794 X-Patchwork-Delegate: jgg@ziepe.ca 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 569B4C433F5 for ; Fri, 14 Jan 2022 15:48:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242899AbiANPsK (ORCPT ); Fri, 14 Jan 2022 10:48:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242930AbiANPsJ (ORCPT ); Fri, 14 Jan 2022 10:48:09 -0500 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2341C06173E for ; Fri, 14 Jan 2022 07:48:08 -0800 (PST) Received: by mail-wm1-x330.google.com with SMTP id q9-20020a7bce89000000b00349e697f2fbso7607982wmj.0 for ; Fri, 14 Jan 2022 07:48:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=D/6OO29zOOdEfBttl6kPJAD668BKq3O8MGDv6y0XtGQ=; b=Xgvx7fcMqlgYsUhaX6BduchF43yhEDg56mnndR9/krOTzPVKY3Knc8i9sMuwcZ54+7 DWemFXR0+PFdJ3TnWyOci/tEeTOVwwFw0J3OID3ZKGppMZb/JKp/Xv1I4aLuJ/sjGKCl GXiYPIHNf8Rp+kQWb/8oP7CwkFuy8wZ+KVjnfglZZ8VCwipJz+0SMEavu8+bz22K8+Fk CKhgwQcgutaaxLzYlxycHtgNhtHbDupPfdFZ0kHTVlB2YjjRIH5nCGQ8cXPbJCz6IpRf HdSC8Nh7kMnm8JwfVfrg/zmHCIo9oPcPsCCsdkyj5WjoiyWWAFF+yQDuJwFPnzxBqmSC IMlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=D/6OO29zOOdEfBttl6kPJAD668BKq3O8MGDv6y0XtGQ=; b=00yDkeOlTSKgilVJx2EkmORLloPyz8E0AX7StLrDI/P5K8EtlfNjMBNWVs2kjcE3OJ /0GLA9oX6PtOhYCv7nm2nxNtVveh8P2ygZwYCY/CrczfoZotdyTX422bn/lOo6cXY5J/ w7fbMP1jbHQvvi2mp9DN2g3O4YjP0mbbV7d6SP7WrQYip76/1GaHvYQTOc1TOnAKI1Qq mLyAsxFz5Pf2OR/eDvFH9ZheE9UKHrEBkrmk3EqyYweKJ6FlA75J4dJq8blDpVczWB58 wjvlrDLQVNVmWshIog+Mk3FuHsPOoGmr7cYK+cfzhsCUnRKAKSX/WPY06n4t928i+TcY EY6Q== X-Gm-Message-State: AOAM530/gg/NGcpnWmTpMQND/UuJJ8XlvCEldYhfoxYOcjBOde70ZauC B9jVd7WGFXgIivjVPfBuqAUB6nU7PXpHSA== X-Google-Smtp-Source: ABdhPJy4M/lELeiV2X2bYeY94109gDXlLWIXsHHCefQWD7SKFcfZ5FDRTzr4tx6kGbNGRt0eGESVJg== X-Received: by 2002:a05:6402:424e:: with SMTP id g14mr9455290edb.399.1642175287025; Fri, 14 Jan 2022 07:48:07 -0800 (PST) Received: from lb01533.fkb.profitbricks.net ([85.214.13.132]) by smtp.gmail.com with ESMTPSA id x20sm2522028edd.28.2022.01.14.07.48.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Jan 2022 07:48:06 -0800 (PST) From: Md Haris Iqbal To: linux-rdma@vger.kernel.org Cc: bvanassche@acm.org, leon@kernel.org, dledford@redhat.com, jgg@ziepe.ca, haris.iqbal@ionos.com, jinpu.wang@ionos.com, Gioh Kim Subject: [PATCH for-next 3/5] RDMA/rtrs-clt: fix CHECK type warnings Date: Fri, 14 Jan 2022 16:47:51 +0100 Message-Id: <20220114154753.983568-4-haris.iqbal@ionos.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220114154753.983568-1-haris.iqbal@ionos.com> References: <20220114154753.983568-1-haris.iqbal@ionos.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Gioh Kim fix below warning CHECK:OPEN_ENDED_LINE: Lines should not end with a '(' Signed-off-by: Gioh Kim Signed-off-by: Md Haris Iqbal --- drivers/infiniband/ulp/rtrs/rtrs-clt-sysfs.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt-sysfs.c b/drivers/infiniband/ulp/rtrs/rtrs-clt-sysfs.c index b4fa473b7888..d3c436ead694 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-clt-sysfs.c +++ b/drivers/infiniband/ulp/rtrs/rtrs-clt-sysfs.c @@ -156,8 +156,7 @@ static DEVICE_ATTR_RW(mpath_policy); static ssize_t add_path_show(struct device *dev, struct device_attribute *attr, char *page) { - return sysfs_emit( - page, + return sysfs_emit(page, "Usage: echo [@] > %s\n\n*addr ::= [ ip: | gid: ]\n", attr->attr.name); } From patchwork Fri Jan 14 15:47:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haris Iqbal X-Patchwork-Id: 12713795 X-Patchwork-Delegate: jgg@ziepe.ca 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 AFD0AC433EF for ; Fri, 14 Jan 2022 15:48:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242992AbiANPsM (ORCPT ); Fri, 14 Jan 2022 10:48:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242938AbiANPsJ (ORCPT ); Fri, 14 Jan 2022 10:48:09 -0500 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 380C9C06161C for ; Fri, 14 Jan 2022 07:48:09 -0800 (PST) Received: by mail-wm1-x32e.google.com with SMTP id v123so6950409wme.2 for ; Fri, 14 Jan 2022 07:48:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vil0NtkJScmskuQyDq3wUbG1nj2Cyjzt1U19Hf8vW90=; b=jKwckO+KSa0ZmeHA0tUcroe4Gp0nKlVaAqZQC1/MRNMY2mq1wydlFnqF8crZ8CqXFv E4hlsEl/GA7El4jb7GZVSlGatHKo9fTHedY1DADLGrM2CGtngQngLVlPdBtQpesNdyOz yAAk2fOfLUKjbG5cBlzyuij4QMwq0tvJl/2wwJK5g1rvDdlBUDmDA9I3pi64/tHLAX2R Nf+XM5gogkK3/sAUsCMCglmo3m31qJx1Q+2g8Ek+e//ntpfgEhWvnZBUI6NW1K3EkkCr /jGIwAtKIeIeZ0HiWr9LjIlIgNjdT2mAQbGnNh1yw4h2kWd23ROQGn2FmN4eCVSdwpuT V9/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vil0NtkJScmskuQyDq3wUbG1nj2Cyjzt1U19Hf8vW90=; b=TjyNEOTE6N+hg3qX5e989gA5UXDDxheHHK+6Gx81xXGDdFQ/a2ZEqOwiWuIjwPIdgG vonHg5330X0o8y5W9eOBqm9Hw3XJb9Jfnvdv/WpG03n6VrLBV2ab4sIh1MHazIbXMP3Q u35LkyQmDQbA3PWz/cGb3roMeIMcVS0koAi7uo/vkJ4DaN4bWTqRSnzJScnNCBfmkfjS DZlOCjtYPXdPsNIPHMIlTKqsQmhIWRg2lYUQgPb7G2lPw7INOj15C5E0Po8e/265N7dR DTBTUyNSVpMgEoUufQB5/7RYjZS990+Z9vVMWVm+AIg9aZoKo2o2sicz/R9YOgNCbgmu 63Hg== X-Gm-Message-State: AOAM532nqYABBULzm2ZN0ok9/90tDKmJlQe5ur2846FzUBJ7tov7qD9K tCMzR859AoFNmeOrEXiYfh8YonkUEd0wJw== X-Google-Smtp-Source: ABdhPJwIt/v4ZvmuOS2hXPD3w7xtYnZl+Qc2G4lqk2NJM1YEUGaV5ArSI355syxNGdDs7eM/cF0Z1g== X-Received: by 2002:a17:906:4fcc:: with SMTP id i12mr7905054ejw.529.1642175287748; Fri, 14 Jan 2022 07:48:07 -0800 (PST) Received: from lb01533.fkb.profitbricks.net ([85.214.13.132]) by smtp.gmail.com with ESMTPSA id x20sm2522028edd.28.2022.01.14.07.48.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Jan 2022 07:48:07 -0800 (PST) From: Md Haris Iqbal To: linux-rdma@vger.kernel.org Cc: bvanassche@acm.org, leon@kernel.org, dledford@redhat.com, jgg@ziepe.ca, haris.iqbal@ionos.com, jinpu.wang@ionos.com Subject: [PATCH for-next 4/5] RDMA/rtrs-clt: Update one outdated comment in path_it_deinit Date: Fri, 14 Jan 2022 16:47:52 +0100 Message-Id: <20220114154753.983568-5-haris.iqbal@ionos.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220114154753.983568-1-haris.iqbal@ionos.com> References: <20220114154753.983568-1-haris.iqbal@ionos.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Jack Wang The skip_list is used for both MIN_INFLIGHT and MIN_LATENCY. Signed-off-by: Jack Wang Signed-off-by: Md Haris Iqbal --- drivers/infiniband/ulp/rtrs/rtrs-clt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ulp/rtrs/rtrs-clt.c index 62ba0f17ac9d..05de9ec7c99a 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c +++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c @@ -907,7 +907,7 @@ static inline void path_it_deinit(struct path_it *it) { struct list_head *skip, *tmp; /* - * The skip_list is used only for the MIN_INFLIGHT policy. + * The skip_list is used only for the MIN_INFLIGHT and MIN_LATENCY policies. * We need to remove paths from it, so that next IO can insert * paths (->mp_skip_entry) into a skip_list again. */ From patchwork Fri Jan 14 15:47:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haris Iqbal X-Patchwork-Id: 12713796 X-Patchwork-Delegate: jgg@ziepe.ca 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 AB32EC433F5 for ; Fri, 14 Jan 2022 15:48:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242955AbiANPsM (ORCPT ); Fri, 14 Jan 2022 10:48:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242960AbiANPsK (ORCPT ); Fri, 14 Jan 2022 10:48:10 -0500 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 309E2C06161C for ; Fri, 14 Jan 2022 07:48:10 -0800 (PST) Received: by mail-wm1-x32b.google.com with SMTP id q9-20020a7bce89000000b00349e697f2fbso7608304wmj.0 for ; Fri, 14 Jan 2022 07:48:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=peRhn+ZcQyZuvGaeFx7wqLuFm/wiTjZvH9rBrtDxgzA=; b=Pae5wUfDwzlm8Jjcm7ewqMheJoh/r8BGUDjJXZIN70A0oW7g9szuOTGCgEpDttIy9V yzajXOGWEjkcP+lbYK3LJmHSuyOR/5/3T6f9v9mnNeDAwCNWslg/vX5EevNxYu0mqQQZ i9+85CmJnIcLeAbyLskjKSLEzFSixeUlPNCTg1sIO/kkTgd6rW9DnOEGYe8Gy+oCzXGu OwOZeaPiv9MS8urdL4LCOlvnymI9Ugn62okc2ITtvHUvbx33aeIhuDVymW1k2EVK9PHY JoLu+f7X0yPX7fo9MK5b7OLHY5dmPLbq/H0zcpnjbWUtxjmmcTk0BdHr01gdEZQ+Z40c Cy9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=peRhn+ZcQyZuvGaeFx7wqLuFm/wiTjZvH9rBrtDxgzA=; b=JutQ9UDzL0Cy7xQO4gjyvAGMZpd40C3dp1veO0NhrK+ayF8KCn6ugwHjZ6ET6y2gzA +/aQMCtnOYLkxd3t4fvDlq0wfK9eE6oZneVBkAd9/R8WdIRbNE8jZhhC99Cz1JhF8rgM Y7DpgNMCH+XeMzn4CJTS8qQyZDKsf1CVZAAXhA/SFLGGK30HSs+OqZabhQYr6Ke7kxWo uiC69ujKJaHVTkejjTEdXQUrfkHBHlf6l+w7RrnSUZnauuCLzV/TBy2KLjhNdgug/jEh 3PMM42TFEctitWUUFRHIzxFqQ7mKJbirwGr8YFO9X22Qo+/6OHIHeH45BEDObLnM6+dN ht0g== X-Gm-Message-State: AOAM5308JH/P8tWj5LfiwlBnArFaGHnu2Ze51JVv+f3+mqV1R8ORjSdm 9EgaYkRnwOP47OpJW/d7OFFumvzx1V7MGA== X-Google-Smtp-Source: ABdhPJyr71+AcR9qxBwN7fNZYxV7MRKotJKFvpAM9TBXxvp7QDS4l5F+VUdcFQ0FinoN/ZVb1Diyqw== X-Received: by 2002:a05:6402:3d2:: with SMTP id t18mr9205636edw.368.1642175288704; Fri, 14 Jan 2022 07:48:08 -0800 (PST) Received: from lb01533.fkb.profitbricks.net ([85.214.13.132]) by smtp.gmail.com with ESMTPSA id x20sm2522028edd.28.2022.01.14.07.48.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Jan 2022 07:48:08 -0800 (PST) From: Md Haris Iqbal To: linux-rdma@vger.kernel.org Cc: bvanassche@acm.org, leon@kernel.org, dledford@redhat.com, jgg@ziepe.ca, haris.iqbal@ionos.com, jinpu.wang@ionos.com, Aleksei Marov Subject: [PATCH for-next 5/5] RDMA/rtrs-clt: Do stop and failover outside reconnect work. Date: Fri, 14 Jan 2022 16:47:53 +0100 Message-Id: <20220114154753.983568-6-haris.iqbal@ionos.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220114154753.983568-1-haris.iqbal@ionos.com> References: <20220114154753.983568-1-haris.iqbal@ionos.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Jack Wang We can't do instant reconnect, not to DDoS server, but we should stop and failover earlier, so there is less service interruption. To avoid deadlock, as error_recovery is called from different callback like rdma event or hb error handler, add a new err recovery_work. Signed-off-by: Jack Wang Reviewed-by: Aleksei Marov Reviewed-by: Md Haris Iqbal Signed-off-by: Md Haris Iqbal --- drivers/infiniband/ulp/rtrs/rtrs-clt.c | 40 ++++++++++++++------------ drivers/infiniband/ulp/rtrs/rtrs-clt.h | 1 + 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ulp/rtrs/rtrs-clt.c index 05de9ec7c99a..b159471a8959 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c +++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c @@ -297,6 +297,7 @@ static bool rtrs_clt_change_state_from_to(struct rtrs_clt_path *clt_path, return changed; } +static void rtrs_clt_stop_and_destroy_conns(struct rtrs_clt_path *clt_path); static void rtrs_rdma_error_recovery(struct rtrs_clt_con *con) { struct rtrs_clt_path *clt_path = to_clt_path(con->c.path); @@ -304,16 +305,7 @@ static void rtrs_rdma_error_recovery(struct rtrs_clt_con *con) if (rtrs_clt_change_state_from_to(clt_path, RTRS_CLT_CONNECTED, RTRS_CLT_RECONNECTING)) { - struct rtrs_clt_sess *clt = clt_path->clt; - unsigned int delay_ms; - - /* - * Normal scenario, reconnect if we were successfully connected - */ - delay_ms = clt->reconnect_delay_sec * 1000; - queue_delayed_work(rtrs_wq, &clt_path->reconnect_dwork, - msecs_to_jiffies(delay_ms + - prandom_u32() % RTRS_RECONNECT_SEED)); + queue_work(rtrs_wq, &clt_path->err_recovery_work); } else { /* * Error can happen just on establishing new connection, @@ -1501,6 +1493,22 @@ static void rtrs_clt_init_hb(struct rtrs_clt_path *clt_path) static void rtrs_clt_reconnect_work(struct work_struct *work); static void rtrs_clt_close_work(struct work_struct *work); +static void rtrs_clt_err_recovery_work(struct work_struct *work) +{ + struct rtrs_clt_path *clt_path; + struct rtrs_clt_sess *clt; + int delay_ms; + + clt_path = container_of(work, struct rtrs_clt_path, err_recovery_work); + clt = clt_path->clt; + delay_ms = clt->reconnect_delay_sec * 1000; + rtrs_clt_stop_and_destroy_conns(clt_path); + queue_delayed_work(rtrs_wq, &clt_path->reconnect_dwork, + msecs_to_jiffies(delay_ms + + prandom_u32() % + RTRS_RECONNECT_SEED)); +} + static struct rtrs_clt_path *alloc_path(struct rtrs_clt_sess *clt, const struct rtrs_addr *path, size_t con_num, u32 nr_poll_queues) @@ -1552,6 +1560,7 @@ static struct rtrs_clt_path *alloc_path(struct rtrs_clt_sess *clt, clt_path->state = RTRS_CLT_CONNECTING; atomic_set(&clt_path->connected_cnt, 0); INIT_WORK(&clt_path->close_work, rtrs_clt_close_work); + INIT_WORK(&clt_path->err_recovery_work, rtrs_clt_err_recovery_work); INIT_DELAYED_WORK(&clt_path->reconnect_dwork, rtrs_clt_reconnect_work); rtrs_clt_init_hb(clt_path); @@ -2321,6 +2330,7 @@ static void rtrs_clt_close_work(struct work_struct *work) clt_path = container_of(work, struct rtrs_clt_path, close_work); + cancel_work_sync(&clt_path->err_recovery_work); cancel_delayed_work_sync(&clt_path->reconnect_dwork); rtrs_clt_stop_and_destroy_conns(clt_path); rtrs_clt_change_state_get_old(clt_path, RTRS_CLT_CLOSED, NULL); @@ -2633,7 +2643,6 @@ static void rtrs_clt_reconnect_work(struct work_struct *work) { struct rtrs_clt_path *clt_path; struct rtrs_clt_sess *clt; - unsigned int delay_ms; int err; clt_path = container_of(to_delayed_work(work), struct rtrs_clt_path, @@ -2650,8 +2659,6 @@ static void rtrs_clt_reconnect_work(struct work_struct *work) } clt_path->reconnect_attempts++; - /* Stop everything */ - rtrs_clt_stop_and_destroy_conns(clt_path); msleep(RTRS_RECONNECT_BACKOFF); if (rtrs_clt_change_state_get_old(clt_path, RTRS_CLT_CONNECTING, NULL)) { err = init_path(clt_path); @@ -2664,11 +2671,7 @@ static void rtrs_clt_reconnect_work(struct work_struct *work) reconnect_again: if (rtrs_clt_change_state_get_old(clt_path, RTRS_CLT_RECONNECTING, NULL)) { clt_path->stats->reconnects.fail_cnt++; - delay_ms = clt->reconnect_delay_sec * 1000; - queue_delayed_work(rtrs_wq, &clt_path->reconnect_dwork, - msecs_to_jiffies(delay_ms + - prandom_u32() % - RTRS_RECONNECT_SEED)); + queue_work(rtrs_wq, &clt_path->err_recovery_work); } } @@ -2900,6 +2903,7 @@ int rtrs_clt_reconnect_from_sysfs(struct rtrs_clt_path *clt_path) &old_state); if (changed) { clt_path->reconnect_attempts = 0; + rtrs_clt_stop_and_destroy_conns(clt_path); queue_delayed_work(rtrs_wq, &clt_path->reconnect_dwork, 0); } if (changed || old_state == RTRS_CLT_RECONNECTING) { diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.h b/drivers/infiniband/ulp/rtrs/rtrs-clt.h index d1b18a154ae0..f848c0392d98 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-clt.h +++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.h @@ -134,6 +134,7 @@ struct rtrs_clt_path { struct rtrs_clt_io_req *reqs; struct delayed_work reconnect_dwork; struct work_struct close_work; + struct work_struct err_recovery_work; unsigned int reconnect_attempts; bool established; struct rtrs_rbuf *rbufs;