Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3118247ybb; Mon, 6 Apr 2020 02:26:10 -0700 (PDT) X-Google-Smtp-Source: APiQypKWxcBEE/qcigO8LPf9dHFYkrZFHArFI38c3s1nAXbJD7NZvYluhtSHH62bH1wKcnFXpHLH X-Received: by 2002:a9d:7ccb:: with SMTP id r11mr17333716otn.204.1586165170636; Mon, 06 Apr 2020 02:26:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586165170; cv=none; d=google.com; s=arc-20160816; b=jhJIrL6Luci803zPf+ILcOq+7gPqNS7iMMAMnGTqcNHfjZcQbGt/gUpfsWu8xUswO6 V/2mFreD3fr5vETwjyieXe1OL6gKdT/+D3/RvLYGvhnIY8t4S2OXJOpdiPlV5LYCNA1r GxgZeae0ND8xwI7Eqezir6orvyO3O9llqRaCGEBzt3qBM8Zr888Lcxji+wfG1uSaikTb X1XGtAcY88e59zVvQhCgONfLcEHuA8TdKAyy6PI/6BwFj5+8kDlF9EePedD3ILQpBaUn tyBm9snZyzSaSogjFLbvssjUS6x5S2qa+ZOHYv7AkDO1hjEGuUq8CM8o/m8hC/ksMDr7 heGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=+Jkl5CwkBjT6BLZjWifTBiWjf1dpkao6vvkn1JtNrnw=; b=z4fnAPiNOwOxWRhxB4YWt+pAms7mX+VsxNfmDPXNvDkcFYIQt78Q9F4HxxrsFAydVc rZfV1z98lOhBUvY8HJ/nnC8d+rXu6dqZywQlm91Py3Nx9D66yYoyq91mEOu4KeVTz2LH pcsGGS/ZocMkWMpomHwOsE5I2jR3L1KQFyRMD/KVL89mtYEJT0wl3PLdsRs1z0WfT06i CzpDXWct3UZ2LrA8JsbPORbUuNPWep5X5kjS3QNBcZLQcHmfm7b9diEPI8N+HS7iAutq YSyMJW2AAA8GbtFwPIgoirVuf05ZVc66S1QvsNBn7W/TFr4WZif794J+QDT3PBog0DjS /mLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@verdurent-com.20150623.gappssmtp.com header.s=20150623 header.b=epaSpNY0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f6si7491510oom.58.2020.04.06.02.25.58; Mon, 06 Apr 2020 02:26:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@verdurent-com.20150623.gappssmtp.com header.s=20150623 header.b=epaSpNY0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726691AbgDFJZX (ORCPT + 99 others); Mon, 6 Apr 2020 05:25:23 -0400 Received: from mail-vk1-f196.google.com ([209.85.221.196]:44767 "EHLO mail-vk1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726659AbgDFJZX (ORCPT ); Mon, 6 Apr 2020 05:25:23 -0400 Received: by mail-vk1-f196.google.com with SMTP id s194so3764489vkb.11 for ; Mon, 06 Apr 2020 02:25:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=verdurent-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=+Jkl5CwkBjT6BLZjWifTBiWjf1dpkao6vvkn1JtNrnw=; b=epaSpNY0AlXvZtQT8gmSkq7YCfCu+H9+4NsGD1EHtUBhiLj7GDKMDP1ju49fLI5pyq pCfSD8KQrN8wMk0FTuTi2fnZ4h0Pl8oDK+75YZP2xKILvVSQ3minilK9OH1HY/2YgtYm pUJ/DhYHYK9Dc6Ak3LSqf7BfvYkxmegzELpkt/yCCPAC6ry0lHe2lNsC/shqs5Rez1SL v/rQ54yfzAVQjvCw8wjwJ/enwXxnVSh+emOgr25K8vE6pmslN3F88JkGQ6h987Qe5lZ+ 9in6Ft3/bkoh+LkqRPVXSvCoGTJD1LDrdL0hZucIf+Rm8VUlfZMDXFwICxkBeNpRXcwh KHdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+Jkl5CwkBjT6BLZjWifTBiWjf1dpkao6vvkn1JtNrnw=; b=nzddxZCG4XbcH59mCZ6vjJalmz3YJv5bFAoRMh/8GtkwHZK4dHPochNzhRNETcqM1e DPeP2MKXuPRstUIWSD/CdyCI16zlqvyic3OFv/pFOE/+uZHlj9ms15tBGsJx0tjRSARO ltv8Pq/Oy/9/HKxac953+/cprfM2ooCSr/ts/UPIJB4piI+p0RwsOqjDi7t/W4pw+jFV IA6oskszXPe9fVUQnwacyQlmLCr7ouubaUUFs9kGobuwAf/5EJfgoDSVycV0mOS2D90g jC9tZXcXcYN7tXWB/sDZxaq7fuNfmixStRL21BnIDsJn8yBJ4c+IC9jwCd3vesf6GXFp ZYuw== X-Gm-Message-State: AGi0PuYkcSK4L1pIICQfq2mFdxmo+i3akrnmvB4xnQOwYtwj2nI8Psmu TSmhpzvK4IfH02swJpxd4721ETQEC3jWxVjkmBr6Tw== X-Received: by 2002:a1f:1e11:: with SMTP id e17mr2996833vke.73.1586165122498; Mon, 06 Apr 2020 02:25:22 -0700 (PDT) MIME-Version: 1.0 References: <20200402142116.22869-1-daniel.lezcano@linaro.org> In-Reply-To: <20200402142116.22869-1-daniel.lezcano@linaro.org> From: Amit Kucheria Date: Mon, 6 Apr 2020 14:55:11 +0530 Message-ID: Subject: Re: [PATCH] thermal: core: Send a sysfs notification on trip points To: Daniel Lezcano Cc: Zhang Rui , vincent.whitchurch@axis.com, "open list:THERMAL" , open list Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 2, 2020 at 7:53 PM Daniel Lezcano wrote: > > Currently the userspace has no easy way to get notified when a > specific trip point was crossed. There are a couple of approaches: > > - the userspace polls the sysfs temperature with usually an > unacceptable delay between the trip temperature point crossing and > the moment it is detected, or a high polling rate with an > unacceptable number of wakeup events. > > - the thermal zone is set to be managed by an userspace governor in > order to receive the uevent even if the thermal zone needs to be > managed by another governor. > > These changes allow to send a sysfs notification on the > trip_point_*_temp when the temperature is getting higher than the trip > point temperature. By this way, the userspace can be notified > everytime when the trip point is crossed, this is useful for the > thermal Android HAL or for notification to be sent via d-bus. > > That allows the userspace to manage the applications based on specific > alerts on different thermal zones to mitigate the skin temperature, > letting the kernel governors handle the high temperature for hardware > like the CPU, the GPU or the modem. > > The temperature can be oscillating around a trip point and the event > will be sent multiple times. It is up to the userspace to deal with > this situation. Thinking about this a bit more, userspace might want a notification when the temperature reduces and crosses the threshold on its way down too. Currently, we're only sending the notification on the way up. How should userspace know when to stop mitigation activity other than constantly polling the TZ temperature? > The following userspace program allows to monitor those events: > > struct trip_data { > int fd; > int temperature; > const char *path; > }; > [snip]