From patchwork Wed Jul 5 07:14:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 107037 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp427983qge; Wed, 5 Jul 2017 00:26:03 -0700 (PDT) X-Received: by 10.200.39.24 with SMTP id g24mr50641718qtg.163.1499239563229; Wed, 05 Jul 2017 00:26:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499239563; cv=none; d=google.com; s=arc-20160816; b=s6cU+wnrFF/dRap0Be0ZeTLjO8Nvl6QUr9Mo0Ivy/MJkYpHY0rH0446lIWPH4qjWgX Lkcwe1wiGVw/93ixTGbK9G5Ts+1+JvQwdqKadW6HBzPIQAfwpae0vs2ye4NJaP5CNnk5 uZzs3EG6YbXUD0hp0QDUi7xZHewqk39i4q+vGwEBWNp/i606RW6ZWANFVjTfXRlYe5zt TOV+HSWkaLTtGNbGuocY9YApimh6wXKSCT+RjLham5SaTmPVTI/MiCrGdpNMBu0QZr8r llnmgjZktQaY1ry+3LrI7lURQHqEdMcb9mFzx26YChf+rfUx2jN46yMfA706zdPdnCyC qsUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=EyH2PLpaOvyCaCwHKZyOrYewcYZ1BkMGBAOvaGnzP+c=; b=Q7BH/zTHhr4LxeU7kM7xLGIASQOHSONlzIKSppOMhVRxIJ81/RAeOR5re3MnMeF5FG 2nsLg1MPoYe6k5+QRJO++yDVyslbUuZcNpthhPIUCiOeezR6EG9VuZdTeT/BKGZTR7AL cZHadMxaGRPJ6yCRCclLB5SW3uzzh/slM1xHSyNYtlKMoWM3bUYwDZ9L5U0B5ePG+I7d uNGAUwfRT/VkeGOPyYy8x7R0g+drbwuz2sA4mOyfrfSAi6ZfPYFeKDxDDZubOX62/O97 ELi2MQ8LJ75H9h7yIC420HRd1eKy0OfoWpPa2CVOpvhy9VI5C1lCQDFCoLnvpSxJejYE Gcgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.b=R4kFF3NH; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id r21si20085049qta.223.2017.07.05.00.26.02 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 05 Jul 2017 00:26:03 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.b=R4kFF3NH; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1]:44534 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSehE-0006Ge-TB for patch@linaro.org; Wed, 05 Jul 2017 03:26:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46564) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSeWl-0004c4-4g for qemu-devel@nongnu.org; Wed, 05 Jul 2017 03:15:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dSeWk-0007fk-2Z for qemu-devel@nongnu.org; Wed, 05 Jul 2017 03:15:11 -0400 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:34661) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dSeWj-0007fC-TR for qemu-devel@nongnu.org; Wed, 05 Jul 2017 03:15:10 -0400 Received: by mail-wm0-x241.google.com with SMTP id p204so30534602wmg.1 for ; Wed, 05 Jul 2017 00:15:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=EyH2PLpaOvyCaCwHKZyOrYewcYZ1BkMGBAOvaGnzP+c=; b=R4kFF3NHPPqCIRPHPS+hQ48hvprFJNj3zNhMd/mpgRVRtIV2+caUwux96bCsPf8aKf gQBoQS3ysD7MLuZnnbIGrvupTT5GQEjCa7lGSBWS9BgH3437VOUy01EvQiVbthwcjjP0 niUdeaqe29kjD4QS5Eka109hm3OJcBsUsK3X4X0tPt+j235N0KzW+2hCLkR5suBb0TCq hAKnF9zgcCsPRz/kWxBwhdQJPUaHHnC9hZ7lACBwPKotZ4e7LFGQMjlKNOiFvYSsMmon uZ47J7Gekm9cMaJGdwdKZwbLUeG4z7VrfeHYDjZnt+xDcT17nfM9PSragPeV3s7RWdQp yOsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=EyH2PLpaOvyCaCwHKZyOrYewcYZ1BkMGBAOvaGnzP+c=; b=sEoSyHSJG2jrElC09FGaiusRTyvVkElhIduZjxVglIkhsxAiUij98MiNaCHbivxPle qYTHaqlT67bGVVFPR2q7b85n/DfjU+b+0i2QeWkmUKxHCM7ubzT6zoG8ZEWhXZiWfNP7 dNKDBXGep1kO0LWGfH8N2ygCUnPiewG2BZ9BL0apeBwj2u9+xAuhC7WyNro5/qLmBGbs DFJx8+jMd0gWDwEyX2ABUhmPrSyvxEMX4sa6l1tooEeoOSQO6+GfuKtQtcu5JlWCOc3W 5FdZRCVmZMcBQqShXfigaGxVdJ9KoscukL/7TCljbqHoFLHZraFvJUu1rNyJGDkusIel VkKA== X-Gm-Message-State: AKS2vOysuBTx7TBtkKY5i8MMECvPSZQR/1Geslgr/L0hG08WpMGmFVly CevuVtlqJXImOmdgWNE= X-Received: by 10.28.68.66 with SMTP id r63mr20823192wma.120.1499238908758; Wed, 05 Jul 2017 00:15:08 -0700 (PDT) Received: from 640k.lan (94-39-191-51.adsl-ull.clienti.tiscali.it. [94.39.191.51]) by smtp.gmail.com with ESMTPSA id y35sm22202793wrc.51.2017.07.05.00.15.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Jul 2017 00:15:08 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 5 Jul 2017 09:14:19 +0200 Message-Id: <1499238885-26161-17-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1499238885-26161-1-git-send-email-pbonzini@redhat.com> References: <1499238885-26161-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::241 Subject: [Qemu-devel] [PULL 16/42] tests/test-char.c: Don't use main_loop_wait()'s return value X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell In QEMU's main_loop() we used to check whether we should do a nonblocking call to main_loop(); this was deleted in commit e330c118f2a5, because now that vCPUs always drop the I/O thread lock it is an unnecessary optimization. The loop in test-char.c copied the old QEMU main_loop() code, but here the nonblocking check has never been necessary because this standalone test case doesn't hold the I/O lock anyway. Remove it, so we can drop the main_loop_wait() return value. Signed-off-by: Peter Maydell Message-Id: <1498584769-12439-2-git-send-email-peter.maydell@linaro.org> Reviewed-by: Marc-André Lureau Signed-off-by: Paolo Bonzini --- tests/test-char.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) -- 1.8.3.1 diff --git a/tests/test-char.c b/tests/test-char.c index 87c724c..b962063 100644 --- a/tests/test-char.c +++ b/tests/test-char.c @@ -20,13 +20,9 @@ typedef struct FeHandler { static void main_loop(void) { - bool nonblocking; - int last_io = 0; - quit = false; do { - nonblocking = last_io > 0; - last_io = main_loop_wait(nonblocking); + main_loop_wait(false); } while (!quit); } From patchwork Wed Jul 5 07:14:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 107038 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp430321qge; Wed, 5 Jul 2017 00:28:40 -0700 (PDT) X-Received: by 10.200.38.34 with SMTP id u31mr47647162qtu.127.1499239720878; Wed, 05 Jul 2017 00:28:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499239720; cv=none; d=google.com; s=arc-20160816; b=opdzY/eMshKbxFNFKP9HyaKQ5fhQK5GjauogFl1sqR4mRySVSSV8Y2w0WQzrtp6BeT 5F2rSK1lJYKoFciw93LURtOzQy3UenMwA0xELGf/wETo2Jn/SrNdXR4AIm71LrYbp4O4 wMC1iL6t64BK3Tf5T8bXykYHyyncwWNesI1NsxGA/VQWi7KAQrdL+i73iMAmypUQS8Ej W8pH67CutNywYsLNxHA87CLtRgHgZmxAju29Z8PJaKhVLhV6UY8a9tCHxZAp+5GnG13M AaZyI1VwgziVB9BxUZ5tNhPgasW59CKNUItKXm2llVKMdcAp/SdbXvSWJI//0gAe9iU0 MXiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=4YI+PgScIwqwdQm6AB4Spg2wLRGv+iKLWY3ItrXKaeQ=; b=an4MDeqEq3dbeqrGKqLJqGNfd9dbZIBIbBfiUYi+6fsDA7bVGgumHiDPE+hj4IqjXV JIpNjlWTPVDvQIz3a3uj/IqnerkXhwFP+7s6Qt6sCtQ1Ww7qYi7T4e8N2eWPvWNuVyZm pVKQ6jAFCbTrhaJCK2NBbubIkQyTl1HS+W0vEokG5g/I4lLQ4dUZSDSZVzJQc/sBFd19 sw2o9+dmG7YTzapigKqkVTNaASgmhZuES50D98wGi3EvSrmBczexIAh9yDe+03NrX8mk nO8jV3IcQXlabwZGUkQkzLhiuzP/6A68oYcVJPbUV4RMFYo+F4dimwhAYtUWxf/iBea8 7sRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.b=tsh5Fcls; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id 127si19986614qkm.234.2017.07.05.00.28.40 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 05 Jul 2017 00:28:40 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.b=tsh5Fcls; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1]:44543 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSejm-0008Oe-JE for patch@linaro.org; Wed, 05 Jul 2017 03:28:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46591) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSeWm-0004f9-Rg for qemu-devel@nongnu.org; Wed, 05 Jul 2017 03:15:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dSeWl-0007gw-KF for qemu-devel@nongnu.org; Wed, 05 Jul 2017 03:15:12 -0400 Received: from mail-wm0-x22b.google.com ([2a00:1450:400c:c09::22b]:38366) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dSeWl-0007gT-DZ for qemu-devel@nongnu.org; Wed, 05 Jul 2017 03:15:11 -0400 Received: by mail-wm0-x22b.google.com with SMTP id f67so102817981wmh.1 for ; Wed, 05 Jul 2017 00:15:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4YI+PgScIwqwdQm6AB4Spg2wLRGv+iKLWY3ItrXKaeQ=; b=tsh5FclsWIGqLvfJ3BmV/m4AtfXSxdc5jaMlwj4iosxLePkYMqXZPrZydJhJzKVYE6 2gQ2F/j4u+qCsvJtoM9sWxaIV2FkABwFO478XqfNYLfszV4kOZRjdV9yBXIfyNIBrh55 kMNwl+SJE9gwNvhZA2PZxLNOT2AGxwx/OIfxDaNkfB2Vw9+7FEndux1V8mOJl3xN0dES f6aXI6aOmeD5TlfGc0Ukmoo/Juo+Q0oT5A7XdACAzCuOLBgMEUiKByT/YJf+HPMiBx36 dN07lSc4vDJvFhJN5KdXAORY7qn5Z6ozzW9alx3St9XbXDi2qv7FzpXfTCIG3VtvPZ1/ ON7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=4YI+PgScIwqwdQm6AB4Spg2wLRGv+iKLWY3ItrXKaeQ=; b=Gb9AY+JYizGIW5+zM8EtZhRkWYihF4yNEVHMYt2W4M+KrMkSOqQEX41JlHhcl4q9HV S1KvH2a+JEvyTddXaK5SLhJrHPTYnEWfCWBs54SapmGXuvbCzVTWfgfnSmY2f5BuJaau aGu/3BPx2jttbKEdy1TowZov8OCgBNzvoAzbdm3MEB9mxEF34nIJc3CQf0G4PTzcYGAT Ymu6oKTVlqxBeq5puKcpV406ctx6OXABHhNiHgWJlVa8YlO2s//llVlJoa7HzeJ8LO9s lyzcZWy1z5FxbZA2jsqOviHvfd2QzSmLnDTgaHFEE9ZCGPjz9EENQqNyJRZVbJXmNYDq qM0Q== X-Gm-Message-State: AKS2vOxaUsSAkgOghgBLs1aMBcGfHjzNL1DaXO3bYPZuHs10yIQF6JD4 gsFygIRgvFtuRMATPAc= X-Received: by 10.28.157.205 with SMTP id g196mr30099492wme.84.1499238909829; Wed, 05 Jul 2017 00:15:09 -0700 (PDT) Received: from 640k.lan (94-39-191-51.adsl-ull.clienti.tiscali.it. [94.39.191.51]) by smtp.gmail.com with ESMTPSA id y35sm22202793wrc.51.2017.07.05.00.15.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Jul 2017 00:15:09 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 5 Jul 2017 09:14:20 +0200 Message-Id: <1499238885-26161-18-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1499238885-26161-1-git-send-email-pbonzini@redhat.com> References: <1499238885-26161-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::22b Subject: [Qemu-devel] [PULL 17/42] main_loop: Make main_loop_wait() return void X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell The last users of main_loop_wait() that cared about the return value have now been changed to no longer use it. Drop the now-useless return value and make the function return void. We avoid the awkwardness of ifdeffery to handle the 'ret' variable in main_loop_wait() only being wanted if CONFIG_SLIRP by simply dropping all the ifdefs. There are stub implementations of slirp_pollfds_poll() and slirp_pollfds_fill() already in stubs/slirp.c which do nothing, as required. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Stefan Hajnoczi Message-Id: <1498584769-12439-3-git-send-email-peter.maydell@linaro.org> Signed-off-by: Paolo Bonzini --- include/qemu/main-loop.h | 2 +- util/main-loop.c | 8 +------- 2 files changed, 2 insertions(+), 8 deletions(-) -- 1.8.3.1 diff --git a/include/qemu/main-loop.h b/include/qemu/main-loop.h index d7e24af..6b4b60b 100644 --- a/include/qemu/main-loop.h +++ b/include/qemu/main-loop.h @@ -79,7 +79,7 @@ int qemu_init_main_loop(Error **errp); * * @nonblocking: Whether the caller should block until an event occurs. */ -int main_loop_wait(int nonblocking); +void main_loop_wait(int nonblocking); /** * qemu_get_aio_context: Return the main loop's AioContext diff --git a/util/main-loop.c b/util/main-loop.c index 19cad6b..2f48f41 100644 --- a/util/main-loop.c +++ b/util/main-loop.c @@ -487,7 +487,7 @@ static int os_host_main_loop_wait(int64_t timeout) } #endif -int main_loop_wait(int nonblocking) +void main_loop_wait(int nonblocking) { int ret; uint32_t timeout = UINT32_MAX; @@ -500,9 +500,7 @@ int main_loop_wait(int nonblocking) /* poll any events */ g_array_set_size(gpollfds, 0); /* reset for new iteration */ /* XXX: separate device handlers from system ones */ -#ifdef CONFIG_SLIRP slirp_pollfds_fill(gpollfds, &timeout); -#endif if (timeout == UINT32_MAX) { timeout_ns = -1; @@ -515,16 +513,12 @@ int main_loop_wait(int nonblocking) &main_loop_tlg)); ret = os_host_main_loop_wait(timeout_ns); -#ifdef CONFIG_SLIRP slirp_pollfds_poll(gpollfds, (ret < 0)); -#endif /* CPU thread can infinitely wait for event after missing the warp */ qemu_start_warp_timer(); qemu_clock_run_all_timers(); - - return ret; } /* Functions to operate on the main QEMU AioContext. */