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] [day] [month] [year] [list]
Message-ID: <48CFEB64.5030808@intel.com>
Date:	Tue, 16 Sep 2008 10:22:44 -0700
From:	"Kok, Auke" <auke-jan.h.kok@...el.com>
To:	Michal Hocko <mstsxfx@...il.com>
CC:	power@...host.org, Alexey Starikovskiy <astarikovskiy@...e.de>,
	linux-kernel@...r.kernel.org
Subject: Re: Why is /sys/class/power_supply/CMB1/energy_now not exported?

Michal Hocko wrote:
> On Mon, Jul 21, 2008 at 09:04:13PM -0600, Michal Hocko wrote:
>> [fixing bad linux kernel mailing list email address - sorry, but gmail's
>> thrown mailing delivery error to the spam]
>>
>> On Tue, Jul 22, 2008 at 01:03:11AM +0400, Alexey Starikovskiy wrote:
>>> Hi Michal,
>> Hi Alexey,
>>
>>> the charge_now part of your patch seems to be correct, but the
>>> calculation is somehow broken --
>> I have made some experiments and the result is quite surprising to me.
>> It seems that this problem is somehow related to Debian distribution
>> kernel, because I wasn't able to reproduce it with the Vanilla kernel (I
>> had to screw something up last time when I have checked that and
>> reported in the original message).
>>
>> I have tried 3 configurations:
>> * 2.6.25 - Vanilla kernel with config-2.6.25 config and result output in
>>   powertop-2.6.25-good
>> * 2.6.25-2 - Debian distribution kernel with config-2.6.25-2 config and
>>   powertop-2.6.25-2-bad output
>> * 2.6.26 - Vanilla kernel with config-2.6.26 config and result output in
>>   powertop-2.6.26-good
> [...]
> 
> I had some time to get back to this issue and the problem why I have
> seen different behavior on distribution and vanilla kernel was in
> configuration. 
> While distribution kernel doesn't use CONFIG_ACPI_PROCFS_POWER=y while
> my vanilla kernel configuration does! This means that the patched code
> wasn't triggered in my vanilla kernel testing.
> 
> So that I have checked the print_batter_sysfs again and it seems that
> the problem is on another place:
> powertop.c:648
> 	sprintf(filename, "/sys/class/power_supply/%s/current_now", dirent->d_name);
> 	file = fopen(filename, "r");
> 	if (!file)
> 		continue;
> 	memset(line, 0, 1024);
> 	if (fgets(line, 1024, file) != NULL) {
> 		watts_drawn = strtoull(line, NULL, 10) / 1000000.0;
> 	}
> 	fclose(file);
> 
> 	if (!dontcount) {
> 		rate += watts_drawn + voltage * amperes_drawn;
> 	}
> 
> current rate (later used for the remaining time calculation:
> display.c:201
> 	sprintf(buffer, _("Power usage (ACPI estimate): %3.1fW (%3.1f hours)"), rate, cap/rate);
> )
> 
> is calculated as watts_drawn + voltage which is not correct, because
> current_* values are in A and not in W (according to
> linux-src/Documentation/power/power_supply_class.txt).
> 
> Updated patch is attached. This one is already working for me.

Merged in powertop-svn, thanks!

Auke
--
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