From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sasha Levin Subject: Re: [PATCH 1/3] kvm tools: Make virtio-net kvm__irq_line thread safe Date: Fri, 29 Apr 2011 19:52:02 +0300 Message-ID: <1304095922.10069.29.camel@lappy> References: <1304058985-13833-1-git-send-email-asias.hejun@gmail.com> <4DBA6519.5070509@gmail.com> <1304063606.10069.7.camel@lappy> <20110429102245.GB22919@elte.hu> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: Asias He , Pekka Enberg , Cyrill Gorcunov , Prasad Joshi , kvm@vger.kernel.org To: Ingo Molnar Return-path: Received: from mail-wy0-f174.google.com ([74.125.82.174]:34180 "EHLO mail-wy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757907Ab1D2QwO (ORCPT ); Fri, 29 Apr 2011 12:52:14 -0400 Received: by wya21 with SMTP id 21so2975253wya.19 for ; Fri, 29 Apr 2011 09:52:13 -0700 (PDT) In-Reply-To: <20110429102245.GB22919@elte.hu> Sender: kvm-owner@vger.kernel.org List-ID: On Fri, 2011-04-29 at 12:22 +0200, Ingo Molnar wrote: > If that is so then indeed the right approach might be to signal the guest every > time we manage to readv() something - there might not come any other packet for > a long time. But the reason is not some 'erroneous state' - all state is > perfectly fine, this is simply a basic property of the event loop that the rx > thread implements ... My idea as for 'erroneous state' was as follows: We have 2 virt queues: one for RX and one for TX, each on it's own thread. RX Thread: - Runs readv() and reads data. - Calls virt_queue__set_used_elem() which starts updating the RX virt queue. TX Thread: - Runs readv() and reads data. - Calls and returns from virt_queue__set_used_elem(). - Calls kvm__irq_line(). At this point, The RX queue state is being updated but since the IRQ was signaled (same IRQ for both TX and RX) the guest virtio-net checks the RX queue and finds a virt queue that wasn't fully updated. -- Sasha.