Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp2904640lqt; Tue, 23 Apr 2024 05:28:18 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXsuJ9YSOpfNUi8cLa+o+G60EK925CyX19uyLicuMa6rqOZ0Eh0IILbHyRLAsU+6DMJZdke17bkNLLS0NRIgCkEa1DqqO2UYNMyC1ICWA== X-Google-Smtp-Source: AGHT+IGFmia+qxDtXlQzTNE/gxvXlKjafVdUAg9gin2PUvXVKqbKqubJ/4CYCPpZtXhY0sFrpTfd X-Received: by 2002:a05:6e02:219b:b0:36a:3c07:9caf with SMTP id j27-20020a056e02219b00b0036a3c079cafmr16973842ila.30.1713875298383; Tue, 23 Apr 2024 05:28:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713875298; cv=pass; d=google.com; s=arc-20160816; b=vipct8DBo6rG4ERY6OPDEWakg9X3V8MIwyyHSQifUvK4pvWdibY8cz0ZfFSbWuqhST 4H+nydfzOAsuabiJvs9p11/yVYJl0izYQaZdz+ePKSy1eB2zboncp+BYFZ2klNdCqEgB 3Ty0yJV59Aoh9U+vNNuBC+Qnr40cCyuSCbKcPkmGsLgxtRDlxJQm+E90A4B4qRc+ntXP tuNKHbT0byaxo2kZa3vML2onACAyS67I9x2zRsB+iXcJYtIwIofPtrNI/wIMrm0o9LwP SGpHyqsZXudXfGajpKvfXufuj84MNd6cZQZ786rJJbX1eOHzaJJa+lYASo71Hdh/Od3o fYlw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=TXVmxc0SmCwJMxvdd4cFPe4f8YSO7HMBkGZg1sJPKW0=; fh=qGz/4eBSDl3S4YEGZPkHobzPc1hXOGsrBA8mZgMYJ1E=; b=qex1A8/w99fn7FY5H0KLtMIR/YAUjRBHX4Ft3TU1/gkLVFP5tEhCx3aRioqKia94mo eKEmWakjyJGGt+RLrsBnJasK8WzU7O4XDbIZsHMswBjO3Nyp8jXz+azQPQtQcatLPr0Z vzdT0Q4GaGAOAds9CS6m3u6F2xvgSd0hxQ5VyRamSPfrewXYyIHqvDJH06IYteWDzKQn vzNx3Q0vbaNLRw56QrYwXLwyVeYotzzMpSAonBsk2yh0aNtyqKWkloBF4M3Lr+A8FREW ikyWnFBMCeNU21i6X6cL6uwy8nfNy2gOvgFYOlAX3drIMigTDvh3f+3kAuUVtAShK+Fe nbLw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Ixyfno0M; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-155160-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-155160-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id r17-20020a63ce51000000b005f3c84f05easi9269887pgi.133.2024.04.23.05.28.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 05:28:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-155160-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Ixyfno0M; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-155160-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-155160-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 8C04D28286A for ; Tue, 23 Apr 2024 12:27:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DCB2286254; Tue, 23 Apr 2024 12:26:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Ixyfno0M" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 0B1478814; Tue, 23 Apr 2024 12:26:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713875196; cv=none; b=O/g7xFciTK/Im6UTf4eV+1BYcYGdjVkCwNT9l1XGgu4rznpPFQlTD+WEc8nCzCWHtoXLPW7rQhgq8tZNn8Qt4KH7sLuQXBaDsf3f2nHDnvb7YzRGpJogDTYpix+N8WliXIRDmwJvvzOmZv2ATLKO93A5nEglrQQa8mX170HZxMg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713875196; c=relaxed/simple; bh=GhFqWYnEMMVlmMXQ3Fz18iujy63dteb43440Fc9T//g=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=noOOflfRSUnvz1UnTlL04Fse38aEvMBcf0LgLfUKkRvAd2OVq+nfiXhlep9+9Mm8GvDUn3D2Pa06Tiym8YA9E42FtPlk6WHAu7Uu24CL6u62oUk+pIxWhUNhCXZwl0H0+xbMc5TWOWpqV2+necaXMM+2sw8J2Jcj8h+QBH1Bf0s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Ixyfno0M; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7016FC3277B; Tue, 23 Apr 2024 12:26:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713875195; bh=GhFqWYnEMMVlmMXQ3Fz18iujy63dteb43440Fc9T//g=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=Ixyfno0Mumqxt2FxXvWIDrsNtDKx93yJVNdJNhB8n5MM2+SDtNwxEMRX5RyDRDFHN 2Qu5PqID+p7dm2F590GnHTWuiAW70aNRmIT/Z9l8FSdI5YYxOBw5i8bY+BvdJIIH+S umR6clL5Tlu6w0K0wY1gOVDeftg/XZ6aPlMJlEoBgVvKmMyzC/T7U9CRJgUx4wxksv 32frTGY3+AHtwkb1uhZsu+HoIq/EcYiA83eIjH4VSrAR344Exe67tXPW8+OcQGxTtv amQbNci+0Z28QM7vjj8jv1DQeDdBXNKrTKj3YXNjWM2+Myrvbm4omg2gvLWqKV80DU qon1HGcHrcNAg== Received: by mail-oo1-f46.google.com with SMTP id 006d021491bc7-5acf5723325so1309113eaf.0; Tue, 23 Apr 2024 05:26:35 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCWrpwo0arYK5Tf59akftLixY3Zs3cSjc/T7a08tM+Vw41Syx/jz1xwzjCiy6hnA/MbYQQRsGP8tYgJyXDw8jQEOpl5nsC281t2Pu/9ITZU4A9nwiOeGpob0iyU75eyXJolF+sfaRf8= X-Gm-Message-State: AOJu0Ywey0VjyYESG0c8nk3WXlremKGpsrfU7UFgxgUABHv6kcAlJsub zRDgXbem2S5Y5M9mprQbjXxWiIb2dZEYn1OjoayTyBoBoWg+EGfJyj1Fpfgm2NqX4SnOYai2FmK x1CpZySy7XWAh0atQ83EKQSV6RkA= X-Received: by 2002:a05:6820:ecb:b0:5ac:6fc1:c2cb with SMTP id en11-20020a0568200ecb00b005ac6fc1c2cbmr13195937oob.0.1713875194616; Tue, 23 Apr 2024 05:26:34 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <4918025.31r3eYUQgx@kreacher> <3a8f1978-c5df-40d6-91ca-276431bb01e1@arm.com> <2acea3c3-5c8f-4f3c-a275-743c3fbfd2e6@linaro.org> In-Reply-To: <2acea3c3-5c8f-4f3c-a275-743c3fbfd2e6@linaro.org> From: "Rafael J. Wysocki" Date: Tue, 23 Apr 2024 14:26:23 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v1 0/3] thermal/debugfs: Fix and clean up trip point statistics updates To: Daniel Lezcano Cc: "Rafael J. Wysocki" , Lukasz Luba , "Rafael J. Wysocki" , LKML , Linux PM Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Apr 22, 2024 at 6:12=E2=80=AFPM Daniel Lezcano wrote: > > On 22/04/2024 17:48, Rafael J. Wysocki wrote: > > On Mon, Apr 22, 2024 at 5:34=E2=80=AFPM Daniel Lezcano > > [ ... ] > > >> or we should expect at least the residency to be showed even if the > >> mitigation state is not closed ? > > > > Well, in fact the device has already been in that state for some time > > and the mitigation can continue for a while. > > Yes, but when to update the residency time ? > > When we cross a trip point point ? > > or > > When we read the information ? > > The former is what we are currently doing AFAIR Not really. Records are added by thermal_debug_cdev_state_update() which only runs when __thermal_cdev_update() is called, ie. from governors. Moreover, it assumes the initial state to be 0 and checks if the new state is equal to the current one before doing anything else, so it will not make a record for the 0 state until the first transition. > and the latter must add the delta between the last update and the current= time for the current > state, right ? Yes, and it is doing this already AFAICS. The problem is that it only creates a record for the old state, so if the new one is seen for the first time, there will be no record for it until it changes to some other state. The appended patch (modulo GMail-induced white space breakage) should help with this, but the initial state handling needs to be addressed separately. --- drivers/thermal/thermal_debugfs.c | 8 ++++++++ 1 file changed, 8 insertions(+) Index: linux-pm/drivers/thermal/thermal_debugfs.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 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 =3D 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 =3D (old_state << 16) | new_state; /*