From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anthony Liguori Subject: Re: [PATCH 1/2] kvm tools: Respect ISR status in virtio header Date: Sat, 07 May 2011 08:14:34 -0500 Message-ID: <4DC545BA.3030501@us.ibm.com> References: <1304735660-10844-1-git-send-email-asias.hejun@gmail.com> <20110507093027.GD27657@elte.hu> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Asias He , "Michael S. Tsirkin" , Rusty Russell , Mark McLoughlin , Pekka Enberg , Cyrill Gorcunov , Sasha Levin , Prasad Joshi , kvm@vger.kernel.org To: Ingo Molnar Return-path: Received: from e37.co.us.ibm.com ([32.97.110.158]:54983 "EHLO e37.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751967Ab1EGNOn (ORCPT ); Sat, 7 May 2011 09:14:43 -0400 Received: from d03relay03.boulder.ibm.com (d03relay03.boulder.ibm.com [9.17.195.228]) by e37.co.us.ibm.com (8.14.4/8.13.1) with ESMTP id p47DBlYA028528 for ; Sat, 7 May 2011 07:11:47 -0600 Received: from d03av03.boulder.ibm.com (d03av03.boulder.ibm.com [9.17.195.169]) by d03relay03.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p47DEaAu151786 for ; Sat, 7 May 2011 07:14:36 -0600 Received: from d03av03.boulder.ibm.com (loopback [127.0.0.1]) by d03av03.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p477EZQA009524 for ; Sat, 7 May 2011 01:14:36 -0600 In-Reply-To: <20110507093027.GD27657@elte.hu> Sender: kvm-owner@vger.kernel.org List-ID: On 05/07/2011 04:30 AM, Ingo Molnar wrote: > Hm, the ISR flag seems to be an explicit IRQ-ack mechanism, not just an > optimization. > > Perhaps if the guest kernel side virtio driver expects us to do honor these > acks and not inject double irqs when the virtio driver does not expect them? > > There's this code in drivers/virtio/virtio_pci.c: > > /* reading the ISR has the effect of also clearing it so it's very > * important to save off the value. */ > isr = ioread8(vp_dev->ioaddr + VIRTIO_PCI_ISR); > > Which seems to suggest that this ISR flag is more important than just a > performance hint. > > Pekka: was this the patch perhaps that fixed the ping latency problem for you? > > Could any virtio gents on Cc: please confirm/deny this theory? :-) When using PCI LNK interrupts, the ISR flag serves two purposes. It indicates that an interrupt was raised (since the actual interrupt line may be shared) and it is used to acknowledge the interrupt (since PCI LNK lines are level triggered). It seems like this patch is simply avoiding raising the interrupt line if the ISR has not been acknowledged yet. I don't think there's a functional issue here but I'm surprised that it's a win. There should be a very short window when the interrupt is lowered in the APIC but still not acknowledged in the ISR. You should just be saving a pretty cheap system call. I wonder if the system call is taking longer than it should.. Regards, Anthony Liguori