From patchwork Sun Mar 20 17:11:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 553186 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1248:0:0:0:0 with SMTP id z8csp878678mag; Sun, 20 Mar 2022 10:22:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx717Na2gBF5OoHBSSpBwzXvbWcBL8vR6UVM6GSu4lWIFCfZfJVGRcOx91oI81BHdcqxubq X-Received: by 2002:ac8:4258:0:b0:2e0:6772:cf88 with SMTP id r24-20020ac84258000000b002e06772cf88mr13458118qtm.157.1647796943671; Sun, 20 Mar 2022 10:22:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647796943; cv=none; d=google.com; s=arc-20160816; b=LikSyUrKerfpLzvr9KklJuUURsjFAs2AC4vo6oBy50cmbpjPpdtCj1WPSH5FOOdPzB OM/1s1IylU24gGIg6Q1Nh+wWyxc1ITeJO5iRrRHwqiZh4V4nbriVxzBNuGfs4W4ufvtf rlrUSKc/CSbSN5b2gKZFlOR7tYECOzvGGs6p9GIRqSC0cu/HUy+sVwk8st6nEoLnt2Cp iPSTrc70ZAp9llmbMxKAwnbc9/NyMMUCehfEwwn2wdt62KbDouDCDQxRsPVM4/eCOw3Q Kj8Q7N85VfW1xtFbVwstTxZZ/GNo/DZSTznUWFCRKdLUWyMjSELotaeSZ1XA6KXiuDyV cqnw== 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=AiGXKmM5Cv0Fdfz4VnJTiU6gz9cUezs0SPdSZR5WJXA=; b=zX/rbt8tRtlYWKt6BmApzrkc1kvcC7btifOyN0OdGyWF9OdTNWplBnImz1EKhnR/ED L/ZniK/LoH0oCuzRIKjBIcxWltPTuRTsdUBlKdPvRBkWxfPFQtsDibCLGe6568vuCwyn afZ/B3p4zFY1JUWd9Eyiu7LC3bhZkCqODR98P4BBweiDWb9oc/K0zU5pJ1ypFyxWxPep aq6XeGvv2zz0m/OzZ8sKwfSes4WVE9SN2kihIQtCYdU0/93AdSb8kiUh3bbAgG9I0BeJ edFPGK/yDz8IkUZS6a2r/Zf2NzkE01h154sbRDGLaO3jiLg0Vy3iQd5zXKsZckUzHTxV nRdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="F160S3K/"; 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 r9-20020a0cf809000000b00440e46a7da3si1241432qvn.577.2022.03.20.10.22.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 20 Mar 2022 10:22:23 -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="F160S3K/"; 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]:42766 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nVzG3-0003Pw-7j for patch@linaro.org; Sun, 20 Mar 2022 13:22:23 -0400 Received: from eggs.gnu.org ([209.51.188.92]:32926) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nVz5l-0008KR-TL for qemu-devel@nongnu.org; Sun, 20 Mar 2022 13:11:45 -0400 Received: from [2607:f8b0:4864:20::52b] (port=33514 helo=mail-pg1-x52b.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nVz5j-0003Qe-O4 for qemu-devel@nongnu.org; Sun, 20 Mar 2022 13:11:44 -0400 Received: by mail-pg1-x52b.google.com with SMTP id 6so8741555pgg.0 for ; Sun, 20 Mar 2022 10:11:43 -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=AiGXKmM5Cv0Fdfz4VnJTiU6gz9cUezs0SPdSZR5WJXA=; b=F160S3K/J48W+34HwvHGEi2w7IO1lXA6+C3AXYSIsvRVDt4Dx1nheHumuqD6Xh46fw pYnCdMRDC62bytTuEtjsMV5GIBiuqVVvNXtGb/6kL2BJwCGbfQW3BsbgzARHIvvOe0JN dQ6FE+6FelVt2t6SqrwAF89fYD9sfEJn9nLrurOrCzEsgtZMh6nfhRvScvwiKI9lWexz PrIVlu3XwtKdQxCj2qviGUDXKM1UQjNl+rnCwlDpqFaN3Nqr/KgiDQUIP3+1NwZmE6Bc dcUDSMGwhlGx2VLQRXGs7c06P+TcaOqK8/kBjtyY1aBgY4aevPWIXfmIVHqoXxf/POD5 yd6A== 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=AiGXKmM5Cv0Fdfz4VnJTiU6gz9cUezs0SPdSZR5WJXA=; b=SXZgwq0XDnfZa1USwuHl1pY6uRJ7dj+H0SH7qbsJB94sLXVb1vxYQ8Anprq9p9kXrm WgrwE0jB99Murdg6RKm/gr+sfNdESMk0KIe/C39zE5XOpOmA/EegkJ42ThGEl6ut9+Ip v9iccHyDMqoeKG/T2+vRf4orjgzzNuUhXshWgniI5wWHPNgKJ443kv7aeyWnqIEGG1Bm piDKjmcKsP8dA8mfwk5HJODSRISTN6vc8LZO/+zTWXcQDkXzZvRIJ+MALbthth9nmKMx CMY+2ZZwO03ROgf0v6R21xiOTAARFMtGOhikU2cRR9cxsb6d5y5bxd6nrOZGqm4Tz8Vp wTIA== X-Gm-Message-State: AOAM530iG4buz8S6qU2ECZML32lIOxZnGl/n9MNL0O0nG/LG90Vhpljy RmXgB+BklmxIIpii6PwEPQCnsSHcNqMHSA== X-Received: by 2002:a05:6a00:814:b0:4f7:4c6:1227 with SMTP id m20-20020a056a00081400b004f704c61227mr20241967pfk.54.1647796302389; Sun, 20 Mar 2022 10:11:42 -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.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Mar 2022 10:11:42 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL for-7.1 06/36] util/log: Treat qemu_log_lock like trylock Date: Sun, 20 Mar 2022 10:11:05 -0700 Message-Id: <20220320171135.2704502-7-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::52b (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::52b; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52b.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" Do not require qemu_log_unlock to be called when qemu_log_lock returns NULL. Signed-off-by: Richard Henderson Reviewed-by: Alex Bennée --- util/log.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/util/log.c b/util/log.c index 248db6211e..b1651d8122 100644 --- a/util/log.c +++ b/util/log.c @@ -39,12 +39,14 @@ static GArray *debug_regions; FILE *qemu_log_lock(void) { QemuLogFile *logfile; + rcu_read_lock(); logfile = qatomic_rcu_read(&qemu_logfile); if (logfile) { qemu_flockfile(logfile->fd); return logfile->fd; } else { + rcu_read_unlock(); return NULL; } } @@ -53,8 +55,8 @@ void qemu_log_unlock(FILE *fd) { if (fd) { qemu_funlockfile(fd); + rcu_read_unlock(); } - rcu_read_unlock(); } /* Return the number of characters emitted. */