Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3834264pxu; Wed, 9 Dec 2020 01:34:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJy+pjmlZQDNWYB7z5RhuxNwHBgcZUrdKO3D6S0GypgSlKgvc3vEW/44L8zxQGL72rBQs6gF X-Received: by 2002:a50:a694:: with SMTP id e20mr1132890edc.261.1607506475345; Wed, 09 Dec 2020 01:34:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607506475; cv=none; d=google.com; s=arc-20160816; b=U97oGSMassBdaLU5TxPqZr7lJ+hKCIb/NqmbNf8mqkaskkobsx5Qi1nV20/NFNpJ7t W3EVR+PE24z+JIKFdKxQdrLlK4zPo7Z+60j0OBL+fnFJkynY2Vj8wLrAiK0himCvC2Uj +61DX5isobVNHkZW5OnxoHVZG753PIVj9Mr5A45rsEFcYHtnfwAjFqRPMV0EPjscpiDD ITt7ioaTQx9TShUCmxR2IlH2AqlqdOB9xdyNWFY3J1qbkZ0MWAQOC+9ZxjH0+GIBQI3E dS6HdGQT8TwuTcBjy0vVpkkaKxFIFaN0wG0VfyohVUaqw4V+VduhQRT/PREWDQgi3F30 t0FQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=L61+JwkcFzkud7jR/ngEi5aVujc/do/nVLhcrDG/U8k=; b=nHDbTTmiTm1W4Q5mswHNOVEr8RPneNBqpCHvYnEaKmJ4/z1OmbRSAEL/8nuprRkI/i je01adEEU/ymoNkULW/4oC+uBr++LImleLQmMO8pTBLx7Md/UhlbdE3/1FLpmFny5cRX dM3g/Jms4YThpZYAlsmFqQEJRX5QJSBNku3m6L7b/bduWhbUjdrGCyKh7pmB0Dp2vqkh KtWRcHiZ2PIwoavskDmJjMEQF+or5qS+kYfLqK7IK7Ax5h2mww7ngRIJ9qCClrP+nLcC fXnBUZQ0FS3pozCgC7dUCZ7jsot/1TUeWeQQlteDcrEJsK/d+17qiFQpCFXOMqEb6X00 RbHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=k3RHRHtV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ay21si514263edb.575.2020.12.09.01.34.12; Wed, 09 Dec 2020 01:34:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=k3RHRHtV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729140AbgLIJaq (ORCPT + 99 others); Wed, 9 Dec 2020 04:30:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728613AbgLIJal (ORCPT ); Wed, 9 Dec 2020 04:30:41 -0500 Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43667C0613D6 for ; Wed, 9 Dec 2020 01:30:26 -0800 (PST) Received: by mail-wm1-x344.google.com with SMTP id a3so896657wmb.5 for ; Wed, 09 Dec 2020 01:30:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=L61+JwkcFzkud7jR/ngEi5aVujc/do/nVLhcrDG/U8k=; b=k3RHRHtV5XNvz0FnIXPif1joM+tCHTwCDBCVYI7Fkq4M8PyR36rHWwZVqjJXxHp3QR bnfXyMEYEdGkGiprQvtkTXJiOtwSOC0D+O9nk5moay5UV0Ylc7q4QFxcTr2MURouNGmn 7C93MSB4SgsK5E4IiQ/7ZYiTAHMCh7PDCyVQbIKDKkhfWlI5MtuwgjG8aR444jtUDXDQ QUpcCzgWiSEiOnkHysofod4gNjGzP/KjydFr/2dlxZIX2mUT8s66qZQXh+YYN3kO9nhj p45rN2rTcRaFWn59p8ud0TXlARrXzP6mo+f9SEz8/QSzT9Vv5tWscIQHk3KAsz4Ku4i4 +fPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=L61+JwkcFzkud7jR/ngEi5aVujc/do/nVLhcrDG/U8k=; b=ciYmt3/7POxItY87R/zUO6rVjNhobWuHGHPXPePBO2jPHBMtCFO2dco7KBwftWS6P6 wbhHe/ee9UlpF8JSBAa4DqB0H6mDfwwG/gvJ9bJq5PEocosw8wM8375/eaAKmzKh+GaH XCfrfleJds2VAPVqb6rcNapDAz8oEQI2hptPweqC1gzDG/5gknuRSUQKCysCTSRBxyAg dCJyBi3KtFw5SuEY96pBUuHlLp1HetUKW5ui2xa3o+eDL82zlB+zNBT4Sj152OKX1t9k bAt4m6uGml9k4gn/S2d4F/YUuHC9OO9eyVX9p6efifNh1kMczXVniT53saLKv0qceMrL JaCA== X-Gm-Message-State: AOAM530QUIYIuNtEMePVEEZQBnMKirPyxikQALtEMWajorpAT+yfqEYG MdpAsTXRDz3NMv4GsVbNzBbAPoT/mdwOnw== X-Received: by 2002:a1c:55ca:: with SMTP id j193mr1734133wmb.87.1607506224513; Wed, 09 Dec 2020 01:30:24 -0800 (PST) Received: from ?IPv6:2a01:e34:ed2f:f020:8cf2:3820:1fbd:70ad? ([2a01:e34:ed2f:f020:8cf2:3820:1fbd:70ad]) by smtp.googlemail.com with ESMTPSA id d8sm2053234wrp.44.2020.12.09.01.30.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 09 Dec 2020 01:30:23 -0800 (PST) Subject: Re: [PATCH 1/3] thermal: core: Add indication for userspace usage To: Kai-Heng Feng Cc: Srinivas Pandruvada , Zhang Rui , amitk@kernel.org, "open list:THERMAL" , open list References: <20201128175450.12456-1-kai.heng.feng@canonical.com> <004fe225-1009-06d8-b297-c03a4c67550f@linaro.org> <860126B8-1152-4EE3-B15E-B4E45EFE879F@canonical.com> <34348B03-5E27-49A0-A704-6332BAC00758@canonical.com> <585bb5d3ee5bea063795682108576c3464ba72b6.camel@linux.intel.com> From: Daniel Lezcano Message-ID: <4767b493-fa24-e294-66df-3989b72bfb01@linaro.org> Date: Wed, 9 Dec 2020 10:30:22 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/12/2020 06:36, Kai-Heng Feng wrote: > > >> On Dec 1, 2020, at 02:39, Srinivas Pandruvada wrote: >> >> On Tue, 2020-12-01 at 02:22 +0800, Kai-Heng Feng wrote: >>>> On Dec 1, 2020, at 02:13, Srinivas Pandruvada < >>>> srinivas.pandruvada@linux.intel.com> wrote: >>> >>> [snipped] >>> >>>>>> What about creating an new callback >>>>>> >>>>>> enum thermal_trip_status { >>>>>> THERMAL_TRIP_DISABLED = 0, >>>>>> THERMAL_TRIP_ENABLED, >>>>>> }; >>>>>> >>>>>> int get_trip_status(struct thermal_zone_device *, int trip, >>>>>> enum >>>>>> thermal_trip_status *state); >>>>>> >>>>>> Then in >>>>>> static void handle_thermal_trip(struct thermal_zone_device *tz, >>>>>> int >>>>>> trip) >>>>>> { >>>>>> >>>>>> /* before tz->ops->get_trip_temp(tz, trip, &trip_temp); */ >>>>>> if (tz->ops->get_trip_status) { >>>>>> enum thermal_trip_status *status; >>>>>> >>>>>> if (!tz->ops->get_trip_status(tz, trip, &status)) { >>>>>> if (status == THERMAL_TRIP_DISABLED) >>>>>> return; >>>>>> } >>>>>> } >>>>>> ... >>>>>> ... >>>>>> >>>>>> } >>>>>> >>>>>> >>>>>> This callback will help the cases: >>>>>> - Allows drivers to selectively disable certain trips during >>>>>> init >>>>>> state >>>>>> or system resume where there can be spikes or always. int340x >>>>>> drivers >>>>>> can disable always. >>>>> >>>>> This sounds really great. This is indeed can happen on system >>>>> resume, >>>>> before userspace process thaw. >>>>> >>>>>> - Still give options for drivers to handle critical trip even >>>>>> if >>>>>> they >>>>>> are bound to user space governors. User space process may be >>>>>> dead, >>>>>> so >>>>>> still allow kernel to process graceful shutdown >>>>> >>>>> To make the scenario happen, do we need a new sysfs to let >>>>> usespace >>>>> enable it with THERMAL_TRIP_ENABLED? >>>> This should be drivers call not user space. >>> >>> Understood. So after thermal_zone_device_register(), the driver can >>> decide to what to return on get_trip_temp(). >> get_trip_status() >> >>> Let me work on a new patch if there's no other concern. >> Better to wait for confirmation from Daniel and others. > > Daniel, > > Do you like Srinivas' proposed solution? > > I hope we can find a solution in upstream kernel soon. (just trying to figure out the full context) If the device is enumerated outside of a thermal zone, the sensor should not register in the thermal zone no ? -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog