Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1245304pxb; Fri, 22 Jan 2021 10:26:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJyx1Nv44E7VcvZKF+sl3Nyienevkua0E3W5W8eFj2bq8vZ7Xi0anGzf7RWpW4uk0KsL132e X-Received: by 2002:a17:906:3603:: with SMTP id q3mr3711417ejb.382.1611339969551; Fri, 22 Jan 2021 10:26:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611339969; cv=none; d=google.com; s=arc-20160816; b=SqneZOEVafXxCdKhFIgQrpDzWDSe5O0rHwBdH5g18jOFsgGunVorURPNCEyFORb5PX M3dmmmJa693QWThB652eB0mCKQzRdwLwSr4LJWyHzDB2v9eEeVKZX9YuaMQvlk2C6Nj7 suv6EQDvrNjtLo+LeFoUucEpEphttXbir0hQcxCMY6spo2Oh/D0yDnStYOzdMvZ5cQiH BV8DUsNG2XbY1rSDCh/oiV+T30sWpk8kRgm7leCtwgfpL6RQ6Ff8OJS2N61VggQSipbU 5mCMSYSTpAPBiiEzk3nZhL3Pq2Q0nre0G6xJL9uBVOcmbgO+jj0iY9qfpCuMqS/Kunha djhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9JpsMcufigrzcTQ9+8C8YmPDIM8/PvbFpgNxVbfET3k=; b=oKDWxjSd7IgnduPxWsHaKB8wUuxlEgoQzGC2gRfU8rnruqmx33kUbhv/0yXiVHPMr7 YDevz0i/qXQ1rXZOcPTTXgJW/GDbwAAwkVnLwUfZzur57bNtWgTyKMjlinkR2zDrCmu2 BJbADynYAc9rstAPMDT4w9xXXAvyeW2k7vyu9LaNRS3VnMRCmjL1FJMeCSLWMtybocxP ROOB1uENCfbuslP1DOgqZI3QCliR+QIVarWmNklW8XPUJaPgFS7TST5jMwt8B2HTpRoi D+s1OnSojNk1AG3XiAix+NA60a1tFJlh12myGFojAFLF+RO9cqqnMKZVN+uE8cNa6mji IG+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mxWxTsUJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u10si3272544ejr.222.2021.01.22.10.25.45; Fri, 22 Jan 2021 10:26:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mxWxTsUJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729851AbhAVSXi (ORCPT + 99 others); Fri, 22 Jan 2021 13:23:38 -0500 Received: from mail.kernel.org ([198.145.29.99]:39060 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728590AbhAVOXQ (ORCPT ); Fri, 22 Jan 2021 09:23:16 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2224F23B7E; Fri, 22 Jan 2021 14:17:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1611325059; bh=BreF1d2jKNiFg+Fwk9ONHe4R+VqIPJQd+QFwBQeAnSI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mxWxTsUJa9UxePD6GwJc3JtnJJu4K8ktPxZa6mGzb1BMmJ9q34nD4YvPOBgPNK4Au MY+3LOxEEnLIJSZZXkvVIiB+SK5u9ZIii8PoaNesXcVY44y4g3wWwiR3aqcsvwJ0CX 2evxCx7EHUCs0VBmxInQ9pp+YVCxSh87/PrRnONo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vadim Pasternak , Jiri Pirko , Ido Schimmel , Jakub Kicinski Subject: [PATCH 5.4 17/33] mlxsw: core: Add validation of transceiver temperature thresholds Date: Fri, 22 Jan 2021 15:12:33 +0100 Message-Id: <20210122135734.282982816@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210122135733.565501039@linuxfoundation.org> References: <20210122135733.565501039@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Vadim Pasternak [ Upstream commit 57726ebe2733891c9f59105eff028735f73d05fb ] Validate thresholds to avoid a single failure due to some transceiver unreliability. Ignore the last readouts in case warning temperature is above alarm temperature, since it can cause unexpected thermal shutdown. Stay with the previous values and refresh threshold within the next iteration. This is a rare scenario, but it was observed at a customer site. Fixes: 6a79507cfe94 ("mlxsw: core: Extend thermal module with per QSFP module thermal zones") Signed-off-by: Vadim Pasternak Reviewed-by: Jiri Pirko Signed-off-by: Ido Schimmel Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/mellanox/mlxsw/core_thermal.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) --- a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c +++ b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c @@ -177,6 +177,12 @@ mlxsw_thermal_module_trips_update(struct if (err) return err; + if (crit_temp > emerg_temp) { + dev_warn(dev, "%s : Critical threshold %d is above emergency threshold %d\n", + tz->tzdev->type, crit_temp, emerg_temp); + return 0; + } + /* According to the system thermal requirements, the thermal zones are * defined with four trip points. The critical and emergency * temperature thresholds, provided by QSFP module are set as "active" @@ -191,11 +197,8 @@ mlxsw_thermal_module_trips_update(struct tz->trips[MLXSW_THERMAL_TEMP_TRIP_NORM].temp = crit_temp; tz->trips[MLXSW_THERMAL_TEMP_TRIP_HIGH].temp = crit_temp; tz->trips[MLXSW_THERMAL_TEMP_TRIP_HOT].temp = emerg_temp; - if (emerg_temp > crit_temp) - tz->trips[MLXSW_THERMAL_TEMP_TRIP_CRIT].temp = emerg_temp + + tz->trips[MLXSW_THERMAL_TEMP_TRIP_CRIT].temp = emerg_temp + MLXSW_THERMAL_MODULE_TEMP_SHIFT; - else - tz->trips[MLXSW_THERMAL_TEMP_TRIP_CRIT].temp = emerg_temp; return 0; }