Return-Path: Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=linux.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=mspinler@linux.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (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 4BBn5L4xbyzDqMt for ; Thu, 23 Jul 2020 06:25:10 +1000 (AEST) Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 06MKOvI9132744; Wed, 22 Jul 2020 16:25:07 -0400 Received: from ppma03wdc.us.ibm.com (ba.79.3fa9.ip4.static.sl-reverse.com [169.63.121.186]) by mx0a-001b2d01.pphosted.com with ESMTP id 32e1xxtyea-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 22 Jul 2020 16:25:02 -0400 Received: from pps.filterd (ppma03wdc.us.ibm.com [127.0.0.1]) by ppma03wdc.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 06MKL5Qu007930; Wed, 22 Jul 2020 20:23:40 GMT Received: from b01cxnp22035.gho.pok.ibm.com (b01cxnp22035.gho.pok.ibm.com [9.57.198.25]) by ppma03wdc.us.ibm.com with ESMTP id 32brq9ertj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 22 Jul 2020 20:23:40 +0000 Received: from b01ledav003.gho.pok.ibm.com (b01ledav003.gho.pok.ibm.com [9.57.199.108]) by b01cxnp22035.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 06MKNdCL36635036 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 22 Jul 2020 20:23:39 GMT Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A385EB2066; Wed, 22 Jul 2020 20:23:39 +0000 (GMT) Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4311CB205F; Wed, 22 Jul 2020 20:23:39 +0000 (GMT) Received: from [9.85.181.22] (unknown [9.85.181.22]) by b01ledav003.gho.pok.ibm.com (Postfix) with ESMTP; Wed, 22 Jul 2020 20:23:39 +0000 (GMT) Subject: Re: Hwmon scale timing issue To: =?UTF-8?B?RHVrZSBEdSAo5p2c56Wl5ZiJKQ==?= Cc: "openbmc@lists.ozlabs.org" , =?UTF-8?B?RWRkaWUgTHUgKOmZuOWuh+WyoSk=?= , =?UTF-8?B?RnJhbiBIc3UgKOW+kOiqjOismSk=?= , =?UTF-8?B?R2VvcmdlIEh1bmcgKOa0quW/oOaVrCk=?= References: From: Matt Spinler Message-ID: Date: Wed, 22 Jul 2020 15:23:39 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-07-22_13:2020-07-22, 2020-07-22 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 priorityscore=1501 bulkscore=0 mlxlogscore=921 clxscore=1015 phishscore=0 mlxscore=0 lowpriorityscore=0 suspectscore=0 impostorscore=0 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007220125 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: Wed, 22 Jul 2020 20:25:11 -0000 On 7/22/2020 4:00 AM, Duke Du (杜祥嘉) wrote: > > Hi Matt, > >    Thanks for solving sensor type issue, but I found another issue, > the scale would not apply when > > hwmon updated value in first time. For example, my battery 3.051 > voltage would record 3051 on dbus > > instead of 3.051 until hwmon update again. I think this is scale > timing issue for hwmon update value > > in first time. Some sensors interval configuration is so long such as > one day that would lead to > > record wrong value for a long time. > > I am not sure this line would lead to hwmon update value with > incorrect scale in first time. > > https://github.com/openbmc/phosphor-hwmon/blob/master/sensor.cpp#L170 > Hi, nice catch!  The bug was that the adjustValue() call that was supposed to apply the scale was running before the _scale variable was set. I put up a fix at https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-hwmon/+/34983. > Thanks > > Duke >