Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp719097lqb; Wed, 17 Apr 2024 08:52:10 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUugf6Hl5BEtC/r37nHelznNNuwSwYI9add9Xp6eNW49ikJghEANWNq2RsYPuY40ZglLGhc0rqT6cKIR6sHlIbMklw1ZfeO+4JdDXU71g== X-Google-Smtp-Source: AGHT+IFC3Y+KillRLwKIwSKJ/CDz9QM9Oz1JAYp7GKFuyZqg7BtZ4OXPhdhCnOtsvSpKPcqYZ/8W X-Received: by 2002:a05:6830:16c9:b0:6ea:1bba:9622 with SMTP id l9-20020a05683016c900b006ea1bba9622mr17670874otr.35.1713369129784; Wed, 17 Apr 2024 08:52:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713369129; cv=pass; d=google.com; s=arc-20160816; b=PPbH7IKsvRaWzP34f87Feiw7Oqm9tmJM1/utEyOOrg5vdmx+WZiWaO9umOtOuERvVL rgJcEGZIfZFuR1AXFTNPqhs8JmLsIH6Q04YTT2t29gukO5OTWYtQlCFIGPjBUb3a80pn W3HYG28N1ImAT/G2W6yXw3Ygc4dm0eQRSYW79MgZPX68ferIeQX/0wIs9FQJKTBv26nr t/lP81goPuLT9X4f4MoZnqnoKHPpz/O5DU6j7rtNY9ClvM2VGzJxhr7AxTQ4bmngAYlq cu5SFxVehZnEs1El5Qd0+O/tuJIloJCTezZkIJiX66SJ18hmeP/9c3Z6R7lMuxeMtSLF IYjw== 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:message-id:date:subject:cc:to :from:dkim-signature; bh=veCCNS4uJBnp0EzDRu1pt6w0mNiSTy/UDigJmQxvXs0=; fh=zmLM8hyyOHyTrGTcN8MevR+kafPFDFN3dQqp4G8quBA=; b=LW+jpBnUI9A45CMImB+jsqn9gFdrRsUNAvsOiQRALTOCkU8WJ+7cpPZMTHNi1FOYPu Y9KBv44YCh4uDhhldCbm89yHoyGizBzTAdCUZVCAU39ffDSCRc/XmUIg6UtsN7m/LT+i ZGpLJM/LXsd1QZ0hsq3FUPmzE0w6Fy1qU6CUvuNM/Cn5bpBT3nwd2vrtwfauVuJbAiM9 LhrMEY8+cl4KtYNOKnzryAVBOXx5QqVVGpha7O5gaetTXAVY1FdCpXTe7eoHiP4l+i3Z aIsHHfBv7MswWABQdiSBa4eCD7zpL3Y0MceUDWD1I5Wa8FrdJWH2a/5vSPu80r4Uy5fJ iaLA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=fail header.i=@rjwysocki.net header.s=dkim header.b="l/ivSgb7"; arc=pass (i=1 spf=pass spfdomain=rjwysocki.net); spf=pass (google.com: domain of linux-kernel+bounces-148851-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-148851-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 t12-20020a05620a0b0c00b0078ec5b028d6si13937208qkg.151.2024.04.17.08.52.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Apr 2024 08:52:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-148851-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="l/ivSgb7"; arc=pass (i=1 spf=pass spfdomain=rjwysocki.net); spf=pass (google.com: domain of linux-kernel+bounces-148851-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-148851-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 A67961C22353 for ; Wed, 17 Apr 2024 15:51:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B4025148303; Wed, 17 Apr 2024 15:51:36 +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="l/ivSgb7" 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 791EB1487E2; Wed, 17 Apr 2024 15:51:32 +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=1713369095; cv=none; b=PUjkDzH/lfZSsJnDGIvCHTP4W0CHDH6FAWcxpBD7wUTpL8my5bzN5Ej++WeXpClZEWGK+tkhaKprgRkyTyBn+z0TS2a0JT9UAJ6ogznmquidEJ9tggnVwp+4BXCBzIRW9H2XTDRLUWt82LzFey40+9z1rTW9fFCkQotRrvkNXgs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713369095; c=relaxed/simple; bh=KHhUKfMqKwftT0o+cptgB02ZPGoBIFgTbNYwHn4USI8=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=maiatUpkCW2OD8srxiXsgZCfRcjLemLhFFKbVOu9sIrBMn6qJ5UZNFVDrvtR0ykRdJ88+wNly4XK4iIc0noZ9PLBDrhA9OYwK1Ld5+eeDEb6hOQ3QXIG3AsKcv2QqRpg5Eyf3EQUoUcuFw6MO3bC+x7wKitWLRghFyH1ybNLbrI= 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=l/ivSgb7 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 55df5da1b28053fc; Wed, 17 Apr 2024 17:51:30 +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 9C80666D284; Wed, 17 Apr 2024 17:51:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rjwysocki.net; s=dkim; t=1713369090; bh=KHhUKfMqKwftT0o+cptgB02ZPGoBIFgTbNYwHn4USI8=; h=From:To:Cc:Subject:Date; b=l/ivSgb7g6hD/JHHwT+0JQ9VJY8RsHdlVzUV+kjmrLU1YS/jbO+qvyeT04OyYODAi gkaLbnKaZkZiAQ+fm2W+iCQDcZGzLuS3ttWvcmJk8Wghj+4I8Nqf58jsGCfjvaPOJL SwyZLdY9nGUWdqV4GpOKWrOzlkswGDF6ngQd7/4fvn/zFB7wisk0JbGCgiM8XMUcQ7 lpdruSIFU9LeKd2Ipn/4udCdQorL8isq2VIpdW3ontxe4xAxYgJS8arq/GyFp6AGgP ujIfWtapQK9rm5ScP2gA7gTlCwUQuoDI+cwxd5rskqw/4Ku2adsvristFnVM2IHuok H3LliR7xuw8dQ== From: "Rafael J. Wysocki" To: Linux PM Cc: Daniel Lezcano , "Rafael J. Wysocki" , Lukasz Luba , LKML Subject: [PATCH v1] thermal/debugfs: Make tze_seq_show() skip invalid trips and trips with no stats Date: Wed, 17 Apr 2024 17:51:29 +0200 Message-ID: <2727917.mvXUDI8C0e@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: gggruggvucftvghtrhhoucdtuddrgedvledrudejkedgleegucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkfgggfgtsehtufertddttdejnecuhfhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqnecuggftrfgrthhtvghrnhepffffffekgfehheffleetieevfeefvefhleetjedvvdeijeejledvieehueevueffnecukfhppeduleehrddufeeirdduledrleegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepudelhedrudefiedrudelrdelgedphhgvlhhopehkrhgvrggthhgvrhdrlhhotggrlhhnvghtpdhmrghilhhfrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqedpnhgspghrtghpthhtohephedprhgtphhtthhopehlihhnuhigqdhpmhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopegurghnihgvlhdrlhgviigtrghnoheslhhinhgrrhhordhorhhgpdhrtghpthhtoheprhgrfhgrvghlsehkvghrnhgvlhdrohhrghdprhgtphhtthhopehluhhkrghsiidrlhhusggrsegrrhhmrdgtohhmpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgv rhdrkhgvrhhnvghlrdhorhhg X-DCC--Metrics: v370.home.net.pl 1024; Body=5 Fuz1=5 Fuz2=5 From: Rafael J. Wysocki Currently, tze_seq_show() output includes all of the trips in the zone except for critical ones, including invalid trips and trips with no stats which is confusing. Make it skip the trips for which there is not mitigation information. Signed-off-by: Rafael J. Wysocki --- This is independent of the other thermal patches sent by me recently. --- drivers/thermal/thermal_debugfs.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) Index: linux-pm/drivers/thermal/thermal_debugfs.c =================================================================== --- linux-pm.orig/drivers/thermal/thermal_debugfs.c +++ linux-pm/drivers/thermal/thermal_debugfs.c @@ -754,6 +754,11 @@ static int tze_seq_show(struct seq_file for_each_trip_desc(tz, td) { const struct thermal_trip *trip = &td->trip; + struct trip_stats *trip_stats; + + /* Skip invalid trips. */ + if (trip->temperature == THERMAL_TEMP_INVALID) + continue; /* * There is no possible mitigation happening at the @@ -763,6 +768,13 @@ static int tze_seq_show(struct seq_file if (trip->type == THERMAL_TRIP_CRITICAL) continue; + trip_id = thermal_zone_trip_id(tz, trip); + trip_stats = &tze->trip_stats[trip_id]; + + /* Skip trips without any stats. */ + if (trip_stats->min > trip_stats->max) + continue; + if (trip->type == THERMAL_TRIP_PASSIVE) type = "passive"; else if (trip->type == THERMAL_TRIP_ACTIVE) @@ -770,17 +782,15 @@ static int tze_seq_show(struct seq_file else type = "hot"; - trip_id = thermal_zone_trip_id(tz, trip); - seq_printf(s, "| %*d | %*s | %*d | %*d | %*lld | %*d | %*d | %*d |\n", 4 , trip_id, 8, type, 9, trip->temperature, 9, trip->hysteresis, - 10, ktime_to_ms(tze->trip_stats[trip_id].duration), - 9, tze->trip_stats[trip_id].avg, - 9, tze->trip_stats[trip_id].min, - 9, tze->trip_stats[trip_id].max); + 10, ktime_to_ms(trip_stats->duration), + 9, trip_stats->avg, + 9, trip_stats->min, + 9, trip_stats->max); } return 0;