From patchwork Sun Mar 20 17:11:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 553206 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1248:0:0:0:0 with SMTP id z8csp887922mag; Sun, 20 Mar 2022 10:42:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzBWD6uZSMqxc/4zopwWPIhZMVnlq8rMQI8q1VVjU5GYXAqUjssQg1vct9HYMsDOF5oF1eA X-Received: by 2002:a05:6214:c48:b0:440:cded:f2ab with SMTP id r8-20020a0562140c4800b00440cdedf2abmr13574248qvj.18.1647798174232; Sun, 20 Mar 2022 10:42:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647798174; cv=none; d=google.com; s=arc-20160816; b=xo41gjGEsf2b/Qa8a8mRbpLWZ4TEXQhAefZBFG1X/jVSbQX0Bh91QIPQfPLdMygBFS TuYO5h4vxK+nGzr/qXwsw04CND4HKlSLwR7C/wuM2kPAppEI5ayRNDVi4Mx+dPi9PZyh zNRajWpZtf1Zj5kbVjx3MrK+T7Oau8ofjykmAOO7Fj9F1p2kF6WQ9cGkmjcUrhVdMLXt nDpYIt3r0s2BFbUkMhB1D5kDWDFV2oIgRiPEKwmqbFe2tUHiWRm7gPYdls5pjJa/C3l6 3dpZ1GdVJkhRwGqIccPwO7t5VxtzNr+WQY3+9web5Kv0PNx/eAbhQ4eRI/uqgAzl3Ppf iUxw== 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=HY6g2dz/onqNKInKBF8VriYCnDheK410T+QzLO/qQ+A=; b=iFL3tQTsDKNI8EPc5bqV5OwDUlamMsx6x2e41OVHsybsOrXX+vxlTGyWOuIO47ECPw 0SCAZf4CwNsfGvrcvask2dIIXiJo7w0yAfMhY3cXdlZaag7XT/u3nIpcUeJKc2aUlTed KXTH+OxlUKf/sduihTQrvswDfTep6X+V7hxuTasnMnmMj0W7hQ1FfK3OR3LdfSVePYUB KEo070gl/yBrEXg2bII5st2kJENVYttcwMTcKxw9v548s5ckJcWMRp9/JesqLN931XjY iiSMSmPKx8NiVyqeGPnztTBgLShHNjX27UaZdxEr5aby/XxhrFeIhHv/qD57r0L6CO1L UTBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=N0LxrPCJ; 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 u127-20020a379285000000b0067e4be2396fsi1281276qkd.436.2022.03.20.10.42.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 20 Mar 2022 10:42:54 -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=N0LxrPCJ; 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]:57400 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nVzZt-00073E-R0 for patch@linaro.org; Sun, 20 Mar 2022 13:42:53 -0400 Received: from eggs.gnu.org ([209.51.188.92]:33194) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nVz5y-0008WB-If for qemu-devel@nongnu.org; Sun, 20 Mar 2022 13:11:58 -0400 Received: from [2607:f8b0:4864:20::42b] (port=34765 helo=mail-pf1-x42b.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nVz5x-0003Tr-4y for qemu-devel@nongnu.org; Sun, 20 Mar 2022 13:11:58 -0400 Received: by mail-pf1-x42b.google.com with SMTP id l8so13701577pfu.1 for ; Sun, 20 Mar 2022 10:11:56 -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=HY6g2dz/onqNKInKBF8VriYCnDheK410T+QzLO/qQ+A=; b=N0LxrPCJhpe3LVEG3sfYUU6Sfg32w+gmviRiRSf53bK6jVUrGASP0styDXbxwEPg0W kGPL+QDxlIRrGpJPTBjMwbQucKRcq0ShycgbJ9ccBLUk3ak2Mbj+HvzXrW2K930bwzi7 P0TgofFw0aLD0YovpLLdsYjIZmOCkIhXOMdedqXvUW6lLMJ+JJkIpcAI2Pbu0PtW+44h W/7rImjZlcuINyz3NPF+XYByzLcuAOPvtXEGLilYXC020NWFjIT/ZRI0WoAICGMNP21l uvKRJyRU64SKDS7rC1YB0yMvEU/kf9ExgnnO2IhUGjwPe9TDKjuYoHQpgIVO28AuAnxX /fEw== 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=HY6g2dz/onqNKInKBF8VriYCnDheK410T+QzLO/qQ+A=; b=KecC2fq/i9/4+c+4MFf+CfBJzHWx7+9HVXdNMTNBQnKmHHcUs1WQJKecos/GLUqn/q HGirR3B0a5L6U4C2XpWuiA1ShmtCozrTn55EqlkZZL1q6NjZW9OZKnyErKmvMB+dNpdD ooUHNqZ4NVyGCsuqVsjFrD7rBZ61BnY1uPTJQcwQPYK2wwabmfTe0tyOHGn14QlO5JlR 4qRy6wHfBIQwqBhnD2+V3wnZa3UOd5P+89DVczK5m+zioZ3DovZoAvjsROIGmVXF2TOZ r5KQqcKXjlRwUoeP6FdTaTf6OPvefI7iaGahI/x7CT7qzu60FbWy5NmznmN5yZWTerqO 1qqw== X-Gm-Message-State: AOAM532cKL+MPGnF5Xqj4lJZpvfU/QIKmHY8eNGxKP1KnPWEnr7wOr5D ontqu85ZwtAyAufDq/oKakziEq4L3w9gsQ== X-Received: by 2002:a63:6645:0:b0:382:65eb:1215 with SMTP id a66-20020a636645000000b0038265eb1215mr3918995pgc.337.1647796315599; Sun, 20 Mar 2022 10:11:55 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id q12-20020a17090aa00c00b001bc6f1baaaesm17149697pjp.39.2022.03.20.10.11.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Mar 2022 10:11:55 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL for-7.1 21/36] include/exec/log: Do not reference QemuLogFile directly Date: Sun, 20 Mar 2022 10:11:20 -0700 Message-Id: <20220320171135.2704502-22-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220320171135.2704502-1-richard.henderson@linaro.org> References: <20220320171135.2704502-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::42b (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::42b; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42b.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, RCVD_IN_DNSWL_NONE=-0.0001, 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 Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Use qemu_log_lock/unlock instead of the raw rcu_read. Signed-off-by: Richard Henderson --- include/exec/log.h | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/include/exec/log.h b/include/exec/log.h index ad0a40cfeb..10d0e809d4 100644 --- a/include/exec/log.h +++ b/include/exec/log.h @@ -15,15 +15,10 @@ */ static inline void log_cpu_state(CPUState *cpu, int flags) { - QemuLogFile *logfile; - - if (qemu_log_enabled()) { - rcu_read_lock(); - logfile = qatomic_rcu_read(&qemu_logfile); - if (logfile) { - cpu_dump_state(cpu, logfile->fd, flags); - } - rcu_read_unlock(); + FILE *f = qemu_log_lock(); + if (f) { + cpu_dump_state(cpu, f, flags); + qemu_log_unlock(f); } }