From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f169.google.com (mail-pg1-f169.google.com [209.85.215.169]) (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 5901F36F421 for ; Wed, 20 May 2026 20:59:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.169 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779310747; cv=none; b=PO+6rUZCgEcdBPsLbzu5hprgTkQt3ZEQ0GyOr+ANR3/jKBe85SnnE5lniDPN4TJVN8Wgivi9VlHeeVmcT0bgn8KLDu6+hnmIAi77f//JUYLubQnnQ5asTg2h22TjaLSUXxKfgilT2ql+h2SAueTjZKFtlM6mFS1C5f2sVtf5XjA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779310747; c=relaxed/simple; bh=ixoCgyJrbUFbAAbfJ/JQgZKkSDKCSy3cuaMIsNX9m9Y=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=pNkypJsu/l0OuOLZoFq+vnbbU/koviI9FZMW92j6fDp4WnQlRbdpVjn8pkINzsrt005dFgkQjEISoNLcb/umfztaRnbvGbCRYQqOLvN2MgZNGTrNWsSdhLUiv2AoxiZ8f1ZFb1jHGkZwQsJrsHSrPIctcVUvzhNO5ikvSd0lepI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=eiwyHAtJ; arc=none smtp.client-ip=209.85.215.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net 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="eiwyHAtJ" Received: by mail-pg1-f169.google.com with SMTP id 41be03b00d2f7-c8016d642b2so2726124a12.0 for ; Wed, 20 May 2026 13:59:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779310746; x=1779915546; 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:sender:from:to:cc:subject:date:message-id:reply-to; bh=y7aqJm2QFZkDCNJszE1BVgA4d8GhcjAWMrwClSCja/w=; b=eiwyHAtJgFVPxwK+G+TubxBJ0tfRON4qidn/jm4grquEBRRZNC8uABtqwdjNpBfqMm OdQgscqBTHDA7PLkQEyXdQ/tOBxAooL/s+k5BeSvwE1lmHDPLzXXC+RRrvWmjT4UxqoM Jl5gk0zYHpve72TwSEdvsMSC6f6HBvuqFsc5/8ZdN1tSgK7SIDDOfti51+E8XBJkEWDx 0anz5H4w98RxWwaJVoyQdeLQ+eJYixyje4g8FHaNXIJ+G+T+cYLHatiUbwneleeuqN6n 7xOiYi9YwplNdQefUsoNV8TvW17YnIk6+S8z9jyznF+Uc7CFzOqmGlAjVB+/B2oDI07T bWBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779310746; x=1779915546; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:sender:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=y7aqJm2QFZkDCNJszE1BVgA4d8GhcjAWMrwClSCja/w=; b=HfKi0AMpLkmzdz50I6nPLcQHQoyrZnNS01i2yUollsEs6pbryBXcqpS7ZhV1gUDvyr 7UzL6ovzt/immE/Zu/VN7Umz+zI4zcdM2SqIS6nG5bEH1yAJrqn9t/PJg5jIO5br/Q12 7kOpFcbMtPa5pxXzMutbJ09hVanUD5OfOK/7e2Sa02vHQkEGImo+S5UhLBO6dQR40EHb 128OM9yJOiVqUrgNJ9qOj53RnQVFE2eIrGWD3LvTlj3te6KilQn03uSwxno/vvWDbCBB w6U+q0ZsNyNCBXlIHvuKo7SV8XQ0KWkWJ58VIq2PI2MLISNY+JUufDQq4LJznsNkLpc3 RXSQ== X-Forwarded-Encrypted: i=1; AFNElJ8Sl1wnyronXllIkkHGe23fHgc1/SzgPg63n1Oc/z0yRutAVVgErr12FPInbgzJu5FwuvA45Y+xOa+8/q8=@vger.kernel.org X-Gm-Message-State: AOJu0YyfKuzf/n4yNHbISWCV2HdLdl6e5flzWCBp6583CVeRavthSmhL bFchp/WRw5ajX29yUDbk6ARtYkPKMUJgZrMs/cXCKCFGSlJ+zheNHfv7 X-Gm-Gg: Acq92OHlE43ZRV7rDizHgmZBom9SYjrTF8nzqMT5saM56BcVongKXgneb+tIH4+4BaB NqakOPF9kImaFLE/j3Eoo3yKEzuwYVszHtgdEERRdM3ifXsY+dfp6jaThbJaYtOc8DVfcqDF7s4 5+tu/+j5XoBgPuYtxAAnynalEyBtVu/bOjBOXZo4LSWYcAdsuXb2GDjl7zd3l9LYlhSvlSdaPI4 8+Mauaz6pcwOa0b6oNP73EF7/u6GXB1TLrb2ziuUZCiQVwmaoHfhPVm6K/3/IIKcJ+M2jzn1ycy gLKRpbG9JYp1ljZGMn55oxlqeXNTUQiAfHciNU/Z3Zi2QFaxHHC5gyu4+g8BWLy24gk9tiMGW8n rSeezX4AOnV5wYZ0nq67S3UZXu2lilzoOl73DYhTBjHLZTwhHArJVixJjUqEE8xeCxbSWDtQxLH PB2gTMTAPoTde5qPjIv6CYa+pT/n6NXxzlKv0y7lAHb+G/53xW4HEflYngTlSiPsd7H9ZQjr8A0 M2KQ3Yoz0FHOaNnx8RFZA== X-Received: by 2002:a17:90a:dfd0:b0:369:9469:aeba with SMTP id 98e67ed59e1d1-36a48dfe7d7mr18963a91.1.1779310745511; Wed, 20 May 2026 13:59:05 -0700 (PDT) Received: from ?IPV6:2600:1700:e321:62f0:da43:aeff:fecc:bfd5? ([2600:1700:e321:62f0:da43:aeff:fecc:bfd5]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-36a3cd96253sm505153a91.17.2026.05.20.13.59.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 20 May 2026 13:59:05 -0700 (PDT) Sender: Guenter Roeck Message-ID: <1783d74e-6acc-40d2-bdff-9bacbb04032c@roeck-us.net> Date: Wed, 20 May 2026 13:59:04 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 0/3] hwmon: (pmbus/adm1266) add clear_blackbox and powerup_counter debugfs entries To: Abdurrahman Hussain , Alexandru Tachici Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Guenter Roeck References: <20260516-adm1266-v4-0-1f8df4797258@nexthop.ai> Content-Language: en-US From: Guenter Roeck Autocrypt: addr=linux@roeck-us.net; keydata= xsFNBE6H1WcBEACu6jIcw5kZ5dGeJ7E7B2uweQR/4FGxH10/H1O1+ApmcQ9i87XdZQiB9cpN RYHA7RCEK2dh6dDccykQk3bC90xXMPg+O3R+C/SkwcnUak1UZaeK/SwQbq/t0tkMzYDRxfJ7 nyFiKxUehbNF3r9qlJgPqONwX5vJy4/GvDHdddSCxV41P/ejsZ8PykxyJs98UWhF54tGRWFl 7i1xvaDB9lN5WTLRKSO7wICuLiSz5WZHXMkyF4d+/O5ll7yz/o/JxK5vO/sduYDIlFTvBZDh gzaEtNf5tQjsjG4io8E0Yq0ViobLkS2RTNZT8ICq/Jmvl0SpbHRvYwa2DhNsK0YjHFQBB0FX IdhdUEzNefcNcYvqigJpdICoP2e4yJSyflHFO4dr0OrdnGLe1Zi/8Xo/2+M1dSSEt196rXaC kwu2KgIgmkRB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y scPJ0OVY7ly5Vm1nnoH4licaU5Y1nSkFR/j2douI5P7Cj687WuNMC6CcFd6j72kRfxklOqXw zvy+2NEcXyziiLXp84130yxAKXfluax9sZhhrhKT6VrD45S6N3HxJpXQ/RY/EX35neH2/F7B RgSloce2+zWfpELyS1qRkCUTt1tlGV2p+y2BPfXzrHn2vxvbhEn1QpQ6t+85FKN8YEhJEygJ F0WaMvQMNrk9UAUziVcUkLU52NS9SXqpVg8vgrO0JKx97IXFPcNh0DWsSj/0Y8HO/RDkGXYn FDMj7fZSPKyPQPmEHg+W/KzxSSfdgWIHF2QaQ0b2q1wOSec4Rti52ohmNSY+KNIW/zODhugJ np3900V20aS7eD9K8GTU0TGC1pyz6IVJwIE= In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 5/20/26 12:40, Abdurrahman Hussain wrote: > On Wed May 20, 2026 at 10:10 AM PDT, Abdurrahman Hussain wrote: >> On Wed May 20, 2026 at 7:10 AM PDT, Guenter Roeck wrote: >>> Hi, >>> >>> On 5/16/26 18:18, Abdurrahman Hussain wrote: >>>> This is what remains of the v3 series after Guenter applied patches >>>> 1/5 (firmware_revision) and 5/5 (GPIO line label) to hwmon-next, and >>>> asked for patch 4/5 (rtc_class) to be dropped. >>>> >>>> Patch 1 adds a write-only clear_blackbox debugfs file. Devices >>>> configured for single-recording mode (BLACKBOX_CONFIG[0] = 0) need >>>> an explicit clear once the 32-record buffer fills; the documented >>>> sub-command ({0xFE, 0x00} block-write to 0xDE) wasn't reachable >>>> from userspace. The patch also acquires pmbus_lock at the >>>> adm1266_nvmem_read() callback boundary so the memset of >>>> data->dev_mem, the blackbox refill, and the memcpy to userspace run >>>> as a single critical section -- the nvmem core does not serialize >>>> concurrent reg_read calls. >>>> >>>> Patch 2 exposes the non-volatile POWERUP_COUNTER (0xE4) via debugfs. >>>> The same value is embedded in every blackbox record, so the live >>>> value lets userspace match a captured record back to the boot it >>>> came from when correlating logs. The block-read is taken under >>>> pmbus_lock to serialise against any pmbus_core PAGE+register >>>> sequence on the device. >>>> >>>> Patch 3 takes pmbus_lock in adm1266_state_read() (the pre-existing >>>> sequencer_state debugfs handler) for the same defensive-locking >>>> reason that motivates the new debugfs files in patches 1 and 2: >>>> any direct device access from outside pmbus_core should be ordered >>>> with respect to pmbus_core's own PAGE+register sequences. >>>> >>>> Signed-off-by: Abdurrahman Hussain >>> >>> The series no longer applies after applying the bug fix series. >>> Please rebase it on top of the hwmon-next branch of >>> git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git >>> and resubmit. >>> >>> Sorry for the trouble, and thanks a lot for fixing all the problems >>> with the driver. >>> >>> Guenter >> >> Will do, thank you for your support! >> >> Abdurrahman > > Hi Guenter, > > Before I send v5 of the adm1266 series, I'd like to revisit the > SET_RTC exposure question from your v3 review [1]. > > The use case I keep landing on is the one the datasheet itself > recommends: a userspace agent (chrony hook, systemd-timesyncd > script, or a small periodic daemon) keeps the chip's seconds > counter aligned with wall-clock so the value embedded in each > blackbox record stays correct across long uptimes. The probe- > time ktime_get_real_seconds() seed (now in hwmon-next) only fixes > this at boot; the chip's counter drifts after that. > > You ruled out rtc_class and called a kernel-side periodic timer > "a bit excessive", which I agree, it is. That leaves a > userspace-triggered sync. Two debugfs shapes I'd consider, both under > pmbus//adm1266/ (alongside the clear_blackbox, > powerup_counter, and sequencer_state entries v5 already adds): > > A. RW since_epoch -- mirrors /sys/class/rtc//since_epoch. > Read returns the chip's SET_RTC seconds counter, write sets > it. The read has the useful side benefit of letting > userspace measure host-vs-chip drift without writing. > > B. Write-only set_rtc -- writing anything to the file makes > the driver read ktime_get_real_seconds() itself and push it > to SET_RTC. Simpler interface (kernel owns the time > source; userspace just triggers the sync), no payload to > parse, no way for userspace to pass in a wrong value. > How about a combination ? read returns the current value, anything written synchronizes with the kernel rtc. > Do either of these look right to you, or would you rather I just > leave the driver at "probe-time seed only" and skip a SET_RTC > interface entirely? v5 as it stands has no such interface and > is ready to send; a SET_RTC patch can follow separately later if > you'd like one. > I am fine either way. Thanks, Guenter