Skip to content
  1. Sep 27, 2022
    • Qais Yousef's avatar
      sched/fair: Consider capacity inversion in util_fits_cpu() · 03bf1363
      Qais Yousef authored and Ionela Voinescu's avatar Ionela Voinescu committed
      
      
      We do consider thermal pressure in util_fits_cpu() for uclamp_min only.
      With the exception of the biggest cores which by definition are the max
      performance point of the system and all tasks by definition should fit.
      
      Even under thermal pressure, the capacity of the biggest CPU is the
      highest in the system and should still fit every task. Except when it
      reaches capacity inversion point, then this is no longer true.
      
      We can handle this by using the inverted capacity as capacity_orig in
      util_fits_cpu(). Which not only addresses the problem above, but also
      ensure uclamp_max now considers the inverted capacity. Force fitting
      a task when a CPU is in this adverse state will contribute to making the
      thermal throttling last longer.
      
      Signed-off-by: Qais Yousef's avatarQais Yousef <qais.yousef@arm.com>
    • Qais Yousef's avatar
      sched/fair: Detect capacity inversion · 80f21c99
      Qais Yousef authored and Ionela Voinescu's avatar Ionela Voinescu committed
      
      
      Check each performance domain to see if thermal pressure is causing its
      capacity to be lower than another performance domain.
      
      We assume that each performance domain has CPUs with the same
      capacities, which is similar to an assumption made in energy_model.c
      
      We also assume that thermal pressure impacts all CPUs in a performance
      domain equally.
      
      If there're multiple performance domains with the same capacity_orig, we
      will trigger a capacity inversion if the domain is under thermal
      pressure.
      
      The new cpu_in_capacity_inversion() should help users to know when
      information about capacity_orig are not reliable and can opt in to use
      the inverted capacity as the 'actual' capacity_orig.
      
      Signed-off-by: Qais Yousef's avatarQais Yousef <qais.yousef@arm.com>
      80f21c99
    • Qais Yousef's avatar
      sched/uclamp: Cater for uclamp in find_energy_efficient_cpu()'s early exit condition · 23de383b
      Qais Yousef authored and Ionela Voinescu's avatar Ionela Voinescu committed
      
      
      If the utilization of the woken up task is 0, we skip the energy
      calculation because it has no impact.
      
      But if the task is boosted (uclamp_min != 0) will have an impact on task
      placement and frequency selection. Only skip if the util is truly
      0 after applying uclamp values.
      
      Change uclamp_task_cpu() signature to avoid unnecessary additional calls
      to uclamp_eff_get(). feec() is the only user now.
      
      Fixes: 732cd75b ("sched/fair: Select an energy-efficient CPU on task wake-up")
      Signed-off-by: Qais Yousef's avatarQais Yousef <qais.yousef@arm.com>
      23de383b
    • Qais Yousef's avatar
      sched/uclamp: Make cpu_overutilized() use util_fits_cpu() · c1584788
      Qais Yousef authored and Ionela Voinescu's avatar Ionela Voinescu committed
      
      
      So that it is now uclamp aware.
      
      This fixes a major problem of busy tasks capped with UCLAMP_MAX keeping
      the system in overutilized state which disables EAS and leads to wasting
      energy in the long run.
      
      Without this patch running a busy background activity like JIT
      compilation on Pixel 6 causes the system to be in overutilized state
      74.5% of the time.
      
      With this patch this goes down to  9.79%.
      
      It also fixes another problem when long running tasks that have their
      UCLAMP_MIN changed while running such that they need to upmigrate to
      honour the new UCLAMP_MIN value. The upmigration doesn't get triggered
      because overutilized state never gets set in this state, hence misfit
      migration never happens at tick in this case until the task wakes up
      again.
      
      Fixes: af24bde8 ("sched/uclamp: Add uclamp support to energy_compute()")
      Signed-off-by: Qais Yousef's avatarQais Yousef <qais.yousef@arm.com>
      c1584788
    • Qais Yousef's avatar
      sched/uclamp: Make asym_fits_capacity() use util_fits_cpu() · 3d67f7d1
      Qais Yousef authored and Ionela Voinescu's avatar Ionela Voinescu committed
      
      
      Use the new util_fits_cpu() to ensure migration margin and capacity
      pressure are taken into account correctly when uclamp is being used
      otherwise we will fail to consider CPUs as fitting in scenarios where
      they should.
      
      s/asym_fits_capacity/asym_fits_cpu/ to better reflect what it does now.
      
      Fixes: b4c9c9f1 ("sched/fair: Prefer prev cpu in asymmetric wakeup path")
      Signed-off-by: Qais Yousef's avatarQais Yousef <qais.yousef@arm.com>
      3d67f7d1
    • Qais Yousef's avatar
      sched/uclamp: Make select_idle_capacity() use util_fits_cpu() · 88826f59
      Qais Yousef authored and Ionela Voinescu's avatar Ionela Voinescu committed
      
      
      Use the new util_fits_cpu() to ensure migration margin and capacity
      pressure are taken into account correctly when uclamp is being used
      otherwise we will fail to consider CPUs as fitting in scenarios where
      they should.
      
      Fixes: b4c9c9f1 ("sched/fair: Prefer prev cpu in asymmetric wakeup path")
      Signed-off-by: Qais Yousef's avatarQais Yousef <qais.yousef@arm.com>
      88826f59
    • Qais Yousef's avatar
      sched/uclamp: Fix fits_capacity() check in feec() · 4d91dc13
      Qais Yousef authored and Ionela Voinescu's avatar Ionela Voinescu committed
      As reported by Yun Hsiang [1], if a task has its uclamp_min >= 0.8 * 1024,
      it'll always pick the previous CPU because fits_capacity() will always
      return false in this case.
      
      The new util_fits_cpu() logic should handle this correctly for us beside
      more corner cases where similar failures could occur, like when using
      UCLAMP_MAX.
      
      We open code uclamp_rq_util_with() except for the clamp() part,
      util_fits_cpu() needs the 'raw' values to be passed to it.
      
      Also introduce uclamp_rq_{set, get}() shorthand accessors to get uclamp
      value for the rq. Makes the code more readable and ensures the right
      rules (use READ_ONCE/WRITE_ONCE) are respected transparently.
      
      [1] https://lists.linaro.org/pipermail/eas-dev/2020-July/001488.html
      
      
      
      Fixes: 1d42509e ("sched/fair: Make EAS wakeup placement consider uclamp restrictions")
      Reported-by: default avatarYun Hsiang <hsiang023167@gmail.com>
      Signed-off-by: Qais Yousef's avatarQais Yousef <qais.yousef@arm.com>
      
      # Conflicts:
      #	kernel/sched/fair.c
      4d91dc13
    • Qais Yousef's avatar
      sched/uclamp: Make task_fits_capacity() use util_fits_cpu() · ef5d2f76
      Qais Yousef authored and Ionela Voinescu's avatar Ionela Voinescu committed
      
      
      So that the new uclamp rules in regard to migration margin and capacity
      pressure are taken into account correctly.
      
      Fixes: a7008c07 ("sched/fair: Make task_fits_capacity() consider uclamp restrictions")
      Co-developed-by: Vincent Guittot's avatarVincent Guittot <vincent.guittot@linaro.org>
      Signed-off-by: Qais Yousef's avatarQais Yousef <qais.yousef@arm.com>
      ef5d2f76
    • Qais Yousef's avatar
      sched/uclamp: Fix relationship between uclamp and migration margin · ffe29f54
      Qais Yousef authored and Ionela Voinescu's avatar Ionela Voinescu committed
      
      
      fits_capacity() verifies that a util is within 20% margin of the
      capacity of a CPU, which is an attempt to speed up upmigration.
      
      But when uclamp is used, this 20% margin is problematic because for
      example if a task is boosted to 1024, then it will not fit on any CPU
      according to fits_capacity() logic.
      
      Or if a task is boosted to capacity_orig_of(medium_cpu). The task will
      end up on big instead on the desired medium CPU.
      
      Similar corner cases exist for uclamp and usage of capacity_of().
      Slightest irq pressure on biggest CPU for example will make a 1024
      boosted task look like it can't fit.
      
      What we really want is for uclamp comparisons to ignore the migration
      margin and capacity pressure, yet retain them for when checking the
      _actual_ util signal.
      
      For example, task p:
      
      	p->util_avg = 300
      	p->uclamp[UCLAMP_MIN] = 1024
      
      Will fit a big CPU. But
      
      	p->util_avg = 900
      	p->uclamp[UCLAMP_MIN] = 1024
      
      will not, this should trigger overutilized state because the big CPU is
      now *actually* being saturated.
      
      Similar reasoning applies to capping tasks with UCLAMP_MAX. For example:
      
      	p->util_avg = 1024
      	p->uclamp[UCLAMP_MAX] = capacity_orig_of(medium_cpu)
      
      Should fit the task on medium cpus without triggering overutilized
      state.
      
      Inlined comments expand more on desired behavior in more scenarios.
      
      Introduce new util_fits_cpu() function which encapsulates the new logic.
      The new function is not used anywhere yet, but will be used to update
      various users of fits_capacity() in later patches.
      
      Fixes: af24bde8 ("sched/uclamp: Add uclamp support to energy_compute()")
      Signed-off-by: Qais Yousef's avatarQais Yousef <qais.yousef@arm.com>
      ffe29f54
    • Valentin Schneider's avatar
      arm64: dts: sdm845: Remove per-CPU thermal zones · a81511a1
      Valentin Schneider authored and Ionela Voinescu's avatar Ionela Voinescu committed
      
      
      The cpufreq cooling devices have been removed by
      
        52e3b2ca ("arm64: dts: qcom: sdm845: Remove cpufreq cooling devices for CPU thermal zones")
      
      but the per-CPU thermal zones remain. Per monitor_thermal_zone(), we get
      one polling workqueue per TZ, which is a lot of noise considering the only
      time those thermal zones will affect the system will be upon crossing a
      critical trip point.
      
      Remove the per-CPU thermal zones and let the cluster-wide ones handle
      critical temperature trip points.
      
      Signed-off-by: default avatarValentin Schneider <valentin.schneider@arm.com>
      2 tags
      a81511a1
    • Morten Rasmussen's avatar
      sched/pelt: [HACK] Make PELT trace points unconditional · fa51c3fb
      Morten Rasmussen authored and Ionela Voinescu's avatar Ionela Voinescu committed
      This is a temporary hack.
      
      Currently trace points for PELT are only triggered when the PELT metrics
      consumed by the scheduler are actually updated, i.e. util_avg. This
      means no updates if no 1 ms boundary is being crossed by the update.
      When reconstructing the PELT signal based on this data, the peak PELT
      value can therefore be up to 1 ms worth of PELT accumulation off (23 in
      absolute terms). This leads to a discrepancy that causes test cases to
      fail.
      
      This patch ensures that trace events are always emitted even if the
      metrics haven't been updated which should allow accurate reconstruction
      of the PELT signals.
    • Ionela Voinescu's avatar
    • Dietmar Eggemann's avatar
      arm, arm64: Enable kernel config options required for EAS testing · e3b24b95
      Dietmar Eggemann authored and Ionela Voinescu's avatar Ionela Voinescu committed
      
      
      arm and arm64:
      
          Add    Debug per_cpu maps access
          Add    Prove Locking
          Add    Scheduler statistics
      
      arm:
      
          Add    kernel .config support and /proc/config.gz
      
      arm64:
      
          Add    Scheduler debugging
          Add    Ftrace
      
      Signed-off-by: Dietmar Eggemann's avatarDietmar Eggemann <dietmar.eggemann@arm.com>
      e3b24b95
    • Dietmar Eggemann's avatar
      arm, arm64: Enable kernel config options required for EAS · 858e7db7
      Dietmar Eggemann authored and Ionela Voinescu's avatar Ionela Voinescu committed
      
      
      arm and arm64:
      
          Add    Cgroups (+ FAIR_GROUP_SCHED and FREEZER)
          Add    Uclamp support for tasks and taskgroups
          Add    CpuFreq governors and make schedutil default
      
      arm:
      
          Add    Cpuset support
          Add    Scheduler autogroups
          Add    DIE (SCHED_MC) sched domain level
          Add    Energy Model
      
      Signed-off-by: Dietmar Eggemann's avatarDietmar Eggemann <dietmar.eggemann@arm.com>
      Signed-off-by: Ionela Voinescu's avatarIonela Voinescu <ionela.voinescu@arm.com>
      [@Ionela: cpufreq governor enablement for both arm and arm64]
      858e7db7
    • Dietmar Eggemann's avatar
      workqueue: Debug file to toggle system_highpri_wq prio · 86ea2a11
      Dietmar Eggemann authored and Ionela Voinescu's avatar Ionela Voinescu committed
      
      
      To let the RqInvariance:test_load_correctness load-tracking test pass
      there has to be a possibility to lower the task priority of the high
      prio workers 'kworker/X:YH-/+xx' from 100 (nice=-20) to 120 (nice=0).
      
      Otherwise the cfs_rq load_avg contribution from these tasks is too high
      since our test assumes normal task weight, i.e. 1024 (nice=0). Our tests
      can only deal with normal task weight.
      
      The /sys/kernel/debug/workqueue/high_prio_wq accepts 0 (to set the prio
      of these tasks to 100) and 1 (to set it back to the default value 120).
      
      The issue was introduced by commit ba70aca0b167 ("random: defer fast
      pool mixing to worker"). add_interrupt_randomness() now queues
      system_highpri_wq workqueue items and these are running in
      'kworker/X:YH-/+xx' tasks.
      
      It was first visible on Arm32 TC2 with its timer interrupt but can be
      seen on other platforms/interrupts too.
      
      This patch is solely there to let our load-tracing tests pass and not
      meant for upstreaming!
      
      Signed-off-by: Dietmar Eggemann's avatarDietmar Eggemann <dietmar.eggemann@arm.com>
    • Ionela Voinescu's avatar
      Revert "arch_topology: Make cpu_capacity sysfs node as read-only" · a3b4e69b
      Ionela Voinescu authored
      This reverts commit 5d777b18.
      
      [ionela.voinescu@arm.com: modify capacity of current CPU only]
    • Ionela Voinescu's avatar
    • Ionela Voinescu's avatar
      arm64: juno: disable CONFIG_MOUSE_PS2 · 05be8c45
      Ionela Voinescu authored
      This config is causing instability on Juno boards.
      05be8c45
    • Ionela Voinescu's avatar
      tc2: multi_v7_defconfig: add board support configs · 53ef9833
      Ionela Voinescu authored
      For Arm:
        Add       ARM vexpress-spc cpufreq driver
        Add       ARM Big.Little cpuidle driver
        Add       Sensor Vexpress
        Disable   CONFIG_HARDEN_BRANCH_HISTORY
      53ef9833
    • Ionela Voinescu's avatar
  2. Sep 20, 2022
  3. Sep 19, 2022
    • Rafael J. Wysocki's avatar
      Merge branch 'acpi-ec' into linux-next · 60d27414
      Rafael J. Wysocki authored
      * acpi-ec:
        ACPI: EC: Drop unneeded result variable from ec_write()
      60d27414
    • Rafael J. Wysocki's avatar
      Merge branches 'thermal-drivers', 'thermal-intel' and 'thermal-misc' into linux-next · 32ef0f72
      Rafael J. Wysocki authored
      * thermal-drivers:
        thermal: cpufreq_cooling: Check the policy first in cpufreq_cooling_register()
        thermal: da9062-thermal: Drop redundant error message
        thermal/drivers/thermal_mmio: Drop of_match_ptr()
      
      * thermal-intel:
        thermal: int340x_thermal: Consolidate priv->data_vault checks
      
      * thermal-misc:
        thermal: Drop duplicate words from comments
      32ef0f72
    • Rafael J. Wysocki's avatar
      Merge branch 'thermal-core' into linux-next · 3c843162
      Rafael J. Wysocki authored
      * thermal-core: (46 commits)
        thermal: move from strlcpy() with unused retval to strscpy()
        thermal: gov_user_space: Do not lock thermal zone mutex
        Revert "mlxsw: core: Add the hottest thermal zone detection"
        thermal/core: Fix lockdep_assert() warning
        thermal/core: Move the mutex inside the thermal_zone_device_update() function
        thermal/core: Move the thermal zone lock out of the governors
        thermal/governors: Group the thermal zone lock inside the throttle function
        thermal/core: Rework the monitoring a bit
        thermal/core: Rearm the monitoring only one time
        thermal/drivers/qcom/spmi-adc-tm5: Remove unnecessary print function dev_err()
        thermal/of: Remove old OF code
        thermal/core: Move set_trip_temp ops to the sysfs code
        thermal/drivers/samsung: Switch to new of thermal API
        regulator/drivers/max8976: Switch to new of thermal API
        Input: sun4i-ts - switch to new of thermal API
        iio/drivers/sun4i_gpadc: Switch to new of thermal API
        hwmon/drivers/core: Switch to new of thermal API
        hwmon: pm_bus: core: Switch to new of thermal API
        ata/drivers/ahci_imx: Switch to new of thermal API
        thermal/drivers/ti-soc: Switch to new of API
        ...
      3c843162
    • Rafael J. Wysocki's avatar
      Merge branches 'pm-sleep' and 'powercap' into linux-next · fe6ef8bb
      Rafael J. Wysocki authored
      * pm-sleep:
        PM: wakeup: Add extra debugging statement for multiple active IRQs
        PM: suspend: move from strlcpy() with unused retval to strscpy()
      
      * powercap:
        powercap: intel_rapl: Add support for RAPTORLAKE_S
      fe6ef8bb
    • Rafael J. Wysocki's avatar
      Merge branches 'pm-cpufreq' and 'pm-cpuidle' into linux-next · eddb0808
      Rafael J. Wysocki authored
      * pm-cpufreq:
        cpufreq: intel_pstate: Add Tigerlake support in no-HWP mode
        cpufreq: amd-pstate: Fix initial highest_perf value
        cpufreq: amd-pstate: update pstate frequency transition delay time
        cpufreq: amd_pstate: map desired perf into pstate scope for powersave governor
        cpufreq: amd_pstate: fix wrong lowest perf fetch
        cpufreq: amd-pstate: fix white-space
        cpufreq: amd-pstate: simplify cpudata pointer assignment
        cpufreq: schedutil: Move max CPU capacity to sugov_policy
      
      * pm-cpuidle:
        cpuidle: Remove redundant check in cpuidle_switch_governor()
        intel_idle: move from strlcpy() with unused retval to strscpy()
        cpuidle: powernv: move from strlcpy() with unused retval to strscpy()
        cpuidle: coupled: Drop duplicate word from a comment
      eddb0808
    • Rafael J. Wysocki's avatar
      Merge branches 'acpi-tables' and 'acpi-docs' into linux-next · c773b7f2
      Rafael J. Wysocki authored
      * acpi-tables:
        ACPI: tables: FPDT: Don't call acpi_os_map_memory() on invalid phys address
      
      * acpi-docs:
        ACPI: docs: enumeration: Fix a few typos and wording mistakes
      c773b7f2
    • Rafael J. Wysocki's avatar
      Merge branches 'acpi-bus', 'acpi-soc', 'acpi-properties' and 'acpi-tools' into linux-next · c8ca3b35
      Rafael J. Wysocki authored
      * acpi-bus:
        ACPI: bus: Refactor ACPI matching functions for better readability
        ACPI: bus: Drop kernel doc annotation from acpi_bus_notify()
        ACPI: bus: Remove the unneeded result variable
      
      * acpi-soc:
        ACPI: LPSS: Deduplicate skipping device in acpi_lpss_create_device()
        ACPI: LPSS: Replace loop with first entry retrieval
        ACPI: LPSS: Use the helper acpi_dev_get_memory_resources()
        ACPI: APD: Use the helper acpi_dev_get_memory_resources()
        ACPI: resource: Add helper function acpi_dev_get_memory_resources()
        ACPI: resource: Filter out the non memory resources in is_memory()
      
      * acpi-properties:
        ACPI: property: Silence missing-declarations warning in apple.c
      
      * acpi-tools:
        ACPI: tools: pfrut: Do not initialize ret in main()
      c8ca3b35
    • Rafael J. Wysocki's avatar
      Merge branches 'acpi-osi', 'acpi-apei', 'acpi-video' and 'acpi-platform' into linux-next · 6cb678db
      Rafael J. Wysocki authored
      * acpi-osi:
        ACPI: OSI: Update Documentation on custom _OSI strings
        ACPI: OSI: Remove Linux-HPI-Hybrid-Graphics _OSI string
        ACPI: OSI: Remove Linux-Lenovo-NV-HDMI-Audio _OSI string
        ACPI: OSI: Remove Linux-Dell-Video _OSI string
      
      * acpi-apei:
        ACPI: APEI: Add BERT error log footer
      
      * acpi-video:
        ACPI: video: Add Toshiba Satellite/Portege Z830 quirk
      
      * acpi-platform:
        ACPI: platform: Use PLATFORM_DEVID_NONE in acpi_create_platform_device()
        ACPI: platform: Sort forbidden_id_list[] in ascending order
        ACPI: platform: Use sizeof(*pointer) instead of sizeof(type)
        ACPI: platform: Remove redundant print on -ENOMEM
        ACPI: platform: Get rid of redundant 'else'
      6cb678db
    • Rafael J. Wysocki's avatar
      Merge branches 'acpi-resource', 'acpi-pm', 'acpi-misc' and 'acpi-cppc' into linux-next · 93d1a04b
      Rafael J. Wysocki authored
      * acpi-resource:
        usb: typec: intel_pmc_mux: Use the helper acpi_dev_get_memory_resources()
        ACPI: resource: Skip IRQ override on Asus Vivobook K3402ZA/K3502ZA
        ACPI: LPSS: Use the helper acpi_dev_get_memory_resources()
        ACPI: APD: Use the helper acpi_dev_get_memory_resources()
        ACPI: resource: Add helper function acpi_dev_get_memory_resources()
        ACPI: resource: Filter out the non memory resources in is_memory()
      
      * acpi-pm:
        ACPI: PM: Fix acpi_dev_state_d0() kerneldoc
      
      * acpi-misc:
        ACPI: move from strlcpy() with unused retval to strscpy()
      
      * acpi-cppc:
        ACPI: CPPC: Add ACPI disabled check to acpi_cpc_valid()
      93d1a04b
    • Rafael J. Wysocki's avatar
      Merge branch 'acpi-dev' into linux-next · 89a5c0e4
      Rafael J. Wysocki authored
      * acpi-dev:
        ACPI: property: Use acpi_dev_parent()
        ACPI: Drop redundant acpi_dev_parent() header
        ACPI: PM: Fix NULL argument handling in acpi_device_get/set_power()
        ACPI: Drop parent field from struct acpi_device
        ACPI: scan: Eliminate __acpi_device_add()
        ACPI: scan: Rearrange initialization of ACPI device objects
        ACPI: scan: Rename acpi_bus_get_parent() and rearrange it
        ACPI: Rename acpi_bus_get/put_acpi_device()
      89a5c0e4
  4. Sep 18, 2022
  5. Sep 16, 2022
Loading