Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp2168310lqa; Tue, 30 Apr 2024 09:47:29 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXPBLQaZKlCfiAiKwVD6lXQ7QRTBym0/U/fTmG1dGWQRZFlWqg3cBG/vYD5DyUrk6VwEW628chuX5WsRzL3GIgt8YZVmmUjYN/qvziqQg== X-Google-Smtp-Source: AGHT+IEEvp8N9HWgY4C0Q5Zrk0RYvKma3JjoSlMSEXgMNO5hzNk7aTUwf3U+aTDq7AVa/Khak0Xc X-Received: by 2002:a05:620a:99a:b0:790:94ae:6091 with SMTP id x26-20020a05620a099a00b0079094ae6091mr529380qkx.17.1714495648903; Tue, 30 Apr 2024 09:47:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714495648; cv=pass; d=google.com; s=arc-20160816; b=IHwOz/ULDO4vqutCFM1sMKwz3dZoKpb/SEYmOlL0ng+n+G+A2YVmq/q7G7lXbpOA+S ukkJP99kSeMpbdAsmlkzXDE2B9rnsrzF+9Xwu6LKOgaVhlc5GIkbhiqFzmKRaD25ryyU 1x21qN8RgBIpesHQe97Rgi/+QDYIt1mXgPTjV5g3/xxuq/697b0xfJbIOcQiAv5Sto9l 9YC/Ee5yr0QI6TLVKmkSVSy5QqBcZ2/u0J3R4cEfu8g9/vFsCO+YE85PRg3nNsVCDwCH HkF0FlrAGLee0T4C2kGhtEuz2lY0XY7Me+FwEFUlcDa28WpUa4ZjA6xa9ca7QvMdmJ+5 HfAQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=95/tdrrDG+JP5CwM9PcVmm3HnegsYVIlvQK/AifiHFE=; fh=Lmr7dKIC72j1DIwoKufWd9H7xxAZ9FezSQmYyNu+YrM=; b=WTBgtytZBLkq+EaJnl++NM4VuKl/TZX5avEHzXccracequczinjHT26xQo+6EPqBk3 r9qJ31OmzneIk8HeKNUKKF7ehu5/RhbtJ/ZmdWhaWW6WIZvbdX2erYDq3K6MVfYhZJQp BdtcMWTUZD8wWQpnQI792SmTXehJRT6a14YhaqFExsQIiO6Y9avGv4hcvbmP5nF0IL3o WJTemCx7CvXUQVuhCw/qEvHMHyB1OsbYNgPeoZ0K6IL9JyJmEoBKzz5SakQXj4/dGZ96 0J/KnKpH7DRYcWZkKt+P1xajAmBBJQqmsYl2J63tAccRWfdIL6rYzaYOfwbzlWLYtGnD S/uw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-164418-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-164418-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id ow29-20020a05620a821d00b0078edc1fa0fbsi29069013qkn.62.2024.04.30.09.47.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Apr 2024 09:47:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-164418-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; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-164418-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-164418-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com 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 813E51C2346C for ; Tue, 30 Apr 2024 16:47:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C518617BB11; Tue, 30 Apr 2024 16:47:15 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C836E12C7FA; Tue, 30 Apr 2024 16:47:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714495635; cv=none; b=BwkBQKt0ScFLb/1rpmaZOB1QN1w79eoZRyxfkUn0ueXnnbo0MtqP1xIfggG72Fav0j4z7SEOhZAlgioZpbesRILnDsvIDZc5W+QGp7rssSbpbhyTR9m5PruHYrQVLjoap8brxEfo1leD2UP1wWoawFQ409V8cbPnqhQJZLUUJ8M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714495635; c=relaxed/simple; bh=93evZwhOPpMP46YPBM7x7WZ4DoHMEWykJH9vC1Lzlfc=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=sstGUmSZ81/7MPOnyzeGHTGBAefrrD557dRmKTAtq6AeJ6fRZDpGTVh19CWvuuoKVhvR/BV4ereFjUKjd00e5rVn6aUPytdbg5hE9HDtR7aBz9U0x7S9a7C5deHDVnu4TIJunOMPEE7F5W5EQC5sMyt1zjg5FitU9tMeBvzWRRg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 85B872F4; Tue, 30 Apr 2024 09:47:39 -0700 (PDT) Received: from [10.57.65.13] (unknown [10.57.65.13]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4431E3F762; Tue, 30 Apr 2024 09:47:12 -0700 (PDT) Message-ID: <73edaf80-9251-4c3b-8fcc-202dd617335a@arm.com> Date: Tue, 30 Apr 2024 17:47:10 +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 v2 2/2] thermal: core: Move passive polling management to the core To: "Rafael J. Wysocki" Cc: Daniel Lezcano , LKML , "Rafael J. Wysocki" , Linux PM References: <5790995.DvuYhMxLoT@kreacher> <2949052.e9J7NaK4W3@kreacher> Content-Language: en-US From: Lukasz Luba In-Reply-To: <2949052.e9J7NaK4W3@kreacher> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 4/30/24 16:52, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki > > Passive polling is enabled by setting the 'passive' field in > struct thermal_zone_device to a positive value so long as the > 'passive_delay_jiffies' field is greater than zero. It causes > the thermal core to actively check the thermal zone temperature > periodically which in theory should be done after crossing a > passive trip point on the way up in order to allow governors to > react more rapidly to temperature changes and adjust mitigation > more precisely. > > However, the 'passive' field in struct thermal_zone_device is currently > managed by governors which is quite problematic. First of all, only > two governors, Step-Wise and Power Allocator, update that field at > all, so the other governors do not benefit from passive polling, > although in principle they should. Moreover, if the zone governor is > changed from, say, Step-Wise to Fair-Share after 'passive' has been > incremented by the former, it is not going to be reset back to zero by > the latter even if the zone temperature falls down below all passive > trip points. > > For this reason, make handle_thermal_trip() increment 'passive' > to enable passive polling for the given thermal zone whenever a > passive trip point is crossed on the way up and decrement it > whenever a passive trip point is crossed on the way down. Also > remove the 'passive' field updates from governors and additionally > clear it in thermal_zone_device_init() to prevent passive polling > from being enabled after a system resume just beacuse it was enabled > before suspending the system. > > Signed-off-by: Rafael J. Wysocki > --- > > v1 -> v2: > * Add a WARN_ON() check for tz->passive < 0. > * Do not start passive polling until tz->passive is positive. > > --- > drivers/thermal/gov_power_allocator.c | 12 +++++++----- > drivers/thermal/gov_step_wise.c | 10 ---------- > drivers/thermal/thermal_core.c | 14 +++++++++++--- > 3 files changed, 18 insertions(+), 18 deletions(-) > Reviewed-by: Lukasz Luba