From patchwork Thu Mar 1 22:44:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eddie James X-Patchwork-Id: 880156 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zsnbD1LvSz9s7P for ; Fri, 2 Mar 2018 09:46:00 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3zsnbC5F12zF1ns for ; Fri, 2 Mar 2018 09:45:59 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com X-Original-To: openbmc@lists.ozlabs.org Delivered-To: openbmc@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.158.5; helo=mx0a-001b2d01.pphosted.com; envelope-from=eajames@linux.vnet.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (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 3zsnYX1NWJzF1mj for ; Fri, 2 Mar 2018 09:44:31 +1100 (AEDT) Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w21MhmD2059571 for ; Thu, 1 Mar 2018 17:44:29 -0500 Received: from e17.ny.us.ibm.com (e17.ny.us.ibm.com [129.33.205.207]) by mx0b-001b2d01.pphosted.com with ESMTP id 2gepmb17fd-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 01 Mar 2018 17:44:28 -0500 Received: from localhost by e17.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 1 Mar 2018 17:44:28 -0500 Received: from b01cxnp22035.gho.pok.ibm.com (9.57.198.25) by e17.ny.us.ibm.com (146.89.104.204) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 1 Mar 2018 17:44:26 -0500 Received: from b01ledav004.gho.pok.ibm.com (b01ledav004.gho.pok.ibm.com [9.57.199.109]) by b01cxnp22035.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w21MiPPk45678608; Thu, 1 Mar 2018 22:44:25 GMT Received: from b01ledav004.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 005C8112047; Thu, 1 Mar 2018 17:42:45 -0500 (EST) Received: from talon7.ibm.com (unknown [9.85.161.189]) by b01ledav004.gho.pok.ibm.com (Postfix) with ESMTP id 8477D112034; Thu, 1 Mar 2018 17:42:44 -0500 (EST) From: Eddie James To: openbmc@lists.ozlabs.org Subject: [PATCH linux dev-4.13 1/2] Revert "drivers/hwmon/occ: Add temperature fault attribute and VRM temp alarm" Date: Thu, 1 Mar 2018 16:44:18 -0600 X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1519944259-27898-1-git-send-email-eajames@linux.vnet.ibm.com> References: <1519944259-27898-1-git-send-email-eajames@linux.vnet.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 18030122-0040-0000-0000-00000400BFA3 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00008609; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000254; SDB=6.00996985; UDB=6.00506901; IPR=6.00776303; MB=3.00019807; MTD=3.00000008; XFM=3.00000015; UTC=2018-03-01 22:44:27 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18030122-0041-0000-0000-00000801C056 Message-Id: <1519944259-27898-3-git-send-email-eajames@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-03-01_12:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1803010276 X-BeenThere: openbmc@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Development list for OpenBMC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Edward A. James" , spinler@linux.vnet.ibm.com Errors-To: openbmc-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "openbmc" From: "Edward A. James" This reverts commit e55423ee10a5057338d24383c00e813436a126ea. Apologies for pushing this up so early... Userspace applications aren't ready for this change. The hwmon polling application cannot accept EGAIN yet, and we can't be returning apparent errors if the sensor is temporarily unavailable. Brad Bishop wrote: > userspace retries for a configurable period on eio, etimedout, > ebadmsg, eagain, and exnio. It also exits cleanly on enoent. > > If any of these errnos don’t go away after the configured number of retry > attempts, an error is logged. Any other errnos and an error is logged > immediately. If this list needs improvement I’d love to hear about it. > > ebadmsg and enxio are observed when i2c devices are unplugged with transfers > in various stages of flight. They occur just before the driver is unbound > after the presence gpio toggle on these devices is noticed and processed > (killing the hwmon userspace daemon cleanly). > > eio, etimedout seem to be bus type errors that appear somewhat infrequently, > but occur nevertheless. > > we all know what eagain means... > > It isn’t so much that the hwmon userspace doesn’t support this change, > its just the resulting behavior difference at the other end of the > hwmon abi <-> dbus api translation is not optimal, right now. > > 1 - Without this change, the hwmon userspace reads a value of 0 out of > the sysfs attribute and happily reports that as the temp at the DBus level. > > With this change, the hwmon userspace would read the attribute, get an > error and retry for a bit. After a number of retries, the error is > logged and the sensor is marked faulted at a dbus level. > > The issue is the consumer of the sensor at the dbus level. Today, the > dbus consumer happens to translate the sensor value of zero into the > desired behavior. If we submit this change the sensor will be put > into faulted state and the consuming application doesn’t have support > for that yet. > > We have open issues to enhance the application to support faulted sensors, > its just not implemented yet. OpenBMC-Staging-Count: 1 Signed-off-by: Eddie James Signed-off-by: Joel Stanley --- drivers/hwmon/occ/common.c | 33 +++------------------------------ 1 file changed, 3 insertions(+), 30 deletions(-) diff --git a/drivers/hwmon/occ/common.c b/drivers/hwmon/occ/common.c index 7c97a4c..a5c4df0 100644 --- a/drivers/hwmon/occ/common.c +++ b/drivers/hwmon/occ/common.c @@ -304,24 +304,11 @@ static ssize_t occ_show_temp_2(struct device *dev, val = get_unaligned_be32(&temp->sensor_id); break; case 1: - val = temp->value; - if (val == OCC_TEMP_SENSOR_FAULT) - return -EREMOTEIO; - - if (temp->fru_type != OCC_FRU_TYPE_VRM) { - /* sensor not ready */ - if (val == 0) - return -EAGAIN; - - val *= 1000; /* millidegrees */ - } + val = temp->value * 1000; break; case 2: val = temp->fru_type; break; - case 3: - val = temp->value == OCC_TEMP_SENSOR_FAULT; - break; default: return -EINVAL; } @@ -790,7 +777,7 @@ static int occ_setup_sensor_attrs(struct occ *occ) num_attrs += (sensors->temp.num_sensors * 2); break; case 2: - num_attrs += (sensors->temp.num_sensors * 4); + num_attrs += (sensors->temp.num_sensors * 3); show_temp = occ_show_temp_2; break; default: @@ -863,22 +850,13 @@ static int occ_setup_sensor_attrs(struct occ *occ) for (i = 0; i < sensors->temp.num_sensors; ++i) { s = i + 1; - temp = ((struct temp_sensor_2 *)sensors->temp.data) + i; snprintf(attr->name, sizeof(attr->name), "temp%d_label", s); attr->sensor = OCC_INIT_ATTR(attr->name, 0444, show_temp, NULL, 0, i); attr++; - if (sensors->temp.version > 1 && - temp->fru_type == OCC_FRU_TYPE_VRM) { - snprintf(attr->name, sizeof(attr->name), - "temp%d_alarm", s); - } else { - snprintf(attr->name, sizeof(attr->name), - "temp%d_input", s); - } - + snprintf(attr->name, sizeof(attr->name), "temp%d_input", s); attr->sensor = OCC_INIT_ATTR(attr->name, 0444, show_temp, NULL, 1, i); attr++; @@ -890,11 +868,6 @@ static int occ_setup_sensor_attrs(struct occ *occ) show_temp, NULL, 2, i); attr++; - snprintf(attr->name, sizeof(attr->name), - "temp%d_fault", s); - attr->sensor = OCC_INIT_ATTR(attr->name, 0444, - show_temp, NULL, 3, i); - attr++; } }