All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
To: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
	"David S. Miller" <davem@davemloft.net>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Gilad Ben-Yossef <gilad@benyossef.com>,
	Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	"Markku-Juhani O . Saarinen" <mjos@iki.fi>,
	Jussi Kivilinna <jussi.kivilinna@iki.fi>, X86 ML <x86@kernel.org>,
	Linux Crypto Mailing List <linux-crypto@vger.kernel.org>,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/3] crypto: sm4 - create SM4 library based on sm4 generic code
Date: Tue, 1 Mar 2022 14:22:14 +0100	[thread overview]
Message-ID: <CAHmME9pvbeGhWD+0N4_nOh-pkWmt7=Q9PDW40QjK8NHiJi7D2w@mail.gmail.com> (raw)
In-Reply-To: <52be961d-a00d-785d-8fb1-15b1a17bd74e@linux.alibaba.com>

Hi Tianjia,

On Tue, Mar 1, 2022 at 12:50 PM Tianjia Zhang
<tianjia.zhang@linux.alibaba.com> wrote:
>
> Hi Jason,
>
> On 3/1/22 6:34 PM, Jason A. Donenfeld wrote:
> >>   lib/crypto/Kconfig   |   3 +
> >>   lib/crypto/Makefile  |   3 +
> >>   lib/crypto/sm4.c     | 184 +++++++++++++++++++++++++++++++++++++++++++
> >
> > If this is only used by the crypto API, it does not belong in
> > lib/crypto. I understand you want fallback generic code for the SIMD
> > implementation, but we've generally done that in crypto/ when the use
> > case is only the crypto API. Can you move this to the right place?
>
> This is not only used by the crypto API, but also used for SIMD
> acceleration under the x86 and arm architectures, mainly for processing
> the remaining blocks after SIMD acceleration. In general, the
> performance of SIMD processing a single block is not as good as that of
> general software implementations.

Yes, and those accelerated implementations are part of the crypto API,
and are not used by anything except the crypto API. Hence this should
be in crypto/, just like everything else that is /only/ used for the
cryto API. lib/crypto/ is for in-kernel users of crypto via normal
code paths. sm4.c does not belong in lib/crypto/ and should be moved.

You additional export symbols of those SIMD implementations in
arch/crypto/, which is not correct either, since nothing in the tree
uses those symbols. Please remove those EXPORT_SYMBOL directives as
well. Those functions can be static, and do not need to be declared in
the .h file.

Thanks,
Jason

WARNING: multiple messages have this Message-ID (diff)
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
To: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
	"David S. Miller" <davem@davemloft.net>,
	 Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	 Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	 "H. Peter Anvin" <hpa@zytor.com>,
	Gilad Ben-Yossef <gilad@benyossef.com>,
	 Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	"Markku-Juhani O . Saarinen" <mjos@iki.fi>,
	 Jussi Kivilinna <jussi.kivilinna@iki.fi>,
	X86 ML <x86@kernel.org>,
	 Linux Crypto Mailing List <linux-crypto@vger.kernel.org>,
	 linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/3] crypto: sm4 - create SM4 library based on sm4 generic code
Date: Tue, 1 Mar 2022 14:22:14 +0100	[thread overview]
Message-ID: <CAHmME9pvbeGhWD+0N4_nOh-pkWmt7=Q9PDW40QjK8NHiJi7D2w@mail.gmail.com> (raw)
In-Reply-To: <52be961d-a00d-785d-8fb1-15b1a17bd74e@linux.alibaba.com>

Hi Tianjia,

On Tue, Mar 1, 2022 at 12:50 PM Tianjia Zhang
<tianjia.zhang@linux.alibaba.com> wrote:
>
> Hi Jason,
>
> On 3/1/22 6:34 PM, Jason A. Donenfeld wrote:
> >>   lib/crypto/Kconfig   |   3 +
> >>   lib/crypto/Makefile  |   3 +
> >>   lib/crypto/sm4.c     | 184 +++++++++++++++++++++++++++++++++++++++++++
> >
> > If this is only used by the crypto API, it does not belong in
> > lib/crypto. I understand you want fallback generic code for the SIMD
> > implementation, but we've generally done that in crypto/ when the use
> > case is only the crypto API. Can you move this to the right place?
>
> This is not only used by the crypto API, but also used for SIMD
> acceleration under the x86 and arm architectures, mainly for processing
> the remaining blocks after SIMD acceleration. In general, the
> performance of SIMD processing a single block is not as good as that of
> general software implementations.

Yes, and those accelerated implementations are part of the crypto API,
and are not used by anything except the crypto API. Hence this should
be in crypto/, just like everything else that is /only/ used for the
cryto API. lib/crypto/ is for in-kernel users of crypto via normal
code paths. sm4.c does not belong in lib/crypto/ and should be moved.

You additional export symbols of those SIMD implementations in
arch/crypto/, which is not correct either, since nothing in the tree
uses those symbols. Please remove those EXPORT_SYMBOL directives as
well. Those functions can be static, and do not need to be declared in
the .h file.

Thanks,
Jason

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

  reply	other threads:[~2022-03-01 13:22 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-10 13:44 [PATCH 0/3] Introduce x86 assembler accelerated implementation for SM4 algorithm Tianjia Zhang
2021-06-10 13:44 ` Tianjia Zhang
2021-06-10 13:44 ` [PATCH 1/3] crypto: sm4 - create SM4 library based on sm4 generic code Tianjia Zhang
2021-06-10 13:44   ` Tianjia Zhang
2021-06-10 23:19   ` Eric Biggers
2021-06-10 23:19     ` Eric Biggers
2021-06-13 10:14     ` Tianjia Zhang
2021-06-13 10:14       ` Tianjia Zhang
2022-03-01 10:34   ` Jason A. Donenfeld
2022-03-01 10:34     ` Jason A. Donenfeld
2022-03-01 11:50     ` Tianjia Zhang
2022-03-01 11:50       ` Tianjia Zhang
2022-03-01 13:22       ` Jason A. Donenfeld [this message]
2022-03-01 13:22         ` Jason A. Donenfeld
2022-03-01 14:17         ` Jason A. Donenfeld
2022-03-01 14:17           ` Jason A. Donenfeld
2022-03-02  0:24     ` Herbert Xu
2022-03-02  0:24       ` Herbert Xu
2022-03-02  0:26       ` Jason A. Donenfeld
2022-03-02  0:26         ` Jason A. Donenfeld
2022-03-02 22:23         ` Eric Biggers
2022-03-02 22:23           ` Eric Biggers
2022-03-11 23:03           ` Jason A. Donenfeld
2022-03-11 23:03             ` Jason A. Donenfeld
2022-03-14  2:32             ` Tianjia Zhang
2022-03-14  2:32               ` Tianjia Zhang
2022-03-14  2:40               ` Jason A. Donenfeld
2022-03-14  2:40                 ` Jason A. Donenfeld
2022-03-14  2:45                 ` Herbert Xu
2022-03-14  2:45                   ` Herbert Xu
2022-03-14  2:46                   ` Jason A. Donenfeld
2022-03-14  2:46                     ` Jason A. Donenfeld
2021-06-10 13:44 ` [PATCH 2/3] crypto: arm64/sm4-ce - Make dependent on sm4 library instead of sm4-generic Tianjia Zhang
2021-06-10 13:44   ` Tianjia Zhang
2021-06-10 13:44 ` [PATCH 3/3] crypto: x86/sm4 - add AES-NI/AVX/x86_64 assembler implementation Tianjia Zhang
2021-06-10 13:44   ` Tianjia Zhang
2021-06-10 23:27   ` Eric Biggers
2021-06-10 23:27     ` Eric Biggers
2021-06-13 10:14     ` Tianjia Zhang
2021-06-13 10:14       ` Tianjia Zhang

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='CAHmME9pvbeGhWD+0N4_nOh-pkWmt7=Q9PDW40QjK8NHiJi7D2w@mail.gmail.com' \
    --to=jason@zx2c4.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=bp@alien8.de \
    --cc=catalin.marinas@arm.com \
    --cc=davem@davemloft.net \
    --cc=gilad@benyossef.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=hpa@zytor.com \
    --cc=jussi.kivilinna@iki.fi \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=mjos@iki.fi \
    --cc=tglx@linutronix.de \
    --cc=tianjia.zhang@linux.alibaba.com \
    --cc=will@kernel.org \
    --cc=x86@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.