linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: Jan Beulich <JBeulich@suse.com>
Cc: mingo@elte.hu, tglx@linutronix.de, hpa@zytor.com,
	davem@davemloft.net, herbert@gondor.apana.org.au,
	rjw@rjwysocki.net, Juergen Gross <jgross@suse.com>,
	linux-kernel@vger.kernel.org, Alok Kataria <akataria@vmware.com>
Subject: Re: [PATCH v2] x86-64: use 32-bit XOR to zero registers
Date: Wed, 4 Jul 2018 22:29:34 +0200	[thread overview]
Message-ID: <20180704202934.GB15246@amd> (raw)
In-Reply-To: <5B39FF1A02000078001CFB54@prv1-mh.provo.novell.com>

[-- Attachment #1: Type: text/plain, Size: 1002 bytes --]

On Mon 2018-07-02 04:31:54, Jan Beulich wrote:
> Some Intel CPUs don't recognize 64-bit XORs as zeroing idioms. Zeroing
> idioms don't require execution bandwidth, as they're being taken care
> of in the frontend (through register renaming). Use 32-bit XORs instead.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

> @@ -702,7 +702,7 @@ _no_extra_mask_1_\@:
>  
>  	# GHASH computation for the last <16 Byte block
>  	GHASH_MUL \AAD_HASH, %xmm13, %xmm0, %xmm10, %xmm11, %xmm5, %xmm6
> -	xor	%rax,%rax
> +	xor	%eax, %eax
>  
>  	mov	%rax, PBlockLen(%arg2)
>  	jmp	_dec_done_\@

This is rather subtle... and looks like a bug. To zero 64-bit
register, you zero its lower half, relying on implicit zeroing of the
upper half. Wow.

Perhaps we should get comments in the code? Because the explicit code
is more readable...

									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

  parent reply	other threads:[~2018-07-04 20:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-02 10:31 [PATCH v2] x86-64: use 32-bit XOR to zero registers Jan Beulich
2018-07-03  8:35 ` [tip:x86/asm] x86/asm/64: Use " tip-bot for Jan Beulich
2018-07-04 20:29 ` Pavel Machek [this message]
2018-07-05  7:12   ` [PATCH v2] x86-64: use " Ingo Molnar
2018-07-09  8:33     ` Pavel Machek
2018-07-09  8:47       ` Jan Beulich

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=20180704202934.GB15246@amd \
    --to=pavel@ucw.cz \
    --cc=JBeulich@suse.com \
    --cc=akataria@vmware.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=hpa@zytor.com \
    --cc=jgross@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rjw@rjwysocki.net \
    --cc=tglx@linutronix.de \
    /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;
as well as URLs for NNTP newsgroup(s).