Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3812293pxu; Mon, 30 Nov 2020 10:44:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJwa+QVHSNjs8Q+NhsBwtVsTpcr9BhI1VcMZLMBsKdne6g8AByaSpTa7TEOcczw9T9bUmq8x X-Received: by 2002:a17:906:1e93:: with SMTP id e19mr22723708ejj.440.1606761877518; Mon, 30 Nov 2020 10:44:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606761877; cv=none; d=google.com; s=arc-20160816; b=balgbYOP6qmG9bPr4sDwfqIJYIOpTGyKS1D9qjYNugD7uckyeBsKJn3NlxBUDYrN8k flfehgjkoQX9E3HCY/yngitFmxXlt0XWK8aQWM+4dkVX5sDWRoH2BcMS7l+7vZ6tJ1VB X0m+jcWjrsrGhbYIzEmUVErwpsAk6VN77Fn4FCDATtm4nKz5n2BHBRtGdoVqWtv1w9+W wyqtnp4lxRtZ+QxSH6Ew93yWPKyl3Mkbnop+drW88DBK07VEje6Q4GwoSgqsRxQhchkd pfqHQcHxpVQo7C1l8ToCQzLKAM0H2myJ74tTQIja7iWTuMLKqgLb99FLYBHA+oQnlAGy P0fQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:ironport-sdr:ironport-sdr; bh=i4LCxnuCeihhDWqBGoIMeCmwn3fbDp0sduqaM3v4h2A=; b=C3QAqX1hRzyMXkdY34YPImzdtBT77Nqn6RdvjL70J8iCvOqgiAjvSn0bgkerfgvILp GXzVTUqWUu7aM1nUojT8rNOuQkl79GGwkXP9Qd4adNf4BxsflRxG792Uhp3aH+5hyRy9 vpa1mjVmjeFaTxxfiaoDUD/aL6UpcBbVx2Mjb2/7o7NR70L0QCPgNGVqCcLNRnG3fa09 2LBgPfcGSWv/wlef4iyCCkHQZjYDrhmCkYbTlsmfSYSzmoertbBX8KuzQPAqungA5PRL mBkO2Y8Lxlg8d2T7wpkTUv0gM6dDoLOcw+UDj0QhrIzkcSRd273KA09f+K6vyLEIX0ng atlQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c1si10656716ejx.607.2020.11.30.10.44.14; Mon, 30 Nov 2020 10:44:37 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729661AbgK3SlN (ORCPT + 99 others); Mon, 30 Nov 2020 13:41:13 -0500 Received: from mga04.intel.com ([192.55.52.120]:50761 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727182AbgK3SlN (ORCPT ); Mon, 30 Nov 2020 13:41:13 -0500 IronPort-SDR: fHZTW5Cr+3BVT1mMo++LBjAAL2lEndh8GVZwc9V6BmyVKJ2vfrjFCh4Li+7z+PAxK+5sx6SgRo 3aShGJ0BgIhw== X-IronPort-AV: E=McAfee;i="6000,8403,9821"; a="170124485" X-IronPort-AV: E=Sophos;i="5.78,382,1599548400"; d="scan'208";a="170124485" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Nov 2020 10:39:18 -0800 IronPort-SDR: msdywq7HqrNzT1Hb5ew0nb3WdQsbUFcBqRZZnlMw0NTddmC3lKbUAR/NXDbqIhHPtnwNK9ZcVY 6UAXf2JmV+2g== X-IronPort-AV: E=Sophos;i="5.78,382,1599548400"; d="scan'208";a="364356541" Received: from nathanhs-mobl1.amr.corp.intel.com ([10.209.72.72]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Nov 2020 10:39:18 -0800 Message-ID: Subject: Re: [PATCH 1/3] thermal: core: Add indication for userspace usage From: Srinivas Pandruvada To: Kai-Heng Feng Cc: Daniel Lezcano , Zhang Rui , amitk@kernel.org, "open list:THERMAL" , open list Date: Mon, 30 Nov 2020 10:39:17 -0800 In-Reply-To: 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> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.34.4 (3.34.4-1.fc31) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Thanks, Srinivas > > Kai-Heng > > > Thanks, > > Srinivas