Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1671588ybv; Thu, 6 Feb 2020 07:51:48 -0800 (PST) X-Google-Smtp-Source: APXvYqwDVpAjGqREZMQRDcKIEOFVa7vN7lJijd/TgTfGKibXvATsM0b+5kmdXbPY3TCsC4n8eEQb X-Received: by 2002:aca:d484:: with SMTP id l126mr7176963oig.114.1581004308322; Thu, 06 Feb 2020 07:51:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581004308; cv=none; d=google.com; s=arc-20160816; b=YXgLjC7OAVxIIwVQ8bI1jYqdkTges3Ot4rnMfXi6ZWNUo2RqDCbTaquxw0GJqMacvv NymAiXrAzYgz5A3DFM3G2LtV6W4Y5KW/1pYqqDOYWh1x0iASlTfiRoUL6siTdvCY0pow 1zXyqw5cWq7X5S+2pC0XBL1vLIbWOGV+SYf9LY/OAuw5HGwldALwZq6TQxRIABYVPEBO o35TN1u2E9vY+GrDbu6uCUbR4GEnI0B/t3JJNnhilzuMMRTpjMVF6eELG6GRdjK3TCtC jSKYpeVqmTDb3naXI7fE2UeDgxxoReM8dbQFrlNm0zfn2r4BLUdGBBHOH+wy5KjM1U6+ HI+Q== 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=2z7Od7AIdCSkZNC7374lA2NlsyOZzZfwKDy4TXEDbrY=; b=aOjnPWUyRWMN9J43eHaelz64CEIuTpAv8NJShXfVWVzEEVU5GuwwIGa3Y50UP2+HIP 4HjH6W/om7vcjJRDiwYM4+UDxy4XHKoib9KRmzuASanUVc1TH9KX6MC9aSUkW75HncyR q3iVgcJZZ/H0c+OAYhepmrlp1SPXfBXp3gWqX6X+8+/Fvv1hoE1HTj4WErKkeroobc37 zZryziJfKlcXYihfTSe9DG+M6YuKY+FulBEmuyv8Y4eGULy1uT9nvEi1Ut9rV9YOvdNM NDr8Ai4pNALtIimSub+7SAwPwtny9ZAhdXnou39QNHn73NURf/368Bhm1+VTAnVD7fyp iElQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="Q3t0/qNL"; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e13si2021560otr.167.2020.02.06.07.51.34; Thu, 06 Feb 2020 07:51:48 -0800 (PST) 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=@gmail.com header.s=20161025 header.b="Q3t0/qNL"; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727556AbgBFPuN (ORCPT + 99 others); Thu, 6 Feb 2020 10:50:13 -0500 Received: from mail-lj1-f193.google.com ([209.85.208.193]:34795 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727389AbgBFPuM (ORCPT ); Thu, 6 Feb 2020 10:50:12 -0500 Received: by mail-lj1-f193.google.com with SMTP id x7so6643542ljc.1; Thu, 06 Feb 2020 07:50:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=2z7Od7AIdCSkZNC7374lA2NlsyOZzZfwKDy4TXEDbrY=; b=Q3t0/qNL+UoB49FPTKL2l6AygWLc2Ikx8S6igun8o4Sxcga+X8EBlP6Pcfh+DNmtYr 1gbf48dby6DxuMWq7iBRglbsJuy96fVKHwh9mVPEpM9XW0mldy/RKnUlSzp7Hnb1O3gP cqJy9WpdlsV3SZbs9nvkP346zyS1FKB1Wn9M3DvrRWjBYnYflpKLtzoUIuZVLFQy31CW mp+SQkz2nIB49UmXKzWMZPWFCbSqBL6auKXhVeRFKlznHkJyiYVF+1HX2yRixP2pEI1s lZGt4cZ7yqtMnZ+sTl6kF8/BNS2A7rjzOcqZOT3jyTy/ZYFr0TuzL9lKDc69ftfQXy1b z2lQ== 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=2z7Od7AIdCSkZNC7374lA2NlsyOZzZfwKDy4TXEDbrY=; b=dPuQ8B2e0VgTMP7Qrzfdt384HAB/OryfcqjXN09lLMhIr9JbiUP/KhIyunSXTc8qK3 dhTnjlcVTNj4AvFS3dJtzDGN/pPsWX0OR1MW/KO+jwO17Y2vJVnt5W7FvxcHpK1eC7br Oj3nhjBKFntCJQITG6hh1bBeUOeXT9ethe3H9aupWyfdKQptbisOJOokQKFaxGhk96Ty 4iQknQ4SjbLDL9Do9pPAxSdPxuiKPWD+1l96oOo+Sew9uRIC7ZETYVCXrYX3Eb6sN0eV H/4UTIhRInOWanhlqDZygxemVunWIi3GL9Qwl5UMIBV050ZVyIn1d40+Pj1mQQN3C+5N WLuw== X-Gm-Message-State: APjAAAUnTAQILzcynd0guxyDlyvhVbED9TIoaZGr5ZiVv3yfMa5w2kke GlwJGXJbJRwnfyhWeBAbiFdWfY5xS0NFG0Oj+38= X-Received: by 2002:a2e:7c08:: with SMTP id x8mr2432034ljc.185.1581004210164; Thu, 06 Feb 2020 07:50:10 -0800 (PST) MIME-Version: 1.0 References: <1580640419-6703-1-git-send-email-avi.shchislowski@wdc.com> <20200202192105.GA20107@roeck-us.net> <94cb1e97-18ed-ebec-23c2-b4d87434726a@roeck-us.net> <20200203214733.GA30898@roeck-us.net> In-Reply-To: From: Julian Calaby Date: Fri, 7 Feb 2020 02:49:58 +1100 Message-ID: Subject: Re: [PATCH 0/5] scsi: ufs: ufs device as a temperature sensor To: Avri Altman Cc: Avi Shchislowski , Guenter Roeck , Alim Akhtar , "James E.J. Bottomley" , "Martin K. Petersen" , "linux-kernel@vger.kernel.org" , "linux-scsi@vger.kernel.org" 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 Hi Avri, On Fri, Feb 7, 2020 at 12:41 AM Avri Altman wrote: > > > > > Hi Avri, > > > > On Thu, Feb 6, 2020 at 11:08 PM Avri Altman > > wrote: > > > > > > > > > > > > > > Hi Avi, > > > > > > > > On Thu, Feb 6, 2020 at 9:48 PM Avi Shchislowski > > > > wrote: > > > > > > > > > > As it become evident that the hwmon is not a viable option to > > implement > > > > ufs thermal notification, I would appreciate some concrete comments of > > this > > > > series. > > > > > > > > That isn't my reading of this thread. > > > > > > > > You have two options: > > > > 1. extend drivetemp if that makes sense for this particular application. > > > > 2. follow the model of other devices that happen to have a built-in > > > > temperature sensor and expose the hwmon compatible attributes as a > > > > subdevice > > > > > > > > It appears that option 1 isn't viable, so what about option 2? > > > This will require to export the ufs device management commands, > > > Which is privet to the ufs driver. > > > > > > This is not a viable option as well, because it will allow unrestricted access > > > (Including format etc.) to the storage device. > > > > > > Sorry for not making it clearer before. > > > > I should have clarified further: I meant having the UFS device > > register a HWMON driver using this API: > > https://www.kernel.org/doc/html/latest/hwmon/hwmon-kernel-api.html > > > > *Not* writing a separate HWMON driver that uses some private interface. > Ok. > Just one last question: > The ufs spec requires to be able to react upon an exception event from the device. > The thermal core provides an api in the form of thermal_notify_framework(). > What would be the hwmon equivalent for that? My understanding is that HWMON is just a standardised way to report hardware sensor data to userspace. There are "alarm" files that can be used to report fault conditions, so any action taken would have to be either managed by userspace or configured using thermal zones configured in the hardware's devicetree. thermal_notify_framework() is a way to notify the "other side" of a thermal zone to do something to reduce the temperature of that zone. E.g. spin up a fan or switch to a lower-power state to cool a CPU. Looking at your code, you're only implementing the "sensor" side of the thermal zone functionality, so your calls to thermal_notify_framework() won't do anything. Thanks, -- Julian Calaby Email: julian.calaby@gmail.com Profile: http://www.google.com/profiles/julian.calaby/