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]
Message-ID: <20131230224045.GC4938@khazad-dum.debian.net>
Date:	Mon, 30 Dec 2013 20:40:45 -0200
From:	Henrique de Moraes Holschuh <hmh@....eng.br>
To:	Julian Andres Klode <jak@...-linux.org>,
	Henrique de Moraes Holschuh <ibm-acpi@....eng.br>,
	Matthew Garrett <matthew.garrett@...ula.com>,
	"open list:THINKPAD ACPI EXT..." 
	<ibm-acpi-devel@...ts.sourceforge.net>,
	"open list:THINKPAD ACPI EXT..." 
	<platform-driver-x86@...r.kernel.org>,
	open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/4] thinkpad_acpi: Add support for controlling charge
 thresholds

On Mon, 30 Dec 2013, Henrique de Moraes Holschuh wrote:
> On Mon, 30 Dec 2013, Julian Andres Klode wrote:
> > On Mon, Nov 11, 2013 at 02:56:30PM +0100, Julian Andres Klode wrote:
> > > Add support for battery charge thresholds in new Sandy Bridge and Ivy Bridge
> > > ThinkPads. Based on the unofficial documentation in tpacpi-bat.
> > > 
> > > The threshold files support the values '0' for the controller's default,
> > > and 1-99 as percentages. Values outside of that range are rejected. The
> > > behaviour of '0' might be confusing, especially for the stop case where
> > > it basically seems to mean '100'.
> > 
> > Thinking more about this, it might make more sense to simply accept a 100
> > value and not accept a 0 value in the stop case (I tried multiple times to
> > write 100 to a stop_charge_thresh file, because that feels more natural).
> > 
> > Having a 0 mean 100% is just odd. So stop_charge_thresh should simply
> > accepts integer values in the range [1, 100] (and start_charge_thresh
> > should continue accept [0, 99], as 0 really means 0 there).
> 
> Indeed.  Just return EINVAL for a stop threshold of 0.

Actually, a stop threshold below the current start threshold is also invalid
and what happens when you try that is implementation-specific.  And the
kernel is not the only party who can change the thresholds, so you have to
read them if you really need to know the current value.

To correct myself, stop threshold being zero is also implementation-
specific. on thinkpads it is not valid.

For thinkpads, I believe the EC firmware changes the other threshold so that
the boundary condition stop > start is always valid.  But I never tried it
with a direct EC write to validate this.  If it becomes important, I can
check -- but I'd still prefer to enforce sanity at the driver level just in
case.  Don't tempt the gremilins, for they live at boundary conditions and
their sleep is light indeed.

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ