From patchwork Sat Jun 4 21:33:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 9154981 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 97AC360574 for ; Sat, 4 Jun 2016 21:42:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 89E1927F2B for ; Sat, 4 Jun 2016 21:42:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7D55428327; Sat, 4 Jun 2016 21:42:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2779D27F2B for ; Sat, 4 Jun 2016 21:42:53 +0000 (UTC) Received: from localhost ([::1]:34240 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b9JLI-0005mx-6V for patchwork-qemu-devel@patchwork.kernel.org; Sat, 04 Jun 2016 17:42:52 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44818) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b9JCi-0006FW-KL for qemu-devel@nongnu.org; Sat, 04 Jun 2016 17:34:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b9JCZ-0005uk-KQ for qemu-devel@nongnu.org; Sat, 04 Jun 2016 17:34:00 -0400 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:33052) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b9JCZ-0005uA-DC for qemu-devel@nongnu.org; Sat, 04 Jun 2016 17:33:51 -0400 Received: by mail-wm0-x241.google.com with SMTP id a136so7295047wme.0 for ; Sat, 04 Jun 2016 14:33:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Qnop1TWwb9n7meuU5fFNr4xEgBbX2KLBF0deAkR5eW0=; b=0+v6IZVGI6esZm9Lr3Z7WaPtm+HSTOG4bnbkYlItWgjjTcIsGLyaENzG38LVXpyFbC sclOlQ0EajDExmW3//a0T6cHchRIg8IVkkjs6Ys0hZXIPQdIsK2vbTkVKN29KL/2CXeL AxNPpxUFlIvsUKFD3T9PNyIEzEjb29W1WUHqgRtPLsOnj2URHEIs/BrGu/a2zhM1E9Qj EzuTprumaPG10HuH8blI/AsGnSzRO+eqRsh2oTarnly7k2OSnUHZWgRV4oBAWtvj2VWC +4+QPm7gno7Etmr7CYr8vnATpSM0QXlCsCcey6FjUiassYxunDRUtZuC9MMDd5CT5sh/ TV3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=Qnop1TWwb9n7meuU5fFNr4xEgBbX2KLBF0deAkR5eW0=; b=HLDn1aM3NOzaR5ODwfzt739II5BYF1eKqTHI9jY5BNfUDb0gIEHJR81Q6XIFebAqfS lfmPbSJFOXrhIBqHzqd4lGVFUwSvBtUrsSuOgPHxBrV2V6EtPaVjIlbm924lmC3x6Yda XrhI3gBEEb9JQ6snSQjzI0m3kR42tV0G0908YCOp7YpItVHlmtLi2ZiBOHZAn7oKY4nt 9mgPFinCQf40Mj/Ba2LNiySQfuh8JfWNGDNITFYpMbDzjeppxGhvXfn+ES+e1S7dzuqa SahCcfdXazs7Kbo3jog6AF5MaW8FBQD6Xgb/AF35xwpKyqR5AirqjZh+wpKrko7ugpyl gbxQ== X-Gm-Message-State: ALyK8tJPl8x0Jb8eVr1CrOX2RbqXPb93sCZuhIpRiv/Dv+LHs6b842JPlvfqMEUJBtXZtw== X-Received: by 10.28.24.82 with SMTP id 79mr5401978wmy.42.1465076030739; Sat, 04 Jun 2016 14:33:50 -0700 (PDT) Received: from localhost (APoitiers-110-1-1-235.w193-248.abo.wanadoo.fr. [193.248.103.235]) by smtp.gmail.com with ESMTPSA id q194sm6235043wme.18.2016.06.04.14.33.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 04 Jun 2016 14:33:49 -0700 (PDT) From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Date: Sat, 4 Jun 2016 23:33:19 +0200 Message-Id: <1465076003-26291-11-git-send-email-marcandre.lureau@redhat.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1465076003-26291-1-git-send-email-marcandre.lureau@redhat.com> References: <1465076003-26291-1-git-send-email-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::241 Subject: [Qemu-devel] [RFC 10/14] qemu-char: block during sync read 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: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , kraxel@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Marc-André Lureau A sync read should block until data is available, instead of retrying. Change the channel to blocking during read. Signed-off-by: Marc-André Lureau --- qemu-char.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/qemu-char.c b/qemu-char.c index efa1e2a..ce09226 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -2911,7 +2911,9 @@ static int tcp_chr_sync_read(CharDriverState *chr, const uint8_t *buf, int len) return 0; } + qio_channel_set_blocking(s->ioc, true, NULL); size = tcp_chr_recv(chr, (void *) buf, len); + qio_channel_set_blocking(s->ioc, false, NULL); if (size == 0) { /* connection closed */ tcp_chr_disconnect(chr);