Received: from eggs.gnu.org ([2001:4830:134:3::10]:43557) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YcbFn-0001H3-SV for qemu-devel@nongnu.org; Mon, 30 Mar 2015 11:05:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YcbFi-0003GX-Ck for qemu-devel@nongnu.org; Mon, 30 Mar 2015 11:05:27 -0400 Received: from mail-wi0-x231.google.com ([2a00:1450:400c:c05::231]:34880) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YcbFi-0003GR-6Y for qemu-devel@nongnu.org; Mon, 30 Mar 2015 11:05:22 -0400 Received: by wicne17 with SMTP id ne17so35214478wic.0 for ; Mon, 30 Mar 2015 08:05:21 -0700 (PDT) Date: Mon, 30 Mar 2015 16:05:15 +0100 From: Stefan Hajnoczi Message-ID: <20150330150515.GM25181@stefanha-thinkpad.redhat.com> References: <1426661368-572-1-git-send-email-famz@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="DXTueXWT3Da08pik" Content-Disposition: inline In-Reply-To: <1426661368-572-1-git-send-email-famz@redhat.com> Subject: Re: [Qemu-devel] [PATCH v4] block/null: Latency simulation by adding new option "latency-ns" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng Cc: Kevin Wolf , qemu-devel@nongnu.org, Stefan Hajnoczi --DXTueXWT3Da08pik Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment On Wed, Mar 18, 2015 at 02:49:28PM +0800, Fam Zheng wrote: > +static coroutine_fn int null_co_common(BlockDriverState *bs) > +{ > + BDRVNullState *s = bs->opaque; > + > + /* Only emulate latency after vcpu is running. */ > + if (s->latency_ns && qemu_clock_get_us(QEMU_CLOCK_VIRTUAL) > 0) { This seems a little hacky. There is runstate_is_running(), which doesn't depend on the CPU clock offset being 0 in qemu_clock_get_us(). --DXTueXWT3Da08pik Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJVGWYrAAoJEJykq7OBq3PI3moH/RFp1ezdWkKd7IzWXaU/HQ+z /dbLEkcNdFTd3BzD7rvLKk3jdWvTTBBXZKDjHCDTtWnPbF8G/iMUnCchxUOSe1Ma nrZgXYSuHWwp2CRZcWB/DtBn+kxJ5uPK+JWoIqlkTI8+o1vw22S2iVrSw4NxF1Uf baTUkcY5BqQcxZJ4Kf/Y/IIEemDfWZUIXHfP+6/2xYoqOx7zulQgxGj/Wv+lNLSu RyExTjFpbtM5DRZ1kvXpKp3FIQhwWXrI3kKwGbuULloxvCT3+LSUucWXJc46Nj85 9iUjMgaz5Za0/DzqOS1OtGmOvuBET/cdYxYtkXYqVsSkO5LoDeyFsTMei5YGMZE= =BuJR -----END PGP SIGNATURE----- --DXTueXWT3Da08pik--