Skip to content

Commit 3d9d740

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: "I'd been collecting these whilst we debugged a CPU hotplug failure, but we ended up diagnosing that one to tglx, who has taken a fix via the -tip tree separately. We're seeing some NFS issues that we haven't gotten to the bottom of yet, and we've uncovered some issues with our backtracing too so there might be another fixes pull before we're done. Summary: - Ensure we have a guard page after the kernel image in vmalloc - Fix incorrect prefetch stride in copy_page - Ensure irqs are disabled in die() - Fix for event group validation in QCOM L2 PMU driver - Fix requesting of PMU IRQs on AMD Seattle - Minor cleanups and fixes" * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux: arm64: mmu: Place guard page after mapping of kernel image drivers/perf: arm_pmu: Request PMU SPIs with IRQF_PER_CPU arm64: sysreg: Fix unprotected macro argmuent in write_sysreg perf: qcom_l2: fix column exclusion check arm64/lib: copy_page: use consistent prefetch stride arm64/numa: Drop duplicate message perf: Convert to using %pOF instead of full_name arm64: Convert to using %pOF instead of full_name arm64: traps: disable irq in die() arm64: atomics: Remove '&' from '+&' asm constraint in lse atomics arm64: uaccess: Remove redundant __force from addr cast in __range_ok
2 parents 080012b + 92bbd16 commit 3d9d740

File tree

15 files changed

+84
-61
lines changed

15 files changed

+84
-61
lines changed

arch/arm/mach-ux500/cpu-db8500.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ static irqreturn_t db8500_pmu_handler(int irq, void *dev, irq_handler_t handler)
133133

134134
static struct arm_pmu_platdata db8500_pmu_platdata = {
135135
.handle_irq = db8500_pmu_handler,
136+
.irq_flags = IRQF_NOBALANCING | IRQF_NO_THREAD,
136137
};
137138

138139
static struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = {

arch/arm64/include/asm/atomic_lse.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ static inline long atomic64_dec_if_positive(atomic64_t *v)
435435
" sub x30, x30, %[ret]\n"
436436
" cbnz x30, 1b\n"
437437
"2:")
438-
: [ret] "+&r" (x0), [v] "+Q" (v->counter)
438+
: [ret] "+r" (x0), [v] "+Q" (v->counter)
439439
:
440440
: __LL_SC_CLOBBERS, "cc", "memory");
441441

arch/arm64/include/asm/sysreg.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ asm(
492492
* the "%x0" template means XZR.
493493
*/
494494
#define write_sysreg(v, r) do { \
495-
u64 __val = (u64)v; \
495+
u64 __val = (u64)(v); \
496496
asm volatile("msr " __stringify(r) ", %x0" \
497497
: : "rZ" (__val)); \
498498
} while (0)
@@ -508,7 +508,7 @@ asm(
508508
})
509509

510510
#define write_sysreg_s(v, r) do { \
511-
u64 __val = (u64)v; \
511+
u64 __val = (u64)(v); \
512512
asm volatile("msr_s " __stringify(r) ", %x0" : : "rZ" (__val)); \
513513
} while (0)
514514

arch/arm64/include/asm/uaccess.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ static inline void set_fs(mm_segment_t fs)
6969
*/
7070
#define __range_ok(addr, size) \
7171
({ \
72-
unsigned long __addr = (unsigned long __force)(addr); \
72+
unsigned long __addr = (unsigned long)(addr); \
7373
unsigned long flag, roksum; \
7474
__chk_user_ptr(addr); \
7575
asm("adds %1, %1, %3; ccmp %1, %4, #2, cc; cset %0, ls" \

arch/arm64/kernel/cpu_ops.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ static const char *__init cpu_read_enable_method(int cpu)
8282
* Don't warn spuriously.
8383
*/
8484
if (cpu != 0)
85-
pr_err("%s: missing enable-method property\n",
86-
dn->full_name);
85+
pr_err("%pOF: missing enable-method property\n",
86+
dn);
8787
}
8888
} else {
8989
enable_method = acpi_get_enable_method(cpu);

arch/arm64/kernel/smp.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ static u64 __init of_get_cpu_mpidr(struct device_node *dn)
469469
*/
470470
cell = of_get_property(dn, "reg", NULL);
471471
if (!cell) {
472-
pr_err("%s: missing reg property\n", dn->full_name);
472+
pr_err("%pOF: missing reg property\n", dn);
473473
return INVALID_HWID;
474474
}
475475

@@ -478,7 +478,7 @@ static u64 __init of_get_cpu_mpidr(struct device_node *dn)
478478
* Non affinity bits must be set to 0 in the DT
479479
*/
480480
if (hwid & ~MPIDR_HWID_BITMASK) {
481-
pr_err("%s: invalid reg property\n", dn->full_name);
481+
pr_err("%pOF: invalid reg property\n", dn);
482482
return INVALID_HWID;
483483
}
484484
return hwid;
@@ -627,8 +627,8 @@ static void __init of_parse_and_init_cpus(void)
627627
goto next;
628628

629629
if (is_mpidr_duplicate(cpu_count, hwid)) {
630-
pr_err("%s: duplicate cpu reg properties in the DT\n",
631-
dn->full_name);
630+
pr_err("%pOF: duplicate cpu reg properties in the DT\n",
631+
dn);
632632
goto next;
633633
}
634634

@@ -640,8 +640,8 @@ static void __init of_parse_and_init_cpus(void)
640640
*/
641641
if (hwid == cpu_logical_map(0)) {
642642
if (bootcpu_valid) {
643-
pr_err("%s: duplicate boot cpu reg property in DT\n",
644-
dn->full_name);
643+
pr_err("%pOF: duplicate boot cpu reg property in DT\n",
644+
dn);
645645
goto next;
646646
}
647647

arch/arm64/kernel/topology.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ static int __init get_cpu_for_node(struct device_node *node)
4545
}
4646
}
4747

48-
pr_crit("Unable to find CPU node for %s\n", cpu_node->full_name);
48+
pr_crit("Unable to find CPU node for %pOF\n", cpu_node);
4949

5050
of_node_put(cpu_node);
5151
return -1;
@@ -71,8 +71,8 @@ static int __init parse_core(struct device_node *core, int cluster_id,
7171
cpu_topology[cpu].core_id = core_id;
7272
cpu_topology[cpu].thread_id = i;
7373
} else {
74-
pr_err("%s: Can't get CPU for thread\n",
75-
t->full_name);
74+
pr_err("%pOF: Can't get CPU for thread\n",
75+
t);
7676
of_node_put(t);
7777
return -EINVAL;
7878
}
@@ -84,15 +84,15 @@ static int __init parse_core(struct device_node *core, int cluster_id,
8484
cpu = get_cpu_for_node(core);
8585
if (cpu >= 0) {
8686
if (!leaf) {
87-
pr_err("%s: Core has both threads and CPU\n",
88-
core->full_name);
87+
pr_err("%pOF: Core has both threads and CPU\n",
88+
core);
8989
return -EINVAL;
9090
}
9191

9292
cpu_topology[cpu].cluster_id = cluster_id;
9393
cpu_topology[cpu].core_id = core_id;
9494
} else if (leaf) {
95-
pr_err("%s: Can't get CPU for leaf core\n", core->full_name);
95+
pr_err("%pOF: Can't get CPU for leaf core\n", core);
9696
return -EINVAL;
9797
}
9898

@@ -137,17 +137,17 @@ static int __init parse_cluster(struct device_node *cluster, int depth)
137137
has_cores = true;
138138

139139
if (depth == 0) {
140-
pr_err("%s: cpu-map children should be clusters\n",
141-
c->full_name);
140+
pr_err("%pOF: cpu-map children should be clusters\n",
141+
c);
142142
of_node_put(c);
143143
return -EINVAL;
144144
}
145145

146146
if (leaf) {
147147
ret = parse_core(c, cluster_id, core_id++);
148148
} else {
149-
pr_err("%s: Non-leaf cluster with core %s\n",
150-
cluster->full_name, name);
149+
pr_err("%pOF: Non-leaf cluster with core %s\n",
150+
cluster, name);
151151
ret = -EINVAL;
152152
}
153153

@@ -159,7 +159,7 @@ static int __init parse_cluster(struct device_node *cluster, int depth)
159159
} while (c);
160160

161161
if (leaf && !has_cores)
162-
pr_warn("%s: empty cluster\n", cluster->full_name);
162+
pr_warn("%pOF: empty cluster\n", cluster);
163163

164164
if (leaf)
165165
cluster_id++;

arch/arm64/kernel/traps.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,10 +274,12 @@ static DEFINE_RAW_SPINLOCK(die_lock);
274274
void die(const char *str, struct pt_regs *regs, int err)
275275
{
276276
int ret;
277+
unsigned long flags;
278+
279+
raw_spin_lock_irqsave(&die_lock, flags);
277280

278281
oops_enter();
279282

280-
raw_spin_lock_irq(&die_lock);
281283
console_verbose();
282284
bust_spinlocks(1);
283285
ret = __die(str, err, regs);
@@ -287,13 +289,15 @@ void die(const char *str, struct pt_regs *regs, int err)
287289

288290
bust_spinlocks(0);
289291
add_taint(TAINT_DIE, LOCKDEP_NOW_UNRELIABLE);
290-
raw_spin_unlock_irq(&die_lock);
291292
oops_exit();
292293

293294
if (in_interrupt())
294295
panic("Fatal exception in interrupt");
295296
if (panic_on_oops)
296297
panic("Fatal exception");
298+
299+
raw_spin_unlock_irqrestore(&die_lock, flags);
300+
297301
if (ret != NOTIFY_STOP)
298302
do_exit(SIGSEGV);
299303
}

arch/arm64/lib/copy_page.S

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,10 @@
3030
*/
3131
ENTRY(copy_page)
3232
alternative_if ARM64_HAS_NO_HW_PREFETCH
33-
# Prefetch two cache lines ahead.
34-
prfm pldl1strm, [x1, #128]
35-
prfm pldl1strm, [x1, #256]
33+
// Prefetch three cache lines ahead.
34+
prfm pldl1strm, [x1, #128]
35+
prfm pldl1strm, [x1, #256]
36+
prfm pldl1strm, [x1, #384]
3637
alternative_else_nop_endif
3738

3839
ldp x2, x3, [x1]
@@ -50,7 +51,7 @@ alternative_else_nop_endif
5051
subs x18, x18, #128
5152

5253
alternative_if ARM64_HAS_NO_HW_PREFETCH
53-
prfm pldl1strm, [x1, #384]
54+
prfm pldl1strm, [x1, #384]
5455
alternative_else_nop_endif
5556

5657
stnp x2, x3, [x0]

arch/arm64/mm/mmu.c

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ void mark_rodata_ro(void)
496496

497497
static void __init map_kernel_segment(pgd_t *pgd, void *va_start, void *va_end,
498498
pgprot_t prot, struct vm_struct *vma,
499-
int flags)
499+
int flags, unsigned long vm_flags)
500500
{
501501
phys_addr_t pa_start = __pa_symbol(va_start);
502502
unsigned long size = va_end - va_start;
@@ -507,10 +507,13 @@ static void __init map_kernel_segment(pgd_t *pgd, void *va_start, void *va_end,
507507
__create_pgd_mapping(pgd, pa_start, (unsigned long)va_start, size, prot,
508508
early_pgtable_alloc, flags);
509509

510+
if (!(vm_flags & VM_NO_GUARD))
511+
size += PAGE_SIZE;
512+
510513
vma->addr = va_start;
511514
vma->phys_addr = pa_start;
512515
vma->size = size;
513-
vma->flags = VM_MAP;
516+
vma->flags = VM_MAP | vm_flags;
514517
vma->caller = __builtin_return_address(0);
515518

516519
vm_area_add_early(vma);
@@ -541,14 +544,15 @@ static void __init map_kernel(pgd_t *pgd)
541544
* Only rodata will be remapped with different permissions later on,
542545
* all other segments are allowed to use contiguous mappings.
543546
*/
544-
map_kernel_segment(pgd, _text, _etext, text_prot, &vmlinux_text, 0);
547+
map_kernel_segment(pgd, _text, _etext, text_prot, &vmlinux_text, 0,
548+
VM_NO_GUARD);
545549
map_kernel_segment(pgd, __start_rodata, __inittext_begin, PAGE_KERNEL,
546-
&vmlinux_rodata, NO_CONT_MAPPINGS);
550+
&vmlinux_rodata, NO_CONT_MAPPINGS, VM_NO_GUARD);
547551
map_kernel_segment(pgd, __inittext_begin, __inittext_end, text_prot,
548-
&vmlinux_inittext, 0);
552+
&vmlinux_inittext, 0, VM_NO_GUARD);
549553
map_kernel_segment(pgd, __initdata_begin, __initdata_end, PAGE_KERNEL,
550-
&vmlinux_initdata, 0);
551-
map_kernel_segment(pgd, _data, _end, PAGE_KERNEL, &vmlinux_data, 0);
554+
&vmlinux_initdata, 0, VM_NO_GUARD);
555+
map_kernel_segment(pgd, _data, _end, PAGE_KERNEL, &vmlinux_data, 0, 0);
552556

553557
if (!pgd_val(*pgd_offset_raw(pgd, FIXADDR_START))) {
554558
/*

arch/arm64/mm/numa.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,6 @@ int __init numa_add_memblk(int nid, u64 start, u64 end)
208208
}
209209

210210
node_set(nid, numa_nodes_parsed);
211-
pr_info("Adding memblock [0x%llx - 0x%llx] on node %d\n",
212-
start, (end - 1), nid);
213211
return ret;
214212
}
215213

@@ -223,10 +221,7 @@ static void __init setup_node_data(int nid, u64 start_pfn, u64 end_pfn)
223221
void *nd;
224222
int tnid;
225223

226-
if (start_pfn < end_pfn)
227-
pr_info("Initmem setup node %d [mem %#010Lx-%#010Lx]\n", nid,
228-
start_pfn << PAGE_SHIFT, (end_pfn << PAGE_SHIFT) - 1);
229-
else
224+
if (start_pfn >= end_pfn)
230225
pr_info("Initmem setup node %d [<memory-less node>]\n", nid);
231226

232227
nd_pa = memblock_alloc_try_nid(nd_size, SMP_CACHE_BYTES, nid);

drivers/perf/arm_pmu.c

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -569,22 +569,41 @@ int armpmu_request_irq(struct arm_pmu *armpmu, int cpu)
569569
if (irq != other_irq) {
570570
pr_warn("mismatched PPIs detected.\n");
571571
err = -EINVAL;
572+
goto err_out;
572573
}
573574
} else {
574-
err = request_irq(irq, handler,
575-
IRQF_NOBALANCING | IRQF_NO_THREAD, "arm-pmu",
575+
struct arm_pmu_platdata *platdata = armpmu_get_platdata(armpmu);
576+
unsigned long irq_flags;
577+
578+
err = irq_force_affinity(irq, cpumask_of(cpu));
579+
580+
if (err && num_possible_cpus() > 1) {
581+
pr_warn("unable to set irq affinity (irq=%d, cpu=%u)\n",
582+
irq, cpu);
583+
goto err_out;
584+
}
585+
586+
if (platdata && platdata->irq_flags) {
587+
irq_flags = platdata->irq_flags;
588+
} else {
589+
irq_flags = IRQF_PERCPU |
590+
IRQF_NOBALANCING |
591+
IRQF_NO_THREAD;
592+
}
593+
594+
err = request_irq(irq, handler, irq_flags, "arm-pmu",
576595
per_cpu_ptr(&hw_events->percpu_pmu, cpu));
577596
}
578597

579-
if (err) {
580-
pr_err("unable to request IRQ%d for ARM PMU counters\n",
581-
irq);
582-
return err;
583-
}
598+
if (err)
599+
goto err_out;
584600

585601
cpumask_set_cpu(cpu, &armpmu->active_irqs);
586-
587602
return 0;
603+
604+
err_out:
605+
pr_err("unable to request IRQ%d for ARM PMU counters\n", irq);
606+
return err;
588607
}
589608

590609
int armpmu_request_irqs(struct arm_pmu *armpmu)
@@ -628,12 +647,6 @@ static int arm_perf_starting_cpu(unsigned int cpu, struct hlist_node *node)
628647
enable_percpu_irq(irq, IRQ_TYPE_NONE);
629648
return 0;
630649
}
631-
632-
if (irq_force_affinity(irq, cpumask_of(cpu)) &&
633-
num_possible_cpus() > 1) {
634-
pr_warn("unable to set irq affinity (irq=%d, cpu=%u)\n",
635-
irq, cpu);
636-
}
637650
}
638651

639652
return 0;

drivers/perf/arm_pmu_platform.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ static int pmu_parse_irqs(struct arm_pmu *pmu)
131131
}
132132

133133
if (!pmu_has_irq_affinity(pdev->dev.of_node)) {
134-
pr_warn("no interrupt-affinity property for %s, guessing.\n",
135-
of_node_full_name(pdev->dev.of_node));
134+
pr_warn("no interrupt-affinity property for %pOF, guessing.\n",
135+
pdev->dev.of_node);
136136
}
137137

138138
/*
@@ -211,7 +211,7 @@ int arm_pmu_device_probe(struct platform_device *pdev,
211211
}
212212

213213
if (ret) {
214-
pr_info("%s: failed to probe PMU!\n", of_node_full_name(node));
214+
pr_info("%pOF: failed to probe PMU!\n", node);
215215
goto out_free;
216216
}
217217

@@ -228,8 +228,7 @@ int arm_pmu_device_probe(struct platform_device *pdev,
228228
out_free_irqs:
229229
armpmu_free_irqs(pmu);
230230
out_free:
231-
pr_info("%s: failed to register PMU devices!\n",
232-
of_node_full_name(node));
231+
pr_info("%pOF: failed to register PMU devices!\n", node);
233232
armpmu_free(pmu);
234233
return ret;
235234
}

drivers/perf/qcom_l2_pmu.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,7 @@ static int l2_cache_event_init(struct perf_event *event)
546546
}
547547

548548
if ((event != event->group_leader) &&
549+
!is_software_event(event->group_leader) &&
549550
(L2_EVT_GROUP(event->group_leader->attr.config) ==
550551
L2_EVT_GROUP(event->attr.config))) {
551552
dev_dbg_ratelimited(&l2cache_pmu->pdev->dev,
@@ -558,6 +559,7 @@ static int l2_cache_event_init(struct perf_event *event)
558559
list_for_each_entry(sibling, &event->group_leader->sibling_list,
559560
group_entry) {
560561
if ((sibling != event) &&
562+
!is_software_event(sibling) &&
561563
(L2_EVT_GROUP(sibling->attr.config) ==
562564
L2_EVT_GROUP(event->attr.config))) {
563565
dev_dbg_ratelimited(&l2cache_pmu->pdev->dev,

0 commit comments

Comments
 (0)