From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7E87A153803; Sat, 11 Jan 2025 17:32:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736616764; cv=none; b=jY+w1fm4D+wAOhXj77+K3Mmn2jNTFRS5N0cKiBiSTAlHSr96+fTQCg8ol2bbyCe62l45MTotXXjscreP5xFT5iDIR11byOr2Qtf87UbenPOxpUKc3dyZYZ8QuSgjEwJFePP7fQTc6UKN2oN3hLQuabvbU+vC6Mph9t9Q5/Q++Es= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736616764; c=relaxed/simple; bh=nppiaBl9/cn2ixhW1mVVwRtX6gT72NQbuTAmzxqk+Yk=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=awoeenpfDqBJ9FVLOSVMPR43QhRKoSXp7px6b3UjX2EsQPH375mW6eMHSTWvwatPM4G3uH3aGoBEZ5nyTspzJVCU7Mxxa15v/aKLso/CVSb1NuaB0z5piLRnGRdj5fjg6KCL4QpjDa2fjcOYKsj0xVIXekc1NxAIZGj+E3rRFkU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=YiqRiK4m; arc=none smtp.client-ip=209.85.128.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="YiqRiK4m" Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-4361f796586so31731975e9.3; Sat, 11 Jan 2025 09:32:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736616759; x=1737221559; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to; bh=WT5lxgWKfKuUNds0df6T6E2qudfAkVIjh0gIjNYsRjk=; b=YiqRiK4m251N0vlB8amdlxI9wvqTaFMR0kqfoCYgdOX6Lc+vjFbu37MctGTqyL5A1v 1DPExcssxMSd+eAq97kl/fWNjea/LVLeF5P9vSOvZEFi7uGTUhoJ+I/cm/LcFoD2yI6L ehDAjL1sttGVzBCkEwBUy0kgmz9lTW8p5ENqlo60O79hm1nq+xqjLL/kTnkAYsOdnzVf 0ia4NGp7tETEDxevx1NrV1GvO7Z7YqT2o8u/XU108rFrKTgLWOZAtV0wOk1U/mEzk7FJ jO634ea/Ngsulq/kXlj3gdbv43iLRPDpifHBWfe3ocE7cSjjbo+p8cgMUeHn0JR1bLGK +tWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736616759; x=1737221559; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=WT5lxgWKfKuUNds0df6T6E2qudfAkVIjh0gIjNYsRjk=; b=OwX1J0jY82nZoQGcV2rROYxGjrqxwsjAAHG3Yz3NxaRxUsX0mYyi+My66pbvax5sub bP1tO06f03SsKnrR3AqKkiYbnEtRQvDbPWIn6zebYMyqYvsdIS6uIXcRs3v6pZ23LCsp oxeNYwVaPK5j80UuUXTYspFq8audoKkKKj1gHqX6rAlLOC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with SMTP id 5b1f17b1804b1-436e2697b32mr94172085e9.11.1736616758616; Sat, 11 Jan 2025 09:32:38 -0800 (PST) Received: from ?IPV6:2a02:3100:a90d:e100:d8f1:2ffc:4f48:89fd? (dynamic-2a02-3100-a90d-e100-d8f1-2ffc-4f48-89fd.310.pool.telefonica.de. [2a02:3100:a90d:e100:d8f1:2ffc:4f48:89fd]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-436e9e37c2esm87758705e9.28.2025.01.11.09.32.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 11 Jan 2025 09:32:37 -0800 (PST) Message-ID: Date: Sat, 11 Jan 2025 18:32:35 +0100 Precedence: bulk X-Mailing-List: linux-hwmon@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net-next 3/3] net: phy: realtek: add hwmon support for temp sensor on RTL822x To: Andrew Lunn Cc: Guenter Roeck , Russell King - ARM Linux , Paolo Abeni , Jakub Kicinski , David Miller , Eric Dumazet , Simon Horman , "netdev@vger.kernel.org" , "linux-hwmon@vger.kernel.org" , Jean Delvare References: <3e2784e3-4670-4d54-932f-b25440747b65@gmail.com> <8d052f8f-d539-45ba-ba21-0a459057f313@lunn.ch> <0adfb0e4-72b2-48c1-bf65-da75213a5f18@lunn.ch> Content-Language: en-US From: Heiner Kallweit Autocrypt: addr=hkallweit1@gmail.com; keydata= xsFNBF/0ZFUBEAC0eZyktSE7ZNO1SFXL6cQ4i4g6Ah3mOUIXSB4pCY5kQ6OLKHh0FlOD5/5/ sY7IoIouzOjyFdFPnz4Bl3927ClT567hUJJ+SNaFEiJ9vadI6vZm2gcY4ExdIevYHWe1msJF MVE4yNwdS+UsPeCF/6CQQTzHc+n7DomE7fjJD5J1hOJjqz2XWe71fTvYXzxCFLwXXbBiqDC9 dNqOe5odPsa4TsWZ09T33g5n2nzTJs4Zw8fCy8rLqix/raVsqr8fw5qM66M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tz0lot8wNGmWb+NcHeKM1eb nwUMOEa1uDdfZeKef/U/2uHBceY7Gc6zPZPWgXghEyQMTH2UhLgeam8yglyO+A6RXCh+s6ak Wje7Vo1wGK4eYxp6pwMPJXLMsI0ii/2k3YPEJPv+yJf90MbYyQSbkTwZhrsokjQEaIfjrIk3 rQRjTve/J62WIO28IbY/mENuGgWehRlTAbhC4BLTZ5uYS0YMQCR7v9UGMWdNWXFyrOB6PjSu Trn9MsPoUc8qI72mVpxEXQDLlrd2ijEWm7Nrf52YMD7hL6rXXuis7R6zY8WnnBhW0uCfhajx q+KuARXC0sDLztcjaS3ayXonpoCPZep2Bd5xqE4Ln8/COCslP7E92W1uf1EcdXXIrx1acg21 H/0Z53okMykVs3a8tECPHIxnre2UxKdTbCEkjkR4V6JyplTS47oWMw3zyI7zkaadfzVFBxk2 lo/Tny+FX1Azea3Ce7oOnRUEZtWSsUidtIjmL8YUQFZYm+JUIgfRmSpMFq8JP4VH43GXpB/S OCrl+/xujzvoUBFV/cHKjEQYBxo+MaiQa1U54ykM2W4DnHb1UiEf5xDkFd4= In-Reply-To: <0adfb0e4-72b2-48c1-bf65-da75213a5f18@lunn.ch> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 11.01.2025 18:00, Andrew Lunn wrote: >> According to Guenters feedback the alarm attribute must not be written >> and is expected to be self-clearing on read. >> If we would clear the alarm in the chip on alarm attribute read, then >> we can have the following ugly scenario: >> >> 1. Temperature threshold is exceeded and chip reduces speed to 1Gbps >> 2. Temperature is falling below alarm threshold >> 3. User uses "sensors" to check the current temperature >> 4. The implicit alarm attribute read causes the chip to clear the >> alarm and re-enable 2.5Gbps speed, resulting in the temperature >> alarm threshold being exceeded very soon again. >> >> What isn't nice here is that it's not transparent to the user that >> a read-only command from his perspective causes the protective measure >> of the chip to be cancelled. >> >> There's no existing hwmon attribute meant to be used by the user >> to clear a hw alarm once he took measures to protect the chip >> from overheating. > > It is generally not the kernels job to implement policy. User space > should be doing that. > > I see two different possible policies, and there are maybe others: > > 1) The user is happy with one second outages every so often as the > chip cycles between too hot and down shifting, and cool enough to > upshift back to the higher speeds. > > 2) The user prefers to have reliable, slower connectivity and needs to > explicitly do something like down/up the interface to get it back to > the higher speed. > This seems to be exactly how I do it currently. > I personally would say, from a user support view, 2) is better. A one > time 1 second break in connectivity and a kernel message is going to > cause less issues. > > Maybe the solution is that the hwmon alarm attribute is not directly > the hardware bit, but a software interpretation of the system state. > When the alarm fires, copy it into a software alarm state, but leave > the hardware alarm alone. A hwmon read clears the software state, but > leaves the hardware alone. A down/up of the interface will then clear > both the software and hardware alarm state. > Not clearing the alarm on read is better from a user perspective IMO (at least for this specific PHY). As long as the alarm is active, the chip forces a downshift. > Anybody wanting policy 1) would then need a daemon polling the state > and taking action. 2) would be the default. > > How easy is it for you to get into the alarm state? Did you need an > environment chamber/oven, or is it happening for you with just lots of > continuous traffic at typical room temperature? Are we talking about > cheap USB dangles in a sealed plastic case with poor thermal design > are going to be doing this all the time? > I have a M.2 card with RTL8126 (w/o heat sink) and an external RJ45 port. This card sits in a slot underneath the mainboard of a mini PC. At 2.5Gbps it makes a big difference whether EEE is active. With EEE it reaches 54°C, w/o EEE temperature quickly goes over 70°C. For tests I add a PHY write to the code which sets the over-temp threshold to 60°C. Then I can easily trigger overheating by disabling EEE. On my system the over-temp threshold set by the BIOS (?) is 120°C. Even w/o heat sink I can hardly imagine that this threshold is ever reached. > Andrew Heiner