|
Looks like my AMD box isn't quite working correctly with regards to
P-states. I noted this repeating periodically: hwpstate0: set freq failed, err 6 I noted these errors when setting the hwpstate verbose systctl on: May 17 22:28:32 Alice kernel: hwpstate0: set freq failed, err 6 May 17 22:28:32 Alice kernel: hwpstate0: setting P1-state on cpu0 May 17 22:28:32 Alice kernel: hwpstate0: result P1-state on cpu0 May 17 22:28:32 Alice kernel: hwpstate0: setting P1-state on cpu1 May 17 22:28:32 Alice kernel: hwpstate0: result P1-state on cpu1 May 17 22:28:32 Alice kernel: hwpstate0: setting P1-state on cpu2 May 17 22:28:32 Alice kernel: hwpstate0: result P1-state on cpu2 May 17 22:28:32 Alice kernel: hwpstate0: setting P1-state on cpu3 May 17 22:28:32 Alice kernel: hwpstate0: result P1-state on cpu3 May 17 22:28:32 Alice kernel: hwpstate0: setting P1-state on cpu4 May 17 22:28:32 Alice kernel: hwpstate0: result P1-state on cpu4 May 17 22:28:32 Alice kernel: hwpstate0: setting P1-state on cpu5 May 17 22:28:32 Alice kernel: hwpstate0: result P1-state on cpu5 May 17 22:28:32 Alice kernel: hwpstate0: setting P1-state on cpu6 May 17 22:28:32 Alice kernel: hwpstate0: result P1-state on cpu6 May 17 22:28:32 Alice kernel: hwpstate0: setting P1-state on cpu7 May 17 22:28:32 Alice kernel: hwpstate0: result P1-state on cpu7 Sean ref this machine: http://forums.pcbsd.org/showthread.php?t=16733 _______________________________________________ [hidden email] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to "[hidden email]" |
|
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1 On 2012-05-18 01:32:09 -0400, Sean Bruno wrote: > Looks like my AMD box isn't quite working correctly with regards > to P-states. I noted this repeating periodically: hwpstate0: set > freq failed, err 6 > > > I noted these errors when setting the hwpstate verbose systctl on: > > May 17 22:28:32 Alice kernel: hwpstate0: set freq failed, err 6 May > 17 22:28:32 Alice kernel: hwpstate0: setting P1-state on cpu0 May > 17 22:28:32 Alice kernel: hwpstate0: result P1-state on cpu0 May > 17 22:28:32 Alice kernel: hwpstate0: setting P1-state on cpu1 May > 17 22:28:32 Alice kernel: hwpstate0: result P1-state on cpu1 May > 17 22:28:32 Alice kernel: hwpstate0: setting P1-state on cpu2 May > 17 22:28:32 Alice kernel: hwpstate0: result P1-state on cpu2 May > 17 22:28:32 Alice kernel: hwpstate0: setting P1-state on cpu3 May > 17 22:28:32 Alice kernel: hwpstate0: result P1-state on cpu3 May > 17 22:28:32 Alice kernel: hwpstate0: setting P1-state on cpu4 May > 17 22:28:32 Alice kernel: hwpstate0: result P1-state on cpu4 May > 17 22:28:32 Alice kernel: hwpstate0: setting P1-state on cpu5 May > 17 22:28:32 Alice kernel: hwpstate0: result P1-state on cpu5 May > 17 22:28:32 Alice kernel: hwpstate0: setting P1-state on cpu6 May > 17 22:28:32 Alice kernel: hwpstate0: result P1-state on cpu6 May > 17 22:28:32 Alice kernel: hwpstate0: setting P1-state on cpu7 May > 17 22:28:32 Alice kernel: hwpstate0: result P1-state on cpu7 > > > Sean > > ref this machine: http://forums.pcbsd.org/showthread.php?t=16733 I briefly looked at the dmesg. You have a Family 15h processor (Bulldozer with Turbo Core) and I believe it isn't supported (yet). It won't be too hard to implement, though. Jung-uk Kim -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk+2dlkACgkQmlay1b9qnVOhzwCfRi7ZqdpQ8yH/N3IHqCFl/586 XdoAnRLeenDvgQKvB6BIjyMsoskXcSNs =hGYz -----END PGP SIGNATURE----- _______________________________________________ [hidden email] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to "[hidden email]" |
|
On Fri, 2012-05-18 at 09:18 -0700, Jung-uk Kim wrote:
> -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > On 2012-05-18 01:32:09 -0400, Sean Bruno wrote: > > Looks like my AMD box isn't quite working correctly with regards > > to P-states. I noted this repeating periodically: hwpstate0: set > > freq failed, err 6 > > > > > > I noted these errors when setting the hwpstate verbose systctl on: > > > > May 17 22:28:32 Alice kernel: hwpstate0: set freq failed, err 6 May > > 17 22:28:32 Alice kernel: hwpstate0: setting P1-state on cpu0 May > > 17 22:28:32 Alice kernel: hwpstate0: result P1-state on cpu0 May > > 17 22:28:32 Alice kernel: hwpstate0: setting P1-state on cpu1 May > > 17 22:28:32 Alice kernel: hwpstate0: result P1-state on cpu1 May > > 17 22:28:32 Alice kernel: hwpstate0: setting P1-state on cpu2 May > > 17 22:28:32 Alice kernel: hwpstate0: result P1-state on cpu2 May > > 17 22:28:32 Alice kernel: hwpstate0: setting P1-state on cpu3 May > > 17 22:28:32 Alice kernel: hwpstate0: result P1-state on cpu3 May > > 17 22:28:32 Alice kernel: hwpstate0: setting P1-state on cpu4 May > > 17 22:28:32 Alice kernel: hwpstate0: result P1-state on cpu4 May > > 17 22:28:32 Alice kernel: hwpstate0: setting P1-state on cpu5 May > > 17 22:28:32 Alice kernel: hwpstate0: result P1-state on cpu5 May > > 17 22:28:32 Alice kernel: hwpstate0: setting P1-state on cpu6 May > > 17 22:28:32 Alice kernel: hwpstate0: result P1-state on cpu6 May > > 17 22:28:32 Alice kernel: hwpstate0: setting P1-state on cpu7 May > > 17 22:28:32 Alice kernel: hwpstate0: result P1-state on cpu7 > > > > > > Sean > > > > ref this machine: http://forums.pcbsd.org/showthread.php?t=16733 > > I briefly looked at the dmesg. You have a Family 15h processor > (Bulldozer with Turbo Core) and I believe it isn't supported (yet). > It won't be too hard to implement, though. > > Jung-uk Kim I'm assuming, something like this to start? http://people.freebsd.org/~sbruno/bulldozer.txt I'm reading the AMD spec, and that *seems* to be right? But, chances are I have no idea what I'm doing. :-) Sean _______________________________________________ [hidden email] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to "[hidden email]" |
|
Hello,
a user at BSDForen.de had the same problem and I helped him to track it down. While I was unable to find a solution I found the cause of the problems. The problem is (all files and line numbers relative to FreeBSD 9.0-RELEASE): 1. When a new p-state is requested (by powerd or by changing the sysctl) in kern/kern_cpu.c the function cf_set_method() is invoked. 2. In line 335 the driver depended function is called. For newer AMD CPU it's hwpstate_set() in x86/cpufreq/hwpstate.c 3. In x86/cpufreq/hwpstate.c line 227 hwpstate_goto_pstate() is called which does the actual magic. 4. In line 199 "if (msr != id)" triggers, returns ENXIO. The error is send back to cf_set_method(), which prints the "hwpstate0: set freq failed". powerd translates the error to "Device not configured" After some further investigation and looking at the linux driver [0] I changed the loop at x86/cpufreq/hwpstate.c 188ff from 100 iterations to 250. It lessend the problem but didn't solve it. The next step was to rewrite the logic between line 183 and 203 and adding a lot of debug printf. The patch (non style(9) compliant) is attached. With the new logic every 100 usec the new p-state is set again, until it's accepted. After 100 tries ENXIO is returned. This lessend the problem even more and showed that - On an old Phenom II X4 940 (K10 / Deneb) the new p-state is always accepted at the first try. At a test run for about 3 hours there was not a single failure. - On the Bulldozer CPU in about 9 in 10 times the new p-state is accepted at the first try. At most other times the new p-state is accepted after 1 to 10 tries. And there is a ~0,25% chance that the new p-state is never accepted, leading to "hwpstate0: set freq failed". At the next call to cf_set_method() (about 500ms to 1s later) the new p-state it's most likely set successfull. This can be seen at the log (full log attached): # First call, failed after 102 iterations hwpstate0: MSR: 0 ID: 1 hwpstate0: Setting failed! hwpstate0: Iterations: 102 # Second call, successfull hwpstate0: setting P1-state on cpu1 hwpstate0: MSR: 1 ID: 1 hwpstate0: Iterations: 1 So the big question is: Why is the new p-state sometimes not accepted? And why does this only happen on Bulldozer CPUs and not at the old K10 (Barcelona, Deneb), etc? Reading the "BIOS and kernel developer guide" for Bulldozer didn't show anything, but I may have overlooked it. One solution may be to change hwpstate not to set p-states but "Frequency IDs" (FID) and "Voltage ID" (VID) like the linux driver does. 0: http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=blob;f=drivers/cpufreq/powernow-k8.c;h=c0e816468e300f242735f4825d09b9d291a9b522;hb=HEAD 1: http://support.amd.com/us/Processor_TechDocs/42301_15h_Mod_00h-0Fh_BKDG.pdf -- Homepage: www.yamagi.org XMPP: [hidden email] GnuPG/GPG: 0xEFBCCBCB |
|
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1 On 2012-05-25 11:47:53 -0400, Andriy Gapon wrote: > on 25/05/2012 17:36 Yamagi Burmeister said the following: >> Hello, a user at BSDForen.de had the same problem and I helped >> him to track it down. While I was unable to find a solution I >> found the cause of the problems. The problem is (all files and >> line numbers relative to FreeBSD 9.0-RELEASE): >> >> 1. When a new p-state is requested (by powerd or by changing the >> sysctl) in kern/kern_cpu.c the function cf_set_method() is >> invoked. 2. In line 335 the driver depended function is called. >> For newer AMD CPU it's hwpstate_set() in x86/cpufreq/hwpstate.c >> 3. In x86/cpufreq/hwpstate.c line 227 hwpstate_goto_pstate() is >> called which does the actual magic. 4. In line 199 "if (msr != >> id)" triggers, returns ENXIO. The error is send back to >> cf_set_method(), which prints the "hwpstate0: set freq failed". >> powerd translates the error to "Device not configured" >> >> After some further investigation and looking at the linux driver >> [0] I changed the loop at x86/cpufreq/hwpstate.c 188ff from 100 >> iterations to 250. It lessend the problem but didn't solve it. >> The next step was to rewrite the logic between line 183 and 203 >> and adding a lot of debug printf. The patch (non style(9) >> compliant) is attached. With the new logic every 100 usec the new >> p-state is set again, until it's accepted. After 100 tries ENXIO >> is returned. >> >> This lessend the problem even more and showed that - On an old >> Phenom II X4 940 (K10 / Deneb) the new p-state is always accepted >> at the first try. At a test run for about 3 hours there was not a >> single failure. - On the Bulldozer CPU in about 9 in 10 times the >> new p-state is accepted at the first try. At most other times the >> new p-state is accepted after 1 to 10 tries. And there is a >> ~0,25% chance that the new p-state is never accepted, leading to >> "hwpstate0: set freq failed". At the next call to cf_set_method() >> (about 500ms to 1s later) the new p-state it's most likely set >> successfull. This can be seen at the log (full log attached): >> >> # First call, failed after 102 iterations hwpstate0: MSR: 0 ID: >> 1 hwpstate0: Setting failed! hwpstate0: Iterations: 102 >> >> # Second call, successfull hwpstate0: setting P1-state on cpu1 >> hwpstate0: MSR: 1 ID: 1 hwpstate0: Iterations: 1 >> >> So the big question is: Why is the new p-state sometimes not >> accepted? And why does this only happen on Bulldozer CPUs and not >> at the old K10 (Barcelona, Deneb), etc? Reading the "BIOS and >> kernel developer guide" for Bulldozer didn't show anything, but I >> may have overlooked it. One solution may be to change hwpstate >> not to set p-states but "Frequency IDs" (FID) and "Voltage ID" >> (VID) like the linux driver does. > > I think that you misread their code a little bit. The vid/fid > transition is used for K8 processors, for newer ones they do the > same P-state transitioning. The secret of their success seems to be > that they just write the MSR without any post-write checks. > > As to your questions about hardware behavior - yes, they are quite > interesting, but perhaps irrelevant. The BKDG never specifies the > OS P-state transition command sequence and timings, it just says > "write the MSR" (exactly what Linux does). There could be > different reasons why a core could be in a different P-state > (mostly I suspect interactions between cores in a Bulldozer compute > unit). When BKDG does specify the P-state transitioning sequence > (for BIOS) it suggest a different one from what we do - first write > the MSR on al processors, only then check the result (and the way > of checking the result is also a bit different - using MSR xxx71). I just looked through the BKDG and I think you should definitely check MSRC001_0071[18:16]. MSRC001_0063[2:0] is "SharedC" but MSRC001_0062[2:0] and MSRC001_0071[18:15] are "Not-same-for-all". I think this means writing a P-state to MSRC001_0062[2:0] will be reflected in MSRC001_0070[18:16] first, then MSRC001_0071[18:16] gets updated when the P-state transition is complete. MSRC001_0063[2:0] will only change when all cores in a compute unit is in sync., which may be too late. > But as I've said, these details are probably not really useful in > practice. We should just quit worrying and double-checking the > hardware :-) I think we should check. Jung-uk Kim >> 0: >> http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=blob;f=drivers/cpufreq/powernow-k8.c;h=c0e816468e300f242735f4825d09b9d291a9b522;hb=HEAD >> >> >> 1: >> http://support.amd.com/us/Processor_TechDocs/42301_15h_Mod_00h-0Fh_BKDG.pdf -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk+/vTkACgkQmlay1b9qnVPY9QCgqcEvUHKKQ3U0Rec5Kzdlrw3L kSkAnj6ofOf8PVkEHlxNrgGZAHJ2so1p =GQw9 -----END PGP SIGNATURE----- _______________________________________________ [hidden email] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to "[hidden email]" |
|
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1 On 2012-05-25 13:11:21 -0400, Jung-uk Kim wrote: > I just looked through the BKDG and I think you should definitely > check MSRC001_0071[18:16]. MSRC001_0063[2:0] is "SharedC" but > MSRC001_0062[2:0] and MSRC001_0071[18:15] are "Not-same-for-all". ^^ 16 Sorry for the typo. Jung-uk Kim -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk+/vb4ACgkQmlay1b9qnVOjPACbBIyx9eHTXqDqJjeAQpamAfPT 9+oAoL99VMf9MAhspIBJGvjFBG2aLynE =4Z9b -----END PGP SIGNATURE----- _______________________________________________ [hidden email] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to "[hidden email]" |
|
In reply to this post by Jung-uk Kim
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1 On 2012-05-25 15:39:39 -0400, Andriy Gapon wrote: > on 25/05/2012 20:11 Jung-uk Kim said the following: >> I just looked through the BKDG and I think you should definitely >> check MSRC001_0071[18:16]. MSRC001_0063[2:0] is "SharedC" but >> MSRC001_0062[2:0] and MSRC001_0071[18:15] are "Not-same-for-all". >> I think this means writing a P-state to MSRC001_0062[2:0] will be >> reflected in MSRC001_0070[18:16] first, then MSRC001_0071[18:16] >> gets updated when the P-state transition is complete. >> MSRC001_0063[2:0] will only change when all cores in a compute >> unit is in sync., which may be too late. >> > [snip] >> I think we should check. > > Jung-uk, > > if we decide so, then I think that we could still keep the things > "simple". As we currently use the "wholesale" approach (all CPUs > are set to the same P-state regardless of topology), then we could > first make a pass of writing the MSR on all processors with a new > P-state value and then make another pass of checking via MSR > C001_0063 that the P-state is acquired. No, I believe checking MSRC001_0071[18:16] is much simpler if it works. And it does not break current cpufreq(4) design principles. Jung-uk Kim -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk+/5iQACgkQmlay1b9qnVOHLgCfY0ELt5oN1hml8S+bDGSHbOux bj4AoKisSh9DlK46U+LFthaSGicp/+Hc =BYej -----END PGP SIGNATURE----- _______________________________________________ [hidden email] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to "[hidden email]" |
|
Hi,
I suprised that followings , cited from AMD BKDG(42301 Rev 3.06 - January 25, 2012) > 2.5.2.1.4 > Core P-state Visibility > (snip) > If a compute unit is in a boosted P-state, MSRC001_0063[CurPstate] > reads back as 0. ^^^^^^^^^^^^^ if in a boosted P-state, MSRC001_0063 "reads back as 0". so here is ugly patch ;-) --- hwpstate.c.orig 2012-05-26 15:06:06.000000000 +0900 +++ hwpstate.c 2012-05-26 15:07:50.000000000 +0900 @@ -196,7 +196,7 @@ msr = rdmsr(MSR_AMD_10H_11H_STATUS); HWPSTATE_DEBUG(dev, "result P%d-state on cpu%d\n", (int)msr, PCPU_GET(cpuid)); - if (msr != id) { + if (msr != id && msr != 0) { HWPSTATE_DEBUG(dev, "error: loop is not enough.\n"); error = ENXIO; } but this doesn't reflect that the cpu frequency is equal to sysctl value. So, disabling the boost and setting the p-state is an answer. And when setting the max freq from sysctl, enable the boost is also. -- Gen O.<[hidden email]> _______________________________________________ [hidden email] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to "[hidden email]" |
|
In reply to this post by Jung-uk Kim
On Fri, 25 May 2012 16:05:56 -0400
Jung-uk Kim <[hidden email]> wrote: > > if we decide so, then I think that we could still keep the things > > "simple". As we currently use the "wholesale" approach (all CPUs > > are set to the same P-state regardless of topology), then we could > > first make a pass of writing the MSR on all processors with a new > > P-state value and then make another pass of checking via MSR > > C001_0063 that the P-state is acquired. > > No, I believe checking MSRC001_0071[18:16] is much simpler if it > works. And it does not break current cpufreq(4) design principles. Okay, thank's for your input. I'll come up with a patch. But it won't happen until tuesday or wednesday next week. -- Homepage: www.yamagi.org XMPP: [hidden email] GnuPG/GPG: 0xEFBCCBCB |
|
On Sat, 26 May 2012 12:34:25 +0300
Andriy Gapon <[hidden email]> wrote: > >>> if we decide so, then I think that we could still keep the things > >>> "simple". As we currently use the "wholesale" approach (all CPUs are > >>> set to the same P-state regardless of topology), then we could first > >>> make a pass of writing the MSR on all processors with a new P-state > >>> value and then make another pass of checking via MSR C001_0063 that the > >>> P-state is acquired. > >> > >> No, I believe checking MSRC001_0071[18:16] is much simpler if it works. > >> And it does not break current cpufreq(4) design principles. One potential problem with MSRC001_0071[18:16] is, that it's on older CPUs supported by hwpstate it's the same as C001_0063. Only on newer models with "turbo" it containts the actual "hardware p-state". So additional logic would be required: 1. Set new p-state 2. Check CPUID for support of "hardware p-states" 3.1 If yes, read MSRC001_0071[18:16] and convert the "hardware p-state" into a "software p-state" 3.2 If not, just read MSRC001_0071[18:16] 4. Compare read (and converted) p-state to the requested p-state I don't think that it's worth this additional efford. The solution suggest by Andriy Gapon is trivial, works fine and is supported by all CPUs supported by hwpstate. > I believe the approach that I suggested to be so trivial to implement (and also > correct) that here is a patch: > > diff --git a/sys/x86/cpufreq/hwpstate.c b/sys/x86/cpufreq/hwpstate.c > index 40e1943..9c17a41 100644 > --- a/sys/x86/cpufreq/hwpstate.c > +++ b/sys/x86/cpufreq/hwpstate.c > @@ -186,16 +186,21 @@ hwpstate_goto_pstate(device_t dev, int pstate) > id, PCPU_GET(cpuid)); > /* Go To Px-state */ > wrmsr(MSR_AMD_10H_11H_CONTROL, id); > + } > + CPU_FOREACH(i) { > + /* Bind to each cpu. */ > + thread_lock(curthread); > + sched_bind(curthread, i); > + thread_unlock(curthread); > /* wait loop (100*100 usec is enough ?) */ > for(j = 0; j < 100; j++){ > + /* get the result. not assure msr=id */ > msr = rdmsr(MSR_AMD_10H_11H_STATUS); > if(msr == id){ > break; > } > DELAY(100); > } > - /* get the result. not assure msr=id */ > - msr = rdmsr(MSR_AMD_10H_11H_STATUS); > HWPSTATE_DEBUG(dev, "result P%d-state on cpu%d\n", > (int)msr, PCPU_GET(cpuid)); > if (msr != id) { Phenom II "Deneb". -- Homepage: www.yamagi.org XMPP: [hidden email] GnuPG/GPG: 0xEFBCCBCB |
|
In reply to this post by Yamagi Burmeister
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1 On 2012-05-26 05:34:25 -0400, Andriy Gapon wrote: > on 26/05/2012 10:02 Yamagi Burmeister said the following: >> On Fri, 25 May 2012 16:05:56 -0400 Jung-uk Kim <[hidden email]> >> wrote: >> >>>> if we decide so, then I think that we could still keep the >>>> things "simple". As we currently use the "wholesale" approach >>>> (all CPUs are set to the same P-state regardless of >>>> topology), then we could first make a pass of writing the MSR >>>> on all processors with a new P-state value and then make >>>> another pass of checking via MSR C001_0063 that the P-state >>>> is acquired. >>> >>> No, I believe checking MSRC001_0071[18:16] is much simpler if >>> it works. And it does not break current cpufreq(4) design >>> principles. >> >> Okay, thank's for your input. I'll come up with a patch. But it >> won't happen until tuesday or wednesday next week. >> > > I believe the approach that I suggested to be so trivial to > implement (and also correct) that here is a patch: It is simple but I don't like locking scheduler, binding CPU, and writing the same MSR, multiple times for each core. Besides, it introduces more delay and you may be reading the correct status because of that. :-P If people really think checking MSRC001_0071[18:16] is unworthy for Bulldozer, I prefer skipping status check but I disagree with this patch. Thanks, Jung-uk Kim -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk/H1GQACgkQmlay1b9qnVM+RQCfaYl6LpyARoO2oiyimwrWrhXD BPoAoIna4GHZKlsCRaXV3jqH8ujpzur5 =NYS0 -----END PGP SIGNATURE----- _______________________________________________ [hidden email] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to "[hidden email]" |
|
on 31/05/2012 23:28 Jung-uk Kim said the following:
> It is simple but I don't like locking scheduler, binding CPU, and writing > the same MSR, multiple times for each core. Not sure if parse this. The MSR is _written_ /once/ for each core. (BTW, "locking scheduler" is not a completely accurate description of what thread_lock does) > Besides, it introduces more delay and you may be reading the correct > status because of that. :-P Having a separate reading pass does introduce more delay indeed. Reading the correct status is a good thing, OTOH. Why would anyone want to read incorrect status? (just want to note that "correct" and "expected" are different things) > If people really think checking MSRC001_0071[18:16] is unworthy for Well, "other people" hasn't demonstrated/proved/convinced yet that it is worthy > Bulldozer, I prefer skipping status check That's what I suggested from the very start. > but I disagree with this patch. Since I am not invested in this issue (I am not affected by the problem and I do not have any personal attachment to the code in question), I will just defer any decision to those who do care about the problem. I hope that a fix will be provided in the end. -- Andriy Gapon _______________________________________________ [hidden email] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to "[hidden email]" |
|
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1 On 2012-06-06 17:58:57 -0400, Andriy Gapon wrote: > on 31/05/2012 23:28 Jung-uk Kim said the following: >> It is simple but I don't like locking scheduler, binding CPU, and >> writing the same MSR, multiple times for each core. > > Not sure if parse this. The MSR is _written_ /once/ for each > core. (BTW, "locking scheduler" is not a completely accurate > description of what thread_lock does) I apologize. I didn't see the whole picture and read your patch wrong. Any way, hwpstate still isn't quite right even without your patch. sys/kern/kern_cpu.c cpufreq_curr_sysctl() -> CPUFREQ_SET() -> /* for all CPU devices */ cf_set_method() -> /* thread_lock(), sched_bind(), ... */ CPUFREQ_DRV_SET() -> sys/x86/cpufreq/hwpstate.c hwpstate_set() -> hwpstate_goto_pstate() /* for each CPU unit */ /* thread_lock(), sched_bind(), ... */ Therefore, "sysctl dev.cpu.0.cpufreq=<freq>" loops n^2 times (i.e., n times per CPU) where n is number of CPUs. At least, it should check unit == 0, e.g., hwpstate_goto_pstate(...) { ... if (unit == 0) { /* XXX Is this really necessary? */ CPU_FOREACH(i) { ... wrmsr(MSR_AMD_10H_11H_CONTROL, id); ... } } /* Check the current P-state. */ for (...) { ... msr = rdmsr(MSR_AMD_10H_11H_STATUS); if (msr == id) break; ... } /* XXX Maybe your patch here? */ ... } >> Besides, it introduces more delay and you may be reading the >> correct status because of that. :-P > > Having a separate reading pass does introduce more delay indeed. > Reading the correct status is a good thing, OTOH. That's what I said. > Why would anyone want to read incorrect status? (just want to note > that "correct" and "expected" are different things) Okay, okay. >> If people really think checking MSRC001_0071[18:16] is unworthy >> for > > Well, "other people" hasn't demonstrated/proved/convinced yet that > it is worthy > >> Bulldozer, I prefer skipping status check > > That's what I suggested from the very start. Buy me a Bulldozer and I'll fix it for you! :-P >> but I disagree with this patch. > > Since I am not invested in this issue (I am not affected by the > problem and I do not have any personal attachment to the code in > question), I will just defer any decision to those who do care > about the problem. I hope that a fix will be provided in the end. Same here. Jung-uk Kim -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk/P4XgACgkQmlay1b9qnVP8cgCgl9sAzyE956YjB2B3bK0wvOHu n64Anih7sdWYQgflQVHuUGstdk05Fs9i =2dS0 -----END PGP SIGNATURE----- _______________________________________________ [hidden email] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to "[hidden email]" |
|
On Wed, 2012-06-06 at 16:02 -0700, Jung-uk Kim wrote:
> Buy me a Bulldozer and I'll fix it for you! :-P Since I have one (FX-8150), do you want me to expose it to the internet and let you play with it? Sean _______________________________________________ [hidden email] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to "[hidden email]" |
|
In reply to this post by Jung-uk Kim
on 07/06/2012 02:02 Jung-uk Kim said the following:
> Any way, hwpstate still isn't quite right even without your patch. > > sys/kern/kern_cpu.c cpufreq_curr_sysctl() -> CPUFREQ_SET() -> /* for all > CPU devices */ cf_set_method() -> /* thread_lock(), sched_bind(), ... */ > CPUFREQ_DRV_SET() -> sys/x86/cpufreq/hwpstate.c hwpstate_set() -> > hwpstate_goto_pstate() /* for each CPU unit */ /* thread_lock(), > sched_bind(), ... */ Oh, I didn't realize that there was the cpufreq-level loop over all CPUs! That really sucks. Maybe some day we should accept that different CPUs could legitimately be in different P-states and provide support for that throughout the stack (from powerd to drivers). -- Andriy Gapon _______________________________________________ [hidden email] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to "[hidden email]" |
|
On 06/07/12 11:10, Andriy Gapon wrote:
> on 07/06/2012 02:02 Jung-uk Kim said the following: >> Any way, hwpstate still isn't quite right even without your patch. >> >> sys/kern/kern_cpu.c cpufreq_curr_sysctl() -> CPUFREQ_SET() -> /* for all >> CPU devices */ cf_set_method() -> /* thread_lock(), sched_bind(), ... */ >> CPUFREQ_DRV_SET() -> sys/x86/cpufreq/hwpstate.c hwpstate_set() -> >> hwpstate_goto_pstate() /* for each CPU unit */ /* thread_lock(), >> sched_bind(), ... */ > > Oh, I didn't realize that there was the cpufreq-level loop over all CPUs! > That really sucks. > > Maybe some day we should accept that different CPUs could legitimately be in > different P-states and provide support for that throughout the stack (from > powerd to drivers). Support for different P-states on different CPUs can be useful if CPUs have different capabilities. I believe it is very rare, but possible. At this moment cpufreq should set for each CPU frequency closest to one that was set on BSP. It should be possible to make powerd to read sets of frequencies from all CPUs and do the same, just more intelligently. Same time using very different frequencies for different CPUs can IMHO be very problematic even in theory. For SMP systems it is quite difficult (because of threads migration and possible inter-operations of multiple threads) to identify cases when even global frequency can be reduced without proportional performance penalty. Making in per-CPU multiplies number of options and requires awareness from the scheduler. -- Alexander Motin _______________________________________________ [hidden email] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to "[hidden email]" |
|
In reply to this post by Jung-uk Kim
On Wed, 06 Jun 2012 19:02:16 -0400
Jung-uk Kim <[hidden email]> wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > On 2012-06-06 17:58:57 -0400, Andriy Gapon wrote: > > on 31/05/2012 23:28 Jung-uk Kim said the following: > >> It is simple but I don't like locking scheduler, binding CPU, and > >> writing the same MSR, multiple times for each core. > > > > Not sure if parse this. The MSR is _written_ /once/ for each > > core. (BTW, "locking scheduler" is not a completely accurate > > description of what thread_lock does) > > I apologize. I didn't see the whole picture and read your patch > wrong. > > Any way, hwpstate still isn't quite right even without your patch. > > sys/kern/kern_cpu.c > cpufreq_curr_sysctl() -> > CPUFREQ_SET() -> /* for all CPU devices */ > cf_set_method() -> /* thread_lock(), sched_bind(), ... > */ CPUFREQ_DRV_SET() -> > sys/x86/cpufreq/hwpstate.c > hwpstate_set() -> > hwpstate_goto_pstate() /* for each CPU unit */ > /* thread_lock(), sched_bind(), ... */ > > Therefore, "sysctl dev.cpu.0.cpufreq=<freq>" loops n^2 times (i.e., n > times per CPU) where n is number of CPUs. At least, it should check > unit == 0, e.g., > > hwpstate_goto_pstate(...) > { > ... > if (unit == 0) { > /* XXX Is this really necessary? */ > CPU_FOREACH(i) { > ... > wrmsr(MSR_AMD_10H_11H_CONTROL, id); > ... > } > } > /* Check the current P-state. */ > for (...) { > ... > msr = rdmsr(MSR_AMD_10H_11H_STATUS); > if (msr == id) > break; > ... > } > /* XXX Maybe your patch here? */ > ... > } > > >> Besides, it introduces more delay and you may be reading the > >> correct status because of that. :-P > > > > Having a separate reading pass does introduce more delay indeed. > > Reading the correct status is a good thing, OTOH. > > That's what I said. > > > Why would anyone want to read incorrect status? (just want to note > > that "correct" and "expected" are different things) > > Okay, okay. > > >> If people really think checking MSRC001_0071[18:16] is unworthy > >> for > > > > Well, "other people" hasn't demonstrated/proved/convinced yet that > > it is worthy > > > >> Bulldozer, I prefer skipping status check > > > > That's what I suggested from the very start. > > Buy me a Bulldozer and I'll fix it for you! :-P If it's of any help, I have an Opteron 6274 I'd be willing to test some patches on, to get Turbo Core working. > >> but I disagree with this patch. > > > > Since I am not invested in this issue (I am not affected by the > > problem and I do not have any personal attachment to the code in > > question), I will just defer any decision to those who do care > > about the problem. I hope that a fix will be provided in the end. > > Same here. > > Jung-uk Kim > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v2.0.19 (FreeBSD) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ > > iEYEARECAAYFAk/P4XgACgkQmlay1b9qnVP8cgCgl9sAzyE956YjB2B3bK0wvOHu > n64Anih7sdWYQgflQVHuUGstdk05Fs9i > =2dS0 > -----END PGP SIGNATURE----- > _______________________________________________ > [hidden email] mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-stable > To unsubscribe, send any mail to > "[hidden email]" -- Theo _______________________________________________ [hidden email] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to "[hidden email]" |
|
In reply to this post by Sean Bruno-5
On Wed, 6 Jun 2012 16:33:20 -0700, Sean Bruno wrote:
> On Wed, 2012-06-06 at 16:02 -0700, Jung-uk Kim wrote: > > Buy me a Bulldozer and I'll fix it for you! :-P > > Since I have one (FX-8150), do you want me to expose it to the internet > and let you play with it? I referred a fairly new user who asked on questions@ about the hwpstate errors on his new ASUS M5A97 EVO + AMD FX 8120 (stepping 15) to this thread, but had to say it wasn't clear whether there was or was not a working patch, amid discussions on a more general solution. He may ask here himself, but I was wondering if and how you got yours going? :) cheers, Ian _______________________________________________ [hidden email] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to "[hidden email]" |
| Powered by Nabble | Edit this page |
