From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: profiling virtio (blk in this case) Date: Sun, 17 May 2009 23:37:22 +0300 Message-ID: <4A107582.7050208@redhat.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org To: Eran Rom Return-path: Received: from mx2.redhat.com ([66.187.237.31]:40569 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753521AbZEQUh1 (ORCPT ); Sun, 17 May 2009 16:37:27 -0400 In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: Eran Rom wrote: > The "Host<-->Guest" calls in virtio_blk (using the generic virtio kick/notify) > are as follows: > > Guest->Host > ----------- > do_virtlkb_request calls kick in the guest side causing handle_output to be > called on the host side. > > Host->Guest > ----------- > virtio_blk_rw_complete calls notify in the host side causing block_done to be > called on the guest side > > My question has to do with the timing of the calls. > Which would be the correct drawing > 1. Overlapping: > kick |------------| > handle_output |------------| > 2. Disjoint: > kick |------------| > handle_output |------------| > kick() competely contains handle_output(). > In other words: > if I do > g1 = get_cpu_cycles > kick > g2 = get_cpu_cycles > and > h1 = get_cpu_cycles > handle_output > h2 = get_cpu_cycles > would (g2-g1) + (h2-h2) count some cycles twice? > h2-h1 would be counted twice. > Same question for notify and block_done. > Different answer. The guest starts executing sometimes in the middle of the host notify function. -- Do not meddle in the internals of kernels, for they are subtle and quick to panic.