Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Supported CPU C-States

    Scheduled Pinned Locked Moved General pfSense Questions
    14 Posts 5 Posters 4.5k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      snow
      last edited by

      Hi guys,

      My current pfsense setup is based on an Intel Celeron G3930 (Kaby Lake).
      When using any Linux Distro like Debian 9, Ubuntu 18.x, etc., the deepest CPU C-State C8 (also Package C8) will be used when System is in idle state.

      When checking the status in pfsense, seems to be the deepest available C-State is C3:

      dev.cpu.0.cx_supported: C1/1/1 C2/2/151 C3/3/256

      Does anyone know if it's possible to get the CPU C-States C3+ available as well?

      Thanks,
      Philipp

      1 Reply Last reply Reply Quote 0
      • stephenw10S
        stephenw10 Netgate Administrator
        last edited by

        Hmm, not sure I've ever seen C-states higher (lower?) than C3 in FreeBSD. Though last time I played around with that stuff it made immeasurably small difference to anything enabling further states.

        Is it actually using the states you have currently? What does dev.cpu.0.cx_usage show?

        What are you actually hoping to achieve by enabling further states?

        Steve

        1 Reply Last reply Reply Quote 0
        • S
          snow
          last edited by

          Hi Steve,

          As shown below, C3 state will be currently used:

          sysctl dev.cpu |grep cx
          dev.cpu.1.cx_method: C1/mwait/hwc C2/mwait/hwc C3/mwait/hwc
          dev.cpu.1.cx_usage_counters: 1513873 2478992 9943845
          dev.cpu.1.cx_usage: 10.86% 17.78% 71.35% last 3386us
          dev.cpu.1.cx_lowest: C8
          dev.cpu.1.cx_supported: C1/1/1 C2/2/151 C3/3/256
          dev.cpu.0.cx_method: C1/mwait/hwc C2/mwait/hwc C3/mwait/hwc
          dev.cpu.0.cx_usage_counters: 83485812 108776041 11098
          dev.cpu.0.cx_usage: 43.42% 56.57% 0.00% last 102us
          dev.cpu.0.cx_lowest: C8
          dev.cpu.0.cx_supported: C1/1/1 C2/2/151 C3/3/256

          Seems to be the C3 state will be used more on the second cpu core (cpu.1):

          dev.cpu.0.cx_usage: 43.42% 56.57% 0.00% last 102us
          dev.cpu.1.cx_usage: 10.86% 17.78% 71.35% last 3386us

          Concerning the lowest state C8, I set the following in > System> Advanced > System Tunables:

          dev.cpu.0.cx_lowest > C8
          dev.cpu.1.cx_lowest > C8
          hw.acpi.cpu.cx_lowest > C8

          The lowest idle power consumption is currently 11.2W (measured with a power meter).
          If the same system is running on Debian 9, the lowest idle power consumption is below 8W.

          1 Reply Last reply Reply Quote 0
          • stephenw10S
            stephenw10 Netgate Administrator
            last edited by stephenw10

            That additional power consumption may not be the CPU of course. 3W seems like a lot for states below C3 which is already very low power. As I said I'm not sure I've seen lower C states reported by FreeBSD. It might not be possible.

            You have enabled powerd I assume? Though the provided P-states are swamped by C-state reductions I found.

            This page, though now a bit dated, was very useful when I was poking at this stuff.
            https://wiki.freebsd.org/TuningPowerConsumption

            Steve

            1 Reply Last reply Reply Quote 0
            • M
              mrsunfire
              last edited by

              Got an i7-1165G7 but I never get to see C2 or C3. All I get is this:

              dev.cpu.3.cx_method: C1/mwait/hwc C2/mwait/hwc C3/mwait/hwc
              dev.cpu.3.cx_usage_counters: 46820 0 0
              dev.cpu.3.cx_usage: 100.00% 0.00% 0.00% last 171us
              dev.cpu.3.cx_lowest: C1
              dev.cpu.3.cx_supported: C1/1/1 C2/2/253 C3/3/1048
              dev.cpu.2.cx_method: C1/mwait/hwc C2/mwait/hwc C3/mwait/hwc
              dev.cpu.2.cx_usage_counters: 46701 0 0
              dev.cpu.2.cx_usage: 100.00% 0.00% 0.00% last 141us
              dev.cpu.2.cx_lowest: C1
              dev.cpu.2.cx_supported: C1/1/1 C2/2/253 C3/3/1048
              dev.cpu.1.cx_method: C1/mwait/hwc C2/mwait/hwc C3/mwait/hwc
              dev.cpu.1.cx_usage_counters: 46400 0 0
              dev.cpu.1.cx_usage: 100.00% 0.00% 0.00% last 149us
              dev.cpu.1.cx_lowest: C1
              dev.cpu.1.cx_supported: C1/1/1 C2/2/253 C3/3/1048
              dev.cpu.0.cx_method: C1/mwait/hwc C2/mwait/hwc C3/mwait/hwc
              dev.cpu.0.cx_usage_counters: 56149 0 0
              dev.cpu.0.cx_usage: 100.00% 0.00% 0.00% last 237us
              dev.cpu.0.cx_lowest: C1
              dev.cpu.0.cx_supported: C1/1/1 C2/2/253 C3/3/1048
              

              Did try the settings written here: https://wiki.freebsd.org/TuningPowerConsumption nothing helped. BIOS C-states enabled of course.

              What am I missing?

              Netgate 6100 MAX

              1 Reply Last reply Reply Quote 0
              • stephenw10S
                stephenw10 Netgate Administrator
                last edited by

                You have to set dev.cpu.X.cx_lowest to C3 if you want it to use them. All 4 cores are restricted to C1 only in that output.

                Steve

                M 1 Reply Last reply Reply Quote 0
                • M
                  mrsunfire @stephenw10
                  last edited by

                  @stephenw10 I've set it to Cmax. Is that wrong?

                  Screenshot 2022-11-20 084515.jpg

                  Netgate 6100 MAX

                  1 Reply Last reply Reply Quote 0
                  • M
                    mvikman
                    last edited by

                    I added this to System Tunables
                    feb4067a-7eff-4260-bc14-af95c904167e-image.png

                    "sysctl dev.cpu | grep cx" showes this, so I guess it's working

                    dev.cpu.3.cx_method: C1/mwait/hwc C2/mwait/hwc C3/mwait/hwc
                    dev.cpu.3.cx_usage_counters: 128 166 6341
                    dev.cpu.3.cx_usage: 1.92% 2.50% 95.56% last 2086us
                    dev.cpu.3.cx_lowest: C3
                    dev.cpu.3.cx_supported: C1/1/1 C2/2/151 C3/3/256
                    dev.cpu.2.cx_method: C1/mwait/hwc C2/mwait/hwc C3/mwait/hwc
                    dev.cpu.2.cx_usage_counters: 174 154 6615
                    dev.cpu.2.cx_usage: 2.50% 2.21% 95.27% last 32us
                    dev.cpu.2.cx_lowest: C3
                    dev.cpu.2.cx_supported: C1/1/1 C2/2/151 C3/3/256
                    dev.cpu.1.cx_method: C1/mwait/hwc C2/mwait/hwc C3/mwait/hwc
                    dev.cpu.1.cx_usage_counters: 221 220 16075
                    dev.cpu.1.cx_usage: 1.33% 1.33% 97.32% last 368us
                    dev.cpu.1.cx_lowest: C3
                    dev.cpu.1.cx_supported: C1/1/1 C2/2/151 C3/3/256
                    dev.cpu.0.cx_method: C1/mwait/hwc C2/mwait/hwc C3/mwait/hwc
                    dev.cpu.0.cx_usage_counters: 142 210 13944
                    dev.cpu.0.cx_usage: 0.99% 1.46% 97.53% last 14974us
                    dev.cpu.0.cx_lowest: C3
                    dev.cpu.0.cx_supported: C1/1/1 C2/2/151 C3/3/256
                    

                    pfSense Plus 24.11-RELEASE (amd64)
                    Dell Optiplex 7040 SFF
                    Core i5-6500, 8GB RAM, 2x 240GB SSD (ZFS Mirror)
                    HPE 561T (X540-AT2), 2-port 10Gb RJ45
                    HPE 562SFP+ (X710-DA2), 2-port 10Gb SFP+

                    M 1 Reply Last reply Reply Quote 1
                    • M
                      mrsunfire @mvikman
                      last edited by mrsunfire

                      @mvikman Thanks! For pfSense hw.acpi.cpu.cx_lowest is the right command. I've set it to Cmax.

                      Did you set anything for "kern.hz"? My CPU seems to stay mostly at C1.

                      dev.cpu.3.cx_method: C1/mwait/hwc C2/mwait/hwc C3/mwait/hwc
                      dev.cpu.3.cx_usage_counters: 411155 21225 1607
                      dev.cpu.3.cx_usage: 94.73% 4.89% 0.37% last 145us
                      dev.cpu.3.cx_lowest: C8
                      dev.cpu.3.cx_supported: C1/1/1 C2/2/253 C3/3/1048
                      dev.cpu.2.cx_method: C1/mwait/hwc C2/mwait/hwc C3/mwait/hwc
                      dev.cpu.2.cx_usage_counters: 427522 21371 1503
                      dev.cpu.2.cx_usage: 94.92% 4.74% 0.33% last 130us
                      dev.cpu.2.cx_lowest: C8
                      dev.cpu.2.cx_supported: C1/1/1 C2/2/253 C3/3/1048
                      dev.cpu.1.cx_method: C1/mwait/hwc C2/mwait/hwc C3/mwait/hwc
                      dev.cpu.1.cx_usage_counters: 434369 22616 1595
                      dev.cpu.1.cx_usage: 94.72% 4.93% 0.34% last 131us
                      dev.cpu.1.cx_lowest: C8
                      dev.cpu.1.cx_supported: C1/1/1 C2/2/253 C3/3/1048
                      dev.cpu.0.cx_method: C1/mwait/hwc C2/mwait/hwc C3/mwait/hwc
                      dev.cpu.0.cx_usage_counters: 457227 29227 1425
                      dev.cpu.0.cx_usage: 93.71% 5.99% 0.29% last 191us
                      dev.cpu.0.cx_lowest: C8
                      dev.cpu.0.cx_supported: C1/1/1 C2/2/253 C3/3/1048
                      

                      Netgate 6100 MAX

                      fireodoF 1 Reply Last reply Reply Quote 0
                      • stephenw10S
                        stephenw10 Netgate Administrator
                        last edited by

                        Mmm, @mvikman's CPU must be very lightly used. Anything I've ever tried that on looks more like your output there, mostly in C1.

                        M 1 Reply Last reply Reply Quote 0
                        • fireodoF
                          fireodo @mrsunfire
                          last edited by fireodo

                          @mrsunfire said in Supported CPU C-States:

                          @mvikman Thanks! For pfSense hw.acpi.cpu.cx_lowest is the right command. I've set it to Cmax.

                          Did you set anything for "kern.hz"? My CPU seems to stay mostly at C1.

                          If the operating system states:

                          dev.cpu.0.cx_supported: C1/1/1 C2/2/253 C3/3/1048
                          

                          why do you think you can go

                          dev.cpu.0.cx_lowest: C8
                          

                          below C3?

                          Just asking out of curiosity :-)

                          Kettop Mi4300YL CPU: i5-4300Y @ 1.60GHz RAM: 8GB Ethernet Ports: 4
                          SSD: SanDisk pSSD-S2 16GB (ZFS) WiFi: WLE200NX
                          pfsense 2.8.0 CE
                          Packages: Apcupsd, Cron, Iftop, Iperf, LCDproc, Nmap, pfBlockerNG, RRD_Summary, Shellcmd, Snort, Speedtest, System_Patches.

                          M 1 Reply Last reply Reply Quote 0
                          • stephenw10S
                            stephenw10 Netgate Administrator
                            last edited by

                            It won't ever go below 3 but I wouldn't expect it to hurt.

                            1 Reply Last reply Reply Quote 0
                            • M
                              mrsunfire @fireodo
                              last edited by

                              @fireodo C8 is max my CPU is supporting. I just set Cmax in system tunables. So I think the CPU decides the max limit even though FreeBSD only supports C3.

                              Netgate 6100 MAX

                              1 Reply Last reply Reply Quote 0
                              • M
                                mvikman @stephenw10
                                last edited by mvikman

                                @stephenw10 said in Supported CPU C-States:

                                Mmm, @mvikman's CPU must be very lightly used. Anything I've ever tried that on looks more like your output there, mostly in C1.

                                LOL yeah, it's just my home router and it's got a i5-6500, just haven't had time to dabble with pfblocker and such things yet 😆

                                @mrsunfire No, that was the only line I added.

                                Though I have PowerD set to Adaptive instead of HiAdaptive because HiAdaptive doesn't seem let CPU to throttle speed lower MHz...

                                pfSense Plus 24.11-RELEASE (amd64)
                                Dell Optiplex 7040 SFF
                                Core i5-6500, 8GB RAM, 2x 240GB SSD (ZFS Mirror)
                                HPE 561T (X540-AT2), 2-port 10Gb RJ45
                                HPE 562SFP+ (X710-DA2), 2-port 10Gb SFP+

                                1 Reply Last reply Reply Quote 1
                                • First post
                                  Last post
                                Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.