From patchwork Sat Mar 26 13:25:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 554372 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1248:0:0:0:0 with SMTP id z8csp6442419mag; Sat, 26 Mar 2022 06:57:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz2poIZP8ov2qysgP36+fLaIgZRf9zWAVqmpxe2s1BjrfVAyYKVIN+zxdL4ylXyEdxTOh7S X-Received: by 2002:a37:6611:0:b0:67d:b78e:ea94 with SMTP id a17-20020a376611000000b0067db78eea94mr10318981qkc.122.1648303058278; Sat, 26 Mar 2022 06:57:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648303058; cv=none; d=google.com; s=arc-20160816; b=DoYLRNLz8Gn1g/N1czvKzXpGjKinzT089xcrQd0z8y/38mcu4Utxce0E3zJS9IHur3 +VM+Lkl6/ZGeKSd5j0x823ncK5i/NWIT8ZR+lqaTe7Znh+GNNn5ffwfq0oGozMKDrpdy UU3PUZ/05DNlrKd8RDHI6iP2H1v6gDuX/iXXJ38bfAAegLp5CijHjTP8sfKMa2pkGGYR vww9DVg6R7WnpsXCrC1UPAICtFo4e0iZW7YtpcF011h4rfDJ6dRMhmzQR3dNgCBtLGB5 iM83TCHz0RpkIh8Qm50+MFl0IXmKvgkPEy3OJ4H3Aa6nQjO6R2Ve/coTVn4wOt4xv89Q uWrg== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=HCB05Inte9LF7rNCvDwYZMk3/K4+jeUff4g5SjwTBWk=; b=v39Cl/0qEy19vBjfPLzGjGJJeBALpnLAXH9HcX0t6+gwJmYqXOYbxuXrcRKbYnpBz8 ua3JT+jJbpFHToifL4EWRw2twq/wxlAMKrTnjWZzx0ONb4e5LaHF+be6cqhx7z06aAuh pLh1vyIyz1ckle14a9sALRxGJq4F6HlnMDnW2Z709lDMQPv+U0k0Gtz23IdfCGpyfZ8s 8eq/Sp0NUPS2nGfj8/IK9NbBRu0Kixa87Re5c1JWYLqY1sKvb8fmaH6x8RxCtnHFDeUG nvVPgPr3Bu+vgjRGE4vWseWy9eWBkQeurIOXidzK2yyZOJ67vPxbdrrkXxQv+X6t/r2P OPgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="h/d1M3QX"; 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 a13-20020a05622a02cd00b002e1fbf3be9bsi3891971qtx.140.2022.03.26.06.57.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 26 Mar 2022 06:57:38 -0700 (PDT) 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="h/d1M3QX"; 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]:36790 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nY6vB-0005aY-SB for patch@linaro.org; Sat, 26 Mar 2022 09:57:37 -0400 Received: from eggs.gnu.org ([209.51.188.92]:34238) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nY6Qx-0007Va-Lc for qemu-devel@nongnu.org; Sat, 26 Mar 2022 09:26:24 -0400 Received: from [2001:4860:4864:20::2a] (port=43741 helo=mail-oa1-x2a.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nY6Qv-0005Vm-P4 for qemu-devel@nongnu.org; Sat, 26 Mar 2022 09:26:23 -0400 Received: by mail-oa1-x2a.google.com with SMTP id 586e51a60fabf-de2cb87f6aso10702807fac.10 for ; Sat, 26 Mar 2022 06:26:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HCB05Inte9LF7rNCvDwYZMk3/K4+jeUff4g5SjwTBWk=; b=h/d1M3QX7NQyvcr60/4rpCWpZhAuc4mXqkIgy9Vxh9y7UP12aBI6sx9B6Edde0gJlU 2ABB8VVdxQD85FLUcg57poXkC8fdCIYAheQnXVzvysjJnGmFbNVJTvzoSm251HwDTolP uTOfIz66vjGJ7+ZJwDxVQ+Dd/K3ru18c7OG7s7SyZ6fgPRx0+JuL73UGWDtIMHVCb5cc WN27DI+EvLQOPBDIk1juOctUTlGreK0jYw7M7S/AjH6sQCXr0GoI/LpEd50CIVB/kag8 GqEpIOLHVrfEl/YE6qRcdriO8Q0+zJHQWBCtqxX5wtjL4PQg9JcDpzf3cgKhEHd3UCr/ tYVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HCB05Inte9LF7rNCvDwYZMk3/K4+jeUff4g5SjwTBWk=; b=ptaA1IsEPyvv1DnJugR3SwFpv5L7A0bpAHhmrtAgYwOpb34+rEViA7EFy5xuTDsMl5 GPMOfumi9PrMs62x47XBsf6TV/pSiEs3gyWXmeNim/YkH1XRK4Xx+E87Y1k9vZpiBhNU LbrmEyBKnGNOo2e+csJW4Jna4iShQXBW5f8gIhkplqJb0AyCZ5y8+te+oYlrFeNbqeW/ hTmrnP2/o7EdhWdPvFVkkO95M0WXsyAwvRKTCOckEL1N3iJPigVl/y+3MyMV4vXS06CB SAf4MwKcK52gJ+G3Ou5jUegLNt89rUdlATzP8ajbT9NXRP4EBz7nv3o6CI0PewabF1PA qzuA== X-Gm-Message-State: AOAM5303pKSu9PECDd/iz2SwdGcbXaRSRLEq1reDz4QUnWGX6y++FVfo YwRF+7WqXGVZrGl4NTKwxafo0HpaX6P7jES0 X-Received: by 2002:a05:6870:a1a0:b0:dd:e471:8baf with SMTP id a32-20020a056870a1a000b000dde4718bafmr11195479oaf.40.1648301180369; Sat, 26 Mar 2022 06:26:20 -0700 (PDT) Received: from localhost.localdomain (168.189-204-159.bestelclientes.com.mx. [189.204.159.168]) by smtp.gmail.com with ESMTPSA id n62-20020acaef41000000b002ef646e6690sm4610331oih.53.2022.03.26.06.26.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Mar 2022 06:26:19 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 19/39] util/log: Remove qemu_log_flush Date: Sat, 26 Mar 2022 07:25:14 -0600 Message-Id: <20220326132534.543738-28-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220326132534.543738-1-richard.henderson@linaro.org> References: <20220326132534.543738-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2001:4860:4864:20::2a (failed) Received-SPF: pass client-ip=2001:4860:4864:20::2a; envelope-from=richard.henderson@linaro.org; helo=mail-oa1-x2a.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 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, PDS_HP_HELO_NORDNS=0.659, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: alex.bennee@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" All uses flush output immediately before or after qemu_log_unlock. Instead of a separate call, move the flush into qemu_log_unlock. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson Reviewed-by: Alex Bennée Reviewed-by: Alex Bennée --- include/qemu/log.h | 2 -- accel/tcg/translate-all.c | 1 - cpu.c | 1 - hw/net/can/can_sja1000.c | 1 - hw/xen/xen_pvdev.c | 1 - net/can/can_socketcan.c | 1 - tcg/tcg.c | 1 - util/log.c | 14 +------------- 8 files changed, 1 insertion(+), 21 deletions(-) diff --git a/include/qemu/log.h b/include/qemu/log.h index 3a1f3a6020..75973111bb 100644 --- a/include/qemu/log.h +++ b/include/qemu/log.h @@ -121,8 +121,6 @@ int qemu_str_to_log_mask(const char *str); */ void qemu_print_log_usage(FILE *f); -/* fflush() the log file */ -void qemu_log_flush(void); /* Close the log file */ void qemu_log_close(void); diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 4812619f00..6080ea997a 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -1595,7 +1595,6 @@ TranslationBlock *tb_gen_code(CPUState *cpu, } } fprintf(logfile, "\n"); - qemu_log_flush(); qemu_log_unlock(logfile); } } diff --git a/cpu.c b/cpu.c index 3340bb7538..bfa4db9cd8 100644 --- a/cpu.c +++ b/cpu.c @@ -406,7 +406,6 @@ void cpu_abort(CPUState *cpu, const char *fmt, ...) vfprintf(logfile, fmt, ap2); fprintf(logfile, "\n"); cpu_dump_state(cpu, logfile, CPU_DUMP_FPU | CPU_DUMP_CCOP); - qemu_log_flush(); qemu_log_unlock(logfile); } qemu_log_close(); diff --git a/hw/net/can/can_sja1000.c b/hw/net/can/can_sja1000.c index 23d634af6f..e0f76d3eb3 100644 --- a/hw/net/can/can_sja1000.c +++ b/hw/net/can/can_sja1000.c @@ -261,7 +261,6 @@ static void can_display_msg(const char *prefix, const qemu_can_frame *msg) fprintf(logfile, " %02X", msg->data[i]); } fprintf(logfile, "\n"); - qemu_log_flush(); qemu_log_unlock(logfile); } } diff --git a/hw/xen/xen_pvdev.c b/hw/xen/xen_pvdev.c index 0423c61158..037152f063 100644 --- a/hw/xen/xen_pvdev.c +++ b/hw/xen/xen_pvdev.c @@ -230,7 +230,6 @@ void xen_pv_printf(struct XenLegacyDevice *xendev, int msg_level, xen_pv_output_msg(xendev, stderr, fmt, args); va_end(args); } - qemu_log_flush(); } void xen_pv_evtchn_event(void *opaque) diff --git a/net/can/can_socketcan.c b/net/can/can_socketcan.c index a6388563c3..c1a1ad0563 100644 --- a/net/can/can_socketcan.c +++ b/net/can/can_socketcan.c @@ -89,7 +89,6 @@ static void can_host_socketcan_display_msg(struct qemu_can_frame *msg) fprintf(logfile, " %02X", msg->data[i]); } fprintf(logfile, "\n"); - qemu_log_flush(); qemu_log_unlock(logfile); } } diff --git a/tcg/tcg.c b/tcg/tcg.c index 25e987d881..124d8be1a0 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -783,7 +783,6 @@ void tcg_prologue_init(TCGContext *s) disas(logfile, s->code_gen_ptr, prologue_size); } fprintf(logfile, "\n"); - qemu_log_flush(); qemu_log_unlock(logfile); } } diff --git a/util/log.c b/util/log.c index 2bd4dfba1b..cab0642a7f 100644 --- a/util/log.c +++ b/util/log.c @@ -54,6 +54,7 @@ FILE *qemu_log_trylock(void) void qemu_log_unlock(FILE *fd) { if (fd) { + fflush(fd); qemu_funlockfile(fd); rcu_read_unlock(); } @@ -269,19 +270,6 @@ out: g_strfreev(ranges); } -/* fflush() the log file */ -void qemu_log_flush(void) -{ - QemuLogFile *logfile; - - rcu_read_lock(); - logfile = qatomic_rcu_read(&qemu_logfile); - if (logfile) { - fflush(logfile->fd); - } - rcu_read_unlock(); -} - /* Close the log file */ void qemu_log_close(void) {