From nobody Tue Nov 4 15:26:24 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1530216802888438.6388574516426; Thu, 28 Jun 2018 13:13:22 -0700 (PDT) Received: from localhost ([::1]:38319 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fYdIA-0005Ff-2v for importer@patchew.org; Thu, 28 Jun 2018 16:13:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37811) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fYdAP-00074B-9s for qemu-devel@nongnu.org; Thu, 28 Jun 2018 16:05:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fYdAN-0008WR-Qq for qemu-devel@nongnu.org; Thu, 28 Jun 2018 16:05:21 -0400 Received: from mail-wr0-x231.google.com ([2a00:1450:400c:c0c::231]:35373) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fYdAN-0008Tv-KM for qemu-devel@nongnu.org; Thu, 28 Jun 2018 16:05:19 -0400 Received: by mail-wr0-x231.google.com with SMTP id c13-v6so6679841wrq.2 for ; Thu, 28 Jun 2018 13:05:19 -0700 (PDT) Received: from 640k.lan ([82.84.124.111]) by smtp.gmail.com with ESMTPSA id 127-v6sm6211110wmd.18.2018.06.28.13.05.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Jun 2018 13:05:17 -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; bh=Lq15VOsfqpHpPD+9CIPW7Xgd9tFBt5Of95lOEI4j25w=; b=DScNkTIb1REnwH+iT+6KNgldf4X/lvDnXrOPEOATi8zDotWsD3+wIq3H7gc9NeRsXJ RQsRzqGChoKaCGfxM0SuL+Bh970ws+aNAXF7CWu8mihQUbHcjybCV9oca2vdORN05xXD TaPdW/4H8CNx6VdMtiAAZmyBuvNesDtTTQMN7/r0pyn1AvTsGvFkjcNQJLJ5rX0B3/jm 3nF+yJTjyqiR5KpU/xhPyyeLSCwj3AkCfBSMR8MWW/hRZoTP9zyShrHkIrv4Rc8rC/z+ G2YDrxCOueynkhECFgCbtMKh5MU/a8jtzeqF2Tt3G/jNmib3IGBk358K5XqlqMv65oc3 G9CQ== 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; bh=Lq15VOsfqpHpPD+9CIPW7Xgd9tFBt5Of95lOEI4j25w=; b=LXBvNvJyA5GbhHFl+16vRsIAt6kO+iBZEiRp9qyaA49He3EF6l4wrfb/fB3Nr9Z6yD LM98jAh5anU7IKFEs1jFg5VVi4h9FZFLOpkA97HS5Z8SIvrIWGmmNhKxsQtAmQsxc9Rs Up+q/02ZwhLgUU24L2qvZsl6vEOHDHGQxFk+3CAqgMhulMamnmh/DzT4R8XyNLB6yM8k GQ8pvKNijVZimwi+AzHcnglbHPqdtM28HxS0SRXoPcVlfZo3W6vHrsq1/Cu7oFBXGF8f 6glGtR9KeA1abcmTP6nnq0A27zmnLHAgftVAm4Pbo91blwxq/5NGsa/gelmqpSj/ahH3 9fTg== X-Gm-Message-State: APt69E03PVApVYNt9bNiTwwE+7zVdSqXnBRM72ijUdhX0TgLQZ2ptURO YIS8Boiuv0Ld3vBPSxdrwXN2v5AZ X-Google-Smtp-Source: AAOMgpcY+TfjW0wYyVcyOD7ahW4asF2Ff5DNlmbxTI4S4tgeyHTyYl3XgVbGlcHmw6dEPN5+ADpDRg== X-Received: by 2002:adf:c7c3:: with SMTP id y3-v6mr9875155wrg.230.1530216318261; Thu, 28 Jun 2018 13:05:18 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Thu, 28 Jun 2018 22:04:15 +0200 Message-Id: <1530216310-52873-6-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1530216310-52873-1-git-send-email-pbonzini@redhat.com> References: <1530216310-52873-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::231 Subject: [Qemu-devel] [PULL 05/60] hw/char/serial: Only retry if qemu_chr_fe_write returns 0 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: Sergio Lopez Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Sergio Lopez Only retry on serial_xmit if qemu_chr_fe_write returns 0, as this is the only recoverable error. Retrying with any other scenario, in addition to being a waste of CPU cycles, can compromise the Guest stability if by the vCPU issuing the write and the main loop thread are, by chance or explicit pinning, running on the same pCPU. Previous discussion: https://lists.nongnu.org/archive/html/qemu-devel/2018-05/msg06998.html Signed-off-by: Sergio Lopez Message-Id: <1528185295-14199-1-git-send-email-slp@redhat.com> Signed-off-by: Paolo Bonzini --- hw/char/serial.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/char/serial.c b/hw/char/serial.c index 605b0d0..6de6c29 100644 --- a/hw/char/serial.c +++ b/hw/char/serial.c @@ -260,7 +260,7 @@ static void serial_xmit(SerialState *s) if (s->mcr & UART_MCR_LOOP) { /* in loopback mode, say that we just received a char */ serial_receive1(s, &s->tsr, 1); - } else if (qemu_chr_fe_write(&s->chr, &s->tsr, 1) !=3D 1 && + } else if (qemu_chr_fe_write(&s->chr, &s->tsr, 1) =3D=3D 0 && s->tsr_retry < MAX_XMIT_RETRY) { assert(s->watch_tag =3D=3D 0); s->watch_tag =3D --=20 1.8.3.1