From patchwork Sat Aug 7 00:55:16 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: adq X-Patchwork-Id: 61163 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id B4A1BB6EE8 for ; Sat, 7 Aug 2010 10:56:49 +1000 (EST) Received: from localhost ([127.0.0.1]:33329 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OhXiP-00033g-Tv for incoming@patchwork.ozlabs.org; Fri, 06 Aug 2010 20:56:45 -0400 Received: from [140.186.70.92] (port=38634 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OhXh3-0002hZ-Gy for qemu-devel@nongnu.org; Fri, 06 Aug 2010 20:55:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OhXh2-0005F2-F5 for qemu-devel@nongnu.org; Fri, 06 Aug 2010 20:55:21 -0400 Received: from mail-qy0-f173.google.com ([209.85.216.173]:38271) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OhXh2-0005Ey-CE for qemu-devel@nongnu.org; Fri, 06 Aug 2010 20:55:20 -0400 Received: by qyk35 with SMTP id 35so172786qyk.4 for ; Fri, 06 Aug 2010 17:55:19 -0700 (PDT) MIME-Version: 1.0 Received: by 10.224.11.146 with SMTP id t18mr6557517qat.120.1281142516629; Fri, 06 Aug 2010 17:55:16 -0700 (PDT) Received: by 10.229.245.196 with HTTP; Fri, 6 Aug 2010 17:55:16 -0700 (PDT) X-Originating-IP: [82.71.49.12] Date: Sat, 7 Aug 2010 01:55:16 +0100 Message-ID: From: adq To: qemu-devel@nongnu.org X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: [Qemu-devel] [patch] fix scsi-generic X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Hi, I've been tracking down why scsi generic devices (using SG_IO) don't work any more. After adding debug, I can see that it actually submits the scsi CDB in hw/scsi-generic.c/execute_command(), but that the hw/scsi-generic.c/scsi_read_complete() callback is never called. This is because these are done with ioctls, and the posix async ioctl code is, I think, broken right now. Some more debugging, led me to posix-aio-compat.c/posix_aio_process_queue(): if (acb->async_context_id != async_context_id) { The async_context_ids don't match, so the request is never handled. This is because the acb->async_context_id field is not initialised in posix-aio-compat.c/paio_ioctl() (compare with posix-aio-compat.c/paio_submit()). The attached patch adds the missing line in. This seems to fix the problem. Of course, /now/ I'm getting other weird problems (as I'm trying to see if I can get slysoft anydvd working in a KVM winXP vm), but they need further investigation and likely other fixes. Please forgive me if I'm mistaken in this, I've only just started looking at the qemu code. diff -Naur qemu-kvm-0.12.5.orig//posix-aio-compat.c qemu-kvm-0.12.5/posix-aio-compat.c --- qemu-kvm-0.12.5.orig//posix-aio-compat.c 2010-07-27 01:43:53.000000000 +0100 +++ qemu-kvm-0.12.5/posix-aio-compat.c 2010-08-07 01:49:07.051265778 +0100 @@ -597,6 +597,7 @@ acb->aio_type = QEMU_AIO_IOCTL; acb->aio_fildes = fd; acb->ev_signo = SIGUSR2; + acb->async_context_id = get_async_context_id(); acb->aio_offset = 0; acb->aio_ioctl_buf = buf; acb->aio_ioctl_cmd = req;