xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: chenbaodong <chenbaodong@mxnavi.com>
To: Julien Grall <julien.grall@arm.com>, <xen-devel@lists.xenproject.org>
Cc: Stefano Stabellini <sstabellini@kernel.org>
Subject: Re: [Xen-devel] [PATCH] xen/arm: io: add function swap_mmio_handler()
Date: Wed, 12 Jun 2019 18:08:43 +0800	[thread overview]
Message-ID: <2ed30cde-e2ab-745e-94f5-0cf6155c9122@mxnavi.com> (raw)
In-Reply-To: <af3fe48d-afaa-3184-e142-9a1e2b8574f4@arm.com>


On 6/12/19 17:08, Julien Grall wrote:
> Hi,
>
> On 6/12/19 6:42 AM, Baodong Chen wrote:
>> Swap function can be used when calling sort().
>> or else, the default swap function generic_swap() is used,
>> which is a little inefficient.
>
> I am not entirely convince this will be more efficient. mmio_handler 
> does not fit in 64 bit, so the compiler may decide to do either 
> multiple load or replace with a memcpy.

Hello Julien,

I have checked the disassemble result,

and IIUC generic_swap has a loop so it should be a little inefficient. 
I'm not expert about hardware, please correct me if i'm wrong.

000000000022ee88 <generic_swap>:
   22ee88:       d2800003        mov     x3, #0x0                        
// #0
   22ee8c:       d503201f        nop
   22ee90:       38636825        ldrb    w5, [x1, x3]
   22ee94:       38636804        ldrb    w4, [x0, x3]
   22ee98:       38236805        strb    w5, [x0, x3]
   22ee9c:       38236824        strb    w4, [x1, x3]
   22eea0:       91000463        add     x3, x3, #0x1
   22eea4:       4b030044        sub     w4, w2, w3
   22eea8:       7100009f        cmp     w4, #0x0
   22eeac:       54ffff2c        b.gt    22ee90 <generic_swap+0x8>
   22eeb0:       d65f03c0        ret
   22eeb4:       d503201f        nop


0000000000242db8 <swap_mmio_handler>:
   242db8:       a9400c22        ldp     x2, x3, [x1]
   242dbc:       d10083ff        sub     sp, sp, #0x20
   242dc0:       a9401404        ldp     x4, x5, [x0]
   242dc4:       a9000c02        stp     x2, x3, [x0]
   242dc8:       a9410c02        ldp     x2, x3, [x0, #16]
   242dcc:       a9411c26        ldp     x6, x7, [x1, #16]
   242dd0:       a9011c06        stp     x6, x7, [x0, #16]
   242dd4:       a9001424        stp     x4, x5, [x1]
   242dd8:       a9010c22        stp     x2, x3, [x1, #16]
   242ddc:       910083ff        add     sp, sp, #0x20
   242de0:       d65f03c0        ret
   242de4:       d503201f        nop

>
> So at best this feels some micro-optimization. But then, this is only 
> call a limited number of time at each domain build. Is it really worth 
> it?

It's not hot path here.

Not sure about worth.

Personally  i will try my best to do things well according to my 
understanding.

>
> On a side note, I have noticed you are sending a lot of 
> optimization/clean-up patch. What is your end goal here?

My goal is to understand how xen works well.

>
> If it is to improve the performance, then there are much bigger fish 
> to fry within Xen code base. I am happy to point some of them based on 
> where you are looking to improve.

Surly i want to improve performance.

Features like Fast Startup ( I learned from xen summit 2018, samsung 
automotive presentation).

But currently i don't understand xen well, only a few weeks experience.

I'm afraid can't catch big fish.

>
> Cheers,
>

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

  reply	other threads:[~2019-06-12 10:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-12  5:42 [Xen-devel] [PATCH] xen/arm: io: add function swap_mmio_handler() Baodong Chen
2019-06-12  9:08 ` Julien Grall
2019-06-12 10:08   ` chenbaodong [this message]
2019-06-12 12:21     ` Julien Grall
2019-06-13  0:31       ` chenbaodong
2019-06-24 18:18         ` Stefano Stabellini
2019-06-24 18:27           ` Stefano Stabellini
2019-06-24 19:27             ` Julien Grall
2019-06-24 20:17               ` Stefano Stabellini
2019-06-24 21:18                 ` Julien Grall
2019-06-24 23:59                   ` Stefano Stabellini
2019-06-25  8:46                     ` Julien Grall
2019-06-27 23:30                       ` chenbaodong

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=2ed30cde-e2ab-745e-94f5-0cf6155c9122@mxnavi.com \
    --to=chenbaodong@mxnavi.com \
    --cc=julien.grall@arm.com \
    --cc=sstabellini@kernel.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).