From: David Miller <davem@davemloft.net>
To: amirv@mellanox.com
Cc: ogerlitz@mellanox.com, yevgenyp@mellanox.com,
Narendra_K@Dell.com, Sreekanth_Reddy@Dell.com,
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, 06 Mar 2014 15:12:54 -0500 (EST) [thread overview]
Message-ID: <20140306.151254.914568962698409365.davem@davemloft.net> (raw)
In-Reply-To: <1394123297-7878-3-git-send-email-amirv@mellanox.com>
From: Amir Vadai <amirv@mellanox.com>
Date: Thu, 6 Mar 2014 18:28:17 +0200
> @@ -150,6 +150,8 @@ struct mlx4_port_config {
> struct pci_dev *pdev;
> };
>
> +static atomic_t pf_loading = ATOMIC_INIT(0);
> +
> int mlx4_check_port_params(struct mlx4_dev *dev,
> enum mlx4_port_type *port_type)
> {
> @@ -1407,6 +1409,11 @@ static int mlx4_init_slave(struct mlx4_dev *dev)
> u32 slave_read;
> u32 cmd_channel_ver;
>
> + 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.
You have absolutely have to maintain this state at least on a per-PF
level.
next prev parent reply other threads:[~2014-03-06 20:12 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 [this message]
2014-03-06 20:19 ` Or Gerlitz
2014-03-06 20:48 ` David Miller
2014-03-06 21:08 ` Or Gerlitz
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=20140306.151254.914568962698409365.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=Narendra_K@Dell.com \
--cc=Sreekanth_Reddy@Dell.com \
--cc=amirv@mellanox.com \
--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).