From: Niklas Schnelle <schnelle@linux.ibm.com>
To: Saeed Mahameed <saeedm@mellanox.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"leon@kernel.org" <leon@kernel.org>
Subject: Re: [PATCH 1/1] net/mlx5: Call pci_disable_sriov() on remove
Date: Thu, 30 Apr 2020 21:47:48 +0200 [thread overview]
Message-ID: <36de00e7-cccb-7de8-bd93-84cf647d6d39@linux.ibm.com> (raw)
In-Reply-To: <2409e7071482b8d05447b8660abcac15987ad399.camel@mellanox.com>
On 4/30/20 5:58 PM, Saeed Mahameed wrote:
> On Thu, 2020-04-30 at 14:03 +0200, Niklas Schnelle wrote:
>> as described in Documentation/PCI/pci-iov-howto.rst a driver with SR-
>> IOV
>> support should call pci_disable_sriov() in the remove handler.
>
> Hi Niklas,
>
> looking at the documentation, it doesn't say "should" it just gives the
> code as example.
>
>> Otherwise removing a PF (e.g. via pci_stop_and_remove_bus_device())
>> with
>> attached VFs does not properly shut the VFs down before shutting down
>> the PF. This leads to the VF drivers handling defunct devices and
>> accompanying error messages.
>>
>
> Which should be the admin responsibility .. if the admin want to do
> this, then let it be.. why block him ?
>
> our mlx5 driver in the vf handles this gracefully and once pf
> driver/device is back online the vf driver quickly recovers.
See my answer to your other answer ;-)
>
>> In the current code pci_disable_sriov() is already called in
>> mlx5_sriov_disable() but not in mlx5_sriov_detach() which is called
>> from
>> the remove handler. Fix this by moving the pci_disable_sriov() call
>> into
>> mlx5_device_disable_sriov() which is called by both.
>>
>> Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
>> ---
>> drivers/net/ethernet/mellanox/mlx5/core/sriov.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/sriov.c
>> b/drivers/net/ethernet/mellanox/mlx5/core/sriov.c
>> index 3094d20297a9..2401961c9f5b 100644
>> --- a/drivers/net/ethernet/mellanox/mlx5/core/sriov.c
>> +++ b/drivers/net/ethernet/mellanox/mlx5/core/sriov.c
>> @@ -114,6 +114,8 @@ mlx5_device_disable_sriov(struct mlx5_core_dev
>> *dev, int num_vfs, bool clear_vf)
>> int err;
>> int vf;
>>
>> + pci_disable_sriov(dev->pdev);
>> +
>> for (vf = num_vfs - 1; vf >= 0; vf--) {
>> if (!sriov->vfs_ctx[vf].enabled)
>> continue;
>> @@ -156,7 +158,6 @@ static void mlx5_sriov_disable(struct pci_dev
>> *pdev)
>> struct mlx5_core_dev *dev = pci_get_drvdata(pdev);
>> int num_vfs = pci_num_vf(dev->pdev);
>>
>> - pci_disable_sriov(pdev);
>
> this patch is no good as it breaks code symmetry.. and could lead to
> many new issues.
Ah you're right I totally missed that there is a matching pci_enable_sriov() in
mlx5_enable_sriov() haven't used these myself before and since it wasn't in the
documentation example I somehow expected it to happen in non-driver code,
so for symmetry that would also have to move to mlx5_device_enable_sriov(),
sorry for the oversight.
>
>
>> mlx5_device_disable_sriov(dev, num_vfs, true);
>> }
>>
>
next prev parent reply other threads:[~2020-04-30 19:48 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-30 12:03 [PATCH 0/1] " Niklas Schnelle
2020-04-30 12:03 ` [PATCH 1/1] " Niklas Schnelle
2020-04-30 15:58 ` Saeed Mahameed
2020-04-30 19:47 ` Niklas Schnelle [this message]
2020-04-30 22:31 ` Niklas Schnelle
2020-04-30 16:13 ` [PATCH 0/1] " Saeed Mahameed
2020-04-30 20:25 ` Niklas Schnelle
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=36de00e7-cccb-7de8-bd93-84cf647d6d39@linux.ibm.com \
--to=schnelle@linux.ibm.com \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=saeedm@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
Powered by JetHome