From: Or Gerlitz <or.gerlitz@gmail.com>
To: David Miller <davem@davemloft.net>
Cc: Amir Vadai <amirv@mellanox.com>,
Or Gerlitz <ogerlitz@mellanox.com>,
Yevgeny Petrilin <yevgenyp@mellanox.com>,
Narendra_K@dell.com, Sreekanth_Reddy@dell.com,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: [PATCH net 2/2] net/mlx4_core: mlx4_init_slave() shouldn't access comm channel before PF is ready
Date: Thu, 6 Mar 2014 23:08:36 +0200 [thread overview]
Message-ID: <CAJZOPZKdxmZ1NBKxnSeAnQv-F=e0zQBsjTON64RE67EitkySLQ@mail.gmail.com> (raw)
In-Reply-To: <20140306.154804.999275744020224288.davem@davemloft.net>
On Thu, Mar 6, 2014 at 10:48 PM, David Miller <davem@davemloft.net> wrote:
> From: Or Gerlitz <or.gerlitz@gmail.com>
> Date: Thu, 6 Mar 2014 22:19:48 +0200
>> On Thu, Mar 6, 2014 at 10:12 PM, David Miller <davem@davemloft.net> wrote:
>>> > +static atomic_t pf_loading = ATOMIC_INIT(0);
>>> > @@ -1407,6 +1409,11 @@ static int mlx4_init_slave(struct mlx4_dev *dev)
>>> > + if (atomic_read(&pf_loading)) {
>>> > + mlx4_warn(dev, "PF is not ready. Deferring probe\n");
>>> > + return -EPROBE_DEFER;
>>> > + }
>>> > +
>>> > @@ -2319,7 +2326,11 @@ static int __mlx4_init_one(struct pci_dev *pdev, int pci_dev_data)
>>> >
>>> > if (num_vfs) {
>>> > mlx4_warn(dev, "Enabling SR-IOV with %d VFs\n",num_vfs);
>>> > +
>>> > + atomic_inc(&pf_loading);
>>> > err = pci_enable_sriov(pdev, num_vfs);
>>> > + atomic_dec(&pf_loading);
>>> > +
>>> This synchronization scheme doesn't look right to me at all.
>>> It's global, so VF's for _any_ PF will probe defer while one is enabling SRIOV.
>>> It doesn't seem correct to cause unrelated VF's to defer the probe.
>> Can you please elaborate a bit why you find this approach to be
>> incorrect? basically, these nested VF probed are a bit headache
>> anyway, so we didn't find such global deferring to be problematic.
> What if a second PF starts to init and call pci_enable_sriov(), while the VFs
> from a previous PF probed call mlx4_init_slave()?
> It will increment pf_loading() and force those unreladed VFs to defer.
By "unreladed VFs" I assume you mean unrelated VFs that belong to the
1st VF, which is OK for them to probe, right? so yes, this is sort of
conservative approach that wait till all PFs are fully ready, and I
understand you don't like it, but still, I would be happy to know
what's wrong in doing so..
> You must have a per-PF value to block the underlying VFs, rather than a global
> one.
next prev parent reply other threads:[~2014-03-06 21:08 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-06 16:28 [PATCH net 0/2] net/mlx4_core: SR-IOV related fixes Amir Vadai
2014-03-06 16:28 ` [PATCH net 1/2] net/mlx4_core: Fix memory access error in mlx4_QUERY_DEV_CAP_wrapper() Amir Vadai
2014-03-06 16:28 ` [PATCH net 2/2] net/mlx4_core: mlx4_init_slave() shouldn't access comm channel before PF is ready Amir Vadai
2014-03-06 20:12 ` David Miller
2014-03-06 20:19 ` Or Gerlitz
2014-03-06 20:48 ` David Miller
2014-03-06 21:08 ` Or Gerlitz [this message]
2014-03-06 21:12 ` David Miller
2014-03-06 21:58 ` Or Gerlitz
2014-03-06 22:09 ` David Miller
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='CAJZOPZKdxmZ1NBKxnSeAnQv-F=e0zQBsjTON64RE67EitkySLQ@mail.gmail.com' \
--to=or.gerlitz@gmail.com \
--cc=Narendra_K@dell.com \
--cc=Sreekanth_Reddy@dell.com \
--cc=amirv@mellanox.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=ogerlitz@mellanox.com \
--cc=yevgenyp@mellanox.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).