From nobody Mon Mar 06 06:39:30 2023 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PVTTB06FBz3wVqJ for ; Mon, 6 Mar 2023 06:39:42 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PVTT93wzBz3nWd for ; Mon, 6 Mar 2023 06:39:41 +0000 (UTC) (envelope-from kevans@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678084781; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3ZQqFsT9Yb7l0YmbhpCiKZ4lDDIF0Ydg2ALoalDV3VQ=; b=P1RZk5K3PIPAGUiVN92Tqgo30B4STyuoK1/Oaivl3s4xeZ4N2C9jp8f6wUq9G4mSVhynY/ q82dNzMUFkVBmw49z4txF2dmOl8T9++FU0AxbO1pzMmkj6jUVPwnyrXif2BmtK0b45K4iT uBN9F16XgHQMr8Z8QEci/FbuXKQAwSciA+XeqxMKWHJ1tR4gcv+dMu1+NtARr2AHz81yd0 VOOcmnywXuAKzXE8D5Pb/e+1Y3CBWIqu7laZi7zGpiGVJGAtw/xHbrqTPAh0FkSrBA+F8E 7Z1pHlM7Z1jjJuxIakRAukpdQssxP+hPY8OOJ3zps6luHH191P5bhSl/GLmOpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678084781; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3ZQqFsT9Yb7l0YmbhpCiKZ4lDDIF0Ydg2ALoalDV3VQ=; b=G5QFTj6CG7zc4USwtcsfgfC3egcsnV9HXjmJjwuPUguu6Jd4Dgkhxs/JeFBzs58b1g3AqN 9jgRX7MBCHWhNxIAquwOTWYJPP/tb2pw+wKNxyMYMBo1a6ri3RfpzOhLl6xgznQkRgF+og QbchmkcIoIcKRMESDFx68YMalvyPwClQ74iwIsvWkEeQXCntizHCpm4X8MBpvlJnIhEM70 LPe94jZO9fvF8zg58IapmIhPspXUC1/y20Z8PirYOCBGhVSvgvdOZ5TXGg5k2kh0dZxIVP amMUnRmi32f8lbyXx5O580r8mpFsyoW/QMMh8iQIw70E8xOC/tneJ+779rQEcg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1678084781; a=rsa-sha256; cv=none; b=DzPC89kSOD+2E0Qdyr4aBI+04XRQ45XEP7TezUOpRzPLz1SxSA/kTdNlRUzlKl8Z83zSAe LnTOQJ/xLxSRippl7ABe/Aq2hdSS5x5cUnBtqWvHj/jxNQ0ehpyHndg77VmXH2RHT36eUA 6B3mMW+jDCnbDmT/sznQXrknsJypiEMP0K8u82ou5N5MvjqS8lfJDdKpOjIpc7nKzC2H4M GxDNacRPJdILbKy/MD07MpcdPGePy91IjLcDS8Xz+sMlMGc3R1GZ0haUETOf+QtvydSMTI D0Mx26lxJX08xojIsJEOyNFhcXCvJAPqYQcOFTjxtaXHbq/GDz15eGF08Q5rEw== Received: from mail-qt1-f169.google.com (mail-qt1-f169.google.com [209.85.160.169]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id 4PVTT92q8mzxpX for ; Mon, 6 Mar 2023 06:39:41 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qt1-f169.google.com with SMTP id r16so7882571qtx.9 for ; Sun, 05 Mar 2023 22:39:41 -0800 (PST) X-Gm-Message-State: AO0yUKXGqRQLjhw7DlHJ1hZLwcf6PTZ5G3qq6jnlCtBN/mZCI+Ttcff9 Zu2Nry6y4iuH4eoJNZhbJbNGf/nXPgcwl1YdafY= X-Google-Smtp-Source: AK7set8onMkh4drf5CvIzH59qs53W1jdV1He3aUR4N04o9G/vgk/kJ2zvIaU83VtIIAJA5J5sA2s95nRaKRJC4iBK+g= X-Received: by 2002:ac8:40cb:0:b0:3bf:c33e:93a9 with SMTP id f11-20020ac840cb000000b003bfc33e93a9mr2772959qtm.1.1678084780915; Sun, 05 Mar 2023 22:39:40 -0800 (PST) List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@freebsd.org MIME-Version: 1.0 References: In-Reply-To: From: Kyle Evans Date: Mon, 6 Mar 2023 00:39:30 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: acpi_cmbat with charge-limited battery To: Warner Losh Cc: FreeBSD Hackers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-ThisMailContainsUnwantedMimeParts: N On Sun, Mar 5, 2023 at 9:33=E2=80=AFPM Warner Losh wrote: > > > > On Sun, Mar 5, 2023 at 7:20=E2=80=AFPM Kyle Evans wr= ote: >> >> Hello! >> >> I've dealt with this mainly over the weekend, but my solution was to >> just disable acpi_cmbat entirely, which is maybe not the best solution >> but I can't tell if this should be considered a firmware bug or if >> it's something we could find a way to workaround in the kernel. >> >> Basically, I've set the firmware on my frame.work laptop to limit the >> battery charge to 80%. When it hits 80% while plugged in, things get a >> little funky- I assume it's because the firmware's trying to carefully >> maintain the limit, but I end up getting (at least) one acpi >> notification per second, alternating between BST_CHANGE/BIX_CHANGE, >> which in turn drives up CPU usage as we tap it out to devd and upowerd >> picks it up. upowerd ends up pegging a core consistently. >> >> Should we be rate-limiting these devd notifications? Is this even >> reasonable behavior for the firmware? I'm not really sure how other OS >> behave here, but I haven't really seen any complaints from other >> framework'ers. > > > Seems like this is crappy firmware behavior and we should rate > limit in the driver... It's not useful information to be sharing once > a second... > The more I think about it (and with your generally confirmatory response), the more I think approaching both problems independently is probably good. I added a quick sysctl to acpi_cmbat to allow an interval for folks with broken firmware like myself; I'll probably throw that up for review tomorrow-ish. I'll also reach out to frame.work folks and see if they can improve this in some way, but I suspect any action there will take a while. Thanks, Kyle Evans