From patchwork Sun May 29 11:00:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: redcap97 X-Patchwork-Id: 9139761 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 852C660755 for ; Sun, 29 May 2016 12:25:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6F11820202 for ; Sun, 29 May 2016 12:25:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 61949252D5; Sun, 29 May 2016 12:25:16 +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.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,RCVD_IN_DNSWL_HI 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 8944920202 for ; Sun, 29 May 2016 12:25:15 +0000 (UTC) Received: from localhost ([::1]:55808 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b6zmL-0003Bg-5H for patchwork-qemu-devel@patchwork.kernel.org; Sun, 29 May 2016 08:25:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34647) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b6yXR-00047K-EK for qemu-devel@nongnu.org; Sun, 29 May 2016 07:05:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b6yXM-0005yH-FE for qemu-devel@nongnu.org; Sun, 29 May 2016 07:05:44 -0400 Received: from indium.canonical.com ([91.189.90.7]:53124) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b6yXM-0005y7-7f for qemu-devel@nongnu.org; Sun, 29 May 2016 07:05:40 -0400 Received: from loganberry.canonical.com ([91.189.90.37]) by indium.canonical.com with esmtp (Exim 4.76 #1 (Debian)) id 1b6yXK-0005a8-Bx for ; Sun, 29 May 2016 11:05:38 +0000 Received: from loganberry.canonical.com (localhost [127.0.0.1]) by loganberry.canonical.com (Postfix) with ESMTP id 579E82E80C1 for ; Sun, 29 May 2016 11:05:38 +0000 (UTC) MIME-Version: 1.0 Date: Sun, 29 May 2016 11:00:18 -0000 From: redcap97 To: qemu-devel@nongnu.org X-Launchpad-Notification-Type: bug X-Launchpad-Bug: product=qemu; status=New; importance=Undecided; assignee=None; X-Launchpad-Bug-Information-Type: Public X-Launchpad-Bug-Private: no X-Launchpad-Bug-Security-Vulnerability: no X-Launchpad-Bug-Commenters: redcap97 X-Launchpad-Bug-Reporter: redcap97 (redcap97) X-Launchpad-Bug-Modifier: redcap97 (redcap97) Message-Id: <20160529110018.18315.70473.malonedeb@soybean.canonical.com> X-Launchpad-Message-Rationale: Subscriber (QEMU) @qemu-devel-ml X-Launchpad-Message-For: qemu-devel-ml Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="18053"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: 286b9465a2b6d29d1d5f061e631387c00ae04a03 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 91.189.90.7 X-Mailman-Approved-At: Sun, 29 May 2016 08:24:44 -0400 Subject: [Qemu-devel] [Bug 1586756] [NEW] "-serial unix:" option of qemu-system-* is broken in qemu 2.6.0 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Bug 1586756 <1586756@bugs.launchpad.net> Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Public bug reported: I found a bug of "-serial unix:PATH_TO_SOCKET" in qemu 2.6.0 (qemu 2.5.1 works fine). Occasionally, a part of the output of qemu disappears in the bug. It looks like following commit is the cause: char: ensure all clients are in non-blocking mode (Author: Daniel P. Berrange ) http://git.qemu.org/?p=qemu.git;a=commitdiff;h=64c800f808748522727847b9cdc73412f22dffb9 In this commit, UNIX socket is set to non-blocking mode, but qemu_chr_fe_write function doesn't handle EAGAIN. You should fix code like that: --- --- Or please do "git revert 64c800f808748522727847b9cdc73412f22dffb9". ** Affects: qemu Importance: Undecided Status: New diff --git a/qemu-char.c b/qemu-char.c index b597ee1..0361d78 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -270,6 +270,7 @@ static int qemu_chr_fe_write_buffer(CharDriverState *s, const uint8_t *buf, int int qemu_chr_fe_write(CharDriverState *s, const uint8_t *buf, int len) { int ret; + int offset = 0; if (s->replay && replay_mode == REPLAY_MODE_PLAY) { int offset; @@ -280,7 +281,21 @@ int qemu_chr_fe_write(CharDriverState *s, const uint8_t *buf, int len) } qemu_mutex_lock(&s->chr_write_lock); - ret = s->chr_write(s, buf, len); + + while (offset < len) { + retry: + ret = s->chr_write(s, buf, len); + if (ret < 0 && errno == EAGAIN) { + g_usleep(100); + goto retry; + } + + if (ret <= 0) { + break; + } + + offset += ret; + } if (ret > 0) { qemu_chr_fe_write_log(s, buf, ret);