lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 30 Dec 2019 11:14:20 +0100
From:   Pavel Machek <pavel@...x.de>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     linux-kernel@...r.kernel.org, stable@...r.kernel.org,
        Merlijn Wajer <merlijn@...zup.org>,
        Tony Lindgren <tony@...mide.com>,
        Sebastian Reichel <sebastian.reichel@...labora.com>,
        Sasha Levin <sashal@...nel.org>
Subject: Re: [PATCH 5.4 162/434] power: supply: cpcap-battery: Check voltage
 before orderly_poweroff

On Sun 2019-12-29 18:23:35, Greg Kroah-Hartman wrote:
> From: Tony Lindgren <tony@...mide.com>
> 
> [ Upstream commit 639c1524da3b273d20c42ff2387d08eb4b12e903 ]
> 
> We can get the low voltage interrupt trigger sometimes way too early,
> maybe because of CPU load spikes. This causes orderly_poweroff() be
> called too easily.
> 
> Let's check the voltage before orderly_poweroff in case it was not
> yet a permanent condition. We will be getting more interrupts anyways
> if the condition persists.
> 
> Let's also show the measured voltages for low battery and battery
> empty warnings since we have them.

I don't believe this is good idea for stable.

Yes, it may be useful on older batteries, but may cause too late
shutdowns on new batteries, or something like that. Certainly needs a
lot more testing than it got.

Best regards,
							Pavel

> Cc: Merlijn Wajer <merlijn@...zup.org>
> Cc: Pavel Machek <pavel@....cz>
> Signed-off-by: Tony Lindgren <tony@...mide.com>
> Signed-off-by: Sebastian Reichel <sebastian.reichel@...labora.com>
> Signed-off-by: Sasha Levin <sashal@...nel.org>
> ---
>  drivers/power/supply/cpcap-battery.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/power/supply/cpcap-battery.c b/drivers/power/supply/cpcap-battery.c
> index 61d6447d1966..00a96e4a1cdc 100644
> --- a/drivers/power/supply/cpcap-battery.c
> +++ b/drivers/power/supply/cpcap-battery.c
> @@ -562,12 +562,14 @@ static irqreturn_t cpcap_battery_irq_thread(int irq, void *data)
>  	switch (d->action) {
>  	case CPCAP_BATTERY_IRQ_ACTION_BATTERY_LOW:
>  		if (latest->current_ua >= 0)
> -			dev_warn(ddata->dev, "Battery low at 3.3V!\n");
> +			dev_warn(ddata->dev, "Battery low at %imV!\n",
> +				latest->voltage / 1000);
>  		break;
>  	case CPCAP_BATTERY_IRQ_ACTION_POWEROFF:
> -		if (latest->current_ua >= 0) {
> +		if (latest->current_ua >= 0 && latest->voltage <= 3200000) {
>  			dev_emerg(ddata->dev,
> -				  "Battery empty at 3.1V, powering off\n");
> +				  "Battery empty at %imV, powering off\n",
> +				  latest->voltage / 1000);
>  			orderly_poweroff(true);
>  		}
>  		break;

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

Download attachment "signature.asc" of type "application/pgp-signature" (182 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ