Skip to content

Commit 0a06ab0

Browse files
author
CKI KWF Bot
committed
Merge: perf: sync with upstream v6.17
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-10/-/merge_requests/1556 JIRA: https://issues.redhat.com/browse/RHEL-78200 Sync perf codebase with upstream v6.17. Signed-off-by: Anubhav Shelat <ashelat@redhat.com> Approved-by: Michael Petlan <mpetlan@redhat.com> Approved-by: Steve Best <sbest@redhat.com> Approved-by: jbrnak <jbrnak@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: CKI GitLab Kmaint Pipeline Bot <26919896-cki-kmaint-pipeline-bot@users.noreply.gitlab.com>
2 parents 2429d88 + e4ced82 commit 0a06ab0

File tree

432 files changed

+13582
-5469
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

432 files changed

+13582
-5469
lines changed

Documentation/admin-guide/syscall-user-dispatch.rst

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,20 +53,25 @@ following prctl:
5353

5454
prctl(PR_SET_SYSCALL_USER_DISPATCH, <op>, <offset>, <length>, [selector])
5555

56-
<op> is either PR_SYS_DISPATCH_ON or PR_SYS_DISPATCH_OFF, to enable and
57-
disable the mechanism globally for that thread. When
58-
PR_SYS_DISPATCH_OFF is used, the other fields must be zero.
59-
60-
[<offset>, <offset>+<length>) delimit a memory region interval
61-
from which syscalls are always executed directly, regardless of the
62-
userspace selector. This provides a fast path for the C library, which
63-
includes the most common syscall dispatchers in the native code
64-
applications, and also provides a way for the signal handler to return
56+
<op> is either PR_SYS_DISPATCH_EXCLUSIVE_ON/PR_SYS_DISPATCH_INCLUSIVE_ON
57+
or PR_SYS_DISPATCH_OFF, to enable and disable the mechanism globally for
58+
that thread. When PR_SYS_DISPATCH_OFF is used, the other fields must be zero.
59+
60+
For PR_SYS_DISPATCH_EXCLUSIVE_ON [<offset>, <offset>+<length>) delimit
61+
a memory region interval from which syscalls are always executed directly,
62+
regardless of the userspace selector. This provides a fast path for the
63+
C library, which includes the most common syscall dispatchers in the native
64+
code applications, and also provides a way for the signal handler to return
6565
without triggering a nested SIGSYS on (rt\_)sigreturn. Users of this
6666
interface should make sure that at least the signal trampoline code is
6767
included in this region. In addition, for syscalls that implement the
6868
trampoline code on the vDSO, that trampoline is never intercepted.
6969

70+
For PR_SYS_DISPATCH_INCLUSIVE_ON [<offset>, <offset>+<length>) delimit
71+
a memory region interval from which syscalls are dispatched based on
72+
the userspace selector. Syscalls from outside of the range are always
73+
executed directly.
74+
7075
[selector] is a pointer to a char-sized region in the process memory
7176
region, that provides a quick way to enable disable syscall redirection
7277
thread-wide, without the need to invoke the kernel directly. selector

arch/powerpc/kernel/eeh_driver.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -907,7 +907,7 @@ void eeh_handle_normal_event(struct eeh_pe *pe)
907907
/* FIXME: Use the same format as dump_stack() */
908908
pr_err("EEH: Call Trace:\n");
909909
for (i = 0; i < pe->trace_entries; i++)
910-
pr_err("EEH: [%pK] %pS\n", ptrs[i], ptrs[i]);
910+
pr_err("EEH: [%p] %pS\n", ptrs[i], ptrs[i]);
911911

912912
pe->trace_entries = 0;
913913
}

arch/powerpc/perf/hv-24x7.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -713,27 +713,27 @@ static ssize_t catalog_event_len_validate(struct hv_24x7_event_data *event,
713713
ev_len = be16_to_cpu(event->length);
714714

715715
if (ev_len % 16)
716-
pr_info("event %zu has length %zu not divisible by 16: event=%pK\n",
716+
pr_info("event %zu has length %zu not divisible by 16: event=%p\n",
717717
event_idx, ev_len, event);
718718

719719
ev_end = (__u8 *)event + ev_len;
720720
if (ev_end > end) {
721-
pr_warn("event %zu has .length=%zu, ends after buffer end: ev_end=%pK > end=%pK, offset=%zu\n",
721+
pr_warn("event %zu has .length=%zu, ends after buffer end: ev_end=%p > end=%p, offset=%zu\n",
722722
event_idx, ev_len, ev_end, end,
723723
offset);
724724
return -1;
725725
}
726726

727727
calc_ev_end = event_end(event, end);
728728
if (!calc_ev_end) {
729-
pr_warn("event %zu has a calculated length which exceeds buffer length %zu: event=%pK end=%pK, offset=%zu\n",
729+
pr_warn("event %zu has a calculated length which exceeds buffer length %zu: event=%p end=%p, offset=%zu\n",
730730
event_idx, event_data_bytes, event, end,
731731
offset);
732732
return -1;
733733
}
734734

735735
if (calc_ev_end > ev_end) {
736-
pr_warn("event %zu exceeds its own length: event=%pK, end=%pK, offset=%zu, calc_ev_end=%pK\n",
736+
pr_warn("event %zu exceeds its own length: event=%p, end=%p, offset=%zu, calc_ev_end=%p\n",
737737
event_idx, event, ev_end, offset, calc_ev_end);
738738
return -1;
739739
}

arch/x86/events/intel/uncore.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1814,6 +1814,12 @@ static const struct intel_uncore_init_fun lnl_uncore_init __initconst = {
18141814
.mmio_init = lnl_uncore_mmio_init,
18151815
};
18161816

1817+
static const struct intel_uncore_init_fun ptl_uncore_init __initconst = {
1818+
.cpu_init = ptl_uncore_cpu_init,
1819+
.mmio_init = ptl_uncore_mmio_init,
1820+
.use_discovery = true,
1821+
};
1822+
18171823
static const struct intel_uncore_init_fun icx_uncore_init __initconst = {
18181824
.cpu_init = icx_uncore_cpu_init,
18191825
.pci_init = icx_uncore_pci_init,
@@ -1895,6 +1901,7 @@ static const struct x86_cpu_id intel_uncore_match[] __initconst = {
18951901
X86_MATCH_VFM(INTEL_ARROWLAKE_U, &mtl_uncore_init),
18961902
X86_MATCH_VFM(INTEL_ARROWLAKE_H, &mtl_uncore_init),
18971903
X86_MATCH_VFM(INTEL_LUNARLAKE_M, &lnl_uncore_init),
1904+
X86_MATCH_VFM(INTEL_PANTHERLAKE_L, &ptl_uncore_init),
18981905
X86_MATCH_VFM(INTEL_SAPPHIRERAPIDS_X, &spr_uncore_init),
18991906
X86_MATCH_VFM(INTEL_EMERALDRAPIDS_X, &spr_uncore_init),
19001907
X86_MATCH_VFM(INTEL_GRANITERAPIDS_X, &gnr_uncore_init),

arch/x86/events/intel/uncore.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,10 +612,12 @@ void tgl_uncore_cpu_init(void);
612612
void adl_uncore_cpu_init(void);
613613
void lnl_uncore_cpu_init(void);
614614
void mtl_uncore_cpu_init(void);
615+
void ptl_uncore_cpu_init(void);
615616
void tgl_uncore_mmio_init(void);
616617
void tgl_l_uncore_mmio_init(void);
617618
void adl_uncore_mmio_init(void);
618619
void lnl_uncore_mmio_init(void);
620+
void ptl_uncore_mmio_init(void);
619621
int snb_pci2phy_map_init(int devid);
620622

621623
/* uncore_snbep.c */

arch/x86/events/intel/uncore_discovery.c

Lines changed: 68 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -273,32 +273,15 @@ uncore_ignore_unit(struct uncore_unit_discovery *unit, int *ignore)
273273
return false;
274274
}
275275

276-
static int parse_discovery_table(struct pci_dev *dev, int die,
277-
u32 bar_offset, bool *parsed,
278-
int *ignore)
276+
static int __parse_discovery_table(resource_size_t addr, int die,
277+
bool *parsed, int *ignore)
279278
{
280279
struct uncore_global_discovery global;
281280
struct uncore_unit_discovery unit;
282281
void __iomem *io_addr;
283-
resource_size_t addr;
284282
unsigned long size;
285-
u32 val;
286283
int i;
287284

288-
pci_read_config_dword(dev, bar_offset, &val);
289-
290-
if (val & ~PCI_BASE_ADDRESS_MEM_MASK & ~PCI_BASE_ADDRESS_MEM_TYPE_64)
291-
return -EINVAL;
292-
293-
addr = (resource_size_t)(val & PCI_BASE_ADDRESS_MEM_MASK);
294-
#ifdef CONFIG_PHYS_ADDR_T_64BIT
295-
if ((val & PCI_BASE_ADDRESS_MEM_TYPE_MASK) == PCI_BASE_ADDRESS_MEM_TYPE_64) {
296-
u32 val2;
297-
298-
pci_read_config_dword(dev, bar_offset + 4, &val2);
299-
addr |= ((resource_size_t)val2) << 32;
300-
}
301-
#endif
302285
size = UNCORE_DISCOVERY_GLOBAL_MAP_SIZE;
303286
io_addr = ioremap(addr, size);
304287
if (!io_addr)
@@ -341,7 +324,32 @@ static int parse_discovery_table(struct pci_dev *dev, int die,
341324
return 0;
342325
}
343326

344-
bool intel_uncore_has_discovery_tables(int *ignore)
327+
static int parse_discovery_table(struct pci_dev *dev, int die,
328+
u32 bar_offset, bool *parsed,
329+
int *ignore)
330+
{
331+
resource_size_t addr;
332+
u32 val;
333+
334+
pci_read_config_dword(dev, bar_offset, &val);
335+
336+
if (val & ~PCI_BASE_ADDRESS_MEM_MASK & ~PCI_BASE_ADDRESS_MEM_TYPE_64)
337+
return -EINVAL;
338+
339+
addr = (resource_size_t)(val & PCI_BASE_ADDRESS_MEM_MASK);
340+
#ifdef CONFIG_PHYS_ADDR_T_64BIT
341+
if ((val & PCI_BASE_ADDRESS_MEM_TYPE_MASK) == PCI_BASE_ADDRESS_MEM_TYPE_64) {
342+
u32 val2;
343+
344+
pci_read_config_dword(dev, bar_offset + 4, &val2);
345+
addr |= ((resource_size_t)val2) << 32;
346+
}
347+
#endif
348+
349+
return __parse_discovery_table(addr, die, parsed, ignore);
350+
}
351+
352+
static bool intel_uncore_has_discovery_tables_pci(int *ignore)
345353
{
346354
u32 device, val, entry_id, bar_offset;
347355
int die, dvsec = 0, ret = true;
@@ -390,6 +398,45 @@ bool intel_uncore_has_discovery_tables(int *ignore)
390398
return ret;
391399
}
392400

401+
static bool intel_uncore_has_discovery_tables_msr(int *ignore)
402+
{
403+
unsigned long *die_mask;
404+
bool parsed = false;
405+
int cpu, die;
406+
u64 base;
407+
408+
die_mask = kcalloc(BITS_TO_LONGS(uncore_max_dies()),
409+
sizeof(unsigned long), GFP_KERNEL);
410+
if (!die_mask)
411+
return false;
412+
413+
cpus_read_lock();
414+
for_each_online_cpu(cpu) {
415+
die = topology_logical_die_id(cpu);
416+
if (__test_and_set_bit(die, die_mask))
417+
continue;
418+
419+
if (rdmsrl_safe_on_cpu(cpu, UNCORE_DISCOVERY_MSR, &base))
420+
continue;
421+
422+
if (!base)
423+
continue;
424+
425+
__parse_discovery_table(base, die, &parsed, ignore);
426+
}
427+
428+
cpus_read_unlock();
429+
430+
kfree(die_mask);
431+
return parsed;
432+
}
433+
434+
bool intel_uncore_has_discovery_tables(int *ignore)
435+
{
436+
return intel_uncore_has_discovery_tables_msr(ignore) ||
437+
intel_uncore_has_discovery_tables_pci(ignore);
438+
}
439+
393440
void intel_uncore_clear_discovery_tables(void)
394441
{
395442
struct intel_uncore_discovery_type *type, *next;
@@ -603,7 +650,7 @@ void intel_generic_uncore_mmio_init_box(struct intel_uncore_box *box)
603650
}
604651

605652
addr = unit->addr;
606-
box->io_addr = ioremap(addr, UNCORE_GENERIC_MMIO_SIZE);
653+
box->io_addr = ioremap(addr, type->mmio_map_size);
607654
if (!box->io_addr) {
608655
pr_warn("Uncore type %d box %d: ioremap error for 0x%llx.\n",
609656
type->type_id, unit->id, (unsigned long long)addr);

arch/x86/events/intel/uncore_discovery.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
/* SPDX-License-Identifier: GPL-2.0-only */
22

3+
/* Store the full address of the global discovery table */
4+
#define UNCORE_DISCOVERY_MSR 0x201e
5+
36
/* Generic device ID of a discovery table device */
47
#define UNCORE_DISCOVERY_TABLE_DEVICE 0x09a7
58
/* Capability ID for a discovery table device */
@@ -168,3 +171,7 @@ bool intel_generic_uncore_assign_hw_event(struct perf_event *event,
168171
struct intel_uncore_box *box);
169172
void uncore_find_add_unit(struct intel_uncore_discovery_unit *node,
170173
struct rb_root *root, u16 *num_units);
174+
struct intel_uncore_type **
175+
uncore_get_uncores(enum uncore_access_type type_id, int num_extra,
176+
struct intel_uncore_type **extra, int max_num_types,
177+
struct intel_uncore_type **uncores);

arch/x86/events/intel/uncore_snb.c

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1854,3 +1854,82 @@ void lnl_uncore_mmio_init(void)
18541854
}
18551855

18561856
/* end of Lunar Lake MMIO uncore support */
1857+
1858+
/* Panther Lake uncore support */
1859+
1860+
#define UNCORE_PTL_MAX_NUM_UNCORE_TYPES 42
1861+
#define UNCORE_PTL_TYPE_IMC 6
1862+
#define UNCORE_PTL_TYPE_SNCU 34
1863+
#define UNCORE_PTL_TYPE_HBO 41
1864+
1865+
#define PTL_UNCORE_GLOBAL_CTL_OFFSET 0x380
1866+
1867+
static struct intel_uncore_type ptl_uncore_imc = {
1868+
.name = "imc",
1869+
.mmio_map_size = 0xf00,
1870+
};
1871+
1872+
static void ptl_uncore_sncu_init_box(struct intel_uncore_box *box)
1873+
{
1874+
intel_generic_uncore_mmio_init_box(box);
1875+
1876+
/* Clear the global freeze bit */
1877+
if (box->io_addr)
1878+
writel(0, box->io_addr + PTL_UNCORE_GLOBAL_CTL_OFFSET);
1879+
}
1880+
1881+
static struct intel_uncore_ops ptl_uncore_sncu_ops = {
1882+
.init_box = ptl_uncore_sncu_init_box,
1883+
.exit_box = uncore_mmio_exit_box,
1884+
.disable_box = intel_generic_uncore_mmio_disable_box,
1885+
.enable_box = intel_generic_uncore_mmio_enable_box,
1886+
.disable_event = intel_generic_uncore_mmio_disable_event,
1887+
.enable_event = intel_generic_uncore_mmio_enable_event,
1888+
.read_counter = uncore_mmio_read_counter,
1889+
};
1890+
1891+
static struct intel_uncore_type ptl_uncore_sncu = {
1892+
.name = "sncu",
1893+
.ops = &ptl_uncore_sncu_ops,
1894+
.mmio_map_size = 0xf00,
1895+
};
1896+
1897+
static struct intel_uncore_type ptl_uncore_hbo = {
1898+
.name = "hbo",
1899+
.mmio_map_size = 0xf00,
1900+
};
1901+
1902+
static struct intel_uncore_type *ptl_uncores[UNCORE_PTL_MAX_NUM_UNCORE_TYPES] = {
1903+
[UNCORE_PTL_TYPE_IMC] = &ptl_uncore_imc,
1904+
[UNCORE_PTL_TYPE_SNCU] = &ptl_uncore_sncu,
1905+
[UNCORE_PTL_TYPE_HBO] = &ptl_uncore_hbo,
1906+
};
1907+
1908+
#define UNCORE_PTL_MMIO_EXTRA_UNCORES 1
1909+
1910+
static struct intel_uncore_type *ptl_mmio_extra_uncores[UNCORE_PTL_MMIO_EXTRA_UNCORES] = {
1911+
&adl_uncore_imc_free_running,
1912+
};
1913+
1914+
void ptl_uncore_mmio_init(void)
1915+
{
1916+
uncore_mmio_uncores = uncore_get_uncores(UNCORE_ACCESS_MMIO,
1917+
UNCORE_PTL_MMIO_EXTRA_UNCORES,
1918+
ptl_mmio_extra_uncores,
1919+
UNCORE_PTL_MAX_NUM_UNCORE_TYPES,
1920+
ptl_uncores);
1921+
}
1922+
1923+
static struct intel_uncore_type *ptl_msr_uncores[] = {
1924+
&mtl_uncore_cbox,
1925+
NULL
1926+
};
1927+
1928+
void ptl_uncore_cpu_init(void)
1929+
{
1930+
mtl_uncore_cbox.num_boxes = 6;
1931+
mtl_uncore_cbox.ops = &lnl_uncore_msr_ops;
1932+
uncore_msr_uncores = ptl_msr_uncores;
1933+
}
1934+
1935+
/* end of Panther Lake uncore support */

arch/x86/events/intel/uncore_snbep.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6408,9 +6408,11 @@ static void uncore_type_customized_copy(struct intel_uncore_type *to_type,
64086408
to_type->get_topology = from_type->get_topology;
64096409
if (from_type->cleanup_mapping)
64106410
to_type->cleanup_mapping = from_type->cleanup_mapping;
6411+
if (from_type->mmio_map_size)
6412+
to_type->mmio_map_size = from_type->mmio_map_size;
64116413
}
64126414

6413-
static struct intel_uncore_type **
6415+
struct intel_uncore_type **
64146416
uncore_get_uncores(enum uncore_access_type type_id, int num_extra,
64156417
struct intel_uncore_type **extra, int max_num_types,
64166418
struct intel_uncore_type **uncores)

drivers/perf/arm_pmu.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -342,12 +342,10 @@ armpmu_add(struct perf_event *event, int flags)
342342
if (idx < 0)
343343
return idx;
344344

345-
/*
346-
* If there is an event in the counter we are going to use then make
347-
* sure it is disabled.
348-
*/
345+
/* The newly-allocated counter should be empty */
346+
WARN_ON_ONCE(hw_events->events[idx]);
347+
349348
event->hw.idx = idx;
350-
armpmu->disable(event);
351349
hw_events->events[idx] = event;
352350

353351
hwc->state = PERF_HES_STOPPED | PERF_HES_UPTODATE;

0 commit comments

Comments
 (0)