Return-Path: Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.intel.com (client-ip=192.55.52.93; helo=mga11.intel.com; envelope-from=james.feist@linux.intel.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.intel.com Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 46K72z3N4KzDq9D for ; Fri, 30 Aug 2019 02:14:01 +1000 (AEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Aug 2019 09:13:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,444,1559545200"; d="scan'208";a="380820314" Received: from skyhawk.jf.intel.com (HELO [10.54.51.81]) ([10.54.51.81]) by fmsmga005.fm.intel.com with ESMTP; 29 Aug 2019 09:13:57 -0700 Subject: Re: [phosphor-pid-control] scaling issue To: Patrick Venture , =?UTF-8?B?SGFuayBMaW91ICjlionmmYnnv7Ap?= Cc: "openbmc@lists.ozlabs.org" References: <369926533c3e448c9d1a0d28391fd688@quantatw.com> From: James Feist Message-ID: <580839e8-3185-35e7-7e49-b34cd4981b08@linux.intel.com> Date: Thu, 29 Aug 2019 09:13:57 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-BeenThere: openbmc@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development list for OpenBMC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Aug 2019 16:14:05 -0000 On 8/29/19 7:24 AM, Patrick Venture wrote: > On Wed, Aug 28, 2019 at 11:00 PM Hank Liou (劉晉翰) wrote: >> >> Hi Patrick, >> >> I think it's OK to parse the config min&max for temp sensors. > > So, iirc, the min/max in the json is only for sensors that write, and > not read. Sorry, I'm ramping up on a new team and slower to catch up > to emails. > > Yeah, the min/max in the json are for basically converting a > percentage value to a PWM values -- that's its initial goal. > Temperature sensors typically don't have minimum and maximum values in > the code's use-cases. I added James to this because they use the > daemon for other cases -- where perhaps that'll make sense. I believe the history of min/max being removed for passive sensors was here: https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-pid-control/+/23470 The only other use case we have for min / max is for fan RPM so that we can create a PID based on Tach %, so that the same PID can be reused on multiple platforms with different sized fans. -James > >> >> Any suggestion? >> >> Thanks, >> Hank >> >>> -----Original Message----- >>> From: openbmc [mailto:openbmc- >>> bounces+hank.liou=quantatw.com@lists.ozlabs.org] On Behalf Of Hank Liou >>> (劉晉翰) >>> Sent: Friday, August 23, 2019 4:31 PM >>> To: Patrick Venture ; James Feist >>> >>> Cc: openbmc@lists.ozlabs.org >>> Subject: RE: [phosphor-pid-control] scaling issue >>> >>> Hi Patrick, >>> >>>> -----Original Message----- >>>> From: Patrick Venture [mailto:venture@google.com] >>>> Sent: Wednesday, August 21, 2019 10:32 PM >>>> To: Hank Liou (劉晉翰) ; James Feist >>>> >>>> Cc: openbmc@lists.ozlabs.org >>>> Subject: Re: [phosphor-pid-control] scaling issue >>>> >>>> On Wed, Aug 21, 2019 at 1:11 AM Hank Liou (劉晉翰) >>>> wrote: >>>>> >>>>> Hi All, >>>>> >>>>> >>>>> After commit [1], I found my temp sensor reading would be re-scaled >>>>> by >>>> multiplying 1 over 255, making temperature into unfamiliar unit. Also >>>> the fan rpm reading would lie in [0,1] interval, letting the fan input >>>> to be 0 (since the input value of fan is from an integer array [2]). Are these >>> normal behaviors? >>>> Or do I miss something? >>>> >>>> Are you using dbus configuration or json? If json, can you attach your config. >>>> Since you're saying it was working and now isn't, I'm assuming there's >>>> something about the config being treated differently with the code >>>> changes in an unexpected way. >>> >>> I found pid control will first read min and max from dbus and then (before >>> commit [1]) revise them if >>> >>> info->min != conf::inheritValueFromDbus (in dbus/dbuspassive.cpp) >>> >>> After value initialization, the min and max would be the ones in json file (Json >>> file [3]). However, after commit [1] the min and max values of config would >>> not be fed into the fan control process. The scaling issue is originated from >>> commit [4] with the aim to treat fan rpm as percentage. It seems that commit >>> [1] unexpectedly affects temp sensors in the sense that the temp is the >>> integer reading not percentage. Before commit [1], it would not re-scale the >>> temp reading since my min and max are 0 [6]. >>> >>> >>> >>> There is another issue with commit [1]. Now the fan rpm would be something >>> like >>> >>> 1500 / 20000 = 0.075 >>> >>> where rpm max 20000 is from dbus. However the fan input function would >>> transfer double into int, which is 0 for 0.075 (see [5]). Hence the fan input is 0 >>> not percentage. Is there something wrong? >>> >>> [1] https://github.com/openbmc/phosphor-pid- >>> control/commit/fc2e803f5d9256944e18c7c878a441606b1f121c >>> [2] https://github.com/openbmc/phosphor-pid- >>> control/blob/a7ec8350d17b70153cebe666d3fbe88bddd02a1a/pid/fancontrolle >>> r.cpp#L86 >>> [3] >>> { >>> "name": "fan1", >>> "type": "fan", >>> "readPath": "/sys/class/hwmon/hwmon1/fan1_input", >>> "writePath": "/sys/class/hwmon/hwmon1/pwm1", >>> "min": 0, >>> "max": 255 >>> }, >>> { >>> "name": "temp1", >>> "type": "temp", >>> "readPath": "/xyz/openbmc_project/sensors/temperature/temp1", >>> "writePath": "", >>> "min": 0, >>> "max": 0 >>> } >>> [4] https://github.com/openbmc/phosphor-pid- >>> control/commit/75eb769d351434547899186f73ff70ae00d7934a >>> [5] https://github.com/openbmc/phosphor-pid- >>> control/blob/a7ec8350d17b70153cebe666d3fbe88bddd02a1a/pid/fancontrolle >>> r.cpp#L64 >>> [6] https://github.com/openbmc/phosphor-pid- >>> control/blob/a7ec8350d17b70153cebe666d3fbe88bddd02a1a/dbus/dbuspassi >>> ve.cpp#L158 >>> >>>> >>>>> >>>>> >>>>> [1] >>>>> https://github.com/openbmc/phosphor-pid- >>>> control/commit/fc2e803f5d92569 >>>>> 44e18c7c878a441606b1f121c >>>>> >>>>> [2] >>>>> https://github.com/openbmc/phosphor-pid- >>>> control/blob/a7ec8350d17b70153 >>>>> cebe666d3fbe88bddd02a1a/pid/fancontroller.cpp#L86 >>>>> >>>>> >>>>> Thanks, >>>>> >>>>> >>>>> Hank Liou >>>>> >>>>> Quanta Computer Inc. >>>>> >>>>> >>> >>> Sincerely, >>> Hank