linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Will Deacon <will.deacon@arm.com>
To: huanglingyan <huanglingyan2@huawei.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>,
	liuyun01@kylinos.cn, linux-arm-kernel@lists.infradead.org,
	ard.biesheuvel@linaro.org
Subject: Re: [PATCH] arm64: lib: accelerate do_csum() with NEON instruction
Date: Mon, 3 Dec 2018 19:32:41 +0000	[thread overview]
Message-ID: <20181203193241.GH29028@arm.com> (raw)
In-Reply-To: <1542792065-98282-1-git-send-email-huanglingyan2@huawei.com>

[+ Ard and Jackie]

On Wed, Nov 21, 2018 at 05:21:05PM +0800, huanglingyan wrote:
> From: Lingyan Huang <huanglingyan2@huawei.com>
> 
> Function do_csum() in lib/checksum.c is used to compute checksum,
> which is turned out to be slowly and costs a lot of resources.
> Let's use neon instructions to accelerate the checksum computation
> for arm64.
> 
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will.deacon@arm.com>
> Signed-off-by: Lingyan Huang <huanglingyan2@huawei.com>
> ---
>  arch/arm64/include/asm/checksum.h |   8 ++
>  arch/arm64/lib/Makefile           |   3 +
>  arch/arm64/lib/checksum.c         |  30 +++++++
>  arch/arm64/lib/do_csum.S          | 182 ++++++++++++++++++++++++++++++++++++++
>  lib/checksum.c                    |   6 +-
>  5 files changed, 226 insertions(+), 3 deletions(-)
>  create mode 100644 arch/arm64/lib/checksum.c
>  create mode 100644 arch/arm64/lib/do_csum.S

I think we can avoid dropping into assembly for this if we build on top of
arm_neon.h for the core of the loop:

> +do_loop_64:
> +
> +	ldp	q5, q4, [x0], #32
> +	ldp	q7, q6, [x0], #32
> +
> +    uadalp v0.4s, v4.8h
> +    uadalp v1.4s, v5.8h
> +    uadalp v2.4s, v6.8h
> +    uadalp v3.4s, v7.8h

So please look at Jackie's patch for XOR checksumming as inspiration:

http://lists.infradead.org/pipermail/linux-arm-kernel/2018-November/615625.html

Thanks,

Will

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

      parent reply	other threads:[~2018-12-03 19:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-21  9:21 [PATCH] arm64: lib: accelerate do_csum() with NEON instruction huanglingyan
2018-11-21 14:41 ` Robin Murphy
2018-11-26 11:28   ` huanglingyan (A)
2018-11-28  1:47   ` huanglingyan (A)
2018-12-03 19:32 ` Will Deacon [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=20181203193241.GH29028@arm.com \
    --to=will.deacon@arm.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=catalin.marinas@arm.com \
    --cc=huanglingyan2@huawei.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=liuyun01@kylinos.cn \
    /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).