From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38445) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VFKEF-000256-Fl for qemu-devel@nongnu.org; Fri, 30 Aug 2013 04:38:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VFKE7-0003mw-1w for qemu-devel@nongnu.org; Fri, 30 Aug 2013 04:38:51 -0400 Received: from mail-qe0-x233.google.com ([2607:f8b0:400d:c02::233]:42979) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VFKE6-0003ms-Sq for qemu-devel@nongnu.org; Fri, 30 Aug 2013 04:38:42 -0400 Received: by mail-qe0-f51.google.com with SMTP id cy11so805929qeb.38 for ; Fri, 30 Aug 2013 01:38:42 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <52205A0B.1040606@redhat.com> Date: Fri, 30 Aug 2013 10:38:35 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1377849572-42883-1-git-send-email-cornelia.huck@de.ibm.com> <1377849572-42883-2-git-send-email-cornelia.huck@de.ibm.com> In-Reply-To: <1377849572-42883-2-git-send-email-cornelia.huck@de.ibm.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] s390-ccw.img: Fix waiting for virtio processing. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Cornelia Huck Cc: Christian Borntraeger , Alexander Graf , Dominik Dingel , qemu-devel Il 30/08/2013 09:59, Cornelia Huck ha scritto: > + vr->used_idx = vr->used->idx; > + /* > + * Wait until the used index has moved. > + * Note: This is only race-free if the host doesn't start draining > + * the queue out of its own accord. > + */ > + while (vr->used->idx == vr->used_idx) { Can you instead initialize vr->used_idx in virtio_setup_block, and then update it _after_ the while loop? This would be race-free. Paolo