Re: Problems with CPU throttling on HP 15-n066us laptop

2016-08-20 Thread Anthony Jenkins via freebsd-acpi


On 08/20/16 10:44, Ian Smith wrote:
> On Sat, 20 Aug 2016 09:50:22 -0400, am_d...@fastmail.fm wrote:
>  > On Thu, Aug 18, 2016, at 09:14 AM, Anthony Jenkins wrote:
>  > > Try this patch, that's what I'm running.
>
>  > I applied this patch to the latest 11 source and built my kernel and now
>  > I have cpu throttling on the AMD machine. I see the Cool'n'Quiet 2.0
>  > driver attach and have frequencies in dev.cpu. The fans now run at a
>  > much lower speed and I am saving upwards of 4 watts when running on
>  > battery power. Thank you so much for this patch and to everyone else for
>  > the suggestions on this issue. It is such a great feeling to know that
>  > now I can use FreeBSD on my new laptop.
>
> That's great news.  More good work, Anthony.
>
> Is there a PR for this issue/fix?  It would be good to see this patch 
> reviewed and headed into the tree, no?
I didn't see anything in the existing PRs (but I didn't look very
thoroughly).

Created PR - https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=212020
Created review - https://reviews.freebsd.org/D7587

Anthony
> cheers, Ian

___
freebsd-acpi@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-acpi
To unsubscribe, send any mail to "freebsd-acpi-unsubscr...@freebsd.org"


Re: Problems with CPU throttling on HP 15-n066us laptop

2016-08-20 Thread Ian Smith
On Sat, 20 Aug 2016 09:50:22 -0400, am_d...@fastmail.fm wrote:
 > On Thu, Aug 18, 2016, at 09:14 AM, Anthony Jenkins wrote:
 > > Try this patch, that's what I'm running.

 > I applied this patch to the latest 11 source and built my kernel and now
 > I have cpu throttling on the AMD machine. I see the Cool'n'Quiet 2.0
 > driver attach and have frequencies in dev.cpu. The fans now run at a
 > much lower speed and I am saving upwards of 4 watts when running on
 > battery power. Thank you so much for this patch and to everyone else for
 > the suggestions on this issue. It is such a great feeling to know that
 > now I can use FreeBSD on my new laptop.

That's great news.  More good work, Anthony.

Is there a PR for this issue/fix?  It would be good to see this patch 
reviewed and headed into the tree, no?

cheers, Ian
___
freebsd-acpi@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-acpi
To unsubscribe, send any mail to "freebsd-acpi-unsubscr...@freebsd.org"


Re: Problems with CPU throttling on HP 15-n066us laptop

2016-08-20 Thread am_dxer
On Thu, Aug 18, 2016, at 09:14 AM, Anthony Jenkins wrote:
> Try this patch, that's what I'm running.
I applied this patch to the latest 11 source and built my kernel and now
I have cpu throttling on the AMD machine. I see the Cool'n'Quiet 2.0
driver attach and have frequencies in dev.cpu. The fans now run at a
much lower speed and I am saving upwards of 4 watts when running on
battery power. Thank you so much for this patch and to everyone else for
the suggestions on this issue. It is such a great feeling to know that
now I can use FreeBSD on my new laptop.
___
freebsd-acpi@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-acpi
To unsubscribe, send any mail to "freebsd-acpi-unsubscr...@freebsd.org"


Re: Problems with CPU throttling on HP 15-n066us laptop

2016-08-19 Thread Anthony Jenkins via freebsd-acpi
On 08/19/2016 09:16 AM, Anthony Jenkins via freebsd-acpi wrote:
>
> On 08/19/2016 09:14 AM, Anthony Jenkins wrote:
>>
>> On 08/19/2016 08:20 AM, am_d...@fastmail.fm wrote:
>>> On Thu, Aug 18, 2016, at 09:14 AM, Anthony Jenkins wrote:
 Try this patch, that's what I'm running.
>>> Could you put this patch in an online pasting service? My mail client
>>> destroyed the formatting of this. I spent a while trying to correct it
>>> but couldn't get it to apply. Thanks and sorry for the noise.
>> Ahh sorry about that.  It's pushed to my github repo branch 'amd_cpufreq'
>>
>> https://github.com/ScoobiFreeBSD/freebsd/tree/amd_cpufreq
>>
>> hopefully you can view this URL
>>
>> 
>> https://github.com/ScoobiFreeBSD/freebsd/commit/a8869f030e5a939a75a6e92f1a83ef0e769006ba
>>
>> but I don't see a way to download a diff of this commit, so I'll stick
>> it on pastebin:
>>
>> http://pastebin.com/iKLmYQjw
>>
> Gah... sorry again, meant to change delivery format to plaintext before
> sending...

Figured out how to get a patch from GitHub.

https://github.com/ScoobiFreeBSD/freebsd/commit/a8869f030e5a939a75a6e92f1a83ef0e769006ba.patch

Reference:
http://chem-bla-ics.blogspot.com/2011/01/github-tip-download-commits-as-patches.html
>> -- 
>> Anthony Jenkins

-- 
Anthony Jenkins

___
freebsd-acpi@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-acpi
To unsubscribe, send any mail to "freebsd-acpi-unsubscr...@freebsd.org"


Re: Problems with CPU throttling on HP 15-n066us laptop

2016-08-19 Thread Anthony Jenkins via freebsd-acpi

___
freebsd-acpi@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-acpi
To unsubscribe, send any mail to "freebsd-acpi-unsubscr...@freebsd.org"


Re: Problems with CPU throttling on HP 15-n066us laptop

2016-08-19 Thread am_dxer


On Thu, Aug 18, 2016, at 09:14 AM, Anthony Jenkins wrote:
> Try this patch, that's what I'm running.
Could you put this patch in an online pasting service? My mail client
destroyed the formatting of this. I spent a while trying to correct it
but couldn't get it to apply. Thanks and sorry for the noise.
___
freebsd-acpi@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-acpi
To unsubscribe, send any mail to "freebsd-acpi-unsubscr...@freebsd.org"


Re: Problems with CPU throttling on HP 15-n066us laptop

2016-08-18 Thread Anthony Jenkins via freebsd-acpi
Try this patch, that's what I'm running.

diff --git a/sys/x86/cpufreq/hwpstate.c b/sys/x86/cpufreq/hwpstate.c
index d4c70b7..326d967 100644
--- a/sys/x86/cpufreq/hwpstate.c
+++ b/sys/x86/cpufreq/hwpstate.c
@@ -408,25 +408,27 @@ hwpstate_get_info_from_msr(device_t dev)
hwpstate_set = sc->hwpstate_settings;
for (i = 0; i < sc->cfnum; i++) {
msr = rdmsr(MSR_AMD_10H_11H_CONFIG + i);
-   if ((msr & ((uint64_t)1 << 63)) != ((uint64_t)1 << 63)) {
+   if ((msr & ((uint64_t)1 << 63)) == 0) {
HWPSTATE_DEBUG(dev, "msr is not valid.\n");
return (ENXIO);
}
did = AMD_10H_11H_CUR_DID(msr);
fid = AMD_10H_11H_CUR_FID(msr);
+   /* fid/did to frequency */
switch(family) {
case 0x11:
-   /* fid/did to frequency */
-   hwpstate_set[i].freq = 100 * (fid + 0x08) / (1
<< did);
+   hwpstate_set[i].freq = (100 * (fid + 0x08)) >> did;
break;
case 0x10:
-   /* fid/did to frequency */
-   hwpstate_set[i].freq = 100 * (fid + 0x10) / (1
<< did);
+   case 0x12:
+   case 0x14:
+   case 0x15:
+   case 0x16:
+   hwpstate_set[i].freq = (100 * (fid + 0x10)) >> did;
break;
default:
-   HWPSTATE_DEBUG(dev, "get_info_from_msr: AMD
family %d CPU's are not implemented yet. sorry.\n", family);
+   HWPSTATE_DEBUG(dev, "get_info_from_msr: AMD
family 0x%02x CPU's are not implemented yet. sorry.\n", family);
return (ENXIO);
-   break;
}
hwpstate_set[i].pstate_id = i;
/* There was volts calculation, but deleted it. */
diff --git a/sys/x86/cpufreq/powernow.c b/sys/x86/cpufreq/powernow.c
index cc62e87..355bde8 100644
--- a/sys/x86/cpufreq/powernow.c
+++ b/sys/x86/cpufreq/powernow.c
@@ -866,17 +866,22 @@ static void
 pn_identify(driver_t *driver, device_t parent)
 {
 
-   if ((amd_pminfo & AMDPM_FID) == 0 || (amd_pminfo & AMDPM_VID) == 0)
+   if ((amd_pminfo & AMDPM_FID) == 0 || (amd_pminfo & AMDPM_VID) ==
0) {
+   printf("powernow: pn_identify: amd_pminfo=0x%04x .\n",
amd_pminfo);
return;
+   }
switch (cpu_id & 0xf00) {
case 0x600:
case 0xf00:
break;
default:
+   printf("powernow: pn_identify: cpu_id=0x%04x.\n", cpu_id);
return;
}
-   if (device_find_child(parent, "powernow", -1) != NULL)
+   if (device_find_child(parent, "powernow", -1) != NULL) {
+   printf("powernow: pn_identify: No \"powernow\"device
found.\n");
return;
+   }
if (BUS_ADD_CHILD(parent, 10, "powernow", -1) == NULL)
device_printf(parent, "powernow: add child failed\n");
 }
@@ -895,8 +900,10 @@ pn_probe(device_t dev)
status = rdmsr(MSR_AMDK7_FIDVID_STATUS);

pc = cpu_get_pcpu(dev);
-   if (pc == NULL)
+   if (pc == NULL) {
+   printf("powernow: cpu_get_pcpu() returned NULL.\n");
return (ENODEV);
+   }

cpu_est_clockrate(pc->pc_cpuid, );

@@ -936,6 +943,7 @@ pn_probe(device_t dev)
device_set_desc(dev, "Cool`n'Quiet K8");
break;
default:
+   printf("powernow: cpuid 0x%04x & 0xf00 not matched.\n",
cpu_id);
return (ENODEV);
}



On 08/18/2016 08:12 AM, Ian Smith wrote:
> On Thu, 18 Aug 2016 06:07:45 -0400, am_d...@fastmail.fm wrote:
>  > On Thu, Aug 18, 2016, at 03:46 AM, Konstantin Belousov wrote:
>  > > On Wed, Aug 17, 2016 at 10:50:12PM -0400, am_d...@fastmail.fm wrote:
>  > > > Hello,
>  > > > I purchased a new laptop for FreeBSD and am having some problems with
>  > > > CPU throttling. This laptop has an aMD a10-5745m processor. I cannot
>  > > > start powerd and the frequency levels in dev.cpu are absent. I tried
>
> Just to clear up any confusion: Adam Pribyl noted that "throttling" is 
> disabled in 10(+) but that refers only to "relative" cpufreq drivers, 
> p4tcc and acpi_throttle, whereas your main problem appears to be that 
> cpufreq(4) isn't attaching at all, so there's no a) control over and b) 
> no ability to read, let alone set, cpu.0.freq.
>
> I don't know much about recent AMDs, but you mention Cool'n'Quiet, 
> otherwise refered to in acpi(4) as:  [ note: reading stable/9 manpage]
>   powernow   AMD PowerNow! and Cool'n'Quiet for K7 and K8
> but again, these are subsidiary drivers to cpufreq(4).
>
>  > > > with 11 and when that didn't work, I upgraded to Current. The laptop is
>  > > > running very hot and the fans are often running at a high speed so I
>  > > > think the cpu 

Problems with CPU throttling on HP 15-n066us laptop

2016-08-17 Thread am_dxer
Hello,
I purchased a new laptop for FreeBSD and am having some problems with
CPU throttling. This laptop has an aMD a10-5745m processor. I cannot
start powerd and the frequency levels in dev.cpu are absent. I tried
with 11 and when that didn't work, I upgraded to Current. The laptop is
running very hot and the fans are often running at a high speed so I
think the cpu is running near full speed.  This is the only issue I am
having in general use of the laptop. I will include the url for my asl
below as well as the output of dmesg after boot -v and sysctl hw.acpi. I
noticed messages like "acpi_ec0: EcCommand: no response to 0x84" near
the bottom of the dmesg but honestly don't know enough about acpi to say
whether this could be causing the problem. I tried Googling the error
and found people who seemed to be having trouble with temperature
readings and battery status. For me, the battery status is working fine
when I check it via acpiconf although I did notice some unusual
temperature readings in the dmesg output. There are some other
temperature readings that appear in sysctl but I would have to study
them more during a work session to see if they remain reasonable. Thanks
in advance for any help.


asl url: http://pasted.co/5770b687

boot-v output: http://pasted.co/c8e9fb89

hw.acpi output: http://pasted.co/cc611266
___
freebsd-acpi@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-acpi
To unsubscribe, send any mail to "freebsd-acpi-unsubscr...@freebsd.org"