From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dl1-f47.google.com (mail-dl1-f47.google.com [74.125.82.47]) (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 1FD9A3446CE for ; Wed, 20 May 2026 19:40:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779306027; cv=none; b=Q6E7rtl90JSy8P/Ld3MjhiPlnccxQsII4egNqm6TsbjTYpSP4pZVyOAK5aebexKdHGZTgA/Qg/hIGycRw4MqWGRPTC7+QLY3MqmBHtAf+HxaMBwvIkJHRPVdJN1PpvufGMfNTYYVBU/j56tcSgwKvzAfoW+F9lQzz+FGZLvjbmA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779306027; c=relaxed/simple; bh=gD9FvkX53JUVKNkxLtMwVrYMxYM+/fehb1JKmOS+44k=; h=Mime-Version:Content-Type:Date:Message-Id:To:Cc:Subject:From: References:In-Reply-To; b=FhAlDGCwRk3BTmjLjYE2eI8ExIDynlB/a+sxT1myAqzyE3Nu0vZIwbrtivK1/mdwbQJh01L/LS47WSeY1dLCSL3Nol6TGlMx0BaPFxROfOzkEY2u6End1iOtdEjYQG76wbJWooeOoBjCcGuvYKqjZfKGxBle+W0fRwkLVHhYsN4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nexthop.ai; spf=pass smtp.mailfrom=nexthop.ai; dkim=pass (2048-bit key) header.d=nexthop.ai header.i=@nexthop.ai header.b=Dxf59BCA; arc=none smtp.client-ip=74.125.82.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nexthop.ai Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nexthop.ai Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nexthop.ai header.i=@nexthop.ai header.b="Dxf59BCA" Received: by mail-dl1-f47.google.com with SMTP id a92af1059eb24-1329fc4bf77so1205157c88.1 for ; Wed, 20 May 2026 12:40:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nexthop.ai; s=google; t=1779306023; x=1779910823; darn=vger.kernel.org; h=in-reply-to:references:from:subject:cc:to:message-id:date :content-transfer-encoding:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=H4Z6auHD47mpoadC6kfYBTYbgxuz8kIYh8F1YtTA+WM=; b=Dxf59BCAl0XpbIGF1c/lwwesAU9E8b2K1YxMXU2qiof8xPs2rtb1NaYAUAlCgFxZQe /lFnFv+hJgGM8/ZZ4OgswZAJ6KqG/TTirNvb2Huc2RxB5gDP8YiDVl1A/i0/sU3yY7Dz 5h7hSw/bpXcseF4/9d0aTRG4o7WsI449/uHOetL2igOnwmbOETCIEvumQ+twJWEzjdmt 5rBfAMZltD2LZBZZLn2j09h1YPJCu1+d0H/yRqXMztcCidRH3zibMs5Plr5lDBTcLBbG z7A/ExEcg3Bh7tV15/bDJhMkgg6KJKyYAZ80EwzG+7mgvgxhazJ+1FxkTuKl9tVo85J2 lbGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779306023; x=1779910823; h=in-reply-to:references:from:subject:cc:to:message-id:date :content-transfer-encoding:mime-version:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=H4Z6auHD47mpoadC6kfYBTYbgxuz8kIYh8F1YtTA+WM=; b=lbQ7tRD4+qJ6u+cDWEJgC0Dz8z0Z1qNIsuk1YZGEuW7f9CM9Iq9Nsqehbko91pKISt 0uoLT4m7tG+Yge3URATcjmZ0BLCur2PbWyWRbYEWiOr+74STr6IX5+XkoUZkc2EZO+gf klbibFdmJJT+7SsfUR/aZj3RcgGwHq8qEilKIPZSydTPvLqfgoH+Pydt2EYXuXLNiaLh 6vjJVB4ZrGv5Dqx3+Nb79mgAnPBVlCBpeZbupG8C6KjSTs/1uYh7TAGW+BqBqxJA2t7X INGGUipCyOtz7Y50/xDzm7MCyg3Eqx2uFYmmGRHPL1r1SmVRJlKEilY801cGkLl0OzY9 LR9g== X-Forwarded-Encrypted: i=1; AFNElJ/5y+BBV97LU5FrnUrvSvFap4WUZnLL16nTHt0hdcoJuUdkUYVT4uZAhUQYF7tr+WC9jmjVPKnOcrRaHRU=@vger.kernel.org X-Gm-Message-State: AOJu0YyXlyLXXeQRgMzPEi+rYxNqMILZLBNq9ra4EnzcdAyifDlW2wsP GA6w8ZdVNOKnZtpXDZdpKLs0/VjpeIjG0hDypiYbzBKtw0X+VkAjBLXKoMZvFME4Imk= X-Gm-Gg: Acq92OEe2rD6yhdFjRtPs8HGineGyYsFqwTep+uA5+EqEKVh5KZBtNHR35YI2QsS3r3 wObybX/Q+p2PgKg4xvFdrW+gHh6Gq5Lj2/cyh1wQpsZWb96F23lw6PbfsrS2+GvzXaHlPhRRWhr HKQ62iWeYQypJWmju5FywNgPmQBCr75ZV2fLgE0EBqxpx6hOEXOnoZTKtp+tELIqCWESA7ex04y bNHpmPzk3BxSikY1rBF2JfkFPqO0FKootIzqwCEuW/7DKm5d3/9wkHPmKw/hTaJaRfVGn4DvJhH k61IITY6ZotVP/cHbYwfhXGHaLdPKzsn+pxn4/M49h/ni9QW4uqysQDlE7THLpHiVGJCfftsRWB ahNKhhlc16BgClgn/8YduGQzXLU24JjTWISTe7X63V4O8eSuhhgKODEj74cNfrCvSbivi7HNQob wk0z9RahGSUve7dTV08Qjc3vYf5dTBH6YLiA== X-Received: by 2002:a05:7022:311:b0:128:d34a:320f with SMTP id a92af1059eb24-13504625a7fmr12415188c88.12.1779306022775; Wed, 20 May 2026 12:40:22 -0700 (PDT) Received: from localhost ([50.145.100.174]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-134cbdce9fasm22637332c88.4.2026.05.20.12.40.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 20 May 2026 12:40:22 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Wed, 20 May 2026 12:40:21 -0700 Message-Id: To: "Abdurrahman Hussain" , "Guenter Roeck" , "Alexandru Tachici" Cc: , , , "Guenter Roeck" Subject: Re: [PATCH v4 0/3] hwmon: (pmbus/adm1266) add clear_blackbox and powerup_counter debugfs entries From: "Abdurrahman Hussain" X-Mailer: aerc 0.21.0 References: <20260516-adm1266-v4-0-1f8df4797258@nexthop.ai> In-Reply-To: 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. >>>=20 >>> Patch 1 adds a write-only clear_blackbox debugfs file. Devices >>> configured for single-recording mode (BLACKBOX_CONFIG[0] =3D 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. >>>=20 >>> 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. >>>=20 >>> 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. >>>=20 >>> 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. 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. [1] https://lore.kernel.org/r/20260512-adm1266-v3-0-a81a479b0bb0@nexthop.ai Thanks, Abdurrahman