Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
f1d34fe
cpufreq: Fix re-boost issue after hotplugging a CPU
Mar 11, 2025
c144c4b
cpufreq: Introduce a more generic way to set default per-policy boost…
Mar 11, 2025
ad9f9fa
cpufreq: CPPC: Fix wrong max_freq in policy initialization
Mar 11, 2025
12a30ec
cpufreq: ACPI: Remove set_boost in acpi_cpufreq_cpu_init()
Mar 11, 2025
41213aa
cpufreq: prevent NULL dereference in cpufreq_online()
AboorvaDevarajan Mar 11, 2025
88a926a
cpufreq: CPPC: Don't warn on failing to read perf counters on offline…
Jun 13, 2025
2ddf94a
cpufreq: CPPC: Fix error handling in cppc_scale_freq_workfn()
Jun 13, 2025
41729f9
cpufreq: cppc: Fix invalid return value in .get() callback
Aug 21, 2025
dbdb317
cpufreq: cppc: Fix invalid return value in hisi_cppc_cpufreq_get_rate()
Aug 21, 2025
3e99fd9
cpufreq: CPPC: Remove forward declaration of hisi_cppc_cpufreq_get_ra…
Aug 21, 2025
32dc4a9
cpufreq: CPPC: Remove cpu_data_list
Aug 21, 2025
266a317
cpufreq: CPPC: Do not return a value from populate_efficiency_class()
Aug 21, 2025
5547c88
cpufreq: CPPC: Remove forward declaration of cppc_cpufreq_register_em()
Aug 21, 2025
017ad0d
cpufreq: Contain scaling_cur_freq.attr in cpufreq_attrs
Aug 21, 2025
86cd42a
cpufreq: Remove duplicate check in __cpufreq_offline()
Aug 21, 2025
32c40ae
cpufreq: Hold cpufreq_driver_lock when assigning cpufreq_driver->set_…
Aug 21, 2025
048e4e6
cpufreq: Move the check of cpufreq_driver->get into cpufreq_verify_cu…
Aug 21, 2025
071d413
ACPI: CPPC: Add New ABIs for reading and writing three new CPPC regis…
Dec 3, 2024
cdb391b
cpufreq: CPPC: Support for auto act window and energy perf in cppc_cp…
Dec 3, 2024
417baf0
cpufreq: Add SEEP governor for hardware-managed P-states
Dec 4, 2024
ac244ee
PCI/ASPM: Update ASPM sysfs on MFD function removal to avoid use-afte…
Jul 30, 2024
7dca29a
hwtracing: hisi_ptt: Initialize the filter sysfs attribute when alloc…
Feb 15, 2025
390f140
hwtracing: hisi_ptt: Check duplicate filters before allocation
Feb 24, 2025
0c214ca
hwtracing: hisi_ptt: Disable interrupt after trace end
Oct 10, 2023
4c88cba
PCI/DPC: Ignore Surprise Down error on hot removal
skoralah Feb 7, 2024
69e2e6e
hwtracing: hisi_ptt: Optimize the trace data committing
Oct 10, 2023
f7af86e
perf hisi-ptt: Fix memory leak in lseek failure handling
visitorckw Sep 30, 2023
bb753e4
drm/hisilicon/hibmc: convert to struct drm_edid
jnikula Mar 14, 2025
42e7f11
drm/hisilicon/hibmc: add dp aux in hibmc drivers
mark1188-ui Mar 14, 2025
be2fd6f
drm/hisilicon/hibmc: add dp link moduel in hibmc drivers
mark1188-ui Mar 14, 2025
213d513
drm/hisilicon/hibmc: add dp hw moduel in hibmc driver
mark1188-ui Mar 14, 2025
9ea9629
drm/hisilicon/hibmc: refactored struct hibmc_drm_private
mark1188-ui Mar 14, 2025
47f1b7e
drm/hisilicon/hibmc: add dp module in hibmc
mark1188-ui Mar 14, 2025
cb5fa54
drm/sysfs: Register "ddc" symlink later
vsyrjala Apr 16, 2025
a34374b
drm/ast: Implement polling for VGA and SIL164 connectors
tdz Apr 16, 2025
fb3a00e
drm: Call drm_atomic_helper_shutdown() at shutdown time for misc drivers
dianders Apr 16, 2025
ca89d35
drm/hisilicon/hibmc: select CONFIG_DRM_DISPLAY_DP_HELPER
arndb Apr 16, 2025
97e99e7
drm/hisilicon/hibmc: Restructuring the header dp_reg.h
mark1188-ui Apr 16, 2025
12e2629
drm/hisilicon/hibmc: Add dp serdes cfg to adjust serdes rate, voltage…
mark1188-ui Apr 16, 2025
073839c
drm/hisilicon/hibmc: Add dp serdes cfg in dp process
mark1188-ui Apr 16, 2025
3402288
drm/hisilicon/hibmc: Refactor the member of drm_aux in struct hibmc_dp
mark1188-ui Apr 16, 2025
9c7f66a
drm/hisilicon/hibmc: Getting connector info and EDID by using AUX cha…
mark1188-ui Apr 16, 2025
f32fe46
drm/hisilicon/hibmc: Add colorbar-cfg feature and its debugfs file
mark1188-ui Apr 16, 2025
fe5fde6
drm/hisilicon/hibmc: Enable this hot plug detect of irq feature
mark1188-ui Apr 16, 2025
d65fb71
drm/hisilicon/hibmc: Add MSI irq getting and requesting for HPD
mark1188-ui Apr 16, 2025
bebb511
drm/hisilicon/hibmc: Add vga connector detect functions
mark1188-ui Apr 16, 2025
725ecf5
drm/hisilicon/hibmc: fix HPD interrupts triggering the wrong behavior
mark1188-ui Apr 17, 2025
a704396
drm/hisilicon/hibmc: fix irq_request()'s irq name variable is local
mark1188-ui Apr 17, 2025
c364203
drm/hisilicon/hibmc:fix KVM is not displaying when GRUB VGA is on
mark1188-ui May 27, 2025
2f6c580
drm/hisilicon/hibmc: hibmc-drm bugfix for DP
mark1188-ui May 27, 2025
2d3bdfd
mm: Export symbol walk_page_range
Jan 18, 2024
2e413de
soc cache: Add framework driver for HiSilicon SoC cache
Apr 17, 2025
315105c
soc cache: Support cache maintenance for HiSilicon SoC Hydra Home Agent
Apr 17, 2025
456e95b
soc cache: Enforce maintain type check
Aug 26, 2025
bb832d0
soc cache: Fix incorrect size validation
Aug 26, 2025
f76dc25
soc cache: Fix incorrect error path of ioctl
Aug 26, 2025
c2151a5
spi: hisi-kunpeng: Fixed the wrong debugfs node name in hisi_spi debu…
Jul 21, 2025
877ec42
hwmon: (xgene) Migrate to use generic PCC shmem related macros
sudeep-holla Sep 27, 2023
c0fd6bd
soc: kunpeng_hccs: Migrate to use generic PCC shmem related macros
sudeep-holla Sep 27, 2023
421b7cd
hwmon: (acpi_power_meter) Fix fail to load module on platform without…
LiHuiSong1 Apr 1, 2025
d5993d3
hwmon: (acpi_power_meter) Fix uninitialized variables
LiHuiSong1 Apr 1, 2025
a337eec
hwmon: (acpi_power_meter) Fix update the power trip points on failure
LiHuiSong1 Apr 1, 2025
e35c3f0
hwmon: (acpi_power_meter) Fix a check for the return value of read_do…
Kazuhiro-Abe-fj Apr 1, 2025
aeb014a
hwmon: (acpi_power_meter) Fix the fake power alarm reporting
LiHuiSong1 Apr 1, 2025
b2b8261
ACPI: IPMI: Add helper to wait for when SMI is selected
khfeng Apr 15, 2025
7fe3c87
hwmon: (acpi_power_meter) Ensure IPMI space handler is ready on Dell …
khfeng Apr 15, 2025
5ca5da5
hwmon: Fix the missing of 'average' word in hwmon_power_attr_templates
LiHuiSong1 Apr 15, 2025
1c1889a
hwmon: (acpi_power_meter) Replace the deprecated hwmon_device_register
LiHuiSong1 Apr 15, 2025
8e2c9ab
perf stat: Enable iostat mode for HiSilicon PCIe PMU
Apr 10, 2025
bfb8b9b
perf iostat: hisi: Fix port range retrival
Jun 16, 2025
023fa2c
firmware: arm_sdei: add interrupt binding api
fenghusthu Dec 5, 2023
dc6f01f
firmware: arm_sdei: make 'sdei_api_event_disable/enable' public
fenghusthu Dec 5, 2023
be0afe5
lockup_detector: init lockup detector after all the init_calls
fenghusthu Dec 5, 2023
43cde10
watchdog: add nmi_watchdog support for arm64 based on SDEI
fenghusthu Dec 5, 2023
78cf633
sdei_watchdog: clear EOI of the secure timer before kdump
fenghusthu Dec 5, 2023
35e236f
sdei_watchdog: set secure timer period base on 'watchdog_thresh'
fenghusthu Dec 5, 2023
8368f46
sdei_watchdog: avoid possible false hardlockup
fenghusthu Dec 5, 2023
6401d93
init: only move down lockup_detector_init() when sdei_watchdog is ena…
fenghusthu Dec 5, 2023
7a85264
kprobes/arm64: Blacklist sdei watchdog callback functions
fenghusthu Dec 5, 2023
578806c
stop_machine: mask sdei before running the callback
fenghusthu Dec 5, 2023
9e11a4e
arm64: kexec: only clear EOI for SDEI in NMI context
fenghusthu Dec 5, 2023
5e81817
watchdog: Support watchdog_sdei coexist with existing watchdogs
Feb 1, 2024
f5ee036
watchdog: Fix call trace when failed to initialize sdei
Mar 28, 2024
1ed7c96
watchdog/perf: Provide function for adjusting the event period
May 13, 2025
f2cdb1b
arm64/watchdog_hld: Add a cpufreq notifier for update watchdog thresh
May 13, 2025
c41af4e
arm64/watchdog: fix watchdog failure in low power scenarios
May 28, 2025
1af0282
sdei_watchdog: use lockup_detector_retry_init() to init sdei watchdog
Aug 5, 2025
be3dcf7
gic: increase the arch_timer priority to avoid hardlockup
Aug 28, 2025
8ae22ae
arch_topology: Support basic SMT control for the driver
Nov 21, 2023
6328ae9
arch_topology: Support SMT control for OF based system
Nov 21, 2023
82e5242
arm64: topology: Support SMT control on ACPI based system
Nov 21, 2023
e632e74
arm64: Kconfig: Enable HOTPLUG_SMT
Nov 21, 2023
992fc3a
drivers: perf: arm_pmuv3: Read PMMIR_EL1 unconditionally
Sep 19, 2024
d02ad12
drivers: perf: arm_pmuv3: Drop some unused arguments from armv8_pmu_i…
Sep 19, 2024
66157cd
KVM: arm64: Make PMEVTYPER<n>_EL0.NSH RES0 if EL2 isn't advertised
oupton Sep 19, 2024
a442e38
KVM: arm64: Add PMU event filter bits required if EL3 is implemented
oupton Sep 19, 2024
93a7043
drivers: perf: arm_pmuv3: Add new macro PMUV3_INIT_MAP_EVENT()
Sep 19, 2024
735a385
arm: perf: Remove inlines from arm_pmuv3.c
James-A-Clark Sep 19, 2024
c9c2bd7
arm: perf: Use GENMASK for PMMIR fields
James-A-Clark Sep 19, 2024
d5fb271
arm: perf: Convert remaining fields to use GENMASK
James-A-Clark Sep 19, 2024
8415710
arm64: perf: Include threshold control fields in PMEVTYPER mask
James-A-Clark Sep 19, 2024
65d1e0f
arm: pmu: Share user ABI format mechanism with SPE
James-A-Clark Sep 19, 2024
2c00079
arm: pmu: Move error message and -EOPNOTSUPP to individual PMUs
James-A-Clark Sep 19, 2024
7c48737
arm64: perf: Add support for event counting threshold
James-A-Clark Sep 19, 2024
4af061b
Documentation: arm64: Document the PMU event counting threshold feature
James-A-Clark Sep 19, 2024
d47b6ab
arm: perf: Fix ARCH=arm build with GCC
James-A-Clark Sep 19, 2024
74a2990
perf: arm_pmuv3: Avoid assigning fixed cycle counter with threshold
robherring Sep 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions Documentation/ABI/testing/sysfs-devices-system-cpu
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,45 @@ Description: Discover CPUs in the same CPU frequency coordination domain
This file is only present if the acpi-cpufreq or the cppc-cpufreq
drivers are in use.

What: /sys/devices/system/cpu/cpuX/cpufreq/auto_act_window
Date: October 2024
Contact: [email protected]
Description: Autonomous activity window

This file indicates a moving utilization sensitivity window to
the platform's autonomous selection policy.

Read/write an integer represents autonomous activity window (in
microseconds) from/to this file. The max value to write is
1270000000 but the max significand is 127. This means that if 128
is written to this file, 127 will be stored. If the value is
greater than 130, only the first two digits will be saved as
significand.

Writing a zero value to this file enable the platform to
Copy link

Copilot AI Dec 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Grammatical error: should be "enable" → "enables" to agree with the singular subject "Writing a zero value".

Suggested change
Writing a zero value to this file enable the platform to
Writing a zero value to this file enables the platform to

Copilot uses AI. Check for mistakes.
determine an appropriate Activity Window depending on the workload.

Writing to this file only has meaning when Autonomous Selection is
enabled.

This file only presents if the cppc-cpufreq driver is in use.
Copy link

Copilot AI Dec 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Grammatical error: should be "This file only presents" → "This file is only present" for correct English grammar and consistency with similar documentation entries (see line 268).

Suggested change
This file only presents if the cppc-cpufreq driver is in use.
This file is only present if the cppc-cpufreq driver is in use.

Copilot uses AI. Check for mistakes.

What: /sys/devices/system/cpu/cpuX/cpufreq/energy_perf
Date: October 2024
Contact: [email protected]
Description: Energy performance preference

Read/write an 8-bit integer from/to this file. This file
represents a range of values from 0 (performance preference) to
0xFF (energy efficiency preference) that influences the rate of
performance increase/decrease and the result of the hardware's
energy efficiency and performance optimization policies.

Writing to this file only has meaning when Autonomous Selection is
enabled.

This file only presents if the cppc-cpufreq driver is in use.
Copy link

Copilot AI Dec 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Grammatical error: should be "This file only presents" → "This file is only present" for correct English grammar and consistency with similar documentation entries (see line 268).

Suggested change
This file only presents if the cppc-cpufreq driver is in use.
This file is only present if the cppc-cpufreq driver is in use.

Copilot uses AI. Check for mistakes.


What: /sys/devices/system/cpu/cpu*/cache/index3/cache_disable_{0,1}
Date: August 2008
Expand Down
42 changes: 42 additions & 0 deletions Documentation/admin-guide/pm/cpufreq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,48 @@ This governor exposes the following tunables:
It effectively causes the frequency to go down ``sampling_down_factor``
times slower than it ramps up.

``seep``
------------

This governor is specifically designed for platforms with hardware-managed P-states
through CPPC (Collaborative Processor Performance Control). Unlike other governors
that implement their own frequency scaling algorithms, the ``seep`` governor
delegates the P-state selection to the hardware/firmware by enabling CPPC
autonomous mode.

The governor requires the ``cppc_cpufreq`` driver and the platform must support
three key CPPC capabilities:
* Autonomous selection (auto_sel)
* Autonomous activity window (auto_act_window)
* Energy-Performance Preference (EPP)
Comment on lines +604 to +606
Copy link

Copilot AI Dec 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent formatting in the list. The items should either all use bullet points (asterisks) or all use numbered format. Looking at the rest of the document, plain text with indentation or dashes would be more consistent. Also, each line should typically be indented consistently.

Suggested change
* Autonomous selection (auto_sel)
* Autonomous activity window (auto_act_window)
* Energy-Performance Preference (EPP)
- Autonomous selection (auto_sel)
- Autonomous activity window (auto_act_window)
- Energy-Performance Preference (EPP)

Copilot uses AI. Check for mistakes.

When this governor is attached to a policy, it enables the hardware autonomous
mode, allowing the processor's firmware to directly manage frequency scaling based
on workload characteristics. The actual P-state selection algorithms are
implemented in firmware/hardware rather than in the operating system.

This governor exposes the following tunables (per-policy):

``auto_act_window``
The time window (in microseconds) used by the hardware/firmware to observe
and evaluate workload characteristics before making P-state decisions.
A smaller window makes the algorithm more responsive but potentially less
stable, while a larger window provides more stable but less responsive
frequency scaling.

``energy_perf``
A value between 0 and 255 that biases the hardware's frequency scaling
decisions between performance and energy efficiency. Lower values (closer
to 0) favor performance at the expense of power consumption, while higher
values (closer to 255) favor energy efficiency but may impact performance.

The ``seep`` governor is particularly suitable for platforms where the hardware
has more accurate and fine-grained information about the system's power and
thermal constraints than the operating system. It can potentially provide better
energy efficiency than software-based governors while maintaining good
performance, as the hardware can make faster and more informed P-state
decisions.


Frequency Boost Support
=======================
Expand Down
72 changes: 72 additions & 0 deletions Documentation/arch/arm64/perf.rst
Original file line number Diff line number Diff line change
Expand Up @@ -164,3 +164,75 @@ and should be used to mask the upper bits as needed.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/perf/arch/arm64/tests/user-events.c
.. _tools/lib/perf/tests/test-evsel.c:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/lib/perf/tests/test-evsel.c

Event Counting Threshold
==========================================

Overview
--------

FEAT_PMUv3_TH (Armv8.8) permits a PMU counter to increment only on
events whose count meets a specified threshold condition. For example if
threshold_compare is set to 2 ('Greater than or equal'), and the
threshold is set to 2, then the PMU counter will now only increment by
when an event would have previously incremented the PMU counter by 2 or
more on a single processor cycle.

To increment by 1 after passing the threshold condition instead of the
number of events on that cycle, add the 'threshold_count' option to the
commandline.

How-to
------

These are the parameters for controlling the feature:

.. list-table::
:header-rows: 1

* - Parameter
- Description
* - threshold
- Value to threshold the event by. A value of 0 means that
thresholding is disabled and the other parameters have no effect.
* - threshold_compare
- | Comparison function to use, with the following values supported:
|
| 0: Not-equal
| 1: Equals
| 2: Greater-than-or-equal
| 3: Less-than
* - threshold_count
- If this is set, count by 1 after passing the threshold condition
instead of the value of the event on this cycle.

The threshold, threshold_compare and threshold_count values can be
provided per event, for example:

.. code-block:: sh

perf stat -e stall_slot/threshold=2,threshold_compare=2/ \
-e dtlb_walk/threshold=10,threshold_compare=3,threshold_count/

In this example the stall_slot event will count by 2 or more on every
cycle where 2 or more stalls happen. And dtlb_walk will count by 1 on
every cycle where the number of dtlb walks were less than 10.

The maximum supported threshold value can be read from the caps of each
PMU, for example:

.. code-block:: sh

cat /sys/bus/event_source/devices/armv8_pmuv3/caps/threshold_max

0x000000ff

If a value higher than this is given, then opening the event will result
in an error. The highest possible maximum is 4095, as the config field
for threshold is limited to 12 bits, and the Perf tool will refuse to
parse higher values.

If the PMU doesn't support FEAT_PMUv3_TH, then threshold_max will read
0, and attempting to set a threshold value will also result in an error.
threshold_max will also read as 0 on aarch32 guests, even if the host
is running on hardware with the feature.
6 changes: 4 additions & 2 deletions arch/arm/kernel/perf_event_v7.c
Original file line number Diff line number Diff line change
Expand Up @@ -1072,8 +1072,10 @@ static int armv7pmu_set_event_filter(struct hw_perf_event *event,
{
unsigned long config_base = 0;

if (attr->exclude_idle)
return -EPERM;
if (attr->exclude_idle) {
pr_debug("ARM performance counters do not support mode exclusion\n");
return -EOPNOTSUPP;
}
if (attr->exclude_user)
config_base |= ARMV7_EXCLUDE_USER;
if (attr->exclude_kernel)
Expand Down
12 changes: 12 additions & 0 deletions arch/arm64/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ config ARM64
select HAVE_KRETPROBES
select HAVE_GENERIC_VDSO
select HOTPLUG_CORE_SYNC_DEAD if HOTPLUG_CPU
select HOTPLUG_SMT if (SMP && HOTPLUG_CPU)
select IRQ_DOMAIN
select IRQ_FORCED_THREADING
select KASAN_VMALLOC if KASAN
Expand Down Expand Up @@ -1217,6 +1218,17 @@ config HISILICON_ERRATUM_161600802

If unsure, say Y.

config HISILICON_ERRATUM_165010801
bool "Hisilicon erratum 165010801"
depends on ARCH_HISI
default y
help
On HIP12, when GIC receives multiple interrupts of the same priority and
different types, the interrupts are selected in the following sequence:
SPI > LPI > SGI > PPI. This scheduling rule may cause PPI starvation.
To prevent starvation from triggering system watchdog hardlockup, the
interrupt priority is explicitly increased in the arch_timer driver.

config QCOM_FALKOR_ERRATUM_1003
bool "Falkor E1003: Incorrect translation due to ASID change"
default y
Expand Down
1 change: 1 addition & 0 deletions arch/arm64/kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ arm64-reloc-test-y := reloc_test_core.o reloc_test_syms.o
obj-$(CONFIG_CRASH_DUMP) += crash_dump.o
obj-$(CONFIG_CRASH_CORE) += crash_core.o
obj-$(CONFIG_ARM_SDE_INTERFACE) += sdei.o
obj-$(CONFIG_SDEI_WATCHDOG) += watchdog_sdei.o
obj-$(CONFIG_ARM64_PTR_AUTH) += pointer_auth.o
obj-$(CONFIG_ARM64_MTE) += mte.o
obj-y += vdso-wrap.o
Expand Down
11 changes: 11 additions & 0 deletions arch/arm64/kernel/machine_kexec.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <linux/irq.h>
#include <linux/kernel.h>
#include <linux/kexec.h>
#include <linux/nmi.h>
#include <linux/page-flags.h>
#include <linux/reboot.h>
#include <linux/set_memory.h>
Expand Down Expand Up @@ -262,6 +263,16 @@ void machine_crash_shutdown(struct pt_regs *regs)
/* shutdown non-crashing cpus */
crash_smp_send_stop();

/*
* when we panic in hardlockup detected by sdei_watchdog, the secure
* timer interrupt remains activate here because firmware clear eoi
* after dispatch is completed. This will cause arm_arch_timer
* interrupt failed to trigger in the second kernel. So we clear eoi
* of the secure timer before booting the second kernel.
*/
if (in_nmi())
sdei_watchdog_clear_eoi();

/* for crashing cpu */
crash_save_cpu(regs, smp_processor_id());
machine_kexec_mask_interrupts();
Expand Down
23 changes: 23 additions & 0 deletions arch/arm64/kernel/topology.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <linux/cpufreq.h>
#include <linux/init.h>
#include <linux/percpu.h>
#include <linux/xarray.h>

#include <asm/cpu.h>
#include <asm/cputype.h>
Expand All @@ -43,11 +44,16 @@ static bool __init acpi_cpu_is_threaded(int cpu)
*/
int __init parse_acpi_topology(void)
{
int thread_num, max_smt_thread_num = 1;
struct xarray core_threads;
int cpu, topology_id;
void *entry;

if (acpi_disabled)
return 0;

xa_init(&core_threads);

for_each_possible_cpu(cpu) {
topology_id = find_acpi_cpu_topology(cpu, 0);
if (topology_id < 0)
Expand All @@ -57,6 +63,20 @@ int __init parse_acpi_topology(void)
cpu_topology[cpu].thread_id = topology_id;
topology_id = find_acpi_cpu_topology(cpu, 1);
cpu_topology[cpu].core_id = topology_id;

entry = xa_load(&core_threads, topology_id);
if (!entry) {
xa_store(&core_threads, topology_id,
xa_mk_value(1), GFP_KERNEL);
} else {
thread_num = xa_to_value(entry);
thread_num++;
xa_store(&core_threads, topology_id,
xa_mk_value(thread_num), GFP_KERNEL);

if (thread_num > max_smt_thread_num)
max_smt_thread_num = thread_num;
}
} else {
cpu_topology[cpu].thread_id = -1;
cpu_topology[cpu].core_id = topology_id;
Expand All @@ -67,6 +87,9 @@ int __init parse_acpi_topology(void)
cpu_topology[cpu].package_id = topology_id;
}

topology_smt_set_num_threads(max_smt_thread_num);

xa_destroy(&core_threads);
return 0;
}
#endif
Expand Down
58 changes: 58 additions & 0 deletions arch/arm64/kernel/watchdog_hld.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,61 @@ bool __init arch_perf_nmi_is_available(void)
*/
return arm_pmu_irq_is_nmi();
}

static int watchdog_perf_update_period(void *data)
{
int cpu = raw_smp_processor_id();
u64 max_cpu_freq, new_period;

max_cpu_freq = cpufreq_get_hw_max_freq(cpu) * 1000UL;
if (!max_cpu_freq)
return 0;

new_period = watchdog_thresh * max_cpu_freq;
hardlockup_detector_perf_adjust_period(cpu, new_period);

return 0;
}

static int watchdog_freq_notifier_callback(struct notifier_block *nb,
unsigned long val, void *data)
{
struct cpufreq_policy *policy = data;
int cpu;

if (val != CPUFREQ_CREATE_POLICY)
return NOTIFY_DONE;

/*
* Let each online CPU related to the policy update the period by their
* own. This will serialize with the framework on start/stop the lockup
* detector (softlockup_{start,stop}_all) and avoid potential race
* condition. Otherwise we may have below theoretical race condition:
* (core 0/1 share the same policy)
* [core 0] [core 1]
* hardlockup_detector_event_create()
* hw_nmi_get_sample_period()
* (cpufreq registered, notifier callback invoked)
* watchdog_freq_notifier_callback()
* watchdog_perf_update_period()
* (since core 1's event's not yet created,
* the period is not set)
* perf_event_create_kernel_counter()
* (event's period is SAFE_MAX_CPU_FREQ)
*/
for_each_cpu(cpu, policy->cpus)
smp_call_on_cpu(cpu, watchdog_perf_update_period, NULL, false);

return NOTIFY_DONE;
}

static struct notifier_block watchdog_freq_notifier = {
.notifier_call = watchdog_freq_notifier_callback,
};

static int __init init_watchdog_freq_notifier(void)
{
return cpufreq_register_notifier(&watchdog_freq_notifier,
CPUFREQ_POLICY_NOTIFIER);
}
core_initcall(init_watchdog_freq_notifier);
Loading
Loading