Skip to content

Commit 82821be

Browse files
committed
Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux
Pull arm64 fixes from Catalin Marinas: - Set the minimum GCC version to 5.1 for arm64 due to earlier compiler bugs. - Make atomic helpers __always_inline to avoid a section mismatch when compiling with clang. - Fix the CMA and crashkernel reservations to use ZONE_DMA (remove the arm64_dma32_phys_limit variable, no longer needed with a dynamic ZONE_DMA sizing in 5.11). - Remove redundant IRQ flag tracing that was leaving lockdep inconsistent with the hardware state. - Revert perf events based hard lockup detector that was causing smp_processor_id() to be called in preemptible context. - Some trivial cleanups - spelling fix, renaming S_FRAME_SIZE to PT_REGS_SIZE, function prototypes added. * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux: arm64: selftests: Fix spelling of 'Mismatch' arm64: syscall: include prototype for EL0 SVC functions compiler.h: Raise minimum version of GCC to 5.1 for arm64 arm64: make atomic helpers __always_inline arm64: rename S_FRAME_SIZE to PT_REGS_SIZE Revert "arm64: Enable perf events based hard lockup detector" arm64: entry: remove redundant IRQ flag tracing arm64: Remove arm64_dma32_phys_limit and its uses
2 parents f288c89 + 3a57a64 commit 82821be

17 files changed

Lines changed: 56 additions & 107 deletions

File tree

arch/arm64/Kconfig

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,6 @@ config ARM64
174174
select HAVE_NMI
175175
select HAVE_PATA_PLATFORM
176176
select HAVE_PERF_EVENTS
177-
select HAVE_PERF_EVENTS_NMI if ARM64_PSEUDO_NMI && HW_PERF_EVENTS
178-
select HAVE_HARDLOCKUP_DETECTOR_PERF if PERF_EVENTS && HAVE_PERF_EVENTS_NMI
179177
select HAVE_PERF_REGS
180178
select HAVE_PERF_USER_STACK_DUMP
181179
select HAVE_REGS_AND_STACK_ACCESS_API

arch/arm64/include/asm/atomic.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include <asm/lse.h>
1818

1919
#define ATOMIC_OP(op) \
20-
static inline void arch_##op(int i, atomic_t *v) \
20+
static __always_inline void arch_##op(int i, atomic_t *v) \
2121
{ \
2222
__lse_ll_sc_body(op, i, v); \
2323
}
@@ -32,7 +32,7 @@ ATOMIC_OP(atomic_sub)
3232
#undef ATOMIC_OP
3333

3434
#define ATOMIC_FETCH_OP(name, op) \
35-
static inline int arch_##op##name(int i, atomic_t *v) \
35+
static __always_inline int arch_##op##name(int i, atomic_t *v) \
3636
{ \
3737
return __lse_ll_sc_body(op##name, i, v); \
3838
}
@@ -56,7 +56,7 @@ ATOMIC_FETCH_OPS(atomic_sub_return)
5656
#undef ATOMIC_FETCH_OPS
5757

5858
#define ATOMIC64_OP(op) \
59-
static inline void arch_##op(long i, atomic64_t *v) \
59+
static __always_inline void arch_##op(long i, atomic64_t *v) \
6060
{ \
6161
__lse_ll_sc_body(op, i, v); \
6262
}
@@ -71,7 +71,7 @@ ATOMIC64_OP(atomic64_sub)
7171
#undef ATOMIC64_OP
7272

7373
#define ATOMIC64_FETCH_OP(name, op) \
74-
static inline long arch_##op##name(long i, atomic64_t *v) \
74+
static __always_inline long arch_##op##name(long i, atomic64_t *v) \
7575
{ \
7676
return __lse_ll_sc_body(op##name, i, v); \
7777
}
@@ -94,7 +94,7 @@ ATOMIC64_FETCH_OPS(atomic64_sub_return)
9494
#undef ATOMIC64_FETCH_OP
9595
#undef ATOMIC64_FETCH_OPS
9696

97-
static inline long arch_atomic64_dec_if_positive(atomic64_t *v)
97+
static __always_inline long arch_atomic64_dec_if_positive(atomic64_t *v)
9898
{
9999
return __lse_ll_sc_body(atomic64_dec_if_positive, v);
100100
}

arch/arm64/include/asm/processor.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,7 @@
9494
#endif /* CONFIG_ARM64_FORCE_52BIT */
9595

9696
extern phys_addr_t arm64_dma_phys_limit;
97-
extern phys_addr_t arm64_dma32_phys_limit;
98-
#define ARCH_LOW_ADDRESS_LIMIT ((arm64_dma_phys_limit ? : arm64_dma32_phys_limit) - 1)
97+
#define ARCH_LOW_ADDRESS_LIMIT (arm64_dma_phys_limit - 1)
9998

10099
struct debug_info {
101100
#ifdef CONFIG_HAVE_HW_BREAKPOINT

arch/arm64/kernel/asm-offsets.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ int main(void)
7575
DEFINE(S_SDEI_TTBR1, offsetof(struct pt_regs, sdei_ttbr1));
7676
DEFINE(S_PMR_SAVE, offsetof(struct pt_regs, pmr_save));
7777
DEFINE(S_STACKFRAME, offsetof(struct pt_regs, stackframe));
78-
DEFINE(S_FRAME_SIZE, sizeof(struct pt_regs));
78+
DEFINE(PT_REGS_SIZE, sizeof(struct pt_regs));
7979
BLANK();
8080
#ifdef CONFIG_COMPAT
8181
DEFINE(COMPAT_SIGFRAME_REGS_OFFSET, offsetof(struct compat_sigframe, uc.uc_mcontext.arm_r0));

arch/arm64/kernel/entry-ftrace.S

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
*/
3636
.macro ftrace_regs_entry, allregs=0
3737
/* Make room for pt_regs, plus a callee frame */
38-
sub sp, sp, #(S_FRAME_SIZE + 16)
38+
sub sp, sp, #(PT_REGS_SIZE + 16)
3939

4040
/* Save function arguments (and x9 for simplicity) */
4141
stp x0, x1, [sp, #S_X0]
@@ -61,15 +61,15 @@
6161
.endif
6262

6363
/* Save the callsite's SP and LR */
64-
add x10, sp, #(S_FRAME_SIZE + 16)
64+
add x10, sp, #(PT_REGS_SIZE + 16)
6565
stp x9, x10, [sp, #S_LR]
6666

6767
/* Save the PC after the ftrace callsite */
6868
str x30, [sp, #S_PC]
6969

7070
/* Create a frame record for the callsite above pt_regs */
71-
stp x29, x9, [sp, #S_FRAME_SIZE]
72-
add x29, sp, #S_FRAME_SIZE
71+
stp x29, x9, [sp, #PT_REGS_SIZE]
72+
add x29, sp, #PT_REGS_SIZE
7373

7474
/* Create our frame record within pt_regs. */
7575
stp x29, x30, [sp, #S_STACKFRAME]
@@ -120,7 +120,7 @@ ftrace_common_return:
120120
ldr x9, [sp, #S_PC]
121121

122122
/* Restore the callsite's SP */
123-
add sp, sp, #S_FRAME_SIZE + 16
123+
add sp, sp, #PT_REGS_SIZE + 16
124124

125125
ret x9
126126
SYM_CODE_END(ftrace_common)
@@ -130,7 +130,7 @@ SYM_CODE_START(ftrace_graph_caller)
130130
ldr x0, [sp, #S_PC]
131131
sub x0, x0, #AARCH64_INSN_SIZE // ip (callsite's BL insn)
132132
add x1, sp, #S_LR // parent_ip (callsite's LR)
133-
ldr x2, [sp, #S_FRAME_SIZE] // parent fp (callsite's FP)
133+
ldr x2, [sp, #PT_REGS_SIZE] // parent fp (callsite's FP)
134134
bl prepare_ftrace_return
135135
b ftrace_common_return
136136
SYM_CODE_END(ftrace_graph_caller)

arch/arm64/kernel/entry.S

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ alternative_else_nop_endif
7575
.endif
7676
#endif
7777

78-
sub sp, sp, #S_FRAME_SIZE
78+
sub sp, sp, #PT_REGS_SIZE
7979
#ifdef CONFIG_VMAP_STACK
8080
/*
8181
* Test whether the SP has overflowed, without corrupting a GPR.
@@ -96,7 +96,7 @@ alternative_else_nop_endif
9696
* userspace, and can clobber EL0 registers to free up GPRs.
9797
*/
9898

99-
/* Stash the original SP (minus S_FRAME_SIZE) in tpidr_el0. */
99+
/* Stash the original SP (minus PT_REGS_SIZE) in tpidr_el0. */
100100
msr tpidr_el0, x0
101101

102102
/* Recover the original x0 value and stash it in tpidrro_el0 */
@@ -253,7 +253,7 @@ alternative_else_nop_endif
253253

254254
scs_load tsk, x20
255255
.else
256-
add x21, sp, #S_FRAME_SIZE
256+
add x21, sp, #PT_REGS_SIZE
257257
get_current_task tsk
258258
.endif /* \el == 0 */
259259
mrs x22, elr_el1
@@ -377,7 +377,7 @@ alternative_else_nop_endif
377377
ldp x26, x27, [sp, #16 * 13]
378378
ldp x28, x29, [sp, #16 * 14]
379379
ldr lr, [sp, #S_LR]
380-
add sp, sp, #S_FRAME_SIZE // restore sp
380+
add sp, sp, #PT_REGS_SIZE // restore sp
381381

382382
.if \el == 0
383383
alternative_insn eret, nop, ARM64_UNMAP_KERNEL_AT_EL0
@@ -580,12 +580,12 @@ __bad_stack:
580580

581581
/*
582582
* Store the original GPRs to the new stack. The orginal SP (minus
583-
* S_FRAME_SIZE) was stashed in tpidr_el0 by kernel_ventry.
583+
* PT_REGS_SIZE) was stashed in tpidr_el0 by kernel_ventry.
584584
*/
585-
sub sp, sp, #S_FRAME_SIZE
585+
sub sp, sp, #PT_REGS_SIZE
586586
kernel_entry 1
587587
mrs x0, tpidr_el0
588-
add x0, x0, #S_FRAME_SIZE
588+
add x0, x0, #PT_REGS_SIZE
589589
str x0, [sp, #S_SP]
590590

591591
/* Stash the regs for handle_bad_stack */

arch/arm64/kernel/perf_event.c

Lines changed: 2 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323
#include <linux/platform_device.h>
2424
#include <linux/sched_clock.h>
2525
#include <linux/smp.h>
26-
#include <linux/nmi.h>
27-
#include <linux/cpufreq.h>
2826

2927
/* ARMv8 Cortex-A53 specific event types. */
3028
#define ARMV8_A53_PERFCTR_PREF_LINEFILL 0xC2
@@ -1250,21 +1248,10 @@ static struct platform_driver armv8_pmu_driver = {
12501248

12511249
static int __init armv8_pmu_driver_init(void)
12521250
{
1253-
int ret;
1254-
12551251
if (acpi_disabled)
1256-
ret = platform_driver_register(&armv8_pmu_driver);
1252+
return platform_driver_register(&armv8_pmu_driver);
12571253
else
1258-
ret = arm_pmu_acpi_probe(armv8_pmuv3_init);
1259-
1260-
/*
1261-
* Try to re-initialize lockup detector after PMU init in
1262-
* case PMU events are triggered via NMIs.
1263-
*/
1264-
if (ret == 0 && arm_pmu_irq_is_nmi())
1265-
lockup_detector_init();
1266-
1267-
return ret;
1254+
return arm_pmu_acpi_probe(armv8_pmuv3_init);
12681255
}
12691256
device_initcall(armv8_pmu_driver_init)
12701257

@@ -1322,27 +1309,3 @@ void arch_perf_update_userpage(struct perf_event *event,
13221309
userpg->cap_user_time_zero = 1;
13231310
userpg->cap_user_time_short = 1;
13241311
}
1325-
1326-
#ifdef CONFIG_HARDLOCKUP_DETECTOR_PERF
1327-
/*
1328-
* Safe maximum CPU frequency in case a particular platform doesn't implement
1329-
* cpufreq driver. Although, architecture doesn't put any restrictions on
1330-
* maximum frequency but 5 GHz seems to be safe maximum given the available
1331-
* Arm CPUs in the market which are clocked much less than 5 GHz. On the other
1332-
* hand, we can't make it much higher as it would lead to a large hard-lockup
1333-
* detection timeout on parts which are running slower (eg. 1GHz on
1334-
* Developerbox) and doesn't possess a cpufreq driver.
1335-
*/
1336-
#define SAFE_MAX_CPU_FREQ 5000000000UL // 5 GHz
1337-
u64 hw_nmi_get_sample_period(int watchdog_thresh)
1338-
{
1339-
unsigned int cpu = smp_processor_id();
1340-
unsigned long max_cpu_freq;
1341-
1342-
max_cpu_freq = cpufreq_get_hw_max_freq(cpu) * 1000UL;
1343-
if (!max_cpu_freq)
1344-
max_cpu_freq = SAFE_MAX_CPU_FREQ;
1345-
1346-
return (u64)max_cpu_freq * watchdog_thresh;
1347-
}
1348-
#endif

arch/arm64/kernel/probes/kprobes_trampoline.S

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
stp x24, x25, [sp, #S_X24]
2626
stp x26, x27, [sp, #S_X26]
2727
stp x28, x29, [sp, #S_X28]
28-
add x0, sp, #S_FRAME_SIZE
28+
add x0, sp, #PT_REGS_SIZE
2929
stp lr, x0, [sp, #S_LR]
3030
/*
3131
* Construct a useful saved PSTATE
@@ -62,7 +62,7 @@
6262
.endm
6363

6464
SYM_CODE_START(kretprobe_trampoline)
65-
sub sp, sp, #S_FRAME_SIZE
65+
sub sp, sp, #PT_REGS_SIZE
6666

6767
save_all_base_regs
6868

@@ -76,7 +76,7 @@ SYM_CODE_START(kretprobe_trampoline)
7676

7777
restore_all_base_regs
7878

79-
add sp, sp, #S_FRAME_SIZE
79+
add sp, sp, #PT_REGS_SIZE
8080
ret
8181

8282
SYM_CODE_END(kretprobe_trampoline)

arch/arm64/kernel/signal.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -914,13 +914,6 @@ static void do_signal(struct pt_regs *regs)
914914
asmlinkage void do_notify_resume(struct pt_regs *regs,
915915
unsigned long thread_flags)
916916
{
917-
/*
918-
* The assembly code enters us with IRQs off, but it hasn't
919-
* informed the tracing code of that for efficiency reasons.
920-
* Update the trace code with the current status.
921-
*/
922-
trace_hardirqs_off();
923-
924917
do {
925918
if (thread_flags & _TIF_NEED_RESCHED) {
926919
/* Unmask Debug and SError for the next task */

arch/arm64/kernel/syscall.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
#include <asm/daifflags.h>
1111
#include <asm/debug-monitors.h>
12+
#include <asm/exception.h>
1213
#include <asm/fpsimd.h>
1314
#include <asm/syscall.h>
1415
#include <asm/thread_info.h>
@@ -165,15 +166,8 @@ static void el0_svc_common(struct pt_regs *regs, int scno, int sc_nr,
165166
if (!has_syscall_work(flags) && !IS_ENABLED(CONFIG_DEBUG_RSEQ)) {
166167
local_daif_mask();
167168
flags = current_thread_info()->flags;
168-
if (!has_syscall_work(flags) && !(flags & _TIF_SINGLESTEP)) {
169-
/*
170-
* We're off to userspace, where interrupts are
171-
* always enabled after we restore the flags from
172-
* the SPSR.
173-
*/
174-
trace_hardirqs_on();
169+
if (!has_syscall_work(flags) && !(flags & _TIF_SINGLESTEP))
175170
return;
176-
}
177171
local_daif_restore(DAIF_PROCCTX);
178172
}
179173

0 commit comments

Comments
 (0)