Skip to content

Commit bcc8aff

Browse files
committed
Merge branch 'x86-asm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 asm updates from Ingo Molnar: "Misc updates: - Remove last remaining calls to exception_enter/exception_exit() and simplify the entry code some more. - Remove force_iret() - Add support for "Fast Short Rep Mov", which is available starting with Ice Lake Intel CPUs - and make the x86 assembly version of memmove() use REP MOV for all sizes when FSRM is available. - Micro-optimize/simplify the 32-bit boot code a bit. - Use a more future-proof SYSRET instruction mnemonic" * 'x86-asm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/boot: Simplify calculation of output address x86/entry/64: Add instruction suffix to SYSRET x86: Remove force_iret() x86/cpufeatures: Add support for fast short REP; MOVSB x86/context-tracking: Remove exception_enter/exit() from KVM_PV_REASON_PAGE_NOT_PRESENT async page fault x86/context-tracking: Remove exception_enter/exit() from do_page_fault()
2 parents 435dd72 + 183ef7a commit bcc8aff

File tree

13 files changed

+21
-72
lines changed

13 files changed

+21
-72
lines changed

arch/x86/boot/compressed/head_32.S

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,9 @@ SYM_FUNC_START_LOCAL_NOALIGN(.Lrelocated)
189189
/* push arguments for extract_kernel: */
190190
pushl $z_output_len /* decompressed length, end of relocs */
191191

192-
movl BP_init_size(%esi), %eax
193-
subl $_end, %eax
194-
movl %ebx, %ebp
195-
subl %eax, %ebp
196-
pushl %ebp /* output address */
192+
leal _end(%ebx), %eax
193+
subl BP_init_size(%esi), %eax
194+
pushl %eax /* output address */
197195

198196
pushl $z_input_len /* input_len */
199197
leal input_data(%ebx), %eax

arch/x86/entry/entry_64.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1728,7 +1728,7 @@ SYM_CODE_END(nmi)
17281728
SYM_CODE_START(ignore_sysret)
17291729
UNWIND_HINT_EMPTY
17301730
mov $-ENOSYS, %eax
1731-
sysret
1731+
sysretl
17321732
SYM_CODE_END(ignore_sysret)
17331733
#endif
17341734

arch/x86/ia32/ia32_signal.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,6 @@ static int ia32_restore_sigcontext(struct pt_regs *regs,
114114

115115
err |= fpu__restore_sig(buf, 1);
116116

117-
force_iret();
118-
119117
return err;
120118
}
121119

arch/x86/include/asm/cpufeatures.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,7 @@
357357
/* Intel-defined CPU features, CPUID level 0x00000007:0 (EDX), word 18 */
358358
#define X86_FEATURE_AVX512_4VNNIW (18*32+ 2) /* AVX-512 Neural Network Instructions */
359359
#define X86_FEATURE_AVX512_4FMAPS (18*32+ 3) /* AVX-512 Multiply Accumulation Single precision */
360+
#define X86_FEATURE_FSRM (18*32+ 4) /* Fast Short Rep Mov */
360361
#define X86_FEATURE_AVX512_VP2INTERSECT (18*32+ 8) /* AVX-512 Intersect for D/Q */
361362
#define X86_FEATURE_MD_CLEAR (18*32+10) /* VERW clears CPU buffers */
362363
#define X86_FEATURE_TSX_FORCE_ABORT (18*32+13) /* "" TSX_FORCE_ABORT */

arch/x86/include/asm/ptrace.h

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -339,22 +339,6 @@ static inline unsigned long regs_get_kernel_argument(struct pt_regs *regs,
339339

340340
#define ARCH_HAS_USER_SINGLE_STEP_REPORT
341341

342-
/*
343-
* When hitting ptrace_stop(), we cannot return using SYSRET because
344-
* that does not restore the full CPU state, only a minimal set. The
345-
* ptracer can change arbitrary register values, which is usually okay
346-
* because the usual ptrace stops run off the signal delivery path which
347-
* forces IRET; however, ptrace_event() stops happen in arbitrary places
348-
* in the kernel and don't force IRET path.
349-
*
350-
* So force IRET path after a ptrace stop.
351-
*/
352-
#define arch_ptrace_stop_needed(code, info) \
353-
({ \
354-
force_iret(); \
355-
false; \
356-
})
357-
358342
struct user_desc;
359343
extern int do_get_thread_area(struct task_struct *p, int idx,
360344
struct user_desc __user *info);

arch/x86/include/asm/thread_info.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -239,15 +239,6 @@ static inline int arch_within_stack_frames(const void * const stack,
239239
current_thread_info()->status & TS_COMPAT)
240240
#endif
241241

242-
/*
243-
* Force syscall return via IRET by making it look as if there was
244-
* some work pending. IRET is our most capable (but slowest) syscall
245-
* return path, which is able to restore modified SS, CS and certain
246-
* EFLAGS values that other (fast) syscall return instructions
247-
* are not able to restore properly.
248-
*/
249-
#define force_iret() set_thread_flag(TIF_NOTIFY_RESUME)
250-
251242
extern void arch_task_cache_init(void);
252243
extern int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src);
253244
extern void arch_release_task_struct(struct task_struct *tsk);

arch/x86/kernel/kvm.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,17 +245,13 @@ NOKPROBE_SYMBOL(kvm_read_and_reset_pf_reason);
245245
dotraplinkage void
246246
do_async_page_fault(struct pt_regs *regs, unsigned long error_code, unsigned long address)
247247
{
248-
enum ctx_state prev_state;
249-
250248
switch (kvm_read_and_reset_pf_reason()) {
251249
default:
252250
do_page_fault(regs, error_code, address);
253251
break;
254252
case KVM_PV_REASON_PAGE_NOT_PRESENT:
255253
/* page is swapped out by the host. */
256-
prev_state = exception_enter();
257254
kvm_async_pf_task_wait((u32)address, !user_mode(regs));
258-
exception_exit(prev_state);
259255
break;
260256
case KVM_PV_REASON_PAGE_READY:
261257
rcu_irq_enter();

arch/x86/kernel/process_32.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ start_thread(struct pt_regs *regs, unsigned long new_ip, unsigned long new_sp)
124124
regs->ip = new_ip;
125125
regs->sp = new_sp;
126126
regs->flags = X86_EFLAGS_IF;
127-
force_iret();
128127
}
129128
EXPORT_SYMBOL_GPL(start_thread);
130129

arch/x86/kernel/process_64.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,6 @@ start_thread_common(struct pt_regs *regs, unsigned long new_ip,
394394
regs->cs = _cs;
395395
regs->ss = _ss;
396396
regs->flags = X86_EFLAGS_IF;
397-
force_iret();
398397
}
399398

400399
void

arch/x86/kernel/signal.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,6 @@ static int restore_sigcontext(struct pt_regs *regs,
151151

152152
err |= fpu__restore_sig(buf, IS_ENABLED(CONFIG_X86_32));
153153

154-
force_iret();
155-
156154
return err;
157155
}
158156

0 commit comments

Comments
 (0)