public inbox for virtio-comment@lists.linux.dev
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Zhu Lingshan <lingshan.zhu@amd.com>
Cc: "Parav Pandit" <parav@nvidia.com>,
	"cohuck@redhat.com" <cohuck@redhat.com>,
	"jasowang@redhat.com" <jasowang@redhat.com>,
	"virtio-comment@lists.linux.dev" <virtio-comment@lists.linux.dev>,
	"Eugenio Pérez" <eperezma@redhat.com>,
	"David Stevens" <stevensd@chromium.org>
Subject: Re: [PATCH V7 v7] virtio: introduce SUSPEND bit in device status
Date: Tue, 24 Sep 2024 19:07:00 -0400	[thread overview]
Message-ID: <20240924190643-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <67a32abf-daaa-4afc-9a74-3ea6b1e827a4@amd.com>

On Thu, Sep 05, 2024 at 03:27:25PM +0800, Zhu Lingshan wrote:
> 
> 
> On 9/3/2024 5:36 PM, Michael S. Tsirkin wrote:
> > On Tue, Sep 03, 2024 at 04:51:18PM +0800, Zhu Lingshan wrote:
> >>
> >> On 8/30/2024 11:10 AM, Parav Pandit wrote:
> >>>> From: Zhu Lingshan <lingshan.zhu@amd.com>
> >>>> Sent: Friday, August 30, 2024 8:07 AM
> >>>>
> >>>>
> >>>> On 8/15/2024 11:07 PM, Michael S. Tsirkin wrote:
> >>>>> On Thu, Aug 15, 2024 at 10:59:45AM +0000, Parav Pandit wrote:
> >>>>>>> From: Michael S. Tsirkin <mst@redhat.com>
> >>>>>>> Sent: Thursday, August 15, 2024 4:23 PM
> >>>>>>>
> >>>>>>> On Tue, Aug 13, 2024 at 06:55:04AM +0000, Parav Pandit wrote:
> >>>>>>>> That means, PCI HW needs to return suspend=0, until the device is
> >>>>>>>> not
> >>>>>>> suspended.
> >>>>>>>> In this example, the device cannot build special circuitry to
> >>>>>>>> answer
> >>>>>>> suspend=true within 50nsec, or in other words building special
> >>>>>>> circuitry to return suspend=false is too complex for the slow operation.
> >>>>>>>> If this understanding of burden is clear,
> >>>>>>>>
> >>>>>>>> The proposal is, can you please extend the interface such that,
> >>>>>>>>
> >>>>>>>> 1. driver writes suspend command.
> >>>>>>>> 2. driver reads suspend_status, and receives not_completed=(false).
> >>>>>>>> This is
> >>>>>>> the default value.
> >>>>>>>> 3. When the device completes suspend, it changes the polarity of
> >>>>>>> suspend_status=true.
> >>>>>>>> This has two main benefits:
> >>>>>>>> [A] This will enable software-based devices to write data to slow
> >>>>>>>> files and
> >>>>>>> does not have to force VM_EXITs.
> >>>>>>>> [B] It also enables hw based devices to not build special circuitry
> >>>>>>>> to answer
> >>>>>>> within 50nsec, which can get very complicated for tens or hundreds
> >>>>>>> of PCI PFs.
> >>>>>>>
> >>>>>>> I read this several times, and I don't understand what is proposed.
> >>>>>>> A special register for suspend/resume? Is this the difference?
> >>>>>>>
> >>>>>> Yes, a command register for suspend/resume operation.
> >>>>>> And device_status new bit that Lingshan defined returns the status of this
> >>>> operation.
> >>>>> Ugh, it's all quite messy IMHO.
> >>>>> We have 4 states:
> >>>>> - operational (resumed)
> >>>>> - suspend in progress
> >>>>> - suspended
> >>>>> - resume in progress
> >>>>>
> >>>>> What I'd do then is a two bit register.
> >>>>> To suspend:
> >>>>> - write suspend in progress
> >>>>> - re-read, waiting until suspended
> >>>>> To resume
> >>>>> - write resume in progress
> >>>>> - re-read, waiting until operational (resumed)
> >>>>>
> >>>>> How does this sound?
> >>>> This can work for sure. but is it a must?
> >>>> I mean, the driver has its own knowledge of how it operate the device.
> >>>> When device presents SUSPEND == 0, It know whether the device is in
> >>>> normal operational state or in the progress of SUSPENDING.
> >>>>
> >>>> But if you think we should add a new register which applying for all
> >>>> device_status transitions, NOT only for SUSPEND. we can surely do that.
> >>>>
> >>>> Thanks
> >>> New register beyond suspend+resume can be useful too.
> >>> For sure it will simplify the suspend + resume flow.
> >> There should be no difference in how the driver handles SUSPEND
> >> and other device status like RESET.
> >>
> >> If we want to add a new register, then it is not only for SUSPEND,
> >> but for all status transitions. 
> >> We need Michael to confirm we should implement this new register
> >> that apply to all device_status transitions for common interests.
> >>
> >> Thanks
> > There is a difference between SUSPEND and RESET.
> > RESET is not a state. Thus a single bit is enough to
> > signal "reset in progress".
> >
> > I don't really see any other transitions that can take
> > a long time. We can start with just suspend, and
> > extend it later if appropriate.
> Yes, that is what I mean, the register should not only work for SUSPEND.
> To be more specific, the definition should be:
> 
> // The device_status is still in a status transition
> #define DEVICE_STATUS_TRANSITION_IN_PROGRESS     0
> // device status transition is done
> #define DEVICE_STATUS_TRANSITION_DONE                     1
> 
> They should not be defined as:
> #define DEVICE_STATUS_SUSPEND_IN_PROGRESS     0
> 
> Thanks
> 


in case we add more commands down the line? ok, sure.

> >
> >


  reply	other threads:[~2024-09-24 23:07 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-01 11:35 [PATCH V7 v7] virtio: introduce SUSPEND bit in device status Zhu Lingshan
2024-08-13  4:42 ` Parav Pandit
2024-08-13  5:44   ` Zhu Lingshan
2024-08-13  5:50     ` Parav Pandit
2024-08-13  6:14       ` Zhu Lingshan
2024-08-13  6:55         ` Parav Pandit
2024-08-15  8:23           ` Zhu Lingshan
2024-08-15  9:34             ` Parav Pandit
2024-08-30  2:31               ` Zhu Lingshan
2024-08-30  3:02                 ` Parav Pandit
2024-09-03  9:05                   ` Zhu Lingshan
2024-09-03  9:45                     ` Michael S. Tsirkin
2024-09-03 10:09                       ` Parav Pandit
2024-09-03 10:35                         ` Michael S. Tsirkin
2024-09-03 10:37                           ` Michael S. Tsirkin
2024-09-04  3:07                             ` Jason Wang
2024-09-04  4:02                               ` Michael S. Tsirkin
2024-09-04  6:31                                 ` Jason Wang
2024-09-04  6:38                                   ` Zhu Lingshan
2024-09-04  6:46                                     ` Parav Pandit
2024-09-05  7:14                                       ` Zhu Lingshan
2024-09-05  7:16                                         ` Parav Pandit
2024-09-05  7:29                                           ` Zhu Lingshan
2024-09-05  7:35                                             ` Parav Pandit
2024-09-05  8:30                                               ` Zhu Lingshan
2024-09-05  8:41                                                 ` David Stevens
2024-09-06  1:53                                                   ` Parav Pandit
2024-09-05  7:17                                         ` Michael S. Tsirkin
2024-09-05  7:31                                           ` Zhu Lingshan
2024-09-05  7:34                                             ` Parav Pandit
2024-09-05  6:51                                     ` Michael S. Tsirkin
2024-09-05  7:12                                       ` Zhu Lingshan
2024-09-05  8:12                                         ` Michael S. Tsirkin
2024-09-05  9:09                                           ` Zhu Lingshan
2024-09-06  1:54                                             ` Parav Pandit
2024-09-05 23:51                                           ` Jason Wang
2024-09-11  3:52                                             ` Zhu Lingshan
2024-09-11 10:20                                             ` Michael S. Tsirkin
2024-09-12  2:05                                               ` Jason Wang
2024-09-12  5:44                                                 ` Michael S. Tsirkin
2024-09-24  7:35                                                   ` Jason Wang
2024-09-24 23:05                                                     ` Michael S. Tsirkin
2024-09-25  3:47                                                       ` Jason Wang
2024-09-25 11:17                                                         ` Michael S. Tsirkin
2024-09-27  4:08                                                           ` Jason Wang
2024-09-29 17:55                                                             ` Michael S. Tsirkin
2024-10-17  6:56                                                               ` Jason Wang
2024-09-03 10:28                     ` Parav Pandit
2024-09-05  7:20                       ` Zhu Lingshan
2024-08-15 10:45             ` Michael S. Tsirkin
2024-08-30  2:32               ` Zhu Lingshan
2024-08-15 10:52           ` Michael S. Tsirkin
2024-08-15 10:59             ` Parav Pandit
2024-08-15 15:07               ` Michael S. Tsirkin
2024-08-17  5:19                 ` Parav Pandit
2024-08-30  2:37                 ` Zhu Lingshan
2024-08-30  3:10                   ` Parav Pandit
2024-09-03  8:51                     ` Zhu Lingshan
2024-09-03  8:55                       ` Parav Pandit
2024-09-03  9:36                       ` Michael S. Tsirkin
2024-09-05  7:27                         ` Zhu Lingshan
2024-09-24 23:07                           ` Michael S. Tsirkin [this message]
2024-08-13  7:51   ` Michael S. Tsirkin
2024-08-13  7:58     ` Parav Pandit
2024-08-13  8:03       ` Michael S. Tsirkin
2024-08-13  8:01 ` Michael S. Tsirkin
2024-08-15  9:12   ` Zhu Lingshan
2024-08-15 10:50     ` Michael S. Tsirkin
2024-08-30  2:20       ` Zhu Lingshan

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=20240924190643-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=cohuck@redhat.com \
    --cc=eperezma@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=lingshan.zhu@amd.com \
    --cc=parav@nvidia.com \
    --cc=stevensd@chromium.org \
    --cc=virtio-comment@lists.linux.dev \
    /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