All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Piotr Skajewski <piotrx.skajewski@intel.com>
Cc: anthony.l.nguyen@intel.com, davem@davemloft.net,
	edumazet@google.com, konrad0.jankowski@intel.com,
	netdev@vger.kernel.org, pabeni@redhat.com
Subject: Re: [PATCH net 1/1] ixgbe: Add locking to prevent panic when setting sriov_numvfs to zero
Date: Thu, 30 Jun 2022 08:11:34 -0700	[thread overview]
Message-ID: <20220630081134.48b9bb53@kernel.org> (raw)
In-Reply-To: <20220630100839.14079-1-piotrx.skajewski@intel.com>

On Thu, 30 Jun 2022 12:08:39 +0200 Piotr Skajewski wrote:
> On Tue, 28 Jun 2022 10:27:07 -0700 Jakub Kicinski wrote:
> > On Tue, 28 Jun 2022 09:53:46 -0700 Tony Nguyen wrote:  
> > > +	spin_lock_irqsave(&adapter->vfs_lock, flags);
> > > +
> > >  	/* set num VFs to 0 to prevent access to vfinfo */
> > >  	adapter->num_vfs = 0;
> > >  
> > > @@ -228,6 +231,8 @@ int ixgbe_disable_sriov(struct ixgbe_adapter *adapter)
> > >  	kfree(adapter->mv_list);
> > >  	adapter->mv_list = NULL;
> > >  
> > > +	spin_unlock_irqrestore(&adapter->vfs_lock, flags);  
> >
> > There's a pci_dev_put() in there, are you sure it won't sleep?  
> 
> Thank Jakub for your notice, during development we were aware about this
> and tests we've made on this particular case, did not report any problems
> that could be related to might_sleep in conjunction with spinlock.

To be on the safe side how about we protect adapter->num_vfs instead 
of adapter->vfinfo ?

You can hold the lock just around setting adapter->num_vfs to zero,
and then inside ixgbe_msg_task() you don't have to add the new if()
because the loop bound is already adapter->num_vfs.

Smaller change, and safer.

  reply	other threads:[~2022-06-30 15:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-28 16:53 [PATCH net 1/1] ixgbe: Add locking to prevent panic when setting sriov_numvfs to zero Tony Nguyen
2022-06-28 17:27 ` Jakub Kicinski
2022-06-30 10:08   ` Piotr Skajewski
2022-06-30 15:11     ` Jakub Kicinski [this message]
2022-07-01  8:31       ` Piotr Skajewski
  -- strict thread matches above, loose matches on Subject: below --
2021-08-12 17:18 Tony Nguyen
2021-08-14  0:20 ` Jakub Kicinski
2021-08-16 17:52   ` Nguyen, Anthony L
2021-08-17 10:23     ` Ken Cox

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=20220630081134.48b9bb53@kernel.org \
    --to=kuba@kernel.org \
    --cc=anthony.l.nguyen@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=konrad0.jankowski@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=piotrx.skajewski@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.