Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp52636lqo; Thu, 9 May 2024 12:18:23 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVO6zBTrGbojRiZpVuJoglz42KQHzn96zhWz/Vn4ftAup8ik9SepHL9TOYRhMnrFEyy6tNT7hOUBdp6/engtuqpT80dYzfe1+3I6TbyUA== X-Google-Smtp-Source: AGHT+IF42B/TQq7FTms4/s8VHE3BdkbKwHmzEjC3Y/tSd9zKtP4tmIPBfPPcVxtWWjMPWke8fodx X-Received: by 2002:a17:90b:78f:b0:2b1:3cc7:ae83 with SMTP id 98e67ed59e1d1-2b6ccd7d3ffmr391499a91.32.1715282302707; Thu, 09 May 2024 12:18:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715282302; cv=pass; d=google.com; s=arc-20160816; b=IEyo7mx3FKUwpOVn4+T/nkf9lTCzSY0zqskWH2NwQhEGK9JYVEgcBjneUb+NIQvoN8 GfTdT4NrZQdn5nRMLBtcB+nOwpBY1FDNvmrYMpH72AT44HA1YoYP4lS8S6D/3Xsueg9C J4j9HgUXp+gDUDPLO/xIZC6RV6t5tEx6WpcpA/tFzozaocnq0nqnajv18Fftdeh+a0iI XXHgyrhX1rQ0Lyt1GjUWTBA7+y7imDM9GLuqikZMlssjtE8+4blgs9RR4cMISjK64sTc FGTDNk/acxkRMzlQmO1NxR4WWZ72zCnY3g+K10ZsSCM0QB8tXP2/CmUZ+gAHK1X3g2eS npoQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=aMN95sJSRj4a6i6zxp+Wev3eEW1GnLD/p1o7U9+n6L0=; fh=HP39+yda0QHsXMT3XaLy3KM419Yj59UqEZWQZo+gOsI=; b=Haj9DT0449RHntQNtMcRnpkZe8lltH9i1FCap39C0dWRGDnfiidqEYNhLT9d/smYW4 FPTj0GKwE4PGr9sX1YJq5+7lX7XBhxnHYwmSduD9qPi61M6zrlNjuCPAg2J7cRTg72qK SHyqerpYzwpvAprbFwdsUk2kABaxOSnXCRS7GBRIy4io/RppGjLw+iSejKDATHUiRBXa Q0z5shfxbsjup6fEyYgya74Eh2UgjX5CmioIZdsV5yFWVZCDNVRe8uR35h5GKWOO2y5O XLdfoD64d3exrehh0pErcV9vX9v6bw/BNL9atyn0Edeoc3PNcM7kQENOv5vSbcKi5p/a 7vZw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=fail header.i=@rjwysocki.net header.s=dkim header.b=jtddYvtT; arc=pass (i=1 spf=pass spfdomain=rjwysocki.net); spf=pass (google.com: domain of linux-kernel+bounces-174809-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-174809-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2b6290d42c9si4070157a91.163.2024.05.09.12.18.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 May 2024 12:18:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-174809-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=fail header.i=@rjwysocki.net header.s=dkim header.b=jtddYvtT; arc=pass (i=1 spf=pass spfdomain=rjwysocki.net); spf=pass (google.com: domain of linux-kernel+bounces-174809-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-174809-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 77758B22236 for ; Thu, 9 May 2024 19:18:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CD7068004F; Thu, 9 May 2024 19:17:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=rjwysocki.net header.i=@rjwysocki.net header.b="jtddYvtT" Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DB0427EEE7; Thu, 9 May 2024 19:17:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=79.96.170.134 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715282271; cv=none; b=vBVb9UPJIiiVUzAOuYTklh/1gHBIRKCwdb+uz42OOlQBKoveX5H6Ydbt2CTR1cBm6snMIN8K2vGUN70EugmWhn3ONnYxXN81Dn9HrlMRuzpep5mFUqkYiDarwd9JRGy6tJLrutaI3vJ0JsZ2nodMhKX0u4pjSKuxA6hnlvgYXLQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715282271; c=relaxed/simple; bh=IZfPLcRxXHmj113Atg8plIho0l7kxPY7n+YKdJVy0Rw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=e60pz6kzxfFtuaoKQfBIwBUbhKJbKxZwwUCOrb1lRFB5aij4b4s7L/F8uEjOt1HlHILj3R3QvoGU3YcT9EJVytFl3Zr4tGQ81Kj/Srbl/ouoQz7s3XNlaVvchsQhAEgBzGO7oWEv0CmcAUX/n4rUUyxiQ7G6FioIJZtVaD6yZKQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rjwysocki.net; spf=pass smtp.mailfrom=rjwysocki.net; dkim=fail (2048-bit key) header.d=rjwysocki.net header.i=@rjwysocki.net header.b=jtddYvtT reason="signature verification failed"; arc=none smtp.client-ip=79.96.170.134 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rjwysocki.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rjwysocki.net Received: from localhost (127.0.0.1) (HELO v370.home.net.pl) by /usr/run/smtp (/usr/run/postfix/private/idea_relay_lmtp) via UNIX with SMTP (IdeaSmtpServer 6.0.0) id c48abd1f18dfa5b3; Thu, 9 May 2024 21:17:42 +0200 Received: from kreacher.localnet (unknown [195.136.19.94]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by cloudserver094114.home.pl (Postfix) with ESMTPSA id A3333A524E7; Thu, 9 May 2024 21:17:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rjwysocki.net; s=dkim; t=1715282262; bh=IZfPLcRxXHmj113Atg8plIho0l7kxPY7n+YKdJVy0Rw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=jtddYvtTWV8Zm3UP/CV42APo3S+UakPAIG0iHaSmZMh+WYA7EiL3jaQb/bIoDyIoH jxTxufoHTnWmYbM43QbRgmPIyoL1pV5nY+7GKb65laXW0RgCsC2oTIMLPCTFm6TtqH Q3rK/QJNjMWYA+3VXveS7XBkI8ONsKF1drTEa+UiBgIa5OKPht352HuMW+giKaMs+L NVa+SWnG/Adxf3DZqDKGNUZG6Uyf1QFXKiI9XN1Cf9KW8FU1hU7XNpMrkuh9NRuevv K1Lr5gCGeZjPa75TJf6nHwYSy4MTDX24bbVP5NVoM6h7+IT7Z0Lzg0VSRldFXgbPn9 ibfBTHNUWxGJA== From: "Rafael J. Wysocki" To: Linux PM Cc: LKML , "Rafael J. Wysocki" , Lukasz Luba , Daniel Lezcano Subject: [PATCH v1 6/7] thermal/debugfs: Move some statements from under thermal_dbg->lock Date: Thu, 09 May 2024 21:16:22 +0200 Message-ID: <8376520.T7Z3S40VBb@kreacher> In-Reply-To: <12438864.O9o76ZdvQC@kreacher> References: <12438864.O9o76ZdvQC@kreacher> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="UTF-8" X-CLIENT-IP: 195.136.19.94 X-CLIENT-HOSTNAME: 195.136.19.94 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvledrvdefvddgudeffecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefufffkjghfggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpedvffeuiedtgfdvtddugeeujedtffetteegfeekffdvfedttddtuefhgeefvdejhfenucfkphepudelhedrudefiedrudelrdelgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduleehrddufeeirdduledrleegpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeehpdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheprhgrfhgrvghlsehkvghrnhgvlhdrohhrghdprhgtphhtthhopehluhhkrghsiidrlhhusggrsegrrhhmrdgtohhmpdhrtghpthhtohepuggrnhhivghlrdhlvgii tggrnhhosehlihhnrghrohdrohhrgh X-DCC--Metrics: v370.home.net.pl 1024; Body=5 Fuz1=5 Fuz2=5 From: Rafael J. Wysocki The tz_dbg local variable assignments in thermal_debug_tz_trip_up(), thermal_debug_tz_trip_down(), and thermal_debug_update_trip_stats() need not be carried out under thermal_dbg->lock, so move them from under that lock (to avoid possible future confusion). While at it, reorder local variable definitions in thermal_debug_tz_trip_up() for more clarity. No functional impact. Signed-off-by: Rafael J. Wysocki --- drivers/thermal/thermal_debugfs.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) Index: linux-pm/drivers/thermal/thermal_debugfs.c =================================================================== --- linux-pm.orig/drivers/thermal/thermal_debugfs.c +++ linux-pm/drivers/thermal/thermal_debugfs.c @@ -568,19 +568,19 @@ static struct tz_episode *thermal_debugf void thermal_debug_tz_trip_up(struct thermal_zone_device *tz, const struct thermal_trip *trip) { - struct tz_episode *tze; - struct tz_debugfs *tz_dbg; struct thermal_debugfs *thermal_dbg = tz->debugfs; int trip_id = thermal_zone_trip_id(tz, trip); ktime_t now = ktime_get(); + struct tz_debugfs *tz_dbg; + struct tz_episode *tze; if (!thermal_dbg) return; - mutex_lock(&thermal_dbg->lock); - tz_dbg = &thermal_dbg->tz_dbg; + mutex_lock(&thermal_dbg->lock); + /* * The mitigation is starting. A mitigation can contain * several episodes where each of them is related to a @@ -667,10 +667,10 @@ void thermal_debug_tz_trip_down(struct t if (!thermal_dbg) return; - mutex_lock(&thermal_dbg->lock); - tz_dbg = &thermal_dbg->tz_dbg; + mutex_lock(&thermal_dbg->lock); + /* * The temperature crosses the way down but there was not * mitigation detected before. That may happen when the @@ -719,10 +719,10 @@ void thermal_debug_update_trip_stats(str if (!thermal_dbg) return; - mutex_lock(&thermal_dbg->lock); - tz_dbg = &thermal_dbg->tz_dbg; + mutex_lock(&thermal_dbg->lock); + if (!tz_dbg->nr_trips) goto out;