Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp1155147lqd; Thu, 25 Apr 2024 07:30:06 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUHJVb0dZpG131ni4XcsCXgAQkhccS30yTZPnNKUcD5zpoSzm55V62xxWk/UlQSDbwt5214BUmEcNGO33eFWqs83E6U491OSQMAC6IEZw== X-Google-Smtp-Source: AGHT+IHbM3UOqCszyqh4s7gQ0hrWg//sMh4ZHoxX4CrvBDyEgSIYrVfzP+MzfSAiWXiKruAdHKBP X-Received: by 2002:a17:902:db07:b0:1e8:9f46:c1af with SMTP id m7-20020a170902db0700b001e89f46c1afmr8029933plx.63.1714055406442; Thu, 25 Apr 2024 07:30:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714055406; cv=pass; d=google.com; s=arc-20160816; b=VrjDfiAG2nlulpzMSgaztsAet1H24jMHXiFihY+0s3oqURnBrSm3Iws0oKX2XaA3XZ DTEfOlOXWLZM6Zr5mfKDnhWxt4vCBOzotYcYgFXsahyDZX+2khHqn9y2j9pmPVIoLjYl IM5WZgfG+uB2C8Z9gh71XfEIOiX75m5frltwWRZN8cX1Mxum8HFU6OdSCCg6O1X9fgOP +XJ6ThCzwpG395f3rWNkoSan1x1ShdPt+H2ymvJfp4kQHmNW8QaIoAlpz8HB1EhcH7mw tOBur5d/RDE97Mk83I2jSgDu/xahUpwMYHGkzS6c3PTJaYPG5cmQzyjOfG9QrLjy4FtI SZ9g== 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=ymM1QliYGoB0Hu2n6tHj0ipcxaHb8DradCUJWw5SsG+JQgV3CyfcLPXPg8Wfe3IEo8 HTlX+k3S3oe41qkrSF11s+5Anob6i0at59caLneBQ9FZggUJbfQMGjr2n+Wh0w9iynD2 9KmXic5Cz/Qtdx7wuv/RAKrwi/eXzSnO3f7ohjcuSczsnvHcTZZ38T2g+5KpwoF16aNO yFe2nmuZvXEOsSxRNkFDJbH52fkJLz5BhxbJix7FWgKo9jcKoc05FyuIP/YlMm9en0yV SESfYuyqJ7Gq3w1C6jDHyvIfGa/b6X3WfBZQSjRQTsR6qtoczqSW+MQMDyStZvKG+Qty 0NOg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=fail header.i=@rjwysocki.net header.s=dkim header.b=HieG2HuK; arc=pass (i=1 spf=pass spfdomain=rjwysocki.net); spf=pass (google.com: domain of linux-kernel+bounces-158655-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-158655-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id e1-20020a170902784100b001ea26bf0919si4550540pln.467.2024.04.25.07.30.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Apr 2024 07:30:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-158655-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=fail header.i=@rjwysocki.net header.s=dkim header.b=HieG2HuK; arc=pass (i=1 spf=pass spfdomain=rjwysocki.net); spf=pass (google.com: domain of linux-kernel+bounces-158655-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-158655-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 A755FB28A37 for ; Thu, 25 Apr 2024 14:06:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2BF0614A4C7; Thu, 25 Apr 2024 14:05:55 +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="HieG2HuK" 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 93406149DF8; Thu, 25 Apr 2024 14:05:52 +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=1714053954; cv=none; b=gZiky9FU6UPCRGJimoU0hHu6tyQswUh54ZtMkjjqBqbGPk9+7ngWKis6+RtGdnGuLNBnIOFOOCGGuzbdHA851RR0YQVHylzTDSQQpQkgavbWjk4kgdPG5bf8mDIMweQZFibJheVtRy5akMXOCoE+xRFUid4FkOjtNoB2DeKbJow= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714053954; c=relaxed/simple; bh=BCnLUuHW13RAzYcj99Bg9BBRzCEWgCC4VRRm5BqFDsQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=USp2bphl/nrLBSr4fuVcHbaY4UuEmmC8x7DWEBVVCRhCnJqz8osevkvKeuN7+WtNBRx54osUMHU7Dhd9PGYHB14gNPzjgBcXOSULvsL+TaKg8U5hTKgYDR2nhHJR+jGjWJwGdWQZvyQFepqXJHzT2+tFrQcHswpugxJiPqfqV8I= 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=HieG2HuK 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 752468661f5a371b; Thu, 25 Apr 2024 16:05:50 +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 E506066DF23; Thu, 25 Apr 2024 16:05:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rjwysocki.net; s=dkim; t=1714053950; bh=BCnLUuHW13RAzYcj99Bg9BBRzCEWgCC4VRRm5BqFDsQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=HieG2HuKO5CcQ0i7OtODKpNqFUSOaQQPOTpIUavE+d+Gk9a9/mxyAimBf2hgy2dvA dsJVKHMA2opf2AKveKxAUNUYc8AsWqdLuR5P0AbpdyzjIcMKn9gdmFjRv7apnyLGRx YJfZmfq2ZWYHf3wkJXcND6fqErYnOEObXpFgBHYf7Z//mfjZtIz1OpNzHT2CxYnlAN wwiWjD92im90VTn+mosDOf78TwPkdkudpUzh5diqYpHRkPY2Z8oJntOXy0vhjnZ1tE 9ogklxeIPT/DgQ+mbYG/MkfpSMNrqpOkykfjjrp/L/Zl8uRI4Ql8ScnFJviIB+WRw8 f1T6tYokl/cCA== From: "Rafael J. Wysocki" To: Linux PM Cc: LKML , "Rafael J. Wysocki" , Lukasz Luba , Daniel Lezcano Subject: [PATCH v2 1/3] thermal/debugfs: Create records for cdev states as they get used Date: Thu, 25 Apr 2024 16:03:42 +0200 Message-ID: <10458619.nUPlyArG6x@kreacher> In-Reply-To: <3297002.44csPzL39Z@kreacher> References: <3297002.44csPzL39Z@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: gggruggvucftvghtrhhoucdtuddrgedvledrudeljedgjeduucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkfgjfhgggfgtsehtufertddttdejnecuhfhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqnecuggftrfgrthhtvghrnhepvdffueeitdfgvddtudegueejtdffteetgeefkeffvdeftddttdeuhfegfedvjefhnecukfhppeduleehrddufeeirdduledrleegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepudelhedrudefiedrudelrdelgedphhgvlhhopehkrhgvrggthhgvrhdrlhhotggrlhhnvghtpdhmrghilhhfrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqedpnhgspghrtghpthhtohephedprhgtphhtthhopehlihhnuhigqdhpmhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehrrghfrggvlheskhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhukhgrshiirdhluhgsrgesrghrmhdrtghomhdprhgtphhtthhopegurghnihgvlhdrlhgviigt rghnoheslhhinhgrrhhordhorhhg 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; /*