From nobody Sun May 19 02:26:46 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584991534; cv=none; d=zohomail.com; s=zohoarc; b=a/1mh2HFzfUkTlj5C0rxotbrLnMarg4QYU/H9xKT2HDAviCeooOqtbEBIgCeh18F82/14iqEfZdQz/tMpgUekrWKRZ3JtFHaAJhL6IBcZMfqowiYfRXXaoX6PBkKtKwwgNnVPYQQmDdodIfmnBaQ+Rv05PPJCUm+KhKSpmKgEvQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584991534; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=4s9LGGuC/cUwoE8l6+Ov3NKbGn1km2smFBRw5GZuuZA=; b=g9vKrEq4NfBYPVa5WOQbowSBZ5Nt42DSsWbvYmOhXj0lIR1ogmX03e0QwtpcKb9TztGAb06SzkSpLpVzUDJYVJwvF9V2IySAw/F/hTwdPiVZhNmZrHtGNQ5t3txchn//FO7DropAKvPIwGdDI+RbQ8YbhJSITIY2IJUl7dja8eY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1584991534581615.3001394874875; Mon, 23 Mar 2020 12:25:34 -0700 (PDT) Received: from localhost ([::1]:38756 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jGShY-0004hD-FY for importer@patchew.org; Mon, 23 Mar 2020 15:25:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44908) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jGSgU-0003hN-Qv for qemu-devel@nongnu.org; Mon, 23 Mar 2020 15:24:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jGSgT-0001cK-RB for qemu-devel@nongnu.org; Mon, 23 Mar 2020 15:24:26 -0400 Received: from us-smtp-delivery-74.mimecast.com ([216.205.24.74]:56298) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jGSgT-0001c9-O4 for qemu-devel@nongnu.org; Mon, 23 Mar 2020 15:24:25 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-37-2gLJLbhmNAqJA6lBpao4pg-1; Mon, 23 Mar 2020 15:24:23 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4E77D800D4E; Mon, 23 Mar 2020 19:24:22 +0000 (UTC) Received: from localhost (ovpn-115-37.ams2.redhat.com [10.36.115.37]) by smtp.corp.redhat.com (Postfix) with ESMTP id C87249B937; Mon, 23 Mar 2020 19:24:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584991465; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4s9LGGuC/cUwoE8l6+Ov3NKbGn1km2smFBRw5GZuuZA=; b=ZYuOtlqKugFOUXNQRlntTNpwcRB9c5iXteVbgwNo3aoOLvOMnWK/WLU/+ZO+S8z8aSZGqo GSsM3B9SkBvM/sKEOEE1eYTa9w0Hi3DlKrLF0/JPo75pY6nPjpOda8jbDHAZyfV+HykEv7 oivUuH5uxY3/V+7RRkCvGSGSaY0Qovc= X-MC-Unique: 2gLJLbhmNAqJA6lBpao4pg-1 From: Stefan Hajnoczi To: qemu-devel@nongnu.org Subject: [PULL for-5.0 1/1] aio-posix: fix io_uring with external events Date: Mon, 23 Mar 2020 19:24:11 +0000 Message-Id: <20200323192411.325247-2-stefanha@redhat.com> In-Reply-To: <20200323192411.325247-1-stefanha@redhat.com> References: <20200323192411.325247-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 216.205.24.74 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Peter Maydell , qemu-block@nongnu.org, Julia Suvorova , Max Reitz , Stefan Hajnoczi , Fam Zheng , Stefano Garzarella Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" When external event sources are disabled fdmon-io_uring falls back to fdmon-poll. The ->need_wait() callback needs to watch for this so it can return true when external event sources are disabled. It is also necessary to call ->wait() when AioHandlers have changed because io_uring is asynchronous and we must submit new sqes. Both of these changes to ->need_wait() together fix tests/test-aio -p /aio/external-client, which failed with: test-aio: tests/test-aio.c:404: test_aio_external_client: Assertion `aio_= poll(ctx, false)' failed. Reported-by: Julia Suvorova Signed-off-by: Stefan Hajnoczi Reviewed-by: Stefano Garzarella Message-id: 20200319163559.117903-1-stefanha@redhat.com Signed-off-by: Stefan Hajnoczi --- util/fdmon-io_uring.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/util/fdmon-io_uring.c b/util/fdmon-io_uring.c index 893b79b622..7e143ef515 100644 --- a/util/fdmon-io_uring.c +++ b/util/fdmon-io_uring.c @@ -290,7 +290,18 @@ static int fdmon_io_uring_wait(AioContext *ctx, AioHan= dlerList *ready_list, =20 static bool fdmon_io_uring_need_wait(AioContext *ctx) { - return io_uring_cq_ready(&ctx->fdmon_io_uring); + /* Have io_uring events completed? */ + if (io_uring_cq_ready(&ctx->fdmon_io_uring)) { + return true; + } + + /* Do we need to submit new io_uring sqes? */ + if (!QSLIST_EMPTY_RCU(&ctx->submit_list)) { + return true; + } + + /* Are we falling back to fdmon-poll? */ + return atomic_read(&ctx->external_disable_cnt); } =20 static const FDMonOps fdmon_io_uring_ops =3D { --=20 2.24.1