From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7E59CC282DE for ; Wed, 5 Jun 2019 08:02:08 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 57A542083E for ; Wed, 5 Jun 2019 08:02:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 57A542083E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([127.0.0.1]:37218 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hYQs3-0001HH-1Z for qemu-devel@archiver.kernel.org; Wed, 05 Jun 2019 04:02:07 -0400 Received: from eggs.gnu.org ([209.51.188.92]:42803) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hYQr6-0000tQ-Mz for qemu-devel@nongnu.org; Wed, 05 Jun 2019 04:01:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hYQr1-00070C-J9 for qemu-devel@nongnu.org; Wed, 05 Jun 2019 04:01:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59772) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hYQqy-0006hr-RZ; Wed, 05 Jun 2019 04:01:01 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 29B718535C; Wed, 5 Jun 2019 08:00:37 +0000 (UTC) Received: from linux.fritz.box (ovpn-117-16.ams2.redhat.com [10.36.117.16]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7B07E19749; Wed, 5 Jun 2019 08:00:32 +0000 (UTC) Date: Wed, 5 Jun 2019 10:00:30 +0200 From: Kevin Wolf To: "Heitke, Kenneth" Message-ID: <20190605080030.GB5491@linux.fritz.box> References: <20190520174030.1647-1-kenneth.heitke@intel.com> <20190528061836.GB32236@apples.localdomain> <20190603111409.GD6523@linux.fritz.box> <20190604082828.GA11013@apples.localdomain> <20190604084645.GB14925@linux.fritz.box> <20190604091358.GB11013@apples.localdomain> <6eecf534-edaa-6763-c91a-8b159313a493@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6eecf534-edaa-6763-c91a-8b159313a493@intel.com> User-Agent: Mutt/1.11.3 (2019-02-01) X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 05 Jun 2019 08:00:43 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: Re: [Qemu-devel] [Qemu-block] [PATCH v2] nvme: add Get/Set Feature Timestamp support X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: keith.busch@intel.com, philmd@redhat.com, qemu-devel@nongnu.org, qemu-block@nongnu.org, mreitz@redhat.com Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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 > > > > > > > > > > > > > > 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