Re: AMD Family 10h cpufreq driver - FreeBSD

This is a discussion on Re: AMD Family 10h cpufreq driver - FreeBSD ; Hi G. Otsuji, This is great news, i've bought a Phenom X9350e to power my new high-end NAS. I'm very keen on testing this driver module. Only question: how do i compile & install? If you could give me some ...

+ Reply to Thread
Results 1 to 7 of 7

Thread: Re: AMD Family 10h cpufreq driver

  1. Re: AMD Family 10h cpufreq driver

    Hi G. Otsuji,

    This is great news, i've bought a Phenom X9350e to power my new high-end
    NAS. I'm very keen on testing this driver module.

    Only question: how do i compile & install? If you could give me some
    pointers that would be great.

    Regards,
    Veronica



    G. Otsuji wrote:
    > Hello ,
    > I have AMD Phenom x4 9850 BE cpu ,but
    > there was no sysctl oid dev.cpu.0.freq_levels.
    > so I read the BKDG (bios and kernel developer guide for AMD Family 10h)
    > and finally I reached some result.
    > I wrote pstate.c cpufreq driver module. attached in this mail.
    > I have tested this module on i386 current/stable, amd64 current/stable.
    > and make -j20 buildworld can be done with running powerd.
    > This module has capability to down clock to 400MHz.
    > but It's slow, so echo "debug.cpufreq.lowest=1200" >>/boot/loader.conf.
    > and the reuslt is as follows.
    > $ sysctl dev.cpu.0.freq_levels
    > dev.cpu.0.freq_levels: 2500/-1 2400/-1 2300/-1 2200/-1 2100/-1 2000/-1
    > 1900/-1 1800/-1 1700/-1 1600/-1 1500/-1 1400/-1 1300/-1 1200/-1
    >
    > I have enjoying this module in a few days but It's OK.
    >
    > AMD Family 10h cpu_id's are 100f23,100f2a,100f22.
    > I don't have Opteron 13XX 23XX 83XX,Phenom X3, and other Phenom X4,And MP system.
    > if you have these cpu's , i would like you to try this module.
    > feel free to contact me.
    >
    > Sincerely,
    > G. Otsuji
    >
    >
    > ------------------------------------------------------------------------
    >
    >
    >
    >
    > ------------------------------------------------------------------------
    >
    > _______________________________________________
    > freebsd-current@freebsd.org mailing list
    > http://lists.freebsd.org/mailman/lis...reebsd-current
    > To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"


    _______________________________________________
    freebsd-current@freebsd.org mailing list
    http://lists.freebsd.org/mailman/lis...reebsd-current
    To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"


  2. Re: AMD Family 10h cpufreq driver


    Hi,
    I foget to say that debug.cpufreq.lowest=1200 in
    /boot/loader.conf and running powerd is my stable state.

    Sincerely,
    G. Otsuji
    _______________________________________________
    freebsd-current@freebsd.org mailing list
    http://lists.freebsd.org/mailman/lis...reebsd-current
    To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"


  3. Re: AMD Family 10h cpufreq driver

    Hi G. Otsuji,

    I have followed your instructions on my 8-CURRENT amd64 system with
    Phenom 9350e CPU. I have built a kernel without cpufreq, so i can use
    the seperate module. Once i load the module i get this, with and without
    verbose logging enabled:

    --
    [root@test ~]# uname -a
    FreeBSD test 8.0-CURRENT FreeBSD 8.0-CURRENT #0: Tue Sep 23 10:27:59 UTC
    2008 root@test:/usr/obj/usr/src/sys/TEST amd64

    [root@test ~]# kldload /boot/kernel/cpufreq.ko
    pstate0: on cpu0
    device_attach: pstate0 attach returned 19
    pstate1: on cpu1
    device_attach: pstate1 attach returned 19
    pstate2: on cpu2
    device_attach: pstate2 attach returned 19
    pstate3: on cpu3
    device_attach: pstate3 attach returned 19
    --

    So it appears not to work, but then i'm using a different CPU than you,
    an 9350e (65W TDP only but quadcore 2GHz). Here's a snippet from dmesg
    about CPU features, if its any helpful:

    --
    Calibrating TSC clock ... TSC clock: 2000015706 Hz
    CPU: AMD Phenom(tm) 9350e Quad-Core Processor (2000.02-MHz K8-class CPU)
    Origin = "AuthenticAMD" Id = 0x100f23 Stepping = 3

    Features=0x178bfbff
    Features2=0x802009
    AMD
    Features=0xee500800
    AMD
    Features2=0x7ff,,,Prefetch,,>
    Cores per package: 4
    --

    I want to mention i'm using amd64, do your intructions account for that?
    Because i see a i386 directory, although if i see some stuff about amd64
    in the makefile that suggests it also uses that directory. Just want a
    confirmation from you that this is not a problem.

    I have enabled Cool'N'Quiet in BIOS by setting it to Auto (other option
    is disabled). There is also a "CPU C1E Feature" setting. Some description:

    --
    From: http://www.xbitlabs.com/articles/cpu...-phenom_3.html

    Cool’nQuiet technology in Phenom processors got to a completely new
    level, too. Now they call it Cool’n’Quiet 2.0. It allows to
    independently adjust the power consumption and frequency of all four
    processor cores and memory controller.

    Moreover, Phenom also supports C1E state that takes place for the
    processor after a few milliseconds of idling. In this case the CPU not
    only drops down its clock speed, but also reduces the HyperTransport and
    system bus power consumption.

    Another new and pretty interesting feature of the Cool’n’Quiet 2.0
    technology is the ability of the CPU voltage regulator to receive data
    on the current power-saving CPU mode. Theoretically, it allows adjusting
    the voltage regulator circuitry parameters interactively depending on
    the processor operational conditions. I believe that mainboard
    developers will be able to implement corresponding algorithms in their
    solutions.

    --
    From: http://lwn.net/Articles/286432/

    AMD CPUs with C1E support are currently excluded from high resolution
    timers and NOHZ support. The reason is that C1E is a BIOS controlled
    C3 power state which switches off TSC and the local APIC timer. The
    ACPI C-State control manages the TSC/local APIC timer wreckage, but
    this does not include the C1 based ("halt" instruction) C1E mode. The
    BIOS/SMM controlled C1E state works on most systems even without
    enabling ACPI C-State control.

    --


    Any change of getting these technologies working on FreeBSD? The C1E
    seems to be a seperate feature of Cool'N'Quiet 2, can you confirm that?
    Any features your driver cannot use yet but is offered by the hardware?

    Any help you can offer is greatly appreciated.

    Regards,
    Veronica



    G.Otsuji wrote:
    > Hi Veronica,
    >
    > Thank you for your response.
    > I doesn't know that the attached source was scrubbed in this mailing list.
    > the url is
    > http://lists.freebsd.org/pipermail/f...0fd/pstate.obj
    > this is pstate.c
    > and copy pstate.c to /sys/i386/cpufreq/ ,
    > and cd /sys/module/cpufreq/ ,
    > and patch ,
    >
    > --- Makefile.orig 2008-09-19 21:48:58.000000000 +0900
    > +++ Makefile 2008-09-19 21:49:08.000000000 +0900
    > @@ -12,7 +12,7 @@
    > CFLAGS+= -I${.CURDIR}/../../contrib/dev/acpica
    >
    > SRCS+= acpi_if.h opt_acpi.h
    > -SRCS+= est.c p4tcc.c powernow.c
    > +SRCS+= est.c p4tcc.c powernow.c pstate.c
    > .endif
    >
    > .if ${MACHINE} == "i386"
    >
    > and make ; make install ; and kldload cpufreq;
    >
    > be careful that ,before down clock, umonut as much as possible and sync sync.
    > because I experienced that kernel panic or forced reset.
    > If you get such case, mail to me agin.
    >
    > psatete.c is not powernow.c 's pstate. I'd like to rather renmae hwpstate.c .
    > MSR is differnt ...and etc....
    >
    > Have a nice day and hopefully enjoy!
    >
    > Cheers,
    > G. Otsuji
    >
    > Veronica wrote:
    >
    >> Hi G. Otsuji,
    >>
    >> This is great news, i've bought a Phenom X9350e to power my new high-end
    >> NAS. I'm very keen on testing this driver module.
    >>
    >> Only question: how do i compile & install? If you could give me some
    >> pointers that would be great.
    >>
    >> Regards,
    >> Veronica
    >>

    > _______________________________________________
    > freebsd-current@freebsd.org mailing list
    > http://lists.freebsd.org/mailman/lis...reebsd-current
    > To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"
    >
    >


    _______________________________________________
    freebsd-current@freebsd.org mailing list
    http://lists.freebsd.org/mailman/lis...reebsd-current
    To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"


  4. Re: AMD Family 10h cpufreq driver


    Hi Veronica,
    I 've tested in amd64 environment. But ...
    Here's a temprorary patch,

    --- pstate.c.before 2008-09-23 14:56:57.000000000 +0900
    +++ pstate.c 2008-09-23 15:19:39.000000000 +0900
    @@ -362,11 +362,16 @@
    *p++ = (char)((reg >> 24) & 0xff);
    }
    }
    + if (sc->mof_id == 0) {
    + device_printf(dev, "msr is = %x\n",msr);
    + }
    if (strstr(cpu_model, "Phenom")) {
    if (strstr(cpu_model, "9600")) {
    sc->mof_id = 23; /* 2.3 GHz */
    } else if (strstr(cpu_model, "9850")) {
    sc->mof_id = 25; /* 2.5 GHz */
    + } else if (strstr(cpu_model, "9350e")) {
    + sc->mof_id = 20; /* 2.0 GHz */
    } else if (strstr(cpu_model, "9950")) {
    sc->mof_id = 26; /* 2.6 GHz */
    }

    Is this cpu is black edition or not?
    I think more verbose debugging message is needed . so msr is = %x
    is added. send me the result please.
    I had an idea that it will be cool that message says Cool`n'quiet 2.0
    and it is not any further deep thought. :-)
    And I have little knowledge about C1E state. :-<

    Thank you for testing.
    and be careful that ,before down clock, mount -u -o ro as much as possible,or sync sync.

    Cheers,
    G. Otsuji
    _______________________________________________
    freebsd-current@freebsd.org mailing list
    http://lists.freebsd.org/mailman/lis...reebsd-current
    To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"


  5. Re: AMD Family 10h cpufreq driver


    Hi Veronica,

    I haven't read yet much so mail again.

    > I want to mention i'm using amd64, do your intructions account for that?
    > Because i see a i386 directory, although if i see some stuff about amd64
    > in the makefile that suggests it also uses that directory. Just want a
    > confirmation from you that this is not a problem.

    Yes! It's not a problem.

    > From: http://www.xbitlabs.com/articles/cpu...-phenom_3.html
    >
    > Cool’nQuiet technology in Phenom processors got to a completely new
    > level, too. Now they call it Cool’n’Quiet 2.0. It allows to
    > independently adjust the power consumption and frequency of all four
    > processor cores and memory controller.


    Yes,too!. but ,FreeBSD has only one oid dev.cpu.0.freq_levels/dev.cpu.0.freq.
    I think it is possible that dev.cpu.1.freq=1000 and dev.cpu.2.freq=1200or so.
    But freebsd is not yet enabled this feature.

    > Moreover, Phenom also supports C1E state that takes place for the
    > processor after a few milliseconds of idling. In this case the CPU not
    > only drops down its clock speed, but also reduces the HyperTransport and
    > system bus power consumption.
    >
    > Another new and pretty interesting feature of the Cool’n’Quiet 2.0
    > technology is the ability of the CPU voltage regulator to receive data
    > on the current power-saving CPU mode. Theoretically, it allows adjusting
    > the voltage regulator circuitry parameters interactively depending on
    > the processor operational conditions. I believe that mainboard
    > developers will be able to implement corresponding algorithms in their
    > solutions.


    Yes.the voltage is dropping as the cpu clock-downs with pstate modules.
    boot -v will writes this message if goes well.

    > AMD CPUs with C1E support are currently excluded from high resolution
    > timers and NOHZ support. The reason is that C1E is a BIOS controlled
    > C3 power state which switches off TSC and the local APIC timer. The
    > ACPI C-State control manages the TSC/local APIC timer wreckage, but
    > this does not include the C1 based ("halt" instruction) C1E mode. The
    > BIOS/SMM controlled C1E state works on most systems even without
    > enabling ACPI C-State control.


    ACPI is not my knowing area, so rewriting is welcome!

    Cheers,
    G. Otsuji
    _______________________________________________
    freebsd-current@freebsd.org mailing list
    http://lists.freebsd.org/mailman/lis...reebsd-current
    To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"


  6. Re: AMD Family 10h cpufreq driver

    G .Otsuji wrote:
    > Hi Veronica,
    >
    > Congratulations too!
    > It's funny that exactly the same thing
    > @400MHz 58.0W is quite a reduction of power!
    >


    Yes i expected some, but not 30W in savings, that's huge! I wonder if i
    can bring my consumption down with another motherboard. I've got some 20
    modern motherboards here for testing purposes; power tests and
    compatibility with BSD.

    By the way, i noted that also Intel E8400's EIST (comparable feature to
    Cool'N'Quiet) is not supported under -CURRENT. The powernow for AMD
    K8-cpu's works though. And thanks to you now also for Phenom
    K10-generation. =)

    >> The only thing missing now is auto-adapting of the frequency by powerd.
    >> I do see powerd active in top, but it appears not to change the
    >> frequency. Anything i can do to fix that? Aside from that issue, i would
    >> say your driver works for me.
    >>

    > anyway, powerd looks at dev.cpu.0.freq_levels .
    > so i'd like to see "sysctl dev.cpu.0.freq_levels" writes.
    >


    dev.cpu.0.freq_levels: 2000/-1 1900/-1 1800/-1 1700/-1 1600/-1 1500/-1
    1400/-1 1300/-1 1200/-1 1100/-1 1000/-1 900/-1 800/-1 700/-1 600/-1
    500/-1 400/-1

    > I think powerd's restart is needed, if there is .
    >


    I started powerd manually, there is no powerd_enable="YES" in
    /etc/rc.conf. I also manually load the cpufreq.ko module.

    > And also i'd like to know about the msr string that would be written
    > if you patched my patch , it'd be some debug informations for me.
    > I think more debug will be needed .
    >


    Patched and rebooted fine, now i get this output when loading cpufreq:

    pstate0: on cpu0
    pstate0: msr is = 28a8011144004804
    pstate1: on cpu1
    pstate1: msr is = 28a8011144004804
    pstate2: on cpu2
    pstate2: msr is = 28a8011144004804
    pstate3: on cpu3
    pstate3: msr is = 28a8011144004804

    [root@test ~]# dd if=/dev/zero of=/dev/gzero.eli bs=1m count=200 &
    [1] 1124
    [root@test ~]# sysctl dev.cpu.0.freq
    dev.cpu.0.freq: 1200

    If powerd works, it should raise the frequency to 2000 now, because of
    100% cpu utilization on one core using GELI encryption kernelmodule.

    Regards,
    Veronica
    _______________________________________________
    freebsd-current@freebsd.org mailing list
    http://lists.freebsd.org/mailman/lis...reebsd-current
    To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"


  7. Re: AMD Family 10h cpufreq driver

    cpghost wrote:
    > On Tue, Sep 23, 2008 at 08:45:59AM +0900, G. Otsuji wrote:
    >
    >> Hi,
    >> I foget to say that debug.cpufreq.lowest=1200 in
    >> /boot/loader.conf and running powerd is my stable state.
    >>

    >
    > I didn't test your patch yet, but this is the lowest freq I can
    > use on my
    > AMD Phenom(tm) 9350e Quad-Core Processor (2000.08-MHz K8-class CPU)
    > running
    > FreeBSD 7.1-PRE as of Sept 5. (/i386 *and* /amd64)
    >
    > If I go below that, the system freezes hard, and I have to power cycle
    > the motherboard to recover. But, again, this is without your patch.
    > I look forward to test it as soon as I can.
    >


    This may also be a hardware issue. Some buck converters on the
    motherboard's VRM (Voltage Regulator Module) do not like switching from
    very low idle drain to much higher one very quickly. I had one user
    report about that who uses Windows.

    Have you tried switching manually gradually down without any load? You
    need to change the debug.cpufreq.lowest together with dev.cpu.0.freq

    Also, it would be nice if i could see the voltage levels somewhere (in
    sysctl?), but i haven't found it yet.

    Cheers,
    Veronica
    _______________________________________________
    freebsd-current@freebsd.org mailing list
    http://lists.freebsd.org/mailman/lis...reebsd-current
    To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"


+ Reply to Thread