From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756792Ab2FRJhL (ORCPT ); Mon, 18 Jun 2012 05:37:11 -0400 Received: from mail-lpp01m010-f46.google.com ([209.85.215.46]:56872 "EHLO mail-lpp01m010-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754100Ab2FRJhI convert rfc822-to-8bit (ORCPT ); Mon, 18 Jun 2012 05:37:08 -0400 MIME-Version: 1.0 In-Reply-To: <1340002390-3950-4-git-send-email-asias@redhat.com> References: <1340002390-3950-1-git-send-email-asias@redhat.com> <1340002390-3950-4-git-send-email-asias@redhat.com> Date: Mon, 18 Jun 2012 10:37:06 +0100 Message-ID: Subject: Re: [PATCH 3/3] virtio-blk: Add bio-based IO path for virtio-blk From: Stefan Hajnoczi To: Asias He Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, Christoph Hellwig , "Michael S. Tsirkin" Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 18, 2012 at 7:53 AM, Asias He wrote: > +static void virtblk_add_buf_wait(struct virtio_blk *vblk, > +                                struct virtblk_req *vbr, > +                                unsigned long out, > +                                unsigned long in) > +{ > +       DEFINE_WAIT(wait); > + > +       for (;;) { > +               prepare_to_wait_exclusive(&vblk->queue_wait, &wait, > +                                         TASK_UNINTERRUPTIBLE); > + > +               spin_lock_irq(vblk->disk->queue->queue_lock); > +               if (virtqueue_add_buf(vblk->vq, vbr->sg, out, in, vbr, > +                                     GFP_ATOMIC) < 0) { > +                       spin_unlock_irq(vblk->disk->queue->queue_lock); > +                       io_schedule(); > +               } else { > +                       virtqueue_kick(vblk->vq); > +                       spin_unlock_irq(vblk->disk->queue->queue_lock); > +                       break; > +               } > + > +       } Is there a meaningful condition where we would cancel this request (e.g. signal)? If the vring fills up for some reason and we get stuck here the user might wish to kill hung processes. Stefan From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefan Hajnoczi Subject: Re: [PATCH 3/3] virtio-blk: Add bio-based IO path for virtio-blk Date: Mon, 18 Jun 2012 10:37:06 +0100 Message-ID: References: <1340002390-3950-1-git-send-email-asias@redhat.com> <1340002390-3950-4-git-send-email-asias@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Cc: "Michael S. Tsirkin" , Christoph Hellwig , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org To: Asias He Return-path: In-Reply-To: <1340002390-3950-4-git-send-email-asias@redhat.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: virtualization-bounces@lists.linux-foundation.org Errors-To: virtualization-bounces@lists.linux-foundation.org List-Id: kvm.vger.kernel.org On Mon, Jun 18, 2012 at 7:53 AM, Asias He wrote: > +static void virtblk_add_buf_wait(struct virtio_blk *vblk, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0struct v= irtblk_req *vbr, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0unsigned= long out, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0unsigned= long in) > +{ > + =A0 =A0 =A0 DEFINE_WAIT(wait); > + > + =A0 =A0 =A0 for (;;) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 prepare_to_wait_exclusive(&vblk->queue_wait= , &wait, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 TASK_UNINTERRUPTIBLE); > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 spin_lock_irq(vblk->disk->queue->queue_lock= ); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (virtqueue_add_buf(vblk->vq, vbr->sg, ou= t, in, vbr, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= GFP_ATOMIC) < 0) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 spin_unlock_irq(vblk->disk-= >queue->queue_lock); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 io_schedule(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } else { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 virtqueue_kick(vblk->vq); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 spin_unlock_irq(vblk->disk-= >queue->queue_lock); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 break; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + > + =A0 =A0 =A0 } Is there a meaningful condition where we would cancel this request (e.g. signal)? If the vring fills up for some reason and we get stuck here the user might wish to kill hung processes. Stefan