mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kaige Li <likaige@loongson.cn>
To: Jakub Kicinski <kuba@kernel.org>,
	"Christian Benvenuti (benve)" <benve@cisco.com>
Cc: David Miller <davem@davemloft.net>,
	"_govind@gmx.com" <_govind@gmx.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"lixuefeng@loongson.cn" <lixuefeng@loongson.cn>,
	"yangtiezhu@loongson.cn" <yangtiezhu@loongson.cn>
Subject: Re: [PATCH RESEND] net/cisco: Fix a sleep-in-atomic-context bug in enic_init_affinity_hint()
Date: Fri, 3 Jul 2020 14:54:41 +0800	[thread overview]
Message-ID: <71243f6a-561f-4fa1-be03-3e1589497ea4@loongson.cn> (raw)
In-Reply-To: <20200624095903.71a01271@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>


On 06/25/2020 12:59 AM, Jakub Kicinski wrote:
> On Wed, 24 Jun 2020 06:32:36 +0000 Christian Benvenuti (benve) wrote:
>> We/Cisco will also look into it, hopefully a small code reorg will be sufficient.

Hi, Christian:

I have seen some submissions and codes, and feel that spin_lock is unnecessary in enci_reset.<https://lore.kernel.org/patchwork/project/lkml/list/?submitter=28441>

<https://lore.kernel.org/patchwork/project/lkml/list/?submitter=28441>

Some key submissions are as follows.

Tue Sep 16 00:17:11 2008

git show 01f2e4ead. we can see that spin_lock is just in here:

+       spin_lock(&enic->devcmd_lock);

+       vnic_dev_hang_notify(enic->vdev);

+       spin_unlock(&enic->devcmd_lock);



Sat Aug 17 06:47:40 2013

git show 0b038566c: Add an interface for USNIC to interact with firmware.

Before commit-id: 0b038566c, spin_lock is not used in enic_reset. rtnl_lock() is enough. And 0b038566c add a interface: enic_api_devcmd_proxy_by_index.

Enic_api_devcmd_proxy_by_index is just used in ./drivers/infiniband/hw/usnic/usnic_fwd.c:50, which is added in 2183b990.

+       spin_lock(&enic->enic_api_lock);

         enic_dev_hang_notify(enic);


         enic_dev_set_ig_vlan_rewrite_mode(enic);

         enic_open(enic->netdev);

+       spin_unlock(&enic->enic_api_lock);

By analyzing enic_api_lock, it's mainly used for locking vnic_dev_cmd(vdev, cmd, a0, a1, wait). And enic_reset didn't call to vnic_dev_cmd.

So, I think spin_lock may be deleted in enci_reset. What do you think? Or you have better advice.

Thank you.

> Make sure you enable CONFIG_DEBUG_ATOMIC_SLEEP when you test.


  reply	other threads:[~2020-07-03  6:54 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-23  8:13 Kaige Li
2020-06-23 20:50 ` Jakub Kicinski
2020-06-24  2:07   ` Kaige Li
2020-06-24  3:24     ` David Miller
2020-06-23 21:33 ` David Miller
2020-06-23 22:26   ` David Miller
2020-06-24  1:56     ` Kaige Li
2020-06-24  3:23       ` David Miller
2020-06-24  3:41         ` Kaige Li
2020-06-24  6:32           ` Christian Benvenuti (benve)
2020-06-24 16:59             ` Jakub Kicinski
2020-07-03  6:54               ` Kaige Li [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-06-22 13:11 Kaige Li
2020-06-23  4:09 ` David Miller
2020-06-23  8:02   ` Kaige Li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=71243f6a-561f-4fa1-be03-3e1589497ea4@loongson.cn \
    --to=likaige@loongson.cn \
    --cc=_govind@gmx.com \
    --cc=benve@cisco.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lixuefeng@loongson.cn \
    --cc=netdev@vger.kernel.org \
    --cc=yangtiezhu@loongson.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®