From patchwork Mon Nov 12 12:30:10 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 198386 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 78AF82C0086 for ; Mon, 12 Nov 2012 23:30:35 +1100 (EST) Received: from localhost ([::1]:55035 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TXt9s-0007m2-C7 for incoming@patchwork.ozlabs.org; Mon, 12 Nov 2012 07:30:32 -0500 Received: from eggs.gnu.org ([208.118.235.92]:58257) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TXt9j-0007ls-VF for qemu-devel@nongnu.org; Mon, 12 Nov 2012 07:30:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TXt9g-0005Zs-St for qemu-devel@nongnu.org; Mon, 12 Nov 2012 07:30:23 -0500 Received: from mail-pa0-f45.google.com ([209.85.220.45]:34503) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TXt9g-0005Zj-Md for qemu-devel@nongnu.org; Mon, 12 Nov 2012 07:30:20 -0500 Received: by mail-pa0-f45.google.com with SMTP id fb10so4148074pad.4 for ; Mon, 12 Nov 2012 04:30:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer; bh=fDCTxWIBX4gmqCh5sEuWh5E4YEOUST+Z/K1Ud56mFCc=; b=Yzv3N4KvhcTo1dOG8JO4NZJlXnCyM5vs9pnxOSrl2MsGsc1j0htAZdXCroO0UfuGq6 jGXGZORNd2sn6B1fc2xgXzGsxYzYmvD+6hZgdMQQiDlv5dtwDZ59m1OUtZiPKLpbrmC6 PjGUHo34dTW8+rhCnjT8zLMgtzzho7lOCRXSS9COyCC4MKNgnMJdlN4I0wq+9u5LTt9U OgV56oEvmsUilmVbSJ1yJtYPyvKEbwTokQMvVOOF9Q8Ms1ArKsXLwPtDYvmxBjBlYkxm KRTMmXZS1UOD+TNqsYaibmsRjnsXByML3xSM1xqWvybSMHwbpLAwjGy++1ZsQrzN0+6I q1Wg== Received: by 10.69.1.1 with SMTP id bc1mr57255552pbd.102.1352723419898; Mon, 12 Nov 2012 04:30:19 -0800 (PST) Received: from yakj.usersys.redhat.com (93-34-169-1.ip50.fastwebnet.it. [93.34.169.1]) by mx.google.com with ESMTPS id gv9sm4144757pbc.21.2012.11.12.04.30.16 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 12 Nov 2012 04:30:18 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 12 Nov 2012 13:30:10 +0100 Message-Id: <1352723410-15705-1-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.7.12.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.220.45 Subject: [Qemu-devel] [PATCH] aio: fix aio_ctx_prepare with idle bottom halves X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Commit ed2aec4867f0d5f5de496bb765347b5d0cfe113d changed the return value of aio_ctx_prepare from false to true when only idle bottom halves are available. This broke PC old-style DMA, which uses them. Fix this by making aio_ctx_prepare return true only when non-idle bottom halves are scheduled to run. Reported-by: malc Signed-off-by: Paolo Bonzini --- Untested, I don't have an image that can do SB16. malc, can you test and perhaps apply? async.c | 6 ++---- 1 file modificato, 2 inserzioni(+), 4 rimozioni(-) diff --git a/async.c b/async.c index 04f9dcb..3f0e8f3 100644 --- a/async.c +++ b/async.c @@ -122,11 +122,9 @@ aio_ctx_prepare(GSource *source, gint *timeout) { AioContext *ctx = (AioContext *) source; QEMUBH *bh; - bool scheduled = false; for (bh = ctx->first_bh; bh; bh = bh->next) { if (!bh->deleted && bh->scheduled) { - scheduled = true; if (bh->idle) { /* idle bottom halves will be polled at least * every 10ms */ @@ -135,12 +133,12 @@ aio_ctx_prepare(GSource *source, gint *timeout) /* non-idle bottom halves will be executed * immediately */ *timeout = 0; - break; + return true; } } } - return scheduled; + return false; } static gboolean