[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 3/3] virtio: optimize virtio_access_is_big_endia
From: |
Cornelia Huck |
Subject: |
Re: [Qemu-devel] [PATCH 3/3] virtio: optimize virtio_access_is_big_endian() for little-endian targets |
Date: |
Thu, 12 Nov 2015 19:08:59 +0100 |
On Mon, 09 Nov 2015 18:58:34 +0100
Greg Kurz <address@hidden> wrote:
> When adding cross-endian support, we introduced the TARGET_IS_BIENDIAN macro
> and the virtio_access_is_big_endian() helper to have a branchless fast path
> in the virtio memory accessors for targets that don't switch endian.
>
> This was considered as a strong requirement at the time.
>
> Now we have added a runtime check for virtio 1.0, which ruins the benefit
> of the virtio_access_is_big_endian() helper for always little-endian targets.
>
> With this patch, fixed little-endian targets stop checking for virtio 1.0,
> since the result is little-endian in all cases.
So always-LE gets optimized, while always-BE and bi-endian stay the same?
(Is there a measurable impact?)
> The helper also gets renamed
> so it is clear it is optimized for fast paths.
Even if it isn't actually 'fast' on anything other than fixed-LE?
>
> Signed-off-by: Greg Kurz <address@hidden>
> ---
> include/hw/virtio/virtio-access.h | 43
> ++++++++++++++++++++-----------------
> 1 file changed, 23 insertions(+), 20 deletions(-)