Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1942117ybv; Thu, 6 Feb 2020 12:44:28 -0800 (PST) X-Google-Smtp-Source: APXvYqyI9rJcW3zvZA5RTlOKAdq1TZphhtP8yiao/Cv+gp9SOu1WE4LMCVJubRW21py0jjmGbFd4 X-Received: by 2002:a9d:7304:: with SMTP id e4mr29456942otk.99.1581021868844; Thu, 06 Feb 2020 12:44:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581021868; cv=none; d=google.com; s=arc-20160816; b=pciXw4caEmQYNhPEGjgri7bwFFuhwhzJ7RBQ0LIL9F14wOqGLA/kvXHzSE8c6EJz18 9tZ95lUdIo8OdwQKcqLbnISzzCIjWV4oXpdNCYHaei3ybvPCy1mWZSHya4dOrhk+U64j UgY08VaY9iVkwUo8N/w4pthvEttb5zrXOkZpHs3LuQRNFUw2F9liYPwZdx2iErxnRP2z hwXAj+qspSCzIsMtq5zs04n2EaPpI80+25grDaIxSs1sbDuEn8ZQff2ajp2Mh6sKiQiH xoHIdC0sT/wdFbdoLfnr91iuUkjZUJ1am4rfwErVyVfl17DfM9pv6F/6Oh7ODef0eTNK KXDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=fFfXRy75SE2j99TG+GoZCaMqB60SsrG/AWbtbzm954o=; b=OyhiHH1tNoHdcbJy8iMV6dT+ySF1+SWO+4K9ZguB1XLPQCRjb/3+pTNgJ4KdgJNe3r iNQQc98+2kuT8Xzgtd6lJpK5WpMrTKpXmJ1W4DMDcsrkMJXzRUnpSdwdf3G7SiQLbo3M KTk8N/R09rc4IYq714zhIb3qvdSS1w0iqHXaSvcVNGEqj72o/1ev+TZNDB0yXvhTqsDA +7BnMRQPBBSsNhzsxuUztJLyIpohrLdGDU6GgXVdupuDIjKiIHCANXX40B0BmBb90bdO /Wpf+fnS8j2dLFRH0RwP7VVl4/OkaCeXZbGXOftyFogq2rlGJs627kShfi3Fv/Aa2+l3 WVKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=vfyUCEYv; 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 n11si356260otk.290.2020.02.06.12.44.15; Thu, 06 Feb 2020 12:44:28 -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=fail header.i=@gmail.com header.s=20161025 header.b=vfyUCEYv; 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 S1727940AbgBFUmW (ORCPT + 99 others); Thu, 6 Feb 2020 15:42:22 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:37708 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727698AbgBFUmV (ORCPT ); Thu, 6 Feb 2020 15:42:21 -0500 Received: by mail-pl1-f195.google.com with SMTP id c23so37093plz.4; Thu, 06 Feb 2020 12:42:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=fFfXRy75SE2j99TG+GoZCaMqB60SsrG/AWbtbzm954o=; b=vfyUCEYvfOWSkNNXqfG/5nISqzUTck+tjMPtcs9vkWIAwYR4PdMEd2JPuBPLk3MRBP iB0DV7pGMZ30CksONlqCvv1BhUdPCTUfEoONuxoYlXI877TJmACrWBjuV1Q1eYqWyPyg Pe8JauYeCeL2JEdhxNQHhs+pTQzIefbdBcP0VvQrT03GoO7TDWKVsOT7H7Q12FxJKI02 v3fkL4B1XNKYB18u6Yq0V9JLfS+TIG0xaUrUKtyEO85BxS5rNjR8sRX3ReI2Ex3JtGiK GZgSPvO9NTJButHxyHjhe5vOCD4gPm+OaTsheqZtKNaTOt8c34y/Q5BsJ+ulB/j9MmXo bkxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=fFfXRy75SE2j99TG+GoZCaMqB60SsrG/AWbtbzm954o=; b=GXp9KUYQQ6+avp5MCpfg4grHUabkny3mOn9cz+LKxBPLh6z6bacRPbx8f3vrW1qqmO PPJjG9Ix1r3gkLBbpX3bvvqqw2Ry6tt+NGsXf8b7x8apxC/F2D7H25CzdrMy7NIa69bI cjO+NNc6IwUMGsJ37Gl6NAiLXB4fGPMgxoz/jnKbrrX7n3TRtD0kDpqC1pX9bXFhMPm1 7JUjtiNgZAwYe4eE9YehXRXyLbkGhzabAwCZUIYx20e/58ggxu87yG97o65onJXeIlnu x2LSq2Juf0vIpriwCmFvh8oiCBbe38nFApvJPyOOAFlpJopjlmIyIGZy/G6n3CfVUXzn 1BSQ== X-Gm-Message-State: APjAAAU63msMm0ZnaWQq9IGmrimM2LpBKo7nfu6gAm5Drc6qBEwtu39c qeojd+a1qdU+jy9mTD/XySk= X-Received: by 2002:a17:902:9890:: with SMTP id s16mr5737406plp.71.1581021740994; Thu, 06 Feb 2020 12:42:20 -0800 (PST) Received: from localhost ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id b12sm287311pfr.26.2020.02.06.12.42.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 06 Feb 2020 12:42:20 -0800 (PST) Date: Thu, 6 Feb 2020 12:42:19 -0800 From: Guenter Roeck To: Avri Altman Cc: Julian Calaby , Avi Shchislowski , Alim Akhtar , "James E.J. Bottomley" , "Martin K. Petersen" , "linux-kernel@vger.kernel.org" , "linux-scsi@vger.kernel.org" Subject: Re: [PATCH 0/5] scsi: ufs: ufs device as a temperature sensor Message-ID: <20200206204218.GA23857@roeck-us.net> References: <20200203214733.GA30898@roeck-us.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 06, 2020 at 07:32:12PM +0000, 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. You have established nothing. What exactly is not an option ? To create alarm attributes ? No one forces you to create any of those if you don't want to. > > > > > 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. > > 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. Not really. Quite the opposite; you are quite obviously heavily opposed to a hwmon driver. > 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? > As mentioned before, the hwmon subsystem lets you create a bridge to the thermal subsystem, it creates standard attributes to report temperatures instead of the private ones your patch provides, and it would result in simpler code. Why the insistence to _not_ use the hwmon subsystem ? Guenter