Skip to content
  1. Apr 27, 2023
  2. Apr 24, 2023
  3. Apr 21, 2023
    • Aaron Thompson's avatar
      sched/clock: Fix local_clock() before sched_clock_init() · f31dcb15
      Aaron Thompson authored
      
      
      Have local_clock() return sched_clock() if sched_clock_init() has not
      yet run. sched_clock_cpu() has this check but it was not included in the
      new noinstr implementation of local_clock().
      
      The effect can be seen on x86 with CONFIG_PRINTK_TIME enabled, for
      instance. scd->clock quickly reaches the value of TICK_NSEC and that
      value is returned until sched_clock_init() runs.
      
      dmesg without this patch:
      
          [    0.000000] kvm-clock: ...
          [    0.000002] kvm-clock: ...
          [    0.000672] clocksource: ...
          [    0.001000] tsc: ...
          [    0.001000] e820: ...
          [    0.001000] e820: ...
           ...
          [    0.001000] ..TIMER: ...
          [    0.001000] clocksource: ...
          [    0.378956] Calibrating delay loop ...
          [    0.379955] pid_max: ...
      
      dmesg with this patch:
      
          [    0.000000] kvm-clock: ...
          [    0.000001] kvm-clock: ...
          [    0.000675] clocksource: ...
          [    0.002685] tsc: ...
          [    0.003331] e820: ...
          [    0.004190] e820: ...
           ...
          [    0.421939] ..TIMER: ...
          [    0.422842] clocksource: ...
          [    0.424582] Calibrating delay loop ...
          [    0.425580] pid_max: ...
      
      Fixes: 776f2291 ("sched/clock: Make local_clock() noinstr")
      Signed-off-by: default avatarAaron Thompson <dev@aaront.org>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Link: https://lkml.kernel.org/r/20230413175012.2201-1-dev@aaront.org
      f31dcb15
    • Zhaohui Shi's avatar
      sched/rt: Fix bad task migration for rt tasks · feffe5bb
      Zhaohui Shi authored
      
      
      Commit 95158a89 ("sched,rt: Use the full cpumask for balancing")
      allows find_lock_lowest_rq() to pick a task with migration disabled.
      The purpose of the commit is to push the current running task on the
      CPU that has the migrate_disable() task away.
      
      However, there is a race which allows a migrate_disable() task to be
      migrated. Consider:
      
        CPU0                                    CPU1
        push_rt_task
          check is_migration_disabled(next_task)
      
                                                task not running and
                                                migration_disabled == 0
      
          find_lock_lowest_rq(next_task, rq);
            _double_lock_balance(this_rq, busiest);
              raw_spin_rq_unlock(this_rq);
              double_rq_lock(this_rq, busiest);
                <<wait for busiest rq>>
                                                    <wakeup>
                                                task become running
                                                migrate_disable();
                                                  <context out>
          deactivate_task(rq, next_task, 0);
          set_task_cpu(next_task, lowest_rq->cpu);
            WARN_ON_ONCE(is_migration_disabled(p));
      
      Fixes: 95158a89 ("sched,rt: Use the full cpumask for balancing")
      Signed-off-by: Zhaohui Shi's avatarSchspa Shi <schspa@gmail.com>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Reviewed-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      Reviewed-by: Dietmar Eggemann's avatarDietmar Eggemann <dietmar.eggemann@arm.com>
      Reviewed-by: default avatarValentin Schneider <vschneid@redhat.com>
      Tested-by: default avatarDwaine Gonyier <dgonyier@redhat.com>
      feffe5bb
    • Mathieu Desnoyers's avatar
      sched: Fix performance regression introduced by mm_cid · 223baf9d
      Mathieu Desnoyers authored
      
      
      Introduce per-mm/cpu current concurrency id (mm_cid) to fix a PostgreSQL
      sysbench regression reported by Aaron Lu.
      
      Keep track of the currently allocated mm_cid for each mm/cpu rather than
      freeing them immediately on context switch. This eliminates most atomic
      operations when context switching back and forth between threads
      belonging to different memory spaces in multi-threaded scenarios (many
      processes, each with many threads). The per-mm/per-cpu mm_cid values are
      serialized by their respective runqueue locks.
      
      Thread migration is handled by introducing invocation to
      sched_mm_cid_migrate_to() (with destination runqueue lock held) in
      activate_task() for migrating tasks. If the destination cpu's mm_cid is
      unset, and if the source runqueue is not actively using its mm_cid, then
      the source cpu's mm_cid is moved to the destination cpu on migration.
      
      Introduce a task-work executed periodically, similarly to NUMA work,
      which delays reclaim of cid values when they are unused for a period of
      time.
      
      Keep track of the allocation time for each per-cpu cid, and let the task
      work clear them when they are observed to be older than
      SCHED_MM_CID_PERIOD_NS and unused. This task work also clears all
      mm_cids which are greater or equal to the Hamming weight of the mm
      cidmask to keep concurrency ids compact.
      
      Because we want to ensure the mm_cid converges towards the smaller
      values as migrations happen, the prior optimization that was done when
      context switching between threads belonging to the same mm is removed,
      because it could delay the lazy release of the destination runqueue
      mm_cid after it has been replaced by a migration. Removing this prior
      optimization is not an issue performance-wise because the introduced
      per-mm/per-cpu mm_cid tracking also covers this more specific case.
      
      Fixes: af7f588d ("sched: Introduce per-memory-map concurrency ID")
      Reported-by: default avatarAaron Lu <aaron.lu@intel.com>
      Signed-off-by: default avatarMathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Tested-by: default avatarAaron Lu <aaron.lu@intel.com>
      Link: https://lore.kernel.org/lkml/20230327080502.GA570847@ziqianlu-desk2/
      223baf9d
    • Peter Zijlstra's avatar
      Merge branch 'v6.3-rc7' · 5a4d3b38
      Peter Zijlstra authored
      
      
      Sync with the urgent patches; in particular:
      
      a53ce18c ("sched/fair: Sanitize vruntime of entity being migrated")
      
      Signed-off-by: default avatarPeter Zijlstra <peterz@infradead.org>
      5a4d3b38
  4. Apr 20, 2023
  5. Apr 18, 2023
    • Sanjay Chandrashekara's avatar
      cpufreq: use correct unit when verify cur freq · 44295af5
      Sanjay Chandrashekara authored
      
      
      cpufreq_verify_current_freq checks() if the frequency returned by
      the hardware has a slight delta with the valid frequency value
      last set and returns "policy->cur" if the delta is within "1 MHz".
      In the comparison, "policy->cur" is in "kHz" but it's compared
      against HZ_PER_MHZ. So, the comparison range becomes "1 GHz".
      
      Fix this by comparing against KHZ_PER_MHZ instead of HZ_PER_MHZ.
      
      Fixes: f55ae08c ("cpufreq: Avoid unnecessary frequency updates due to mismatch")
      Signed-off-by: default avatarSanjay Chandrashekara <sanjayc@nvidia.com>
      [ sumit gupta: Commit message update ]
      Signed-off-by: default avatarSumit Gupta <sumitg@nvidia.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      44295af5
    • Hans de Goede's avatar
      ACPI: LPSS: Add 80862289 ACPI _HID for second PWM controller on Cherry Trail · 03c57b01
      Hans de Goede authored
      
      
      On some Cherry Trail devices the second PWM controller uses
      80862289 as ACPI _HID, rather then using 80862288 as is done
      for both controllers on most models.
      
      Add the missing 80862289 ACPI _HID, note this uses its own
      lpss_device_desc, without ".setup = bsw_pwm_setup" so that
      the pwm_lookup is not added for it.
      On devices where both controllers use the 80862288 _HID bsw_pwm_setup()
      does a UID check to avoid registering the lookup for the second
      controller but that will not work here.
      
      Adding the missing id fixes the second PWM controller no longer
      working after the entire LPSS1 island has been in D3 at least
      once, which causes the contents of the LPSS private registers
      to get lost. Adding the _HID makes acpi_lpss restore these
      when the controller moves from D3 to D0.
      
      Reviewed-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      03c57b01
    • Rafael J. Wysocki's avatar
      ACPI: bus: Ensure that notify handlers are not running after removal · faae4437
      Rafael J. Wysocki authored
      
      
      Currently, acpi_device_remove_notify_handler() may return while the
      notify handler being removed is still running which may allow the
      module holding that handler to be torn down prematurely.
      
      Address this issue by making acpi_device_remove_notify_handler() wait
      for the handling of all the ACPI events in progress to complete before
      returning.
      
      Fixes: 5894b0c4 ("ACPI / scan: Move bus operations and notification routines to bus.c")
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      faae4437
    • Rafael J. Wysocki's avatar
      ACPI: bus: Add missing braces to acpi_sb_notify() · 6d572d39
      Rafael J. Wysocki authored
      
      
      As per the kernel coding style.
      
      No functional impact.
      
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      6d572d39
    • Rafael J. Wysocki's avatar
      Merge branch 'pm-opp' into linux-next · a55dbec1
      Rafael J. Wysocki authored
      * pm-opp:
        OPP: Move required opps configuration to specialized callback
        OPP: Handle all genpd cases together in _set_required_opps()
        opp: Use of_property_present() for testing DT property presence
      a55dbec1
    • Rafael J. Wysocki's avatar
      Merge tag 'opp-updates-6.4' of git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm into pm-opp · 0ba4962d
      Rafael J. Wysocki authored
      Pull OPP updates for 6.4 from Viresh Kumar:
      
      "- Use of_property_present() for testing DT property presence (Rob
         Herring).
      
       - Add set_required_opps() callback to the 'struct opp_table', to make
         the code paths cleaner (Viresh Kumar)."
      
      * tag 'opp-updates-6.4' of git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm:
        OPP: Move required opps configuration to specialized callback
        OPP: Handle all genpd cases together in _set_required_opps()
        opp: Use of_property_present() for testing DT property presence
      0ba4962d
    • Srinivas Pandruvada's avatar
      thermal: intel: int340x: Add DLVR support for RFIM control · 5bc6b1df
      Srinivas Pandruvada authored
      
      
      Add support for DLVR (Digital Linear Voltage Regulator) attributes,
      which can be used to control RFIM.
      
      Here instead of "fivr" another directory "dlvr" is created with DLVR
      attributes:
      
      /sys/bus/pci/devices/0000:00:04.0/dlvr
      ├── dlvr_freq_mhz
      ├── dlvr_freq_select
      ├── dlvr_hardware_rev
      ├── dlvr_pll_busy
      ├── dlvr_rfim_enable
      └── dlvr_spread_spectrum_pct
      └── dlvr_control_mode
      └── dlvr_control_lock
      
      Attributes
      dlvr_freq_mhz (RO):
      Current DLVR PLL frequency in MHz.
      
      dlvr_freq_select (RW):
      Sets DLVR PLL clock frequency.
      
      dlvr_hardware_rev (RO):
      DLVR hardware revision.
      
      dlvr_pll_busy (RO):
      PLL can't accept frequency change when set.
      
      dlvr_rfim_enable (RW):
      0: Disable RF frequency hopping, 1: Enable RF frequency hopping.
      
      dlvr_control_mode (RW):
      Specifies how frequencies are spread. 0: Down spread, 1: Spread in Center.
      
      dlvr_control_lock (RW):
      1: future writes are ignored.
      
      dlvr_spread_spectrum_pct (RW)
      A write to this register updates the DLVR spread spectrum percent value.
      
      Signed-off-by: default avatarSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
      [ rjw: Subject edits ]
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      5bc6b1df
    • Sumit Gupta's avatar
      cpufreq: tegra194: add OPP support and set bandwidth · f41e1442
      Sumit Gupta authored
      
      
      Add support to use OPP table from DT in Tegra194 cpufreq driver.
      Tegra SoC's receive the frequency lookup table (LUT) from BPMP-FW.
      Cross check the OPP's present in DT against the LUT from BPMP-FW
      and enable only those DT OPP's which are present in LUT also.
      
      The OPP table in DT has CPU Frequency to bandwidth mapping where
      the bandwidth value is per MC channel. DRAM bandwidth depends on the
      number of MC channels which can vary as per the boot configuration.
      This per channel bandwidth from OPP table will be later converted by
      MC driver to final bandwidth value by multiplying with number of
      channels before sending the request to BPMP-FW.
      
      If OPP table is not present in DT, then use the LUT from BPMP-FW
      directy as the CPU frequency table and not do the DRAM frequency
      scaling which is same as the current behavior.
      
      Now, as the CPU Frequency table is being controlling through OPP
      table in DT. Keeping fewer entries in the table will create less
      frequency steps and can help to scale fast to high frequencies
      when required.
      
      Signed-off-by: default avatarSumit Gupta <sumitg@nvidia.com>
      Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      f41e1442
  6. Apr 17, 2023
    • Rafael J. Wysocki's avatar
      Merge branches 'pm-core', 'pm-devfreq' and 'pm-tools' into linux-next · bc538c8b
      Rafael J. Wysocki authored
      * pm-core:
        PM: core: Remove unnecessary (void *) conversions
      
      * pm-devfreq:
        PM / devfreq: exynos-ppmu: Use devm_platform_get_and_ioremap_resource()
        PM / devfreq: exynos: Use of_property_present() for testing DT property presence
        PM / devfreq: exyos-bus: drop of_match_ptr for ID table
        PM / devfreq: Remove "select SRCU"
      
      * pm-tools:
        PM: tools: sleepgraph: Recognize "CPU killed" messages
        pm-graph: Update to v5.11
      bc538c8b
    • Rafael J. Wysocki's avatar
      Merge branches 'pm-cpufreq' and 'pm-cpuidle' into linux-next · ca531c85
      Rafael J. Wysocki authored
      * pm-cpufreq:
        cpufreq: amd-pstate: Make varaiable mode_state_machine static
        cpufreq: drivers with target_index() must set freq_table
        cpufreq: pmac32: Use of_property_read_bool() for boolean properties
        cpufreq: Fix typo in the ARM_BRCMSTB_AVS_CPUFREQ Kconfig entry
        cpufreq: warn about invalid vals to scaling_max/min_freq interfaces
        Documentation: cpufreq: amd-pstate: Update amd_pstate status sysfs for guided
        cpufreq: amd-pstate: Add guided mode control support via sysfs
        cpufreq: amd-pstate: Add guided autonomous mode
        Documentation: cpufreq: amd-pstate: Move amd_pstate param to alphabetical order
        ACPI: CPPC: Add auto select register read/write support
        ACPI: CPPC: Add min and max perf register writing support
        cpufreq: intel_pstate: Enable HWP IO boost for all servers
      
      * pm-cpuidle:
        cpuidle: Use of_property_present() for testing DT property presence
      ca531c85
    • Rafael J. Wysocki's avatar
      Merge branches 'acpi-video', 'acpi-misc', 'acpi-utils' and 'acpi-docs' into linux-next · 345798ff
      Rafael J. Wysocki authored
      * acpi-video:
        ACPI: video: Remove desktops without backlight DMI quirks
        ACPI: video: Remove register_backlight_delay module option and code
      
      * acpi-misc:
        ACPI: Replace irqdomain.h include with struct declarations
        fpga: lattice-sysconfig-spi: Add explicit include for of.h
        tpm: atmel: Add explicit include for of.h
        virtio-mmio: Add explicit include for of.h
        pata: ixp4xx: Add explicit include for of.h
        ata: pata_macio: Add explicit include of irqdomain.h
        serial: 8250_tegra: Add explicit include for of.h
        net: rfkill-gpio: Add explicit include for of.h
        staging: iio: resolver: ad2s1210: Add explicit include for of.h
        iio: adc: ad7292: Add explicit include for of.h
      
      * acpi-utils:
        ACPI: utils: Fix acpi_evaluate_dsm_typed() redefinition error
      
      * acpi-docs:
        ACPI: docs: Update the pm_profile sysfs attribute documentation
      345798ff
    • Rafael J. Wysocki's avatar
      Merge branches 'acpi-apei', 'acpi-properties', 'acpi-sbs' and 'acpi-thermal' into linux-next · f1a4f350
      Rafael J. Wysocki authored
      * acpi-apei:
        ACPI: APEI: EINJ: warn on invalid argument when explicitly indicated by platform
        ACPI: APEI: EINJ: Add CXL error types
      
      * acpi-properties:
        ACPI: property: Refactor acpi_data_prop_read_single()
      
      * acpi-sbs:
        ACPI: SBS: Fix handling of Smart Battery Selectors
        ACPI: EC: Fix oops when removing custom query handlers
        ACPI: EC: Limit explicit removal of query handlers to custom query handlers
      
      * acpi-thermal:
        ACPI: thermal: Replace ternary operator with min_t()
      f1a4f350
    • Rafael J. Wysocki's avatar
      Merge branches 'acpi-processor', 'acpi-pm', 'acpi-tables' and 'acpi-sysfs' into linux-next · 6e56016e
      Rafael J. Wysocki authored
      * acpi-processor:
        ACPI: processor: Fix evaluating _PDC method when running as Xen dom0
        ACPI: cpufreq: Use platform devices to load ACPI PPC and PCC drivers
        ACPI: processor: Check for null return of devm_kzalloc() in fch_misc_setup()
      
      * acpi-pm:
        ACPI: s2idle: Log when enabling wakeup IRQ fails
      
      * acpi-tables:
        ACPI: VIOT: Initialize the correct IOMMU fwspec
        ACPI: SPCR: Amend indentation
        ACPI: SPCR: Prefix error messages with FW_BUG
      
      * acpi-sysfs:
        ACPI: sysfs: Enable ACPI sysfs support for CCEL records
      6e56016e
    • Rafael J. Wysocki's avatar
      Merge branch 'acpica' into linux-next · e9dfdaeb
      Rafael J. Wysocki authored
      * acpica: (32 commits)
        ACPICA: Update version to 20230331
        ACPICA: add os specific support for Zephyr RTOS
        ACPICA: ACPICA: check null return of ACPI_ALLOCATE_ZEROED in acpi_db_display_objects
        ACPICA: acpi_resource_irq: Replace 1-element arrays with flexible array
        ACPICA: acpi_madt_oem_data: Fix flexible array member definition
        ACPICA: acpi_dmar_andd: Replace 1-element array with flexible array
        ACPICA: acpi_pci_routing_table: Replace fixed-size array with flex array member
        ACPICA: struct acpi_resource_dma: Replace 1-element array with flexible array
        ACPICA: Introduce ACPI_FLEX_ARRAY
        ACPICA: struct acpi_nfit_interleave: Replace 1-element array with flexible array
        ACPICA: actbl2: Replace 1-element arrays with flexible arrays
        ACPICA: actbl1: Replace 1-element arrays with flexible arrays
        ACPICA: struct acpi_resource_vendor: Replace 1-element array with flexible array
        ACPICA: Avoid undefined behavior: load of misaligned address
        ACPICA: Avoid undefined behavior: member access within misaligned address
        ACPICA: Avoid undefined behavior: member access within misaligned address
        ACPICA: Avoid undefined behavior: member access within misaligned address
        ACPICA: Avoid undefined behavior: member access within misaligned address
        ACPICA: Avoid undefined behavior: member access within null pointer
        ACPICA: Avoid undefined behavior: applying zero offset to null pointer
        ...
      e9dfdaeb
Loading