Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3528ybv; Thu, 6 Feb 2020 16:49:45 -0800 (PST) X-Google-Smtp-Source: APXvYqzovS0mohrMB/9TmJsUI1ce+KmiTP28j7TG4C6OhxfvKFU0ZLRuY2WCdIfaRZjZ204ZtFy4 X-Received: by 2002:a9d:63d6:: with SMTP id e22mr717160otl.72.1581036584928; Thu, 06 Feb 2020 16:49:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581036584; cv=none; d=google.com; s=arc-20160816; b=nOODvFM/OzCbpitjQw5qHFOVTM3I7QufRKWvc136gw911oKqmOm0dWXfsbx1mKU7Uf l+49dFR+n8z0cINYgfyVcAltGJSBvqq9xUfJCgFquBCdFagoDgKmNFXayG7Hxmyr0FD5 6ai8P1e0IcBjfHbUHjgWwChpySt7eDS+6wYBtMYkfyTZKA7ynXmRad1LWQiENl5NYtat 8gKKx9Ezt4MT0fL9gSqVLpS7OUGut9UhfjkafK5lxi3DAGs8Hs1dxFeG8pjur165E4G1 k63yc5+lDNz+1s1S9vTI4SyFeizonbDER1u1Ln2dQGsp3YTK4NxaYTNDTvT1+Ll4Uber NKeg== 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=AY8ajexCAjKq8Bc5ioUkiIPxTkipEMTNRaq2FmUDl74=; b=J2zmAhkQJXFfTVudYGZIgEvTnW9SJahxBgXm3OtPRSwUdyhLnkkNN3JkocVrc5J3KZ XrgNqH0jVcXi9EeO1gFABS2erkrWZEe8CIfpFbcQiPfAREedJvkIg5y+yQvNIoiB0uLl fWR0nyvZrq7i/eN8VLqhnZlMqHYWVNr8tL6WFO7jrXbAjAiySt9nEqwfcYuiWGLoREQz cXom4GJuwzWPtY6oAdC0RKEbL9mjbFk7zr8VeNR27Uf+eTSRcSeBlwM+n0xvkV1Ue+uf b6OgV25xbPF9Yy2GblQOJVhCb44yjXQCMRqFzsF0PYvuOu7iSAx9X37bw8MGTES5Rk/p 8bNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=hZQYTq7W; 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 c18si1100086ots.317.2020.02.06.16.49.28; Thu, 06 Feb 2020 16:49:44 -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=hZQYTq7W; 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 S1726838AbgBGArc (ORCPT + 99 others); Thu, 6 Feb 2020 19:47:32 -0500 Received: from mail-lj1-f193.google.com ([209.85.208.193]:44866 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726509AbgBGArc (ORCPT ); Thu, 6 Feb 2020 19:47:32 -0500 Received: by mail-lj1-f193.google.com with SMTP id q8so251540ljj.11; Thu, 06 Feb 2020 16:47:30 -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=AY8ajexCAjKq8Bc5ioUkiIPxTkipEMTNRaq2FmUDl74=; b=hZQYTq7WKtFbU46SHYU9FbNPt7fDY32V6tPM8LIdbg29M/Hhxr5KOsJeXzzGcM9H9/ EFtEwDiiYf9IJUT5cFwmYzIDR1RpyhQZem3mS07l8ORF74yatZkc35OGVGH/4lcQfkSm ghl82f09qpkYNh/FUGB7hgDpW/nrB7acERxNLGwared71ctAoeW2GBJwrxSH8fz8Km5W zrfgqDHUpSE6EbqjDMu+lUpS5Vn8NCQv5PntRn+d/54eJKcqPnB+MyN9/HMDPuZgnSSk 6tOhAaNvnlpHbS3axVeGiLdNxvgHHkGCslCGy0X1Oks5457PIOO9dLKs/bT5xREoaSyo 1N7Q== 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=AY8ajexCAjKq8Bc5ioUkiIPxTkipEMTNRaq2FmUDl74=; b=S97OPjCm1qBqy1+TiVbxxvbHiNLfcBe7NCwoWq0UIDJIQX4zGjNly8ZHfk06tL8FRw ldmpdOg0EJlreXxisuGpLkcbyf3dicHJTT8shCNKHp48PWX0zm7gf1my1I6G7BOZobQG DoNLudYe4m3kRT0bpKa5Q/XZbCr8LCGlwrEaCwjmuZyFUOhHtrNLUBCmmjTLMu1TayMy fjCiJ2yvNYikd1UD9G34LMHUppgbqiZEroP5ENE2KOwvv18v6pa0b9BoRQodsfBmNQLD 4I/Kdck9iZ0LQuPJQbC5MLiS+ACu1Y0nhaLg1f9mdI0yoSOmRfVTTCeppQN6iOy8dhLf x6gw== X-Gm-Message-State: APjAAAUwQ+uCu00xNnhm45uJHXCVli/DID3E86S0pBQTeNxWOMUtoPnc H+zPCD8akHRm4xw01CJt6RLqeY/b76y4RRoCznI= X-Received: by 2002:a2e:b6ce:: with SMTP id m14mr3412822ljo.99.1581036449777; Thu, 06 Feb 2020 16:47:29 -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 11:47:18 +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 6:32 AM Avri Altman wrote: > > Hi Julian, > > > > > > > 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. > Those "alarms" are implemented as part of the modules under drivers/hwmon/ isn't it? > We already established that this is not an option for the ufs driver. The HWMON API I pointed you to is a way for _any_ driver to implement the necessary bits and pieces to report temperatures, alarms, etc. It is _not_ restricted to modules under drivers/hwmon/ - you can implement all parts of the HWMON interface from any driver anywhere. Which means that all that is required to report alarms is to simply implement support for that particular type of file. > > 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. > Right. The thermal core allows to react to such notifications, > Provided that the thermal zone device has a governor defined, > And/or notify ops etc. Yes, but you don't define a cooling device, so there's nothing to react to those notifications. > Should the current patches implement those callbacks or not, > Can be discussed during their review process. > But the important thing is that the thermal core support it in an intuitive and simple way, > While the hwmon doesn't. > > We are indifference with respect of which subsystem to use. > The thermal core was our first choice because we bumped into it, > Looking for a way to raise thermal exceptions. > It provides the functionality we need, and other devices uses it, > Why the insistence not to use it? Other devices using the thermal zone subsystem implement both "sides" of the zone: a sensor that monitors the device and cooling device(s) which should be able to react to that. E.g. lowering the clock speed of a CPU, slowing the transmission speed of a WiFi card, etc. Your implementation doesn't do that. Thanks, -- Julian Calaby Email: julian.calaby@gmail.com Profile: http://www.google.com/profiles/julian.calaby/