Archive-only list for patches
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: "Luck, Tony" <tony.luck@intel.com>
Cc: Borislav Petkov <bp@alien8.de>,
	x86@kernel.org, linux-kernel@vger.kernel.org,
	patches@lists.linux.dev, Youquan Song <youquan.song@intel.com>
Subject: Re: [PATCH v2] x86/mce: Reduce number of machine checks taken during recovery
Date: Fri, 24 Dec 2021 12:50:01 +0100	[thread overview]
Message-ID: <YcWz6aEfsOZlHHXp@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <YcTW5dh8yTGucDd+@agluck-desk2.amr.corp.intel.com>

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
> 

  reply	other threads:[~2021-12-24 11:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-15 22:20 [PATCH] x86/mce: Reduce number of machine checks taken during recovery Tony Luck
2021-12-18  0:53 ` Peter Zijlstra
2021-12-23 20:07   ` [PATCH v2] " Luck, Tony
2021-12-24 11:50     ` Peter Zijlstra [this message]
2021-12-27 10:52       ` Borislav Petkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YcWz6aEfsOZlHHXp@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=bp@alien8.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patches@lists.linux.dev \
    --cc=tony.luck@intel.com \
    --cc=x86@kernel.org \
    --cc=youquan.song@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox