From patchwork Wed Apr 20 18:06:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 564000 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp4416936map; Wed, 20 Apr 2022 11:33:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxgwod5/jqyfS88SZlLV3Z2NawnCZ4uNWFlj6ZANvMh4ChUSOQNeN5t9p1HQnr6Uf2uDFxl X-Received: by 2002:a5b:982:0:b0:63e:7d7e:e2f2 with SMTP id c2-20020a5b0982000000b0063e7d7ee2f2mr19974669ybq.549.1650479605113; Wed, 20 Apr 2022 11:33:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650479605; cv=none; d=google.com; s=arc-20160816; b=zG4lEL+M3v88P/ta6Hav0v+8OEablvl8fxWliyWa9H8dEsXNeXPkZF+c5SiSpQ8XlL k9nMZmSU1O1epfc9fi9Jo1j8jFW3sj+TaqmLQ3BFI/krvLGoytT6iWGPGgq3Vd87CIW4 2VvRMXuIePUVIpiRI3j2x/J3gvncZKB9FUscfMwf6SmPyy+D77emvAftNLoj1JRTVivB 77eThJuxW+kI0xWnFAdrh379S37ruZs9e7/PmN4ilsQM8tUxbWnvV/bZScOTYP0NcKhl dXxyLeDZaorJ4jmxQxaMen3Fi68I3rGj5TClu0xBpIubXyag4N4h9Yij+uEbCv5JuqbR vVpg== 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=ZUqBSat00byLemeTfD7/Iumu+QHfeVxNUfYZbny+2jE=; b=cxV/mb/9tc0A5O9Etp2jr7O/67E4yUi/bCw7DWZnlHQxhD+1anzbKwKHyoWX4spGcX oo5gk6Ri52AmBusazhjcNLmjmSwVq4Tx01AtTkAunBH1MwMNfbNt0+vrNRlV6JLv+biI ca09nwJB8+cbAgvn7b1beXBKGArVWdXgcW3apTMLFVHC4/jJ37i1AOXByoaxnUZk38OZ lJHqyRUVsK/HeKDKNf67C3KYVq5nsYkEfK1GPq4YaBbv0Nfr7AdfNnTvAWiuvGEMJm1T SjGVFZBMEdoBgtuqcidkBHLpNnQ0X3uoDMxYkdo6bf8qpdmx7z0TGjxQldCe+9t9nY87 +BUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=prQmANPm; 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 e18-20020a25d312000000b0063da5bb690asi649086ybf.486.2022.04.20.11.33.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 20 Apr 2022 11:33:25 -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=prQmANPm; 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]:42048 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhF8m-0000r8-Im for patch@linaro.org; Wed, 20 Apr 2022 14:33:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53460) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhEj2-000619-AJ for qemu-devel@nongnu.org; Wed, 20 Apr 2022 14:06:48 -0400 Received: from mail-pg1-x535.google.com ([2607:f8b0:4864:20::535]:35570) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhEj0-0001KP-Lh for qemu-devel@nongnu.org; Wed, 20 Apr 2022 14:06:48 -0400 Received: by mail-pg1-x535.google.com with SMTP id r83so2341579pgr.2 for ; Wed, 20 Apr 2022 11:06:46 -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=ZUqBSat00byLemeTfD7/Iumu+QHfeVxNUfYZbny+2jE=; b=prQmANPm6S7etniKW2gdS+qVcyfqxy5syT0HPryuxuPo2TWrYmgADWAWFaUjQoaglu XcJwpQRG2td4uLmIsEJX/f51V3y0kN+FihM8sOw3AuAFi8f2dNQQpyB21jt0/yHJW1rs PPRqijV4YbtGDb5OdtBseHhBHXwTNtS4q6ts6a4I5RzO583k4NU4SJDxu5LaykLxCgml bEdfmDARgBnfjqSan/AiTWCw1XFJw0H1sMhDnZj0Kj6phmZp1484J3GyiYnlFFufNPB9 JOhm8SCx/pSka8kkKXQNOE6U5CAdvw6oijiXEbYv3512WTVbymZOwwsHdDak1TiwQ9YM LOJw== 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=ZUqBSat00byLemeTfD7/Iumu+QHfeVxNUfYZbny+2jE=; b=vsV0hZaJiOU23mMPkIrzuEOaJ+OldzNap3yrOpwOf3UCzeftIjT8XoMjmfktUeVm/D bk0VezMELQ2y03gJxTwWMScHFblwTMBX+VpUXW26LSfqdBGb/RANaYbFDzEJVglRfYif hQW6vv2XUl1cHQXUd7o/Z3oAm5YgAsRO9mX3sHSzaxAC2zGDxH2zuW5FCMwM75ZKqkfj biltatjprg9EpoAHFw3ol7z29E2hMqrVlnzuPHZzJ+w6JFek0/Z9u0WJqTG+AHCmnEkD Rgh3NTGAWXbQCkzMy3W5hhRu7+KDsNu+4o2zdMVzbQWf+GGvReXfCr+nE4+guBMw3XnQ J7rg== X-Gm-Message-State: AOAM531bOdDcs1t6kNVtnkQ64ShYARmHKuEbMgQ7EbUWHlkPpb0WdHwp ErrXxrzaQhqCmLr7rcvG60POIPV1+TtVqw== X-Received: by 2002:a05:6a00:2444:b0:4fd:db81:cbdd with SMTP id d4-20020a056a00244400b004fddb81cbddmr24580821pfj.32.1650478005282; Wed, 20 Apr 2022 11:06:45 -0700 (PDT) Received: from stoup.. (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id i2-20020a17090a058200b001d2fc489b8asm56681pji.25.2022.04.20.11.06.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Apr 2022 11:06:44 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 24/39] include/exec/log: Do not reference QemuLogFile directly Date: Wed, 20 Apr 2022 11:06:03 -0700 Message-Id: <20220420180618.1183855-25-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220420180618.1183855-1-richard.henderson@linaro.org> References: <20220420180618.1183855-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::535; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x535.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, RCVD_IN_DNSWL_NONE=-0.0001, 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: , Cc: =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Use qemu_log_trylock/unlock instead of the raw rcu_read. Signed-off-by: Richard Henderson Reviewed-by: Alex Bennée Message-Id: <20220417183019.755276-25-richard.henderson@linaro.org> --- 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..4a7375a45f 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_trylock(); + if (f) { + cpu_dump_state(cpu, f, flags); + qemu_log_unlock(f); } }