xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: xen-devel <xen-devel@lists.xenproject.org>,
	"Edwin Török" <edvin.torok@citrix.com>, WeiLiu <wl@xen.org>,
	"Roger Pau Monne" <roger.pau@citrix.com>
Subject: Re: [Xen-devel] [PATCH] x86/clear_page: Update clear_page_sse2() after dropping 32bit Xen
Date: Tue, 18 Jun 2019 11:35:46 +0100	[thread overview]
Message-ID: <7c3041a1-bd4b-5140-4ce7-471fc81a94a6@citrix.com> (raw)
In-Reply-To: <5D08BE0B0200007800239323@prv1-mh.provo.novell.com>

On 18/06/2019 11:33, Jan Beulich wrote:
>>>> On 17.06.19 at 21:49, <andrew.cooper3@citrix.com> wrote:
>> This code was never updated when the 32bit build of Xen was dropped.
>>
>>  * Expand the now-redundant ptr_reg macro.
>>  * The number of iterations in the loop can be halfed by using 64bit writes,
>>    without consuming any extra execution resource in the pipeline.  Adjust all
>>    numbers/offsets appropriately.
>>  * Replace dec with sub to avoid a eflags stall, and position it to be
>>    macro-fused with the related jmp.
>>  * With no need to preserve eflags across the body of the loop, replace lea
>>    with add which has 1/3'rd the latency on basically all 64bit hardware.
>>
>> A quick userspace perf test on my Haswell dev box indicates that the old
>> version takes ~1385 cycles on average (ignoring outliers), and the new version
>> takes ~1060 cyles, or about 77% of the time.
>>
>> Reported-by: Edwin Török <edvin.torok@citrix.com>
>> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
> Assuming you want this to go in despite your REP STOSQ remark
> later on,
> Reviewed-by: Jan Beulich <jbeulich@suse.com>
> with one remark:
>
>> --- a/xen/arch/x86/clear_page.S
>> +++ b/xen/arch/x86/clear_page.S
>> @@ -2,18 +2,16 @@
>>  
>>  #include <asm/page.h>
>>  
>> -#define ptr_reg %rdi
>> -
>>  ENTRY(clear_page_sse2)
>> -        mov     $PAGE_SIZE/16, %ecx
>> +        mov     $PAGE_SIZE/32, %ecx
>>          xor     %eax,%eax
>>  
>> -0:      dec     %ecx
>> -        movnti  %eax, (ptr_reg)
>> -        movnti  %eax, 4(ptr_reg)
>> -        movnti  %eax, 8(ptr_reg)
>> -        movnti  %eax, 12(ptr_reg)
>> -        lea     16(ptr_reg), ptr_reg
>> +0:      movnti  %rax,  0(%rdi)
> Could I talk you into leaving out this 0? Rather old gas actually emits
> an 8-bit displacement when it's spelled like this.

Oh ok.  I'll still align the (%rdi) though to make the column easier to
read.

I'll put this in now, and see if I can find some time before 4.13 ships
to make some alternatives-based better options.

~Andrew

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

      reply	other threads:[~2019-06-18 10:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-17 19:49 [Xen-devel] [PATCH] x86/clear_page: Update clear_page_sse2() after dropping 32bit Xen Andrew Cooper
2019-06-17 20:04 ` Andrew Cooper
2019-06-18 10:33 ` Jan Beulich
2019-06-18 10:35   ` Andrew Cooper [this message]

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=7c3041a1-bd4b-5140-4ce7-471fc81a94a6@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=edvin.torok@citrix.com \
    --cc=roger.pau@citrix.com \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /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).