Skip to content

scx_lavd detects wrong cpu configuration #1893

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
tr1xem opened this issue May 16, 2025 · 8 comments
Closed

scx_lavd detects wrong cpu configuration #1893

tr1xem opened this issue May 16, 2025 · 8 comments
Assignees
Labels
bug Something isn't working scx_lavd

Comments

@tr1xem
Copy link

tr1xem commented May 16, 2025

May 16 11:13:15 am am cachyos scx_loader[342185]: 05:43:15 am am [INFO] CPU pref order in performance mode: [12, 13, 14, 15, 16, 17, 18, 19, 0, 2, 4, 6, 8, 10, 1, 3, 5, 7, 9, 11]
May 16 11:13:15 am am cachyos scx_loader[342185]: 05:43:15 am am [INFO] CPU pref order in powersave mode: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]

Using scx_lavd I have i7-13650hx
According my cpu config 0-12 are performance core aka high power core and powersave use them is it not weird??
while performance mode use 12 - 19 which are low power threads aka efficient cores

I have i7-13650hx

CPU NODE SOCKET CORE L1d:L1i:L2:L3 ONLINE    MAXMHZ   MINMHZ       MHZ
  0    0      0    0 0:0:0:0          yes 2600.0000 800.0000 2600.0000
  1    0      0    0 0:0:0:0          yes 2600.0000 800.0000 2600.0259
  2    0      0    1 4:4:1:0          yes 2600.0000 800.0000 2600.0000
  3    0      0    1 4:4:1:0          yes 2600.0000 800.0000 2600.0000
  4    0      0    2 8:8:2:0          yes 2600.0000 800.0000 2136.8860
  5    0      0    2 8:8:2:0          yes 2600.0000 800.0000 1128.5850
  6    0      0    3 12:12:3:0        yes 2600.0000 800.0000 1599.2610
  7    0      0    3 12:12:3:0        yes 2600.0000 800.0000  800.0000
  8    0      0    4 16:16:4:0        yes 2600.0000 800.0000  948.2410
  9    0      0    4 16:16:4:0        yes 2600.0000 800.0000  800.0000
 10    0      0    5 20:20:5:0        yes 2600.0000 800.0000 2482.2520
 11    0      0    5 20:20:5:0        yes 2600.0000 800.0000  800.0000
 12    0      0    6 24:24:6:0        yes 1900.0000 800.0000 1900.6110
 13    0      0    7 25:25:6:0        yes 1900.0000 800.0000  800.0000
 14    0      0    8 26:26:6:0        yes 1900.0000 800.0000 1899.9611
 15    0      0    9 27:27:6:0        yes 1900.0000 800.0000 1899.7540
 16    0      0   10 28:28:7:0        yes 1900.0000 800.0000  800.0000
 17    0      0   11 29:29:7:0        yes 1900.0000 800.0000 1359.9220
 18    0      0   12 30:30:7:0        yes 1900.0000 800.0000  800.0000
 19    0      0   13 31:31:7:0        yes 1900.0000 800.0000 1555.4290

my lstopo

Image

@multics69 multics69 self-assigned this May 17, 2025
@multics69 multics69 added bug Something isn't working scx_lavd labels May 17, 2025
@multics69
Copy link
Contributor

Thanks @tr1xem for reporting this and providing info (over Discord). Will take a look!

@tr1xem
Copy link
Author

tr1xem commented May 17, 2025

Looking forward to get it fixed Always ready for any kind of help. Thanks

multics69 pushed a commit to multics69/scx that referenced this issue May 17, 2025
A case was reported that /sys/devices/system/cpu/cpuX/acpi_cppc/highest_perf
have the same value for all CPUs on an Intel hybrid processor (i7-13650hx).
This should be a bug in the driver side.

To circumvent such a problem, make more efforts to find a source that can tell
the capacity differences among the cores. If there is no such source, resort
on the max frequency of CPUs to estimate CPU capacity.

This should solve the following issue:
  sched-ext#1893

Signed-off-by: Changwoo Min <[email protected]>
multics69 pushed a commit to multics69/scx that referenced this issue May 17, 2025
A case was reported that /sys/devices/system/cpu/cpuX/acpi_cppc/highest_perf
have the same value for all CPUs on an Intel hybrid processor (i7-13650hx).
This should be a bug in the driver side.

To circumvent such a problem, make more efforts to find a source that can tell
the capacity differences among the cores. If there is no such source, resort
on the max frequency of CPUs to estimate CPU capacity.

This should solve the following issue:
  sched-ext#1893

Signed-off-by: Changwoo Min <[email protected]>
multics69 pushed a commit to multics69/scx that referenced this issue May 17, 2025
A case was reported that /sys/devices/system/cpu/cpuX/acpi_cppc/highest_perf
have the same value for all CPUs on an Intel hybrid processor (i7-13650hx).
This should be a bug on the driver's side.

To circumvent such a problem, make more efforts to find a source that can tell
the capacity differences among the cores. If there is no such source, resort
to the max frequency of CPUs to estimate CPU capacity.

This should solve the following issue:
  sched-ext#1893

Signed-off-by: Changwoo Min <[email protected]>
@multics69
Copy link
Contributor

@tr1xem -- PR #1903 should fix your problem. Please test it when you have some spare cycles.

@tr1xem
Copy link
Author

tr1xem commented May 17, 2025

@multics69
Dont really think it mitigated issue "completely".

05:08:28 [INFO] Autopilot mode is enabled.
05:08:28 [INFO] Opts {
    autopilot: true,
    autopower: false,
    performance: false,
    powersave: false,
    balanced: false,
    slice_max_us: 5000,
    slice_min_us: 300,
    cpu_pref_order: "",
    no_futex_boost: false,
    no_preemption: false,
    no_wake_sync: false,
    no_core_compaction: false,
    no_freq_scaling: false,
    stats: None,
    monitor: None,
    monitor_sched_samples: None,
    verbose: 0,
    version: false,
    help_stats: false,
}
05:08:28 [INFO] CPU pref order in performance mode: [0, 2, 4, 6, 8, 10, 12, 13, 14, 15, 16, 17, 18, 19, 1, 3, 5, 7, 9, 11]
05:08:28 [INFO] CPU pref order in powersave mode: [12, 13, 14, 15, 16, 17, 18, 19, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
05:08:28 [INFO] scx_lavd scheduler is initialized (build ID: 1.0.12-g2c3b186d x86_64-unknown-linux-gnu)
05:08:28 [INFO] scx_lavd scheduler starts running.

As you could see 1 3 5 7 8 11 are at last in performance mode they should be in front as they are part of pcore too. However Powersave mode's cpu pref are fine

Also this:
Not a error just a warning

warning: value assigned to `raw_capacity` is never read
   --> rust/scx_utils/src/topology.rs:606:13
    |
606 |     let mut raw_capacity = 0;
    |             ^^^^^^^^^^^^
    |
    = help: maybe it is overwritten before being read?
    = note: `#[warn(unused_assignments)]` on by default

warning: `scx_utils` (lib) generated 1 warning

EricccTaiwan added a commit to EricccTaiwan/scx that referenced this issue May 17, 2025
Initialize `raw_capacity` only when needed to avoid warning.

Ref: sched-ext#1893

Signed-off-by: Cheng-Yang Chou <[email protected]>
EricccTaiwan added a commit to EricccTaiwan/scx that referenced this issue May 17, 2025
Initialize `raw_capacity` only when needed to avoid warning.

Ref: sched-ext#1893

Signed-off-by: Cheng-Yang Chou <[email protected]>
@multics69
Copy link
Contributor

multics69 commented May 18, 2025

@tr1xem -- Hmm, The only thing that I can imagine is that /sys/devices/system/cpu/cpu*/acpi_cppc/highest_perf changes dynamically depending on the load. That was not the case on my AMD laptop and Intel RaptorLake desktop. When you see the odd results, could you share the output of cat /sys/devices/system/cpu/cpu*/acpi_cppc/highest_perf and cat /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_max_freq?

@tr1xem
Copy link
Author

tr1xem commented May 18, 2025

@multics69
In idle
Highest Perf for all is : 225
Max Freq for P Cores : 2.6 ghz
Max Freq for E Cores : 1.9 ghz

Under Load Condtion (turbo boost on) some weird output
Cpu0 - Cpu3 4.7ghz
cpu4 - cpu7 4.9ghz
cpu8 - cpu 11 4.7ghz
cpu 13 - cpu19 3.6 ghz

highest pref is same for all still

@multics69
Copy link
Contributor

05:08:28 [INFO] CPU pref order in performance mode: [0, 2, 4, 6, 8, 10, 12, 13, 14, 15, 16, 17, 18, 19, 1, 3, 5, 7, 9, 11]

@tr1xem - -I double-checked the output for performance mode. I found it works as designed: physical P-CPUs first 0, 2, 4, 6, 8, 10, then physical E-CPUs 12, 13, 14, 15, 16, 17, 18, 19, finally SMT-siblings of P-CPUs 1, 3, 5, 7, 9, 11. Cconsidering that an SMT sibling can deliver around 50-60% empirically, so this design was chosen.

Under Load Condtion (turbo boost on) some weird output
Cpu0 - Cpu3 4.7ghz
cpu4 - cpu7 4.9ghz
cpu8 - cpu 11 4.7ghz
cpu 13 - cpu19 3.6 GHz

It is weird in the sense that the cpuinfo_max_freq is updating dynamically. But the P-CPUs have higher frequencies than the E-CPUs. So it should be okay. I guess your cpu4-7 seems turbo-boostable.

So, it works as designed. I will close the issue for now.
Of course, there is room for improvement. If you have any suggestion, please let me know through github issue or discord.
Thanks!

@tr1xem
Copy link
Author

tr1xem commented May 20, 2025

The performance is better already pcores are getting turbo boost first and everything seems pretty stable now
The latency are lower and fps are higher in my testing.
Thankyou for Lavd :>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working scx_lavd
Projects
None yet
Development

No branches or pull requests

2 participants