All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: Si-Wei Liu <si-wei.liu@oracle.com>, Eli Cohen <elic@nvidia.com>,
	"Michael S. Tsirkin" <mst@redhat.com>
Cc: linux-kernel@vger.kernel.org,
	virtualization@lists.linux-foundation.org,
	netdev@vger.kernel.org
Subject: Re: [PATCH v2 3/3] vdpa/mlx5: defer clear_virtqueues to until DRIVER_OK
Date: Thu, 18 Feb 2021 14:37:10 +0800	[thread overview]
Message-ID: <27c7858e-67a4-9f22-37e3-f527f1dd85a6@redhat.com> (raw)
In-Reply-To: <88ecbbb6-a339-a5cd-82b7-387225a45d36@oracle.com>


On 2021/2/18 上午5:55, Si-Wei Liu wrote:
>
>
> On 2/16/2021 7:21 AM, Eli Cohen wrote:
>> On Thu, Feb 11, 2021 at 09:33:14AM +0200, Eli Cohen wrote:
>>> On Wed, Feb 10, 2021 at 01:48:00PM -0800, Si-Wei Liu wrote:
>>>> While virtq is stopped,  get_vq_state() is supposed to
>>>> be  called to  get  sync'ed  with  the latest internal
>>>> avail_index from device. The saved avail_index is used
>>>> to restate  the virtq  once device is started.  Commit
>>>> b35ccebe3ef7 introduced the clear_virtqueues() routine
>>>> to  reset  the saved  avail_index,  however, the index
>>>> gets cleared a bit earlier before get_vq_state() tries
>>>> to read it. This would cause consistency problems when
>>>> virtq is restarted, e.g. through a series of link down
>>>> and link up events. We  could  defer  the  clearing of
>>>> avail_index  to  until  the  device  is to be started,
>>>> i.e. until  VIRTIO_CONFIG_S_DRIVER_OK  is set again in
>>>> set_status().
>>>>
>>>> Fixes: b35ccebe3ef7 ("vdpa/mlx5: Restore the hardware used index 
>>>> after change map")
>>>> Signed-off-by: Si-Wei Liu <si-wei.liu@oracle.com>
>>>> Acked-by: Jason Wang <jasowang@redhat.com>
>>> Acked-by: Eli Cohen <elic@nvidia.com>
>>>
>> I take it back. I think we don't need to clear the indexes at all. In
>> case we need to restore indexes we'll get the right values through
>> set_vq_state(). If we suspend the virtqueue due to VM being suspended,
>> qemu will query first and will provide the the queried value. In case of
>> VM reboot, it will provide 0 in set_vq_state().
>>
>> I am sending a patch that addresses both reboot and suspend.
> With set_vq_state() repurposed to restoring used_index I'm fine with 
> this approach.
>
> Do I have to repost a v3 of this series while dropping the 3rd patch?
>
> -Siwei 


Yes, please.

Thanks



WARNING: multiple messages have this Message-ID (diff)
From: Jason Wang <jasowang@redhat.com>
To: Si-Wei Liu <si-wei.liu@oracle.com>, Eli Cohen <elic@nvidia.com>,
	"Michael S. Tsirkin" <mst@redhat.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	virtualization@lists.linux-foundation.org
Subject: Re: [PATCH v2 3/3] vdpa/mlx5: defer clear_virtqueues to until DRIVER_OK
Date: Thu, 18 Feb 2021 14:37:10 +0800	[thread overview]
Message-ID: <27c7858e-67a4-9f22-37e3-f527f1dd85a6@redhat.com> (raw)
In-Reply-To: <88ecbbb6-a339-a5cd-82b7-387225a45d36@oracle.com>


On 2021/2/18 上午5:55, Si-Wei Liu wrote:
>
>
> On 2/16/2021 7:21 AM, Eli Cohen wrote:
>> On Thu, Feb 11, 2021 at 09:33:14AM +0200, Eli Cohen wrote:
>>> On Wed, Feb 10, 2021 at 01:48:00PM -0800, Si-Wei Liu wrote:
>>>> While virtq is stopped,  get_vq_state() is supposed to
>>>> be  called to  get  sync'ed  with  the latest internal
>>>> avail_index from device. The saved avail_index is used
>>>> to restate  the virtq  once device is started.  Commit
>>>> b35ccebe3ef7 introduced the clear_virtqueues() routine
>>>> to  reset  the saved  avail_index,  however, the index
>>>> gets cleared a bit earlier before get_vq_state() tries
>>>> to read it. This would cause consistency problems when
>>>> virtq is restarted, e.g. through a series of link down
>>>> and link up events. We  could  defer  the  clearing of
>>>> avail_index  to  until  the  device  is to be started,
>>>> i.e. until  VIRTIO_CONFIG_S_DRIVER_OK  is set again in
>>>> set_status().
>>>>
>>>> Fixes: b35ccebe3ef7 ("vdpa/mlx5: Restore the hardware used index 
>>>> after change map")
>>>> Signed-off-by: Si-Wei Liu <si-wei.liu@oracle.com>
>>>> Acked-by: Jason Wang <jasowang@redhat.com>
>>> Acked-by: Eli Cohen <elic@nvidia.com>
>>>
>> I take it back. I think we don't need to clear the indexes at all. In
>> case we need to restore indexes we'll get the right values through
>> set_vq_state(). If we suspend the virtqueue due to VM being suspended,
>> qemu will query first and will provide the the queried value. In case of
>> VM reboot, it will provide 0 in set_vq_state().
>>
>> I am sending a patch that addresses both reboot and suspend.
> With set_vq_state() repurposed to restoring used_index I'm fine with 
> this approach.
>
> Do I have to repost a v3 of this series while dropping the 3rd patch?
>
> -Siwei 


Yes, please.

Thanks


_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

  reply	other threads:[~2021-02-18  7:27 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-10 21:47 [PATCH v2 0/3] mlx5_vdpa bug fixes Si-Wei Liu
2021-02-10 21:47 ` Si-Wei Liu
2021-02-10 21:47 ` [PATCH v2 1/3] vdpa/mlx5: should exclude header length and fcs from mtu Si-Wei Liu
2021-02-10 21:47   ` Si-Wei Liu
2021-02-10 21:47 ` [PATCH v2 2/3] vdpa/mlx5: fix feature negotiation across device reset Si-Wei Liu
2021-02-10 21:47   ` Si-Wei Liu
2021-02-11  7:33   ` Eli Cohen
2021-02-18  6:36   ` Jason Wang
2021-02-18  6:36     ` Jason Wang
2021-02-10 21:48 ` [PATCH v2 3/3] vdpa/mlx5: defer clear_virtqueues to until DRIVER_OK Si-Wei Liu
2021-02-10 21:48   ` Si-Wei Liu
2021-02-11  7:33   ` Eli Cohen
2021-02-16 15:21     ` Eli Cohen
2021-02-17 21:55       ` Si-Wei Liu
2021-02-17 21:55         ` Si-Wei Liu
2021-02-18  6:37         ` Jason Wang [this message]
2021-02-18  6:37           ` Jason Wang

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=27c7858e-67a4-9f22-37e3-f527f1dd85a6@redhat.com \
    --to=jasowang@redhat.com \
    --cc=elic@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=si-wei.liu@oracle.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 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.