Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp1352622rdb; Sat, 23 Dec 2023 03:42:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IF/9OB84MmZoTOobLMDg1kbu3m2ja3GFwX+LtLN3o7SPErSr3M2kpfBc6gUI1NhjephV/uB X-Received: by 2002:a05:6a20:4c10:b0:195:10aa:eb29 with SMTP id fm16-20020a056a204c1000b0019510aaeb29mr2845051pzb.33.1703331724362; Sat, 23 Dec 2023 03:42:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703331724; cv=none; d=google.com; s=arc-20160816; b=qn2ZTr91bqhc43Zocgrg5G65fQGdRyUma7mnSp8fzhvtU/Jg6impYrFCHCWF8C5jip Qr0NnPgg2ep/OEPS/5+WQi/IVvGb8dYnBCg99/GIdlP+b94bYm8Ahd2MrNtTOYd7ekmL MJ1hetG1N8b3Kuvg5hnQ+zLxHc42CcDv7qFOaR+bwztxHxGwQeQRU2MzIV3A4edkJYNd 1hSXdwFkX/dJKmhsfxrMIGEnXJy7Q1u1W4JHy9c2sSvVqaKDZ+8hC+3iai7B+6lzxt58 KqAoSGwNBgvCtqOOTbf3Ff3n6AalRRhYwkOohx8Z+lNWYdQhMM64QdS+hOaCwW7nSyq9 i2cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=XvbgNe9ygEkQ00vTu/GxGFniUa92RCIW2iyIcatnI3I=; fh=UekkbB4LTWOAjXIpYdgQEcGSZ9BABUjlRS+mK+eiC+E=; b=JoHeATLp0Mr9GdrvLxRTDBIw7wys4NZFsZPsTRmPAaMJaDehvKvcKsvGzwMEUtydYl G6Ku843aJBrvEgoHgDvYwuSVhWgYzqdp9gpxuM9h2HGKq/E8K9EYQtwVD8qv6NQCjvvf EVN5m032yu6U0rh8+1d1dQO8OkQOJLWXjPIqsI1h/mclIoSPm6yWqvjPQ1DVD5ngIqhO MwFhVNKyYra+cFJYPoDwcjBYjVXAdPnF44R+gF3CYS1ZbSB3nChsDVr7Mu8Tod6Go8tR tGuKUVcduvmZYnegzA8Mdnh8pXl+WEva65uTjHjnAHPSqFAd257yCDQv1MMZHc25Pb9/ 7P8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=f3DW52Xd; spf=pass (google.com: domain of linux-kernel+bounces-10393-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-10393-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id u26-20020a62d45a000000b006d99fb9bb67si1070938pfl.319.2023.12.23.03.42.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Dec 2023 03:42:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-10393-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=f3DW52Xd; spf=pass (google.com: domain of linux-kernel+bounces-10393-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-10393-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.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 DA3FC2841AB for ; Sat, 23 Dec 2023 11:42:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3A608CA7E; Sat, 23 Dec 2023 11:41:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="f3DW52Xd" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BBF09CA5F for ; Sat, 23 Dec 2023 11:41:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-336979a566aso1096876f8f.1 for ; Sat, 23 Dec 2023 03:41:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1703331713; x=1703936513; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=XvbgNe9ygEkQ00vTu/GxGFniUa92RCIW2iyIcatnI3I=; b=f3DW52XdirTnImDxactCkUyTRTR5R/GEYrofoJdKXnircDTy1Jv47IA8JXjtpdXBvz E0W794qudG/skctUv0qONqd7bJRaJMbGKxPaO8bmhCLEzpZ35t6yiWzRHKAZMbXbKYyG FNQqoQ9bVAF7Tna/AsncCzgkFMtvs3o1smYoqoG4gzmgzFhgzggZLpcBt9uxNj97bKe8 DsP4O+BbAlmKYL0Zgf6KzwoUtzXfjQKwyBJ0W8x0qS3JzJd707qQN+tWPnSC2Y0sATzI KzBGIRmLks/mz1yxLNzhD6JSTNyhEDa+qSDXrm1Fq5FuHYrR6/I8GOaQrgWDnQlu9Y7Z W8nA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703331713; x=1703936513; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=XvbgNe9ygEkQ00vTu/GxGFniUa92RCIW2iyIcatnI3I=; b=PgXqLmsOYj3c7NVoA+Y49p1i8dLpA2K+69U1rLdIyuNR4DIlKllFcsYaFo2BI6QF/a cn3Z0ZRYt1x+JbwijbliM9F0s0oGKyGsrsJbMLp3kqupBkiB6/VRCPFRD8PnxTcktMsf t9x9Am/2jfwbzmAzHxDtEUxcZ4+5EoY6NPl/RuJ985lfiZqgFCY/wI6gMiNNY0QagX2X 7Yc2tfq+agh6oY8hlpDrKAofUhlXX3KWul9zyvpT0HHBk7A+MVikYl9v2VYMRPLvc3F0 uMFV6molxNyYfpeyVnEydkEs+wBTyReVaQv+aeHqD9KuQmfRrfvlkqDwPMszWOlCDHwM kGgg== X-Gm-Message-State: AOJu0YxVtdVmcWlKFESOrLFc+gwf7WScashfNBPiHyvN+3iUkIDUiu7d JoyxIm2/fKNmdfpTURd83PbuftynQi4uoA== X-Received: by 2002:a5d:67cb:0:b0:333:5464:1d01 with SMTP id n11-20020a5d67cb000000b0033354641d01mr1291999wrw.91.1703331712837; Sat, 23 Dec 2023 03:41:52 -0800 (PST) Received: from [192.168.10.46] ([78.240.5.0]) by smtp.googlemail.com with ESMTPSA id z8-20020adfec88000000b0033672971fabsm6306658wrn.115.2023.12.23.03.41.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 23 Dec 2023 03:41:52 -0800 (PST) Message-ID: <60ecab8e-7b96-469e-9bae-25c51514e6e8@linaro.org> Date: Sat, 23 Dec 2023 12:41:51 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 2/2] thermal/debugfs: Add thermal debugfs information for mitigation episodes Content-Language: en-US To: "Rafael J. Wysocki" Cc: rjw@rjwysocki.net, lukasz.luba@arm.com, rui.zhang@intel.com, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org References: <20231219092539.3655172-1-daniel.lezcano@linaro.org> <20231219092539.3655172-2-daniel.lezcano@linaro.org> From: Daniel Lezcano In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Hi Rafael, On 21/12/2023 20:26, Rafael J. Wysocki wrote: [ ... ] >> +/** >> + * struct tz_events - Store all events related to a mitigation episode >> + * >> + * The tz_events structure describes a mitigation episode. > > So why not call it tz_mitigation? A mitigation episode = N x tz_events eg. trip A = passive cooling - cpufreq cluster0 trip B = passive cooling - cpufreq cluster0 + cluster1 trip C = active cooling + fan temperature trip A < trip B < trip C The mitigation episode, as defined, begins at trip A, and we can have multiple events (eg. trip B crossed several times, trip C, then trip B again etc ...). [ ... ] >> + if (dfs->tz.trip_index < 0) { >> + tze = thermal_debugfs_tz_event_alloc(tz, now); >> + if (!tze) >> + return; >> + >> + list_add(&tze->node, &dfs->tz.tz_events); >> + } >> + >> + dfs->tz.trip_index++; >> + dfs->tz.trips_crossed[dfs->tz.trip_index] = trip_id; > > So trip_index is an index into trips_crossed[] and the value is the ID > of the trip passed by thermal_debug_tz_trip_up() IIUC, so the trip IDs > in trips_crossed[] are always sorted by the trip temperature, in the > ascending order. > > It would be good to write this down somewhere in a comment. > > And what if trip temperatures change during a mitigation episode such > that the order by the trip temperature changes? Changing a trip point temperature during a mitigation is a general question about the thermal framework. How the governors will behave with such a change on the fly while they are in action? IMO, we should prevent to change a trip point temperature when this one is crossed and has a cooling device bound to it. >> + >> + tze = list_first_entry(&dfs->tz.tz_events, struct tz_events, node); >> + tze->trip_stats[trip_id].timestamp = now; >> + tze->trip_stats[trip_id].max = max(tze->trip_stats[trip_id].max, temperature); >> + tze->trip_stats[trip_id].min = min(tze->trip_stats[trip_id].min, temperature); >> + tze->trip_stats[trip_id].avg = tze->trip_stats[trip_id].avg + >> + (temperature - tze->trip_stats[trip_id].avg) / >> + tze->trip_stats[trip_id].count; >> + >> + mutex_unlock(&dfs->lock); >> +} -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog