From nobody Sun May 19 07:11:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1591887184; cv=none; d=zohomail.com; s=zohoarc; b=kKbKKvmbTd0SWvzhQ8C6XX7Lg+yFrpOpEf+BsEe+IlVzNI2dS5w4wAzfZb/whdgPg8Awxpu42in4+dSqeON/q8HsGuUZiNAE6w5VRCeo94eJFvgsLQoAJeouFwoyAjb8eoizfLy98qJK2fHF8HktlWD9wM2YCuf2nIYM+4nskes= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591887184; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=LzOz9VFkB26YxJcmiYuJHQzM0svMerx3Jk8uYHGUhAA=; b=Oiai/h/W/HtKLrD1aD+yqVtBvACM5dfSZrFJlRlGEsu03kvWDMa1LlR0cft19b8frXeUO5MdhnXClyXjdI6PzIz3i3DxnXwKexlCxc6LbwIYXWaQULCO29KtwKpGLgSs5HRsxxCoMBwfHAo4NW2lgJTBAAHNgQ6A+bMH/TydFGw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1591887184476484.07567992071097; Thu, 11 Jun 2020 07:53:04 -0700 (PDT) Received: from localhost ([::1]:46172 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjOZj-0003B7-6m for importer@patchew.org; Thu, 11 Jun 2020 10:53:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41360) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjOSm-0001V3-2b for qemu-devel@nongnu.org; Thu, 11 Jun 2020 10:45:52 -0400 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:37020) by eggs.gnu.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jjOSk-0003tg-7W for qemu-devel@nongnu.org; Thu, 11 Jun 2020 10:45:51 -0400 Received: by mail-wm1-x343.google.com with SMTP id y20so5318197wmi.2 for ; Thu, 11 Jun 2020 07:45:43 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id f9sm5116609wre.65.2020.06.11.07.45.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jun 2020 07:45:40 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id EAB581FF7E; Thu, 11 Jun 2020 15:45:39 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=LzOz9VFkB26YxJcmiYuJHQzM0svMerx3Jk8uYHGUhAA=; b=bxXgORhgF3PAKSr6f2Suvgbh83N4Ltmk+CL66juf7Pf2QnpaWFOCiR8lMlh/FHIpzy Ne2EyqH/juWY8HQjj71zOPWNO4tY9sFhfv1c7Wh9pdUPdO6zBYW6HEjlXKyewN/gmIWG jh5iFmN6sn2nH8kfDbC78LNHEBn7eABo3mQh/QWbgBiWkK/PhgzzPFIcVDkhUziRQWJd YmixVsaFswIPEWcX0D+oxIYa6XXX/9Py/FRJ8kYlPP2cRJesWZmsgb7bq/pJGCEYBhBy Gm5kgK/wz7EHHZSOElz0Xs5OsRxLxrS5xJcJgwj2Zqx8kPBILLeIB1gpm2LL92Cwpld2 sXOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=LzOz9VFkB26YxJcmiYuJHQzM0svMerx3Jk8uYHGUhAA=; b=TTv/hGzkUbENFj3DR2Ua1cND6j+zNrGHt9NUA3cFTcELbPBDm8z7MDZxShuNDXdyV9 TyXLD0nGqhKgjHzGeM5NyARvD3gcLXnq0ABOdIOetiIlNRJ3dQxiWNPpKVl0nETaHDGN FSf+zHWcTUHCaCDQYuFMqDZxNAh2UMsXVdXa8oQMLrPbUaMYAnw/OWJSltJKv0UD9Y/1 +qZJKrk0jIEh2cjHw24r7QZEuKdyKpHcDIX4XzneDoDLIP7Ck3yCqa2UTpJ6+cPtTZjP UVxbWedxNhBAPaFHCs4y54UTWuCPpVfI5s+8X+OWN8kWMxelO2AgYC2xgzM8/FyhLQks M3JA== X-Gm-Message-State: AOAM530umDNzFhxof+PgVvDwgl6ELcPb8tBsNSmq6jG+36ybvDlvObFB CZeAtAwpUUQNqxJEWLwoTK5kXA== X-Google-Smtp-Source: ABdhPJzZBwznH9HoRcX6IxGLE5YdbnR/892PtkaKXByK3akXiBUxC2OYrULGZaDFe3y354CTazpgQA== X-Received: by 2002:a1c:7505:: with SMTP id o5mr8338912wmc.164.1591886742346; Thu, 11 Jun 2020 07:45:42 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [RFC PATCH] logging: add a LOG_TCG_WARN for temp leaks Date: Thu, 11 Jun 2020 15:45:30 +0100 Message-Id: <20200611144531.20142-1-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::343; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x343.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Paolo Bonzini , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Pretty much all calls to qemu_log are either wrapped in some other enabling check or only enabled with debug defines. Add a specific flag for TCG warnings and expand the documentation of the qemu_log function. Signed-off-by: Alex Benn=C3=A9e Cc: Peter Maydell --- include/qemu/log-for-trace.h | 9 ++++++++- include/qemu/log.h | 2 ++ accel/tcg/translator.c | 4 ++-- util/log.c | 2 ++ 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/include/qemu/log-for-trace.h b/include/qemu/log-for-trace.h index 2f0a5b080ea..521d7936243 100644 --- a/include/qemu/log-for-trace.h +++ b/include/qemu/log-for-trace.h @@ -29,7 +29,14 @@ static inline bool qemu_loglevel_mask(int mask) return (qemu_loglevel & mask) !=3D 0; } =20 -/* main logging function */ +/** + * qemu_log: main logging function + * + * Most users shouldn't be calling qemu_log unconditionally as it adds + * noise to logging output. Either use qemu_log_mask() or wrap + * successive log calls a qemu_loglevel_mask() check and + * qemu_log_lock/unlock(). The tracing infrastructure does similar wrappin= g. + */ int GCC_FMT_ATTR(1, 2) qemu_log(const char *fmt, ...); =20 #endif diff --git a/include/qemu/log.h b/include/qemu/log.h index f4724f73301..e1574ef7c14 100644 --- a/include/qemu/log.h +++ b/include/qemu/log.h @@ -64,6 +64,8 @@ static inline bool qemu_log_separate(void) #define CPU_LOG_PLUGIN (1 << 18) /* LOG_STRACE is used for user-mode strace logging. */ #define LOG_STRACE (1 << 19) +/* Additional TCG warnings */ +#define LOG_TCG_WARN (1 << 20) =20 /* Lock output for a series of related logs. Since this is not needed * for a single qemu_log / qemu_log_mask / qemu_log_mask_and_addr, we diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c index 603d17ff831..44396ccd7ad 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -26,8 +26,8 @@ void translator_loop_temp_check(DisasContextBase *db) { if (tcg_check_temp_count()) { - qemu_log("warning: TCG temporary leaks before " - TARGET_FMT_lx "\n", db->pc_next); + qemu_log_mask(LOG_TCG_WARN, "warning: TCG temporary leaks before " + TARGET_FMT_lx "\n", db->pc_next); } } =20 diff --git a/util/log.c b/util/log.c index bdb3d712e88..fad25d9317f 100644 --- a/util/log.c +++ b/util/log.c @@ -334,6 +334,8 @@ const QEMULogItem qemu_log_items[] =3D { #endif { LOG_STRACE, "strace", "log every user-mode syscall, its input, and its result" }, + { LOG_TCG_WARN, "tcg", + "log TCG warnings useful to developers." }, { 0, NULL, NULL }, }; =20 --=20 2.20.1