Message ID | 1695134522-126655-2-git-send-email-guwen@linux.alibaba.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp3482693vqi; Tue, 19 Sep 2023 08:39:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGw77JNZK65y8QKUyyNqcrsOWGk9ajEDy+GhQDRcRkVDZNtX8zHskDyB3ZJtfcO2UnWIG/q X-Received: by 2002:a05:6300:8002:b0:14c:d5e9:21b8 with SMTP id an2-20020a056300800200b0014cd5e921b8mr11105502pzc.30.1695137985184; Tue, 19 Sep 2023 08:39:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695137985; cv=none; d=google.com; s=arc-20160816; b=tGG4d2whMoPO1egGy09A5iyC9SuEoKF8TUxKZbNWyb4lDmp4afjGkOCy3CJThYvTtg OLCm4J9X30EeQCS9R5G73V44yWf7+yyFM+paxqKEtxI9P2pe6tOuLPA+aigA6+jsubv/ /kPFAr3KtqDqdz1vaVXauleO3q0uMUQCz0PY4GWhep7yxWG5tDU4sgYQPbc7U0xQf2TN tJeafyKzMI4EdcLa9Cc2HCSss+XWVSUp9gP59uRJoXLSkidZj14W7DJDe833Iff70qAU Bw1rTLzVX1mSTDQNT/WSJpNwWIJTVUw/ZfVaNmHCDKSp/SThD9OfZZcBMQ0O/SVfQuRp Nclw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=2pM1iPMxEbHhpM0cC4MR9TZN1sh+tiMrz6RmDDUzn8Y=; fh=2Ks5OhTjwS8gZt4F+VGxBODwUEQ0u2wJBF3lQY5ZqAM=; b=kru3u4Q8GRHWep4JOAbxRtd+Hg1XF/tZoXHqJq09jMnM7KOwTl2Y3ZH89X4o2pTeCH 1Lq3s3lSZNPINlEVji6mk1w1z7PS8qYRIyP2fuDYTcjKGgUsbbWxw0nuW7tULHKfgIlw KWNXUllz8eYsTyMmriMpdppTTkYX+PnMyo2KgnkBNHRENob5dsVFcb0Yl3/Pqt+bRXTY kqhIWBqFHHJYL0zwlMDO23XHPOt2cSG8UWe9Qq+ZESFAP2zrGfkcPjUOih65FM1sghOX 8D+cHGMQNWEi9skrd4r9zoxjoUA2x8WBxOkmQd51A5/dXJ91tkV5r3AG5TT5zmpj3awA jCSw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id 19-20020a631753000000b00578b4edf57esi1373535pgx.797.2023.09.19.08.39.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Sep 2023 08:39:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id F3DCD80D44DF; Tue, 19 Sep 2023 07:42:47 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232878AbjISOms (ORCPT <rfc822;toshivichauhan@gmail.com> + 26 others); Tue, 19 Sep 2023 10:42:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232316AbjISOmq (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 19 Sep 2023 10:42:46 -0400 Received: from out30-132.freemail.mail.aliyun.com (out30-132.freemail.mail.aliyun.com [115.124.30.132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFB4CBF; Tue, 19 Sep 2023 07:42:39 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R171e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046060;MF=guwen@linux.alibaba.com;NM=1;PH=DS;RN=13;SR=0;TI=SMTPD_---0VsRsRjQ_1695134534; Received: from localhost(mailfrom:guwen@linux.alibaba.com fp:SMTPD_---0VsRsRjQ_1695134534) by smtp.aliyun-inc.com; Tue, 19 Sep 2023 22:42:36 +0800 From: Wen Gu <guwen@linux.alibaba.com> To: kgraul@linux.ibm.com, wenjia@linux.ibm.com, jaka@linux.ibm.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: alibuda@linux.alibaba.com, tonylu@linux.alibaba.com, guwen@linux.alibaba.com, linux-s390@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 01/18] net/smc: decouple ism_dev from SMC-D device dump Date: Tue, 19 Sep 2023 22:41:45 +0800 Message-Id: <1695134522-126655-2-git-send-email-guwen@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1695134522-126655-1-git-send-email-guwen@linux.alibaba.com> References: <1695134522-126655-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_BLOCKED,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: <linux-kernel.vger.kernel.org> 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]); Tue, 19 Sep 2023 07:42:48 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777481007983736185 X-GMAIL-MSGID: 1777481007983736185 |
Series |
net/smc: implement virtual ISM extension and loopback-ism
|
|
Commit Message
Wen Gu
Sept. 19, 2023, 2:41 p.m. UTC
This patch helps to decouple ISM device from SMC-D device, allowing
different underlying device forms, such as virtual ISM devices.
Signed-off-by: Wen Gu <guwen@linux.alibaba.com>
---
net/smc/smc_ism.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
Comments
On Tue, Sep 19, 2023 at 10:41:45PM +0800, Wen Gu wrote: > This patch helps to decouple ISM device from SMC-D device, allowing > different underlying device forms, such as virtual ISM devices. > > Signed-off-by: Wen Gu <guwen@linux.alibaba.com> > --- > net/smc/smc_ism.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/net/smc/smc_ism.c b/net/smc/smc_ism.c > index fbee249..0045fee 100644 > --- a/net/smc/smc_ism.c > +++ b/net/smc/smc_ism.c > @@ -230,12 +230,11 @@ static int smc_nl_handle_smcd_dev(struct smcd_dev *smcd, > char smc_pnet[SMC_MAX_PNETID_LEN + 1]; > struct smc_pci_dev smc_pci_dev; > struct nlattr *port_attrs; > + struct device *priv_dev; > struct nlattr *attrs; > - struct ism_dev *ism; > int use_cnt = 0; > void *nlh; > > - ism = smcd->priv; > nlh = genlmsg_put(skb, NETLINK_CB(cb->skb).portid, cb->nlh->nlmsg_seq, > &smc_gen_nl_family, NLM_F_MULTI, > SMC_NETLINK_GET_DEV_SMCD); > @@ -250,7 +249,10 @@ static int smc_nl_handle_smcd_dev(struct smcd_dev *smcd, > if (nla_put_u8(skb, SMC_NLA_DEV_IS_CRIT, use_cnt > 0)) > goto errattr; > memset(&smc_pci_dev, 0, sizeof(smc_pci_dev)); Hi Wen Gu, priv_dev is uninitialised here. > - smc_set_pci_values(to_pci_dev(ism->dev.parent), &smc_pci_dev); > + if (smcd->ops->get_dev) > + priv_dev = smcd->ops->get_dev(smcd); It is conditionally initialised here. > + if (priv_dev->parent) But unconditionally dereferenced here. As flagged by clang-16 W=1, and Smatch > + smc_set_pci_values(to_pci_dev(priv_dev->parent), &smc_pci_dev); > if (nla_put_u32(skb, SMC_NLA_DEV_PCI_FID, smc_pci_dev.pci_fid)) > goto errattr; > if (nla_put_u16(skb, SMC_NLA_DEV_PCI_CHID, smc_pci_dev.pci_pchid)) > -- > 1.8.3.1 > >
On 2023/9/22 04:41, Simon Horman wrote: > On Tue, Sep 19, 2023 at 10:41:45PM +0800, Wen Gu wrote: >> This patch helps to decouple ISM device from SMC-D device, allowing >> different underlying device forms, such as virtual ISM devices. >> >> Signed-off-by: Wen Gu <guwen@linux.alibaba.com> >> --- >> net/smc/smc_ism.c | 8 +++++--- >> 1 file changed, 5 insertions(+), 3 deletions(-) >> >> diff --git a/net/smc/smc_ism.c b/net/smc/smc_ism.c >> index fbee249..0045fee 100644 >> --- a/net/smc/smc_ism.c >> +++ b/net/smc/smc_ism.c >> @@ -230,12 +230,11 @@ static int smc_nl_handle_smcd_dev(struct smcd_dev *smcd, >> char smc_pnet[SMC_MAX_PNETID_LEN + 1]; >> struct smc_pci_dev smc_pci_dev; >> struct nlattr *port_attrs; >> + struct device *priv_dev; >> struct nlattr *attrs; >> - struct ism_dev *ism; >> int use_cnt = 0; >> void *nlh; >> >> - ism = smcd->priv; >> nlh = genlmsg_put(skb, NETLINK_CB(cb->skb).portid, cb->nlh->nlmsg_seq, >> &smc_gen_nl_family, NLM_F_MULTI, >> SMC_NETLINK_GET_DEV_SMCD); >> @@ -250,7 +249,10 @@ static int smc_nl_handle_smcd_dev(struct smcd_dev *smcd, >> if (nla_put_u8(skb, SMC_NLA_DEV_IS_CRIT, use_cnt > 0)) >> goto errattr; >> memset(&smc_pci_dev, 0, sizeof(smc_pci_dev)); > > Hi Wen Gu, > > priv_dev is uninitialised here. > >> - smc_set_pci_values(to_pci_dev(ism->dev.parent), &smc_pci_dev); >> + if (smcd->ops->get_dev) >> + priv_dev = smcd->ops->get_dev(smcd); > > It is conditionally initialised here. > >> + if (priv_dev->parent) > > But unconditionally dereferenced here. > > As flagged by clang-16 W=1, and Smatch > Hi Simon. Yes, I fixed it in v3. Thank you! >> + smc_set_pci_values(to_pci_dev(priv_dev->parent), &smc_pci_dev); >> if (nla_put_u32(skb, SMC_NLA_DEV_PCI_FID, smc_pci_dev.pci_fid)) >> goto errattr; >> if (nla_put_u16(skb, SMC_NLA_DEV_PCI_CHID, smc_pci_dev.pci_pchid)) >> -- >> 1.8.3.1 >> >>
On Fri, 2023-09-22 at 16:05 +0800, Wen Gu wrote: > On 2023/9/22 04:41, Simon Horman wrote: > > On Tue, Sep 19, 2023 at 10:41:45PM +0800, Wen Gu wrote: > > > > priv_dev is uninitialised here. > > > > > - smc_set_pci_values(to_pci_dev(ism->dev.parent), > > > &smc_pci_dev); > > > + if (smcd->ops->get_dev) > > > + priv_dev = smcd->ops->get_dev(smcd); > > > > It is conditionally initialised here. > > > > > + if (priv_dev->parent) > > > > But unconditionally dereferenced here. > > > > As flagged by clang-16 W=1, and Smatch > > > > Hi Simon. Yes, I fixed it in v3. Thank you! Hi Wen Gu, seems like there is some email filter at work. Neither v2 nor v3 made it to the netdev mailing list - nor to patchwork.kernel.org. There's traces of Wenjia's replies and your replies to her - but not the original mail. Could you please check? Thanks! Gerd
On 2023/9/23 02:13, Gerd Bayer wrote: > Hi Wen Gu, > > seems like there is some email filter at work. Neither v2 nor v3 made > it to the netdev mailing list - nor to patchwork.kernel.org. > There's traces of Wenjia's replies and your replies to her - but not > the original mail. > > Could you please check? Thanks! > Gerd Yes, it is ture. v2 and v3 was refused by ver.kernel.org. I will send the v4 based on Wenjia's comments as soon as possible, and add CC of you, Sandy, Niklas and Halil in v4 in case the filter happens again. Thank you very much for your reminder! Regards, Wen Gu
diff --git a/net/smc/smc_ism.c b/net/smc/smc_ism.c index fbee249..0045fee 100644 --- a/net/smc/smc_ism.c +++ b/net/smc/smc_ism.c @@ -230,12 +230,11 @@ static int smc_nl_handle_smcd_dev(struct smcd_dev *smcd, char smc_pnet[SMC_MAX_PNETID_LEN + 1]; struct smc_pci_dev smc_pci_dev; struct nlattr *port_attrs; + struct device *priv_dev; struct nlattr *attrs; - struct ism_dev *ism; int use_cnt = 0; void *nlh; - ism = smcd->priv; nlh = genlmsg_put(skb, NETLINK_CB(cb->skb).portid, cb->nlh->nlmsg_seq, &smc_gen_nl_family, NLM_F_MULTI, SMC_NETLINK_GET_DEV_SMCD); @@ -250,7 +249,10 @@ static int smc_nl_handle_smcd_dev(struct smcd_dev *smcd, if (nla_put_u8(skb, SMC_NLA_DEV_IS_CRIT, use_cnt > 0)) goto errattr; memset(&smc_pci_dev, 0, sizeof(smc_pci_dev)); - smc_set_pci_values(to_pci_dev(ism->dev.parent), &smc_pci_dev); + if (smcd->ops->get_dev) + priv_dev = smcd->ops->get_dev(smcd); + if (priv_dev->parent) + smc_set_pci_values(to_pci_dev(priv_dev->parent), &smc_pci_dev); if (nla_put_u32(skb, SMC_NLA_DEV_PCI_FID, smc_pci_dev.pci_fid)) goto errattr; if (nla_put_u16(skb, SMC_NLA_DEV_PCI_CHID, smc_pci_dev.pci_pchid))