mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: Eli Cohen <eli@mellanox.com>
Cc: mst@redhat.com, virtualization@lists.linux-foundation.org,
	linux-kernel@vger.kernel.org, shahafs@mellanox.com,
	saeedm@mellanox.com, Parav Pandit <parav@mellanox.com>,
	Eugenio Perez Martin <eperezma@redhat.com>
Subject: Re: [PATCH vhost next 10/10] vdpa/mlx5: Add VDPA driver for supported mlx5 devices
Date: Mon, 20 Jul 2020 12:12:30 +0800	[thread overview]
Message-ID: <ed10cb66-174f-ec5c-8043-4e18de65fb99@redhat.com> (raw)
In-Reply-To: <20200718194902.GA52765@mtl-vdi-166.wap.labs.mlnx>


On 2020/7/19 上午3:49, Eli Cohen wrote:
> On Fri, Jul 17, 2020 at 04:57:29PM +0800, Jason Wang wrote:
>>> Looks like checking intialized is enough. Will fix this.
>>>>> +
>>>>> +static void mlx5_vdpa_set_vq_ready(struct vdpa_device *vdev, u16 idx, bool ready)
>>>>> +{
>>>>> +	struct mlx5_vdpa_dev *mvdev = to_mvdev(vdev);
>>>>> +	struct mlx5_vdpa_net *ndev = to_mlx5_vdpa_ndev(mvdev);
>>>>> +	struct mlx5_vdpa_virtqueue *mvq = &ndev->vqs[idx];
>>>>> +	int err;
>>>>> +
>>>>> +	if (!mvq->ready && ready && mvq->fw_state != MLX5_VIRTIO_NET_Q_OBJECT_STATE_RDY) {
>>>>> +		err = modify_virtqueue(ndev, mvq, MLX5_VIRTIO_NET_Q_OBJECT_STATE_RDY);
>>>>> +		if (err) {
>>>>> +			mlx5_vdpa_warn(mvdev, "failed to modify virtqueue(%d)\n", err);
>>>>> +			return;
>>>>> +		}
>>>>> +	}
>>>> I wonder what's the reason of changing vq state on the hardware
>>>> here. I think we can defer it to set_status().
>>>>
>>> I can defer this to set status.
>>>
>>> I just wonder if it is possible that the core vdpa driver may call this
>>> function with ready equals false and after some time call it with ready
>>> equals true.
>>
>> Good point, so I think we can keep the logic. But looks like the
>> code can not work if ready equals false since it only tries to
>> modify vq state to RDY.
>>
> The point is that you cannot modify the virtqueue to "not ready".


Is this a hardware limitation of software one?

I'm asking since we need support live migration. But a questions is how 
to stop the device but not reset, since we need get e.g last_avail_idx 
from the device.

It could be either:

1) set_status(0)
2) get_vq_state()

or

1) set_queue_ready(0)
2) get_vq_state()

Set_status(0) means reset the virtio device but last_avail_idx is 
something out of virtio spec. I guess using set_queue_ready() is better.

What's you opinion?

Thanks


>   The
> only option is to destroy it and create a new one. This means that if I
> get ready equals false after the virtqueue has been created I need to
> teardown the driver and set it up again.
>
> Given that, I think your original suggestion to defer this logic is
> reasonable.
>


  reply	other threads:[~2020-07-20  4:13 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-16  7:23 [PATCH vhost next 00/10] VDPA support for Mellanox ConnectX devices Eli Cohen
2020-07-16  7:23 ` [PATCH vhost next 01/10] vhost-vdpa: support batch updating Eli Cohen
2020-07-16  7:23 ` [PATCH vhost next 02/10] vdpa_sim: use the batching API Eli Cohen
2020-07-16  7:23 ` [PATCH vhost next 03/10] vdpa: remove hard coded virtq num Eli Cohen
2020-07-16  7:23 ` [PATCH vhost next 04/10] net/vdpa: Use struct for set/get vq state Eli Cohen
2020-07-16  7:23 ` [PATCH vhost next 05/10] vhost: Fix documentation Eli Cohen
2020-07-16  8:08   ` Jason Wang
2020-07-16  7:23 ` [PATCH vhost next 06/10] vdpa: Add means to communicate vq status on get_vq_state Eli Cohen
2020-07-16  8:11   ` Jason Wang
2020-07-16  8:21     ` Eli Cohen
2020-07-16  9:35       ` Jason Wang
2020-07-16 10:25         ` Eli Cohen
2020-07-20  4:13           ` Jason Wang
2020-07-16  7:23 ` [PATCH vhost next 07/10] vdpa/mlx5: Add hardware descriptive header file Eli Cohen
2020-07-16  7:23 ` [PATCH vhost next 08/10] vdpa/mlx5: Add support library for mlx5 VDPA implementation Eli Cohen
2020-07-16 10:44   ` kernel test robot
2020-07-16  7:23 ` [PATCH vhost next 09/10] vdpa/mlx5: Add shared memory registration code Eli Cohen
2020-07-16  8:13   ` Jason Wang
2020-07-16  8:28     ` Eli Cohen
2020-07-16  9:32       ` Jason Wang
2020-07-16 10:15   ` kernel test robot
2020-07-16 14:19   ` kernel test robot
2020-07-16  7:23 ` [PATCH vhost next 10/10] vdpa/mlx5: Add VDPA driver for supported mlx5 devices Eli Cohen
2020-07-16  9:14   ` Jason Wang
2020-07-16 11:54     ` Eli Cohen
2020-07-17  8:57       ` Jason Wang
2020-07-18 19:49         ` Eli Cohen
2020-07-20  4:12           ` Jason Wang [this message]
2020-07-20  5:19             ` Eli Cohen
2020-07-16 10:55   ` kernel test robot

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=ed10cb66-174f-ec5c-8043-4e18de65fb99@redhat.com \
    --to=jasowang@redhat.com \
    --cc=eli@mellanox.com \
    --cc=eperezma@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=parav@mellanox.com \
    --cc=saeedm@mellanox.com \
    --cc=shahafs@mellanox.com \
    --cc=virtualization@lists.linux-foundation.org \
    /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