Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp12754845rwd; Fri, 23 Jun 2023 10:10:53 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5ebyTOSUmPhGxBblblZ+1hVsH7r/2cmb/VVr/UBmKZL7RpoxM5+VuQcwHd1pMZ37L2zWbD X-Received: by 2002:a05:6a00:3a10:b0:668:8596:7524 with SMTP id fj16-20020a056a003a1000b0066885967524mr14005057pfb.20.1687540253646; Fri, 23 Jun 2023 10:10:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687540253; cv=none; d=google.com; s=arc-20160816; b=yPpk+djXgg34fCwoHFOQa3zIJxKVw8uoRq4nhN26qdNCZjfZGIUkxs16mE6RbC2yfV wDZOFRRCcasvfUwhydAUm6TjMUrt9nfte57e5LsfwjqabLFtXWCud+b1wzwGS9/b/+1R j2Gm2fyy0g3zbzqtjoSFIKILr8MjkS/h3iJfrw2t6yTmgiK85jHHvTb07zmD2OODBct8 58FoF1ktRGk0syBJ8Oc+yZRf6KLWkRwwTtCzVWfupU8rDQaJA+bkEdNoYv+knpVA+l8J 7wdX5UvNat2HxcmnapmAVRAiboHU9df8fzzAe9VoMhQV1auEjnOsctp3iU4BqrhsMD0w TGaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=aXaVQ8mRAfjtj04ssKNEG1ILAWks16PIVhw0xdGG7DA=; b=Cs7L9TWLS8YlPX8sa3sRzUnS3HJXvjn09Fwgxeh0gXqUM7OP+/3tvyj55RFSQEigj9 UxnItsgcVQlhvgtAOvuNyDsr0vNxviMkBJ5Fq989yN34plHLSupXqxFEKw/XQwhHeQMa Di+7snfvUApiAreVDsDL4i/oGjmSL2YU/Wn8u0HOKjZPIpu6WzNYilcQ7P2Aam8viqFW st7vk73MB8grFRETLf9tQIBOoG/I6l3P28c5shSIYfKPrw3AUkjT0037aFBhHCZVs7QF MCqRywxc21Mq8QHFAWuMTT5KSsyyECUbF1+6qik7a5rRsxP2yWxkWiNrFILuQ+twaXgG fsKQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s9-20020aa78bc9000000b00661397beb62si8942187pfd.171.2023.06.23.10.10.29; Fri, 23 Jun 2023 10:10:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232566AbjFWQlN convert rfc822-to-8bit (ORCPT + 99 others); Fri, 23 Jun 2023 12:41:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232135AbjFWQks (ORCPT ); Fri, 23 Jun 2023 12:40:48 -0400 Received: from mail-ej1-f44.google.com (mail-ej1-f44.google.com [209.85.218.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 022562735; Fri, 23 Jun 2023 09:40:33 -0700 (PDT) Received: by mail-ej1-f44.google.com with SMTP id a640c23a62f3a-97ea801b0d0so17668766b.1; Fri, 23 Jun 2023 09:40:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687538431; x=1690130431; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RI6u41EPWnXmYM2KqVmefAwYHHL4vqTlKsNGHSEOQT4=; b=YQyqAadBGAE0W4Ywx/T7E//VTOUS1re4gAUJSNOQ7GcbtIeDst8Dy3LsayYsV5GtFq lSZoMGryQCQ8HVj/GxPoB9sJfbTJhxuk1XUOjolj4w0LYjYiQHpZza1tEOQmBimDDr+u Y9VRBoztYU9GUXYqHoaQc7n5NHbs7PPLP3HvHuFM3mWz3srr9N1/xeORrVmK8x4/DXml HU7gsQv7NU1dB+0AWwnD7ifMrSrq+Qn3NI1cUS8diwSqallSHyKks0XG/Fuqlf6IJhud ifkGJsvAbv5aI36pwKv1wpVA677X7EhfnfxCrihwKNShdoSmnyCvh7VLkXjQzvpmESXy nWnw== X-Gm-Message-State: AC+VfDyZIlbAmrnQyaBpipchwIIlM/WB0VBovp2eNsLIVSS6Dl/GRWDJ S5uz0Xq0Fp1UxKp+l/1IbuqtZ/cAe/oMGmSdfg8= X-Received: by 2002:a17:906:729e:b0:988:c8bb:e3ac with SMTP id b30-20020a170906729e00b00988c8bbe3acmr10300946ejl.7.1687538431246; Fri, 23 Jun 2023 09:40:31 -0700 (PDT) MIME-Version: 1.0 References: <20230519032719.2581689-1-evalenti@kernel.org> <20230519032719.2581689-6-evalenti@kernel.org> In-Reply-To: From: "Rafael J. Wysocki" Date: Fri, 23 Jun 2023 18:40:20 +0200 Message-ID: Subject: Re: [PATCH 5/7] thermal: stats: introduce tz time in trip To: Eduardo Valentin Cc: "Rafael J. Wysocki" , eduval@amazon.com, linux-pm@vger.kernel.org, Daniel Lezcano , Amit Kucheria , Zhang Rui , Jonathan Corbet , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 21, 2023 at 6:45 AM Eduardo Valentin wrote: > > On Tue, Jun 20, 2023 at 07:27:57PM +0200, Rafael J. Wysocki wrote: > > > > > > > > On Fri, May 19, 2023 at 5:27 AM Eduardo Valentin wrote: > > > > > > From: Eduardo Valentin > > > > > > This patch adds a statistic to report how long > > > the thermal zone spent on temperature intervals > > > created by each trip point. The first interval > > > is the range below the first trip point. All > > > subsequent intervals are accounted when temperature > > > is above the trip point temperature value. > > > > > > Samples: > > > $ cat /sys//class/thermal/thermal_zone0/stats/time_in_trip_ms > > > trip-1 0 0 > > > > The above line is confusing. > > > > > trip0 -10000 35188 > > > trip1 25000 0 > > > > And the format violates the "one value per attribute" sysfs rule. > > > > > $ cat /sys//class/thermal/thermal_zone0/stats/time_in_trip_ms > > > trip-1 0 0 > > > trip0 -10000 36901 > > > trip1 25000 0 > > > $ echo 25001 > /sys//class/thermal/thermal_zone0/emul_temp > > > $ cat /sys//class/thermal/thermal_zone0/stats/time_in_trip_ms > > > trip-1 0 0 > > > trip0 -10000 47810 > > > trip1 25000 2259 > > > $ cat /sys//class/thermal/thermal_zone0/stats/time_in_trip_ms > > > trip-1 0 0 > > > trip0 -10000 47810 > > > trip1 25000 3224 > > > $ echo 24001 > /sys//class/thermal/thermal_zone0/emul_temp > > > $ cat /sys//class/thermal/thermal_zone0/stats/time_in_trip_ms > > > trip-1 0 0 > > > trip0 -10000 48960 > > > trip1 25000 10080 > > > $ cat /sys//class/thermal/thermal_zone0/stats/time_in_trip_ms > > > trip-1 0 0 > > > trip0 -10000 49844 > > > trip1 25000 10080 > > > > > > Cc: "Rafael J. Wysocki" (supporter:THERMAL) > > > Cc: Daniel Lezcano (supporter:THERMAL) > > > Cc: Amit Kucheria (reviewer:THERMAL) > > > Cc: Zhang Rui (reviewer:THERMAL) > > > Cc: Jonathan Corbet (maintainer:DOCUMENTATION) > > > Cc: linux-pm@vger.kernel.org (open list:THERMAL) > > > Cc: linux-doc@vger.kernel.org (open list:DOCUMENTATION) > > > Cc: linux-kernel@vger.kernel.org (open list) > > > > > > Signed-off-by: Eduardo Valentin > > > --- > > > .../driver-api/thermal/sysfs-api.rst | 2 + > > > drivers/thermal/thermal_sysfs.c | 86 +++++++++++++++++++ > > > 2 files changed, 88 insertions(+) > > > > > > diff --git a/Documentation/driver-api/thermal/sysfs-api.rst b/Documentation/driver-api/thermal/sysfs-api.rst > > > index ed5e6ba4e0d7..4a2b92a7488c 100644 > > > --- a/Documentation/driver-api/thermal/sysfs-api.rst > > > +++ b/Documentation/driver-api/thermal/sysfs-api.rst > > > @@ -359,6 +359,8 @@ Thermal zone device sys I/F, created once it's registered:: > > > |---stats/reset_tz_stats: Writes to this file resets the statistics. > > > |---stats/max_gradient: The maximum recorded dT/dt in uC/ms. > > > |---stats/min_gradient: The minimum recorded dT/dt in uC/ms. > > > + |---stats/time_in_trip_ms: Time spent on each temperature interval of > > > + trip points. > > > > I would write "in each temperature interval between consecutive trip points". > > Ok > > > > > Doesn't this assume a specific temperature ordering of trip points? > > And so what if they are not ordered? > > It does. I believe other things will break if they are not ordered. But there's no guarantee that they will be ordered, so it looks like those other things are already broken.