qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: "Heitke, Kenneth" <kenneth.heitke@intel.com>
Cc: keith.busch@intel.com, philmd@redhat.com, qemu-devel@nongnu.org,
	qemu-block@nongnu.org, mreitz@redhat.com
Subject: Re: [Qemu-devel] [Qemu-block] [PATCH v2] nvme: add Get/Set Feature Timestamp support
Date: Wed, 5 Jun 2019 10:00:30 +0200	[thread overview]
Message-ID: <20190605080030.GB5491@linux.fritz.box> (raw)
In-Reply-To: <6eecf534-edaa-6763-c91a-8b159313a493@intel.com>

Am 04.06.2019 um 19:06 hat Heitke, Kenneth geschrieben:
> 
> 
> On 6/4/2019 3:13 AM, Klaus Birkelund wrote:
> > On Tue, Jun 04, 2019 at 10:46:45AM +0200, Kevin Wolf wrote:
> > > Am 04.06.2019 um 10:28 hat Klaus Birkelund geschrieben:
> > > > On Mon, Jun 03, 2019 at 09:30:53AM -0600, Heitke, Kenneth wrote:
> > > > > 
> > > > > 
> > > > > On 6/3/2019 5:14 AM, Kevin Wolf wrote:
> > > > > > Am 28.05.2019 um 08:18 hat Klaus Birkelund geschrieben:
> > > > > > > On Mon, May 20, 2019 at 11:40:30AM -0600, Kenneth Heitke wrote:
> > > > > > > > Signed-off-by: Kenneth Heitke <kenneth.heitke@intel.com>
> > > > > > 
> > > > > > > > diff --git a/hw/block/nvme.h b/hw/block/nvme.h
> > > > > > > > index 56c9d4b4b1..d7277e72b7 100644
> > > > > > > > --- a/hw/block/nvme.h
> > > > > > > > +++ b/hw/block/nvme.h
> > > > > > > > @@ -69,6 +69,7 @@ typedef struct NvmeCtrl {
> > > > > > > >        uint16_t    max_prp_ents;
> > > > > > > >        uint16_t    cqe_size;
> > > > > > > >        uint16_t    sqe_size;
> > > > > > > > +    uint16_t    oncs;
> > > > > > > 
> > > > > > > Looks like this unused member snuck its way into the patch. But I see no
> > > > > > > harm in it being there.
> > > > > > 
> > > > > > Good catch. I'll just remove it again from my branch.
> > > > > > 
> > > > > > > > +static inline void nvme_set_timestamp(NvmeCtrl *n, uint64_t ts)
> > > > > > > > +{
> > > > > > > > +    trace_nvme_setfeat_timestamp(ts);
> > > > > > > > +
> > > > > > > > +    n->host_timestamp = le64_to_cpu(ts);
> > > > > > > > +    n->timestamp_set_qemu_clock_ms = qemu_clock_get_ms(QEMU_CLOCK_REALTIME);
> > > > > > > > +}
> > > > > > > > +
> > > > > > > > +static inline uint64_t nvme_get_timestamp(const NvmeCtrl *n)
> > > > > > > > +{
> > > > > > > > +    uint64_t current_time = qemu_clock_get_ms(QEMU_CLOCK_REALTIME);
> > > > > > 
> > > > > > Here I wonder why we use QEMU_CLOCK_REALTIME in a device emulation.
> > > > > > Wouldn't QEMU_CLOCK_VIRTUAL make more sense?
> > > > > > 
> > > > > 
> > > > > QEMU_CLOCK_VIRTUAL probably would make more sense. When I was reading
> > > > > through the differences I wasn't really sure what to pick. iven that this is
> > > > > the time within the device's context, the virtual time seems more correct.
> > > > > 
> > > > I thought about this too when I reviewed, but came to the conclusion
> > > > that REALTIME was correct. The timestamp is basically a value that the
> > > > host stores in the controller. When the host uses Get Features to get
> > > > the the current time it would expect it to match the progression for its
> > > > own wall clockright? If I understand REALTIME vs VIRTUAL correctly,
> > > > using VIRTUAL, it would go way out of sync.
> > > 
> > > Which two things would go out of sync with VIRTUAL?
> > > 
> > > Not an expert on clocks myself, but I think the main question is what
> > > happens to the clock while the VM is stopped. REALTIME continues running
> > > where as VIRTUAL is stopped. If we expose REALTIME measurements to the
> > > guest, the time passed may look a lot longer than what the guest's clock
> > > actually says. So this is the thing I am worried would go out of sync
> > > with REALTIME.
> > > 
> > 
> > OK, fair point.
> > 
> > Thinking about this some more, I agree that VIRTUAL is more correct. An
> > application should never track elapsed time using real wall clock time,
> > but some monotonic clock that is oblivious to say NTP adjustments.
> > 
> > Klaus
> > 
> 
> Kevin, would you like me to update the patch to reflect this change or will
> you make the change directly?

I already made it directly.

Kevin


  reply	other threads:[~2019-06-05  8:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-20 17:40 [Qemu-devel] [PATCH v2] nvme: add Get/Set Feature Timestamp support Kenneth Heitke
2019-05-28  6:18 ` Klaus Birkelund
2019-06-03 11:14   ` Kevin Wolf
2019-06-03 15:30     ` Heitke, Kenneth
2019-06-04  8:28       ` [Qemu-devel] [Qemu-block] " Klaus Birkelund
2019-06-04  8:46         ` Kevin Wolf
2019-06-04  9:13           ` Klaus Birkelund
2019-06-04 13:23             ` Kevin Wolf
2019-06-04 17:06             ` Heitke, Kenneth
2019-06-05  8:00               ` Kevin Wolf [this message]
2019-06-03 11:09 ` [Qemu-devel] " Kevin Wolf

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=20190605080030.GB5491@linux.fritz.box \
    --to=kwolf@redhat.com \
    --cc=keith.busch@intel.com \
    --cc=kenneth.heitke@intel.com \
    --cc=mreitz@redhat.com \
    --cc=philmd@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.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;
as well as URLs for NNTP newsgroup(s).