Message ID | 20231211131051.1500834-1-neelx@redhat.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp7036559vqy; Mon, 11 Dec 2023 05:12:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IFG1/23aUxCJy5lxJYJYelXtyZW4sOFq1lzikQfxS6mG/nZF6+/H9d7tGm89KrxziL6VHg2 X-Received: by 2002:a05:6a20:9184:b0:185:a90d:363d with SMTP id v4-20020a056a20918400b00185a90d363dmr1636143pzd.2.1702300331259; Mon, 11 Dec 2023 05:12:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702300331; cv=none; d=google.com; s=arc-20160816; b=oE6tOhdPZcO/YbsTiF2x+AtOdE1XVbbo72pESqGG6VUGoHPuaannRFaE8OZtgZ8l/u sEpfzzjS6YBYFNdNPu8n/f4oX/0pfLRuxVrEdqTr6d0pn54Os9l1pujdRa2wsmZchzZI ESlnbDcCCYshaewoq91X5zbUWDofgH14NmH01ezMek1nAb7MC+UErmZCgPZiGJDvM84d +B2nO1fMU+W8ZMfngPuwXQA5pW0uv7jy6aH0J/TZOUJgHtnyJTAOhxAlccIugh7YYKA8 bd+FEK8EiPPnTTqrIfvblkwITX9SKq2ADhFVsz6WlOWyIKXxw/2MeNAQy061sFNA7swM 1oQg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=bxkpf05We2DBfBoO7M+TMnamc353LQSiQtx/2gTu6dc=; fh=kUHVXghdBMLDUJvQ4SlMugBa0raJHHo/i5LV5D2iUJQ=; b=e3fk2CCivWlkCEPYjnAt8TDWLIBsf9GaT986idmOLv/ZETB7q0l4tf18T695DaE/hK NW0hGatQ7j5GpUyJ5Bt+w6cuU0u3/OURTlTX4NRLd/c7D4lEiD6VH/BuVy38vmDwiq8F lyuEvWy9FEXtZ7d8SFhVSQDkD+xwg7qrw3eCVkn8cOYWFLsUBpGdaPmffQyWQVTYyHDS 6fRY0K4BXBM1hIrzabAy2BvXaNHOcrXiABrOa87A/SveR2OcMcB3UnbYF0Bnqyw9m3Lb PfhdYwkk57xG01tpMwj2Is/P6RFn0vQcRqg0bK5AktyPsFMlFXuKE15UTP0R3OHG3QnJ 55kw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ian1pH9t; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id h2-20020a655182000000b0058978136247si5956448pgq.483.2023.12.11.05.12.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 05:12:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ian1pH9t; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (Postfix) with ESMTP id CF57F8069FBA; Mon, 11 Dec 2023 05:12:08 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234637AbjLKNL6 (ORCPT <rfc822;dexuan.linux@gmail.com> + 99 others); Mon, 11 Dec 2023 08:11:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234350AbjLKNL5 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 11 Dec 2023 08:11:57 -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 149F8C4 for <linux-kernel@vger.kernel.org>; Mon, 11 Dec 2023 05:11:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1702300319; 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; bh=bxkpf05We2DBfBoO7M+TMnamc353LQSiQtx/2gTu6dc=; b=ian1pH9tOT/c0f1MzrYxll/p9JE5hu6+N7o2fAs7XeklXdY4kj+KmTJ62yBq0GpfN1umfq Cy1zEg8dgrvekf7cOhQhIFpZPGNo4/Z8gfpq554OGKa7tJrx0T53t5cG6tmzcNcXmGfG2s bTX6py/QYLVXWYVvS4yWYOrwfduw37o= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-471-rpkuKG-9P4uvbNB6RUNR3w-1; Mon, 11 Dec 2023 08:11:55 -0500 X-MC-Unique: rpkuKG-9P4uvbNB6RUNR3w-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (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 487C31C068C2; Mon, 11 Dec 2023 13:11:55 +0000 (UTC) Received: from metal.redhat.com (unknown [10.45.224.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id E897340C6EB9; Mon, 11 Dec 2023 13:11:53 +0000 (UTC) From: Daniel Vacek <neelx@redhat.com> To: Jason Gunthorpe <jgg@ziepe.ca>, Leon Romanovsky <leon@kernel.org> Cc: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, Daniel Vacek <neelx@redhat.com> Subject: [PATCH] IB/ipoib: No need to hold the lock while printing the warning Date: Mon, 11 Dec 2023 14:10:50 +0100 Message-ID: <20231211131051.1500834-1-neelx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,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 groat.vger.email 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 (groat.vger.email [0.0.0.0]); Mon, 11 Dec 2023 05:12:09 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784991272234978016 X-GMAIL-MSGID: 1784991272234978016 |
Series |
IB/ipoib: No need to hold the lock while printing the warning
|
|
Commit Message
Daniel Vacek
Dec. 11, 2023, 1:10 p.m. UTC
Signed-off-by: Daniel Vacek <neelx@redhat.com>
---
drivers/infiniband/ulp/ipoib/ipoib_multicast.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Comments
On Mon, Dec 11, 2023 at 02:10:50PM +0100, Daniel Vacek wrote: > Signed-off-by: Daniel Vacek <neelx@redhat.com> Please fill some text in commit message. Thanks > --- > drivers/infiniband/ulp/ipoib/ipoib_multicast.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c > index 5b3154503bf4..ae2c05806dcc 100644 > --- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c > +++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c > @@ -536,17 +536,17 @@ static int ipoib_mcast_join(struct net_device *dev, struct ipoib_mcast *mcast) > multicast = ib_sa_join_multicast(&ipoib_sa_client, priv->ca, priv->port, > &rec, comp_mask, GFP_KERNEL, > ipoib_mcast_join_complete, mcast); > - spin_lock_irq(&priv->lock); > if (IS_ERR(multicast)) { > ret = PTR_ERR(multicast); > ipoib_warn(priv, "ib_sa_join_multicast failed, status %d\n", ret); > + spin_lock_irq(&priv->lock); > /* Requeue this join task with a backoff delay */ > __ipoib_mcast_schedule_join_thread(priv, mcast, 1); > clear_bit(IPOIB_MCAST_FLAG_BUSY, &mcast->flags); > spin_unlock_irq(&priv->lock); > complete(&mcast->done); > - spin_lock_irq(&priv->lock); > } > + spin_lock_irq(&priv->lock); > return 0; > } > > -- > 2.43.0 >
On Mon, Dec 11, 2023 at 03:22:17PM +0200, Leon Romanovsky wrote: > Please fill some text in commit message. Yes, explain *why* you are doing this > > diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c > > index 5b3154503bf4..ae2c05806dcc 100644 > > --- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c > > +++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c > > @@ -536,17 +536,17 @@ static int ipoib_mcast_join(struct net_device *dev, struct ipoib_mcast *mcast) > > multicast = ib_sa_join_multicast(&ipoib_sa_client, priv->ca, priv->port, > > &rec, comp_mask, GFP_KERNEL, > > ipoib_mcast_join_complete, mcast); > > - spin_lock_irq(&priv->lock); > > if (IS_ERR(multicast)) { > > ret = PTR_ERR(multicast); > > ipoib_warn(priv, "ib_sa_join_multicast failed, status %d\n", ret); > > + spin_lock_irq(&priv->lock); > > /* Requeue this join task with a backoff delay */ > > __ipoib_mcast_schedule_join_thread(priv, mcast, 1); > > clear_bit(IPOIB_MCAST_FLAG_BUSY, &mcast->flags); > > spin_unlock_irq(&priv->lock); > > complete(&mcast->done); > > - spin_lock_irq(&priv->lock); It is super weird to unlock just around complete. Jason
On Mon, Dec 11, 2023 at 2:25 PM Jason Gunthorpe <jgg@ziepe.ca> wrote: > > On Mon, Dec 11, 2023 at 03:22:17PM +0200, Leon Romanovsky wrote: > > > Please fill some text in commit message. > > Yes, explain *why* you are doing this Oh, sorry. I did not mention it but there's no particular reason really. The @Subject says it all. There should be no logical or functional change other than reducing the span of that critical section. In other words, just nitpicking, not a big deal. While checking the code (and past changes) related to the other issue I also sent today I just noticed the way 08bc327629cbd added the spin_lock before returning from this function and it appeared to me it's clearer the way I'm proposing here. Honestly, I was not looking into why the lock is released for that completion. And I'm not changing that logic. If this complete() can be called with priv->lock held, the cleanup would look different, of course. That said, If you'd like to keep this patch I can send a v2 with the above details in the message body. Otherwise feel free to drop this. --nX > > > diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c > > > index 5b3154503bf4..ae2c05806dcc 100644 > > > --- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c > > > +++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c > > > @@ -536,17 +536,17 @@ static int ipoib_mcast_join(struct net_device *dev, struct ipoib_mcast *mcast) > > > multicast = ib_sa_join_multicast(&ipoib_sa_client, priv->ca, priv->port, > > > &rec, comp_mask, GFP_KERNEL, > > > ipoib_mcast_join_complete, mcast); > > > - spin_lock_irq(&priv->lock); > > > if (IS_ERR(multicast)) { > > > ret = PTR_ERR(multicast); > > > ipoib_warn(priv, "ib_sa_join_multicast failed, status %d\n", ret); > > > + spin_lock_irq(&priv->lock); > > > /* Requeue this join task with a backoff delay */ > > > __ipoib_mcast_schedule_join_thread(priv, mcast, 1); > > > clear_bit(IPOIB_MCAST_FLAG_BUSY, &mcast->flags); > > > spin_unlock_irq(&priv->lock); > > > complete(&mcast->done); > > > - spin_lock_irq(&priv->lock); > > It is super weird to unlock just around complete. > > Jason >
On Mon, Dec 11, 2023 at 03:09:13PM +0100, Daniel Vacek wrote: > On Mon, Dec 11, 2023 at 2:25 PM Jason Gunthorpe <jgg@ziepe.ca> wrote: > > > > On Mon, Dec 11, 2023 at 03:22:17PM +0200, Leon Romanovsky wrote: > > > > > Please fill some text in commit message. > > > > Yes, explain *why* you are doing this > > Oh, sorry. I did not mention it but there's no particular reason > really. The @Subject says it all. There should be no logical or > functional change other than reducing the span of that critical > section. In other words, just nitpicking, not a big deal. > > While checking the code (and past changes) related to the other issue > I also sent today I just noticed the way 08bc327629cbd added the > spin_lock before returning from this function and it appeared to me > it's clearer the way I'm proposing here. > > Honestly, I was not looking into why the lock is released for that > completion. And I'm not changing that logic. > > If this complete() can be called with priv->lock held, the cleanup > would look different, of course. complete() can be called under spinlocks just fine, AFAIK.. Jason
On Mon, Dec 11, 2023 at 4:27 PM Jason Gunthorpe <jgg@ziepe.ca> wrote: > > On Mon, Dec 11, 2023 at 03:09:13PM +0100, Daniel Vacek wrote: > > On Mon, Dec 11, 2023 at 2:25 PM Jason Gunthorpe <jgg@ziepe.ca> wrote: > > > > > > On Mon, Dec 11, 2023 at 03:22:17PM +0200, Leon Romanovsky wrote: > > > > > > > Please fill some text in commit message. > > > > > > Yes, explain *why* you are doing this > > > > Oh, sorry. I did not mention it but there's no particular reason > > really. The @Subject says it all. There should be no logical or > > functional change other than reducing the span of that critical > > section. In other words, just nitpicking, not a big deal. > > > > While checking the code (and past changes) related to the other issue > > I also sent today I just noticed the way 08bc327629cbd added the > > spin_lock before returning from this function and it appeared to me > > it's clearer the way I'm proposing here. > > > > Honestly, I was not looking into why the lock is released for that > > completion. And I'm not changing that logic. > > > > If this complete() can be called with priv->lock held, the cleanup > > would look different, of course. > > complete() can be called under spinlocks just fine, AFAIK.. Yup, agreed. We ended up removing the lock completely in this function with the other patch. This patch can be discarded. --nX > Jason >
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c index 5b3154503bf4..ae2c05806dcc 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c @@ -536,17 +536,17 @@ static int ipoib_mcast_join(struct net_device *dev, struct ipoib_mcast *mcast) multicast = ib_sa_join_multicast(&ipoib_sa_client, priv->ca, priv->port, &rec, comp_mask, GFP_KERNEL, ipoib_mcast_join_complete, mcast); - spin_lock_irq(&priv->lock); if (IS_ERR(multicast)) { ret = PTR_ERR(multicast); ipoib_warn(priv, "ib_sa_join_multicast failed, status %d\n", ret); + spin_lock_irq(&priv->lock); /* Requeue this join task with a backoff delay */ __ipoib_mcast_schedule_join_thread(priv, mcast, 1); clear_bit(IPOIB_MCAST_FLAG_BUSY, &mcast->flags); spin_unlock_irq(&priv->lock); complete(&mcast->done); - spin_lock_irq(&priv->lock); } + spin_lock_irq(&priv->lock); return 0; }