Skip to content

Commit

Permalink
Merge tag 'xtensa-20210329' of git://github.com/jcmvbkbc/linux-xtensa
Browse files Browse the repository at this point in the history
Pull xtensa fixes from Max Filippov:

 - fix build with separate exception vectors when they are placed too
   far from the rest of the kernel

 - fix uaccess-related livelock in do_page_fault.

* tag 'xtensa-20210329' of git://github.com/jcmvbkbc/linux-xtensa:
  xtensa: fix uaccess-related livelock in do_page_fault
  xtensa: move coprocessor_flush to the .text section
  • Loading branch information
torvalds committed Mar 29, 2021
2 parents a5e13c6 + 7b9acbb commit 1e43c37
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 32 deletions.
64 changes: 33 additions & 31 deletions arch/xtensa/kernel/coprocessor.S
Original file line number Diff line number Diff line change
Expand Up @@ -99,37 +99,6 @@
LOAD_CP_REGS_TAB(6)
LOAD_CP_REGS_TAB(7)

/*
* coprocessor_flush(struct thread_info*, index)
* a2 a3
*
* Save coprocessor registers for coprocessor 'index'.
* The register values are saved to or loaded from the coprocessor area
* inside the task_info structure.
*
* Note that this function doesn't update the coprocessor_owner information!
*
*/

ENTRY(coprocessor_flush)

/* reserve 4 bytes on stack to save a0 */
abi_entry(4)

s32i a0, a1, 0
movi a0, .Lsave_cp_regs_jump_table
addx8 a3, a3, a0
l32i a4, a3, 4
l32i a3, a3, 0
add a2, a2, a4
beqz a3, 1f
callx0 a3
1: l32i a0, a1, 0

abi_ret(4)

ENDPROC(coprocessor_flush)

/*
* Entry condition:
*
Expand Down Expand Up @@ -245,6 +214,39 @@ ENTRY(fast_coprocessor)

ENDPROC(fast_coprocessor)

.text

/*
* coprocessor_flush(struct thread_info*, index)
* a2 a3
*
* Save coprocessor registers for coprocessor 'index'.
* The register values are saved to or loaded from the coprocessor area
* inside the task_info structure.
*
* Note that this function doesn't update the coprocessor_owner information!
*
*/

ENTRY(coprocessor_flush)

/* reserve 4 bytes on stack to save a0 */
abi_entry(4)

s32i a0, a1, 0
movi a0, .Lsave_cp_regs_jump_table
addx8 a3, a3, a0
l32i a4, a3, 4
l32i a3, a3, 0
add a2, a2, a4
beqz a3, 1f
callx0 a3
1: l32i a0, a1, 0

abi_ret(4)

ENDPROC(coprocessor_flush)

.data

ENTRY(coprocessor_owner)
Expand Down
5 changes: 4 additions & 1 deletion arch/xtensa/mm/fault.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,11 @@ void do_page_fault(struct pt_regs *regs)
*/
fault = handle_mm_fault(vma, address, flags, regs);

if (fault_signal_pending(fault, regs))
if (fault_signal_pending(fault, regs)) {
if (!user_mode(regs))
goto bad_page_fault;
return;
}

if (unlikely(fault & VM_FAULT_ERROR)) {
if (fault & VM_FAULT_OOM)
Expand Down

0 comments on commit 1e43c37

Please sign in to comment.