Skip to content

Commit 7200095

Browse files
committed
Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux
Pull arm64 fixes from Will Deacon: "There's no real pattern to the fixes, but the main one fixes our pmd_leaf() definition to resolve a NULL dereference on the migration path. - Fix PMU event validation in the absence of any event counters - Fix allmodconfig build using clang in conjunction with binutils - Fix definitions of pXd_leaf() to handle PROT_NONE entries - More typo fixes" * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux: arm64: mm: fix p?d_leaf() arm64: fix typos in comments arm64: Improve HAVE_DYNAMIC_FTRACE_WITH_REGS selection for clang arm_pmu: Validate single/group leader events
2 parents 22f19f6 + 23bc8f6 commit 7200095

File tree

3 files changed

+18
-11
lines changed

3 files changed

+18
-11
lines changed

arch/arm64/Kconfig

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,6 @@ config ARM64
175175
select HAVE_DEBUG_KMEMLEAK
176176
select HAVE_DMA_CONTIGUOUS
177177
select HAVE_DYNAMIC_FTRACE
178-
select HAVE_DYNAMIC_FTRACE_WITH_REGS \
179-
if $(cc-option,-fpatchable-function-entry=2)
180178
select FTRACE_MCOUNT_USE_PATCHABLE_FUNCTION_ENTRY \
181179
if DYNAMIC_FTRACE_WITH_REGS
182180
select HAVE_EFFICIENT_UNALIGNED_ACCESS
@@ -228,6 +226,17 @@ config ARM64
228226
help
229227
ARM 64-bit (AArch64) Linux support.
230228

229+
config CLANG_SUPPORTS_DYNAMIC_FTRACE_WITH_REGS
230+
def_bool CC_IS_CLANG
231+
# https://github.com/ClangBuiltLinux/linux/issues/1507
232+
depends on AS_IS_GNU || (AS_IS_LLVM && (LD_IS_LLD || LD_VERSION >= 23600))
233+
select HAVE_DYNAMIC_FTRACE_WITH_REGS
234+
235+
config GCC_SUPPORTS_DYNAMIC_FTRACE_WITH_REGS
236+
def_bool CC_IS_GCC
237+
depends on $(cc-option,-fpatchable-function-entry=2)
238+
select HAVE_DYNAMIC_FTRACE_WITH_REGS
239+
231240
config 64BIT
232241
def_bool y
233242

@@ -678,7 +687,7 @@ config ARM64_ERRATUM_2051678
678687
default y
679688
help
680689
This options adds the workaround for ARM Cortex-A510 erratum ARM64_ERRATUM_2051678.
681-
Affected Coretex-A510 might not respect the ordering rules for
690+
Affected Cortex-A510 might not respect the ordering rules for
682691
hardware update of the page table's dirty bit. The workaround
683692
is to not enable the feature on affected CPUs.
684693

arch/arm64/include/asm/pgtable.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
535535
PMD_TYPE_TABLE)
536536
#define pmd_sect(pmd) ((pmd_val(pmd) & PMD_TYPE_MASK) == \
537537
PMD_TYPE_SECT)
538-
#define pmd_leaf(pmd) pmd_sect(pmd)
538+
#define pmd_leaf(pmd) (pmd_present(pmd) && !pmd_table(pmd))
539539
#define pmd_bad(pmd) (!pmd_table(pmd))
540540

541541
#define pmd_leaf_size(pmd) (pmd_cont(pmd) ? CONT_PMD_SIZE : PMD_SIZE)
@@ -625,7 +625,7 @@ static inline unsigned long pmd_page_vaddr(pmd_t pmd)
625625
#define pud_none(pud) (!pud_val(pud))
626626
#define pud_bad(pud) (!pud_table(pud))
627627
#define pud_present(pud) pte_present(pud_pte(pud))
628-
#define pud_leaf(pud) pud_sect(pud)
628+
#define pud_leaf(pud) (pud_present(pud) && !pud_table(pud))
629629
#define pud_valid(pud) pte_valid(pud_pte(pud))
630630

631631
static inline void set_pud(pud_t *pudp, pud_t pud)

drivers/perf/arm_pmu.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,9 @@ validate_group(struct perf_event *event)
400400
if (!validate_event(event->pmu, &fake_pmu, leader))
401401
return -EINVAL;
402402

403+
if (event == leader)
404+
return 0;
405+
403406
for_each_sibling_event(sibling, leader) {
404407
if (!validate_event(event->pmu, &fake_pmu, sibling))
405408
return -EINVAL;
@@ -489,12 +492,7 @@ __hw_perf_event_init(struct perf_event *event)
489492
local64_set(&hwc->period_left, hwc->sample_period);
490493
}
491494

492-
if (event->group_leader != event) {
493-
if (validate_group(event) != 0)
494-
return -EINVAL;
495-
}
496-
497-
return 0;
495+
return validate_group(event);
498496
}
499497

500498
static int armpmu_event_init(struct perf_event *event)

0 commit comments

Comments
 (0)