lkml.org 
[lkml]   [2021]   [Dec]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] x86/mce: Reduce number of machine checks taken during recovery
On Thu, Dec 23, 2021 at 12:07:01PM -0800, Luck, Tony wrote:
> diff --git a/arch/x86/lib/copy_user_64.S b/arch/x86/lib/copy_user_64.S
> index e6ac38587b40..26781cbe7e37 100644
> --- a/arch/x86/lib/copy_user_64.S
> +++ b/arch/x86/lib/copy_user_64.S
> @@ -212,6 +212,7 @@ EXPORT_SYMBOL(copy_user_enhanced_fast_string)
> * Don't try to copy the tail if machine check happened
> *
> * Input:
> + * eax x86 trap number - set by fixup_excpetion()

That's inaccurate, fixup_exception() (event if it's spelled correctly)
does not unconditionally set the trap number in RAX, that's only done by
ex_handler_fault() (or ex_handler_sgx()), which means all flows into
this function must pass through: EX_TYPE_FAULT, EX_TYPE_FAULT_MCE or
EX_TYPE_COPY.

Boris might fix up your comment if he applies I suppose..

> * rdi destination
> * rsi source
> * rdx count
> @@ -220,12 +221,20 @@ EXPORT_SYMBOL(copy_user_enhanced_fast_string)
> * eax uncopied bytes or 0 if successful.
> */
> SYM_CODE_START_LOCAL(.Lcopy_user_handle_tail)
> + cmp $X86_TRAP_MC,%eax
> + je 3f
> +
> movl %edx,%ecx
> 1: rep movsb
> 2: mov %ecx,%eax
> ASM_CLAC
> RET
>
> +3:
> + movl %edx,%eax
> + ASM_CLAC
> + RET
> +
> _ASM_EXTABLE_CPY(1b, 2b)
>
> .Lcopy_user_handle_align:
>
> base-commit: 82a8954acd93ae95d6252fb93a3d210c8f71b093
> --
> 2.31.1
>

\
 
 \ /
  Last update: 2021-12-24 12:51    [W:0.059 / U:0.416 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site