Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp3163358lqt; Tue, 23 Apr 2024 12:04:04 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU1J8TjST9cQfxNWiIaX9PvsDknC2d447Ujzi+gScwn9i85uMQK7aU2Z9pGzGm19wg3dWuQPanxKaoP+eUadh0bj9Im17m+Z+s5IB0R0A== X-Google-Smtp-Source: AGHT+IFKOn2XhP9ZTNMNa58ZH47mFsAQxhaCV6OOOZ7R6QAn1bzy38VQ3NKSUlceuCW/WWU8cjRL X-Received: by 2002:a05:622a:1a92:b0:439:8122:ede6 with SMTP id s18-20020a05622a1a9200b004398122ede6mr627747qtc.30.1713899044094; Tue, 23 Apr 2024 12:04:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713899044; cv=pass; d=google.com; s=arc-20160816; b=AaSAYX3gdsTlOSv37BaCWA6YCvJ9NvTyFChVfWe0Z1Q6G5IpjrkYLVXo+Tlpyb0uyK L2s8kSz6vDxzKgFzFAwS86ioZxoD245De4avyg8D8DT7e7b1gzVpu6IRg0TTf9t6M2mP 4TeSLKgPUifS2Us+U0VQu5ClCi2KuzwZbgspnVTRKNlg8Fslh4UeLRRX29SXx4EKyMZ1 ItV6ei4G81URjqCJoEzQoehcdrqNQugFTUTWoFgjtFXIoEpjbeqlUfTeiNPaZsMgg7ut V7MUPZA9n9cTBZ8csGbiYUPklfw9TpJlBj9vx+KK/NPUtvqo0gkr0ShiuI0+UooggfLf 15KA== 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=HzoE8I6us3JiCJ9PVW6P9vT+qFwhrTaC6g7/CqbtLcU=; fh=HP39+yda0QHsXMT3XaLy3KM419Yj59UqEZWQZo+gOsI=; b=XvkgoY2AtVRkYgCfPJ4ZwHmn9QuSSLDfjloG3Chx/RwmYIEC2zo1vHrNKdeoKqss3C fiDawT1sel/4WWiiz4lu44ynb2TKIC1ZQ+OnIGAxa3ewEot5JbDPeHbYJWGBK8OmtYbY Su0BYVh7ghuEgWUZvnyhuH3s4spt1htK44gHuMWW184M826mBOb/rqRYhbEGRdlb1hqI qohnyDBvoOFOIsbt+R/bF0UsBwG8OAcF0xMTqzQK7TScW8v8x8iRdfr9xrQQh6FPzKNv vfKqSCtT26b8SSegTjsklRwR+xZqjJXv2iPKUpUtvATQOXhwFt7gwZAY8n5N2FbISZRD nr5Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=fail header.i=@rjwysocki.net header.s=dkim header.b="dyL7/vX6"; arc=pass (i=1 spf=pass spfdomain=rjwysocki.net); spf=pass (google.com: domain of linux-kernel+bounces-155778-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-155778-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id g13-20020ac87d0d000000b0043992f44b29si6674805qtb.196.2024.04.23.12.04.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 12:04:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-155778-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=fail header.i=@rjwysocki.net header.s=dkim header.b="dyL7/vX6"; arc=pass (i=1 spf=pass spfdomain=rjwysocki.net); spf=pass (google.com: domain of linux-kernel+bounces-155778-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-155778-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id CE0CE1C22574 for ; Tue, 23 Apr 2024 19:04:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CF78C22F00; Tue, 23 Apr 2024 19:03:23 +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="dyL7/vX6" 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 11008140368; Tue, 23 Apr 2024 19:03:20 +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=1713899003; cv=none; b=QHkP/VgE83Sx85LUa9aZbQDJ76sZQ5IdepJgMp8I/m4mhCsGnFVbZUpzVeFnZtQJrX9432UvBId6RgRSc6ElUV2l6+W5Bn0PSVW8uU73zYzk1aGigjbfmCZm20sSp+yedSzQq9i0Fjgbrs2COXGqMYJBC+m18pWpTnGZCiDTINw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713899003; c=relaxed/simple; bh=BCnLUuHW13RAzYcj99Bg9BBRzCEWgCC4VRRm5BqFDsQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=WL+0x596XpN88qJQJNnY/9snNP86CgMJVLiCK2Vmbzb65HKCC8XW8RLjdATeuhdZR+9m4jbYDsKaQdD6Tdg0pUBkmt2bkwQDKbQ97aDLNI71uFCQ6K7kmp+/8zo3rVJ5uIqKd9I47HaTRDfgMF1nmQsIz2ZWZy+7RX3KZTJQy60= 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=dyL7/vX6 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 e648cc0ef7cc95b2; Tue, 23 Apr 2024 20:03:19 +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 D4ABB66DB86; Tue, 23 Apr 2024 20:03:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rjwysocki.net; s=dkim; t=1713895399; bh=BCnLUuHW13RAzYcj99Bg9BBRzCEWgCC4VRRm5BqFDsQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=dyL7/vX6+N17bdJwiEJ40z8PUKUFAdeolxetOluIbAwssaqT6/OksUlRlRF8F789D HNQGwrGIWo/IgUcFM4MOoDFkIc5umSTrEOaUvVyr41jcC2hsdbiylQ+iUOsTgkz/SE LwyDdoigbiG6yd1EK6UUkapvDMIcsN6Ne2U3YRQ2p/36YNxIhXj8T8QbDVftvO59AJ jGMmOxYn3CeKOdFpw52jJvwAyrr3kmZH7+yONIPr9AGX6ogR00D06xqQ+N+blcCJTN cB1Zzzgy7abGo+WazpB5cnQs9v7Sm86bfHwrNjYoUjzgHg7W0kyUpjx/EF3zoY8x8K oPKJ7tRLIBY+Q== From: "Rafael J. Wysocki" To: Linux PM Cc: LKML , "Rafael J. Wysocki" , Lukasz Luba , Daniel Lezcano Subject: [PATCH v1 1/3] thermal/debugfs: Create records for cdev states as they get used Date: Tue, 23 Apr 2024 19:59:46 +0200 Message-ID: <4886487.GXAFRqVoOG@kreacher> In-Reply-To: <5774279.DvuYhMxLoT@kreacher> References: <5774279.DvuYhMxLoT@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: gggruggvucftvghtrhhoucdtuddrgedvledrudeluddguddvudcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefufffkjghfggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpedvffeuiedtgfdvtddugeeujedtffetteegfeekffdvfedttddtuefhgeefvdejhfenucfkphepudelhedrudefiedrudelrdelgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduleehrddufeeirdduledrleegpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeehpdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheprhgrfhgrvghlsehkvghrnhgvlhdrohhrghdprhgtphhtthhopehluhhkrghsiidrlhhusggrsegrrhhmrdgtohhmpdhrtghpthhtohepuggrnhhivghlrdhlvgii tggrnhhosehlihhnrghrohdrohhrgh X-DCC--Metrics: v370.home.net.pl 1024; Body=5 Fuz1=5 Fuz2=5 From: Rafael J. Wysocki Because thermal_debug_cdev_state_update() only creates a duration record for the old state of a cooling device, if its new state is used for the first time, there will be no record for it and cdev_dt_seq_show() will not print the duration information for it even though it contains code to compute the duration value in that case. Address this by making thermal_debug_cdev_state_update() create a duration record for the new state if there is none. Fixes: 755113d76786 ("thermal/debugfs: Add thermal cooling device debugfs information") Reported-by: Lukasz Luba Signed-off-by: Rafael J. Wysocki --- drivers/thermal/thermal_debugfs.c | 8 ++++++++ 1 file changed, 8 insertions(+) Index: linux-pm/drivers/thermal/thermal_debugfs.c =================================================================== --- linux-pm.orig/drivers/thermal/thermal_debugfs.c +++ linux-pm/drivers/thermal/thermal_debugfs.c @@ -433,6 +433,14 @@ void thermal_debug_cdev_state_update(con } cdev_dbg->current_state = new_state; + + /* + * Create a record for the new state if it is not there, so its + * duration will be printed by cdev_dt_seq_show() as expected if it + * runs before the next state transition. + */ + thermal_debugfs_cdev_record_get(thermal_dbg, cdev_dbg->durations, new_state); + transition = (old_state << 16) | new_state; /*