From patchwork Mon Dec 11 09:13:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 752518 Delivered-To: patch@linaro.org Received: by 2002:a5d:4c83:0:b0:333:3a04:f257 with SMTP id z3csp1199818wrs; Mon, 11 Dec 2023 01:21:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IGjQ+9kn8ySF2YoINkBew5rHF9qmzDTK2KIYhimltSH1QacO1n2kO5ExAnZ9166Q5rVc5RA X-Received: by 2002:a05:6214:d6e:b0:67a:4835:f907 with SMTP id 14-20020a0562140d6e00b0067a4835f907mr7702849qvs.21.1702286515207; Mon, 11 Dec 2023 01:21:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702286515; cv=none; d=google.com; s=arc-20160816; b=SkyntcREcJIgLkZRLuwvLMOxin5tyFWhIxDV6TFgP8tSZ/+h/S6a01/v/b3r7Z2o4E XZuPzGdP4fuENXrz8yFzruRdewWoTX0TxoswHvDk11Pa9qt7+1w0J/nLuNXi0qOnizu0 tTWefUf0cJHLTs1wwzO3H4MrBXZizUI+b/w13gHv6iMTdXc94uW7PgGRCyhg5YJHWnaD poPDDOXxo6tZ20qajtZP3U63f24MWd3SCsen7UlN9GvY52XP6v5Fs1nXrCo1kZMaUuMV ymeCnL0HpLL19rRnLIsEp5PBt4hez0XlO/cGhELlFvlE/ggZIgIGgIt+MOpwpEPfVX3V HhuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Aqd0pfIovAzzjPlAx4oEmpXI090Lp7qY6On7DWG3S3w=; fh=f1WUYuFnVBAEIncgxZ+HIUkw3mzwzJ7NOR6vwyn/FI0=; b=MOXQB/YJc3hFlEbtOxI2vnZI65EYew0Lg7f/o1bbtxt9/KUILZNdU4Mh2+DuzHv2jH nSKjfRDEMux6RdtP8PPZXrUSd8jTQfh9YesHfsNZrgr7T0by+KXBMtQFyJQCYc4c9z3j KFNtpoY9ZQat+yj/JgZOR2LZdPEANFmxmVn7Z5wNIImpwfj6DNMnDdFOANxPm7rRm2CM oUnXYRhoLwxcchfrPMmmt8RBTUxlyOnxcSbn1gnMExuh6yYRFG+sdFW8I8CIj6BDQWhF jZ2H00ISj6UZ0AKRF/nbo4VB82wm3oXjL3LsbnU+yOme0y2Rgane0zI1CHNZoSEgV1fX 8Zzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UKCmXlgX; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id em16-20020ad44f90000000b0067a9ff8b199si7675916qvb.261.2023.12.11.01.21.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Dec 2023 01:21:55 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UKCmXlgX; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rCcTW-0000Gh-7g; Mon, 11 Dec 2023 04:21:18 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rCcTU-0000GA-E1 for qemu-devel@nongnu.org; Mon, 11 Dec 2023 04:21:16 -0500 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rCcTE-0005vK-Qy for qemu-devel@nongnu.org; Mon, 11 Dec 2023 04:21:16 -0500 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-40c38e292c8so11093495e9.0 for ; Mon, 11 Dec 2023 01:21:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1702286457; x=1702891257; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Aqd0pfIovAzzjPlAx4oEmpXI090Lp7qY6On7DWG3S3w=; b=UKCmXlgXsAK0g99t71Sm2+ADEWaZvCCg57pdSE+P7pQGOcrhHVgiBG7EAbpRI14Hud k4mEzvx9HYwhDB6U42b5PdQo1Y+jq++/AViXn7YD1qMcbJH/TT2mQyc6jdq2iahXB+D2 xDNHumvNzbwr/CafwDcS3srLGXt7O7wz63dGyyQuePPccglYrW1aHVSIm7p3nOrvWHbP SporDZrAff7E0x0pB/pWa5GEfANY0Ric/ghPuHyIpYbce5p2F4kMNoxckweHlHvTPmTl zG9NjU7gm/uHB56/+OIrt4p0lWIfedigW5KX1Ucb+4mzUp2e49rOnpiYBAwSaBUqA83K aixQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702286457; x=1702891257; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Aqd0pfIovAzzjPlAx4oEmpXI090Lp7qY6On7DWG3S3w=; b=ALS7IcIlpn/Uv2h9X2OA+cT8+tr3imOl1vWXWhPAokK3Cywe6nng1Nlti2bWvombmX ZOK68rNZ2/OXii4ezXoOlSj0KP4eRFyYvsHDPG+6/zSZw0MZtEiVv2wTYuot/5jdY7VO d9ZQpk71PTe3Y56wzLEWtT7teB38+PiVMjBRflOH6sFhwihiqN/sJdY56pbD4qu3q7Kg XI/35FC65TyPqJ1GqBYRGX4wkfguouGE3rWOwIcl3GHpHPNr8GdwytKDy8VKf3EvUFsm yIqZ58sVoSlREtPckb47sw5G3Re+t6SkeaO5qiLmFhs8tWbHMefl7mck8C636UwX8hXr FXOA== X-Gm-Message-State: AOJu0YyCjjgrcJTYa0i2RXL3r65gvOjICgacpoh6tzc+CKkTo2miev+h MqH1O1krmrsDmkthW0gBo1+LyA== X-Received: by 2002:a05:600c:3d1b:b0:40b:5e56:7b6e with SMTP id bh27-20020a05600c3d1b00b0040b5e567b6emr1926390wmb.183.1702286457498; Mon, 11 Dec 2023 01:20:57 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id o5-20020a05600c510500b0040c1d2c6331sm12343122wms.32.2023.12.11.01.20.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 01:20:56 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 2AA165FBD3; Mon, 11 Dec 2023 09:13:47 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: John Snow , Eduardo Habkost , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Paolo Bonzini , Wainer dos Santos Moschetta , Cleber Rosa , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Beraldo Leal , Richard Henderson , Pavel Dovgalyuk , =?utf-8?q?Alex_Benn=C3=A9e?= , Pavel Dovgalyuk Subject: [PATCH v2 12/16] chardev: force write all when recording replay logs Date: Mon, 11 Dec 2023 09:13:41 +0000 Message-Id: <20231211091346.14616-13-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231211091346.14616-1-alex.bennee@linaro.org> References: <20231211091346.14616-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x332.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org This is mostly a problem within avocado as serial generally isn't busy enough to overfill pipes. However the consequences of recording a failed write will haunt us on replay when the log will be out of sync to the playback. Fixes: https://gitlab.com/qemu-project/qemu/-/issues/2010 Message-Id: <20231205204106.95531-11-alex.bennee@linaro.org> Acked-by: Pavel Dovgalyuk Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Alex Bennée Reviewed-by: Richard Henderson --- v2 - add explicit if REPLAY_MODE_RECORD leg with comment. --- chardev/char.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/chardev/char.c b/chardev/char.c index 996a024c7a..48f28881c2 100644 --- a/chardev/char.c +++ b/chardev/char.c @@ -171,6 +171,18 @@ int qemu_chr_write(Chardev *s, const uint8_t *buf, int len, bool write_all) return res; } + if (replay_mode == REPLAY_MODE_RECORD) { + /* + * When recording we don't want temporary conditions to + * perturb the result. By ensuring we write everything we can + * while recording we avoid playback being out of sync if it + * doesn't encounter the same temporary conditions (usually + * triggered by external programs not reading the chardev fast + * enough and pipes filling up). + */ + write_all = true; + } + res = qemu_chr_write_buffer(s, buf, len, &offset, write_all); if (qemu_chr_replay(s) && replay_mode == REPLAY_MODE_RECORD) {