From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) (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 8BAA81A08BB for ; Tue, 30 Jul 2024 14:57:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722351447; cv=none; b=iK3EnztHeEvT5TXicw2SWrPs85ASUFe/1mEysDlzQwusMoKX+rkcbwJnxK8syqdK2aD1CS2zE5VkqpWSs9V0Xd9UcAcEqdJMV3TD0ARIIXZnSxFOxuJ2fUJ4ocYlwrxMJswhLiYf9BbVx37iCR2znzU+g1BG3JJF0vtfT8ukSJU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722351447; c=relaxed/simple; bh=MNyIklkvk5eNrbXx1HAIESYmSdzQGisP3oacgmCWrJQ=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=YEekcWE1qtZG6GhOxcINFrSgQWrb13yFB7iGWRWb81A2h4yl/B1pi1ES42RlWc+xiYRTri4uYtcawLM0Ae8FQ3vACL1avibROTio3f4URAfSFXZ5FO8HUm/1PmlfB7HcGpxoPyPH5NklIucu/K/HPHZu07zOHjQQWnCM92F/pZA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=DBXqE7pM; arc=none smtp.client-ip=209.85.221.42 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="DBXqE7pM" Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-368313809a4so1888760f8f.0 for ; Tue, 30 Jul 2024 07:57:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1722351443; x=1722956243; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=LQkDwkMKeHB3gfeZECnxLbG2/UiCvD08G2Fc8wZUh4Q=; b=DBXqE7pMmv/a2ruOPbY13Np+OuXij5rE17wlqZzYl3pymE3ST491zFLvYwkULMd6nS mM6J5jx++J7ARxcFocBBPzBBnEK9oYMTZSqc48jNGN/i8EgBKyE0jpEx3kqvFncJmAbz 5p7ceCP7h41RTJWHjjrJfUBIbwpPNR6t64LtyjTXB6xeNEOoK6FpL9YrJ2abktTBKAAZ 75RW19eYN76HNleqS5/SKD3Y+lpPkNd/xVvzOxztjlJJgVusUS3kxRsJDjBIFndcE749 1F44WNHtPLZDz5prheSaI//+oTcQn9ss64pEsAic4x1pvo4Op35m3Ar45/6bmZdepIl2 CEbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722351443; x=1722956243; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=LQkDwkMKeHB3gfeZECnxLbG2/UiCvD08G2Fc8wZUh4Q=; b=XWj3EHc9g1CoqyVCGDrzXLP0Zml1DfPWq0lUYc+Q0c0puK8X2apZKFJ+PyLryTYlLi 4NC3xkgVhOkLSSXN39ug0cJ8fT+JxhOcfY8WsvRD5etJnGI9xPZz8P3ldVEryMp+MWa6 u98YrWR8zQy6N0xBQNNtN2hZ0XQBTpOtLnu1f9FiMt762iQAd00kq0DohSixRhaAUYGR AyvtigGeWSA8oM75k3Z++SH4G9JCJMfGvHCkuTZGfJO1Ei/IU0b7P2yxoaA2WExNe/8f MquhEMIS8zJWgO0G/+UlLdyDMghjExlEOuIWt+q7mly4lVU46suDik6ug6TnFij+/muO u3Wg== X-Gm-Message-State: AOJu0YwCNKsT0PyA+0UUR7v8vdTy7t6L9+f9Cb7pk4xvlaW6APq7zjfG Qlc65tdRs+DdKZ3RkoB4zN62VLxvaj1ocQCuox7taje5ORao2zg9XL081Vf+YaE= X-Google-Smtp-Source: AGHT+IE8K5z3y5NAb85msPqG0Tkidle9ZyftH1V9Ip7movF2FO60IW4SMO/JQ0qbCQRYVV7qKFrV1w== X-Received: by 2002:adf:b1da:0:b0:360:7856:fa62 with SMTP id ffacd0b85a97d-36b8c8e99e0mr1439005f8f.15.1722351442739; Tue, 30 Jul 2024 07:57:22 -0700 (PDT) Received: from [192.168.10.46] (146725694.box.freepro.com. [130.180.211.218]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-42808f684d0sm196227775e9.6.2024.07.30.07.57.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 30 Jul 2024 07:57:22 -0700 (PDT) Message-ID: <4448b729-5998-440c-939e-08e719070ac5@linaro.org> Date: Tue, 30 Jul 2024 16:57:21 +0200 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 v1] thermal: trip: Avoid skipping trips in thermal_zone_set_trips() To: "Rafael J. Wysocki" , Linux PM Cc: LKML , Lukasz Luba References: <12509184.O9o76ZdvQC@rjwysocki.net> Content-Language: en-US From: Daniel Lezcano In-Reply-To: <12509184.O9o76ZdvQC@rjwysocki.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 30/07/2024 16:41, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki > > Say there are 3 trip points A, B, C sorted in ascending temperature > order with no hysteresis. If the zone temerature is exactly equal to > B, thermal_zone_set_trips() will set the boundaries to A and C and the > hardware will not catch any crossing of B (either way) until either A > or C is crossed and the boundaries are changed. When the temperature is B, an interrupt fired which led to the thermal_zone_update() and in turn it calls thermal_zone_set_trips() As the current temperature is equal to trip B, it makes sense to set A and C, as B has been processes when handling the thermal trips right before calling thermal_zone_set_trips() I'm failing to understand the issue you describe Were you able to reproduce the issue with emul_temp ? > To avoid that, use non-strict inequalities when comparing the trip > threshold to the zone temperature in thermal_zone_set_trips(). > > In the example above, it will cause both boundaries to be set to B, > which is desirable because an interrupt will trigger when the zone > temperature becomes different from B regardless of which way it goes. > That will allow a new interval to be set depending on the direction of > the zone temperature change. > > Fixes: 893bae92237d ("thermal: trip: Make thermal_zone_set_trips() use trip thresholds") > Signed-off-by: Rafael J. Wysocki > --- > > 6.11-rc material. > > --- > drivers/thermal/thermal_trip.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > Index: linux-pm/drivers/thermal/thermal_trip.c > =================================================================== > --- linux-pm.orig/drivers/thermal/thermal_trip.c > +++ linux-pm/drivers/thermal/thermal_trip.c > @@ -82,10 +82,10 @@ void thermal_zone_set_trips(struct therm > return; > > for_each_trip_desc(tz, td) { > - if (td->threshold < tz->temperature && td->threshold > low) > + if (td->threshold <= tz->temperature && td->threshold > low) > low = td->threshold; > > - if (td->threshold > tz->temperature && td->threshold < high) > + if (td->threshold >= tz->temperature && td->threshold < high) > high = td->threshold; > } > > > > -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog