Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp467542lqt; Thu, 6 Jun 2024 08:43:37 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV73Hyt17QEt93FdA8UgtycvX37Lc8YO9wvK4fqph7t03/Kvfwxv6M5dxu8UB5V5lg4mFrI7UfuTRlnR1pcHS8Wr8ESXODKjmwcQ4766g== X-Google-Smtp-Source: AGHT+IF0kAe44LHjHHJvUECUJZKVh3ZKad7wlqtF6PEuXm+8uYBZCMIQe8FrupS6XGTQXhGGMLkV X-Received: by 2002:a17:902:d2c4:b0:1f6:5bba:f134 with SMTP id d9443c01a7336-1f6a5a5c189mr71182665ad.46.1717688617433; Thu, 06 Jun 2024 08:43:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717688617; cv=pass; d=google.com; s=arc-20160816; b=woLlT97kskRgXvM4bknC3EJM+VEvXuwqocQByGS2T882kNRuBPsKHxZ5dB8giMv/SX EauSpXT5sGzcntBnxy9QVt23IqU7axPdVdbrmqNjChBaDIVxQJ6CG6QcST5NdgnxP5Jg IUj+Ll3F8Df2MS+2yqiBdbdekDLjSihTBzExyK7mnHAP0nvQ8wQ6iN5fC3NL8KuUWMXb YbMdVz88tvJqYhPbcS555fktwTecuT4DGPP3six3wzUEz63N5l1YDuxCf6rnQfzIf4jL CgW0XWRYZ9C8ujCb5VkWEqMEvp9OJ4kLy4fGzdvB2CuhRBhZnvVd4YbtaMmXkfCb1mVP CHOw== 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:dkim-signature; bh=4eQN39Nkp7zX3QVgBwh8fSEqWjLG+WRfJd6VENywnME=; fh=sruy826NOpihcmztWc+i4Y/V0F93b5HIqz5khqEmTXo=; b=rlA3zxRxTqDMQP54Ur8g8gaPn4S+Z0GFZeWdjEsw4Focok685zx4AAVzdtM6cHaCPe EQuJhWbqZd82O/GPFCtAvTBiZb350uVpfGLKr2i8t8qTCNtQYzHDyO910JoK0/1pb7Te lNdTIvgw1guxLRalj7E1dnVa1P3hncDyRCAspVVUkJOWF9sGzeHKtaXTWU80hvupcl8a z/Lh7hSRmwQ1FZMCjgTuy0GyCxF+SoG5IAb+j0oVbwIzTituvEyHscTyw82NkLC5WHHL Qc1RqAxmPtIELAU1qe11yrSVnDP9IlQU/Bg0ClgpqHalxnXAWfB9He2YH6uW6WS0LDmZ FelQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TIGotSiG; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-204527-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204527-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id d9443c01a7336-1f6bd7e4feesi13712615ad.371.2024.06.06.08.43.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 08:43:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-204527-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TIGotSiG; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-204527-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204527-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 70441B304E2 for ; Thu, 6 Jun 2024 15:12:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A17DF19FA8B; Thu, 6 Jun 2024 14:50:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="TIGotSiG" Received: from mail-lj1-f178.google.com (mail-lj1-f178.google.com [209.85.208.178]) (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 51DB81A01B9 for ; Thu, 6 Jun 2024 14:50:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717685431; cv=none; b=NJJqO6dXWdeQb74PFF5XsNAFXQp7RkytrOiuHsKeQhm6+NmeoaZJJto9OFkzsLX72ulbfA+U+5k2zFBgbUlZqdTjjizub8aQr0fm2QOqWvfSU/SETKIuv0pXGDPuBr8e5IErKRNHX2Gnf0izYvXZKWTymbLpDsxJ0R+TtD3yp/w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717685431; c=relaxed/simple; bh=ZvQ1pENygtYl6o/j4xo9oIYijYCQF5WO63/exjSZDws=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=X+Zo/xgIUXHLPtQ3NEy981vcu4r/gCLm/Z2Dv/SEyuem/6U7YawDDkwjg4JcZm5Kvi51TsrXIRZbiVBPOyA/DRhR5I2Aq1HjItvaDw1PpT+W5in92QIwSuqO9xn8HD1HtNtRmi8GvZjDjeknD+z/VDL62CsqQMg4rp/lwxSfg0w= 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=TIGotSiG; arc=none smtp.client-ip=209.85.208.178 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-lj1-f178.google.com with SMTP id 38308e7fff4ca-2eaad2c673fso15171041fa.3 for ; Thu, 06 Jun 2024 07:50:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1717685425; x=1718290225; 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=4eQN39Nkp7zX3QVgBwh8fSEqWjLG+WRfJd6VENywnME=; b=TIGotSiGK97J3TK+yfmqtjjNklSBHm66MwWyCUGJXLj+XmQDPe65PDDJm6XcbruucD iHmPmpcfG0Rlm6ZVsR2+EvUYW3rZh3X2NKShJ3GkgHtMFlNry/aXUDHfX51C/bAhgAN8 NOawqkWoe4VUw8T290hGNjFUmxBSYTnnoxuJSfmD6k2Dlsb64pWU7dxJD3YABhZFSzp5 Wno34xAVdS3rl9Uus8ljaa9cZH3XGZKLOij4v7m8TQs9CQbcleXtNQcrdNJ6TCYCNtx7 ThkV+eO2NurqGYQWx/00WnDlDlnjg06Hok/M2b5Kyghg/+nitVbiAAjyImR+c0BzQrGO ZWsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717685425; x=1718290225; 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=4eQN39Nkp7zX3QVgBwh8fSEqWjLG+WRfJd6VENywnME=; b=haa19sO6FocxuFjXwFt9ApgJmnqFH8IRMk45ccKGfzfzL4eXPPSx3uHEeHEIMAyAfc O6/LPkeEfi+t4+STP7+EbACVNcBZi8a5x294cfJ5YiSg5T+EQqXkipzB7humfrDWAjCc 1o0TIWB+1Z+uVdDdxh0AhgTqaAstYgcgQgr+T7VetQLVNl2YE1tKgiB7TUcj1BfdwfkS 4ErD9tJ6zgxfL/KKHE3YCEH8f3CZzWg9awQBVm8Lb9kxhbrhGPfSUhZjesdPtXIA3vzJ XTNo9/W1u22E82h/8cGGUx89Gn6HkDTEZ13XbgkvojzrJE6/AbIhsGg96nHbMgdwtMgz ptsw== X-Forwarded-Encrypted: i=1; AJvYcCUZ+bjOZzRHk/jR9fve32n4oU2f5uLJVYhbCy7vCxkzCYM3x1G6+lMtB51epHA0p9hWFtmQ2onpCftTCSJQmnroJhJPNR2+3F+LMfDf X-Gm-Message-State: AOJu0YyBl18K3R9LeBQug1U8mpCOsXKuTbXXhfXh4THtDM+f1yzG00fI 8c5WLa/dG8fB8jIWUPhROpCikudZakxD8Zhswp47kd+nGlSxMrInKTS48QPI2F4= X-Received: by 2002:a05:651c:1a2a:b0:2de:ca7f:c849 with SMTP id 38308e7fff4ca-2eac7a7fcd5mr50121091fa.43.1717685425433; Thu, 06 Jun 2024 07:50:25 -0700 (PDT) Received: from ?IPV6:2a05:6e02:1041:c10:f9a9:3740:b905:9995? ([2a05:6e02:1041:c10:f9a9:3740:b905:9995]) by smtp.googlemail.com with ESMTPSA id a640c23a62f3a-a6c8070ea54sm106413366b.157.2024.06.06.07.50.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 06 Jun 2024 07:50:24 -0700 (PDT) Message-ID: <90a9df3e-153f-4972-8086-13c21a574763@linaro.org> Date: Thu, 6 Jun 2024 16:50:24 +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: core: Do not fail cdev registration because of invalid initial state To: "Rafael J. Wysocki" Cc: "Rafael J. Wysocki" , Linux PM , Linux ACPI , LKML , Lukasz Luba , Srinivas Pandruvada , Zhang Rui , Laura Nao References: <4569763.LvFx2qVVIh@kreacher> <5f93f034-f781-47e0-b8ce-3c8407a709f7@linaro.org> Content-Language: en-US From: Daniel Lezcano In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 06/06/2024 16:18, Rafael J. Wysocki wrote: > On Thu, Jun 6, 2024 at 3:42 PM Rafael J. Wysocki wrote: >> >> On Thu, Jun 6, 2024 at 3:07 PM Daniel Lezcano wrote: >>> >>> On 05/06/2024 21:17, Rafael J. Wysocki wrote: >>>> From: Rafael J. Wysocki >>>> >>>> It is reported that commit 31a0fa0019b0 ("thermal/debugfs: Pass cooling >>>> device state to thermal_debug_cdev_add()") causes the ACPI fan driver >>>> to fail probing on some systems which turns out to be due to the _FST >>>> control method returning an invalid value until _FSL is first evaluated >>>> for the given fan. If this happens, the .get_cur_state() cooling device >>>> callback returns an error and __thermal_cooling_device_register() fails >>>> as uses that callback after commit 31a0fa0019b0. >>>> >>>> Arguably, _FST should not return an inavlid value even if it is >>>> evaluated before _FSL, so this may be regarded as a platform firmware >>>> issue, but at the same time it is not a good enough reason for failing >>>> the cooling device registration where the initial cooling device state >>>> is only needed to initialize a thermal debug facility. >>>> >>>> Accordingly, modify __thermal_cooling_device_register() to pass a >>>> negative state value to thermal_debug_cdev_add() instead of failing >>>> if the initial .get_cur_state() callback invocation fails and adjust >>>> the thermal debug code to ignore negative cooling device state values. >>>> >>>> Fixes: 31a0fa0019b0 ("thermal/debugfs: Pass cooling device state to thermal_debug_cdev_add()") >>>> Closes: https://lore.kernel.org/linux-acpi/20240530153727.843378-1-laura.nao@collabora.com >>>> Reported-by: Laura Nao >>>> Tested-by: Laura Nao >>>> Signed-off-by: Rafael J. Wysocki >>> >>> As it is a driver issue, it should be fixed in the driver, not in the >>> core code. The resulting code logic in the core is trying to deal with >>> bad driver behavior, it does not really seem appropriate. > > Besides, I don't quite agree with dismissing it as a driver issue. If > a driver cannot determine the cooling device state, it should not be > required to make it up. > > Because .get_cur_state() is specifically designed to be able to return > an error, the core should be prepared to deal with errors returned by > it and propagating the error is not always the best choice, like in > this particular case. > >>> The core code has been clean up from the high friction it had with the >>> legacy ACPI code. It would be nice to continue it this direction. > > This isn't really ACPI specific. Any driver can return an error from > .get_cur_state() if it has a good enough reason. We are talking about registration time, right? If the driver is registering too soon, eg. the firmware is not ready, should it fix the moment it is registering the cooling device when it is sure the firmware completed its initialization ? >> Essentially, you are saying that .get_cur_state() should not return an >> error even if it gets an utterly invalid value from the platform >> firmware. >> >> What value should it return then? -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog