linux-next: manual merge of the sound-asoc tree with the crypto tree
Subsystems (2)
Hi all,
Today's linux-next merge of the sound-asoc tree got a conflict in:
sound/soc/codecs/cros_ec_codec.c
between commit:
85fc78b80f15 ("ASoC: cros_ec_codec: use crypto_shash_tfm_digest()")
from the crypto tree and commit:
a1304cba816e ("ASoC: cros_ec_codec: allocate shash_desc dynamically")
from the sound-asoc tree.
I fixed it up (I just used the former) and can carry the fix as necessary. This is now fixed as far as linux-next is concerned, but any non trivial conflicts should be mentioned to your upstream maintainer when your tree is submitted for merging. You may also want to consider cooperating with the maintainer of the conflicting tree to minimise any particularly complex conflicts.
Signature · 2 lines
Cheers, Stephen Rothwell
Mark Brown
maintainerQuoted 10 lines · Stephen Rothwell
Hi all,
Today's linux-next merge of the sound-asoc tree got a conflict in:
sound/soc/codecs/cros_ec_codec.cbetween commit:
85fc78b80f15("ASoC:cros_ec_codec: usecrypto_shash_tfm_digest()")
Oh, this is the first I've heard of that patch :(
Quoted 4 lines
from the crypto tree and commit:
a1304cba816e("ASoC:cros_ec_codec: allocateshash_descdynamically")
Quoted 8 lines
from the sound-asoc tree.
I fixed it up (I just used the former) and can carry the fix as necessary. This is now fixed as far as linux-next is concerned, but any non trivial conflicts should be mentioned to your upstream maintainer when your tree is submitted for merging. You may also want to consider cooperating with the maintainer of the conflicting tree to minimise any particularly complex conflicts.
That doesn't seem ideal - Eric, Herbert can we get a branch with the crypto patches in them to pull into the ASoC tree or something?
Quoted 5 lines · Mark Brown
Quoted 4 lines · Stephen Rothwell
Hi all,
Today's linux-next merge of the sound-asoc tree got a conflict in:
Quoted 14 lines
Quoted 6 lines
sound/soc/codecs/cros_ec_codec.cbetween commit:
85fc78b80f15("ASoC:cros_ec_codec: usecrypto_shash_tfm_digest()")Oh, this is the first I've heard of that patch :(
Quoted 5 lines
from the crypto tree and commit:
a1304cba816e("ASoC:cros_ec_codec: allocateshash_descdynamically")from the sound-asoc tree.
I Cc'ed it to the people listed in MAINTAINERS for "CHROMEOS EC CODEC DRIVER". I guess wasn't enough and I should have added [email protected] too?
Quoted 10 lines
Quoted 7 lines
I fixed it up (I just used the former) and can carry the fix as necessary. This is now fixed as far as linux-next is concerned, but any non trivial conflicts should be mentioned to your upstream maintainer when your tree is submitted for merging. You may also want to consider cooperating with the maintainer of the conflicting tree to minimise any particularly complex conflicts.
That doesn't seem ideal - Eric, Herbert can we get a branch with the crypto patches in them to pull into the ASoC tree or something?
We should just drop one of the patches.
If you just want to eliminate the compiler warning about stack usage in wov_hotword_model_put(), then my patch in cryptodev would be better, as it moves the stack allocation into another function in another file.
Alternatively, if you actually need to reduce the total stack usage (across all functions), then the kmalloc() patch in sound-asoc would be better.
Which do you prefer?
- Eric
Mark Brown
maintainerQuoted 10 lines · Eric Biggers
Quoted 5 lines · Mark Brown
Quoted 5 lines
from the crypto tree and commit:
a1304cba816e("ASoC:cros_ec_codec: allocateshash_descdynamically")from the sound-asoc tree.
I Cc'ed it to the people listed in
MAINTAINERSfor "CHROMEOS EC CODEC DRIVER". I guess wasn't enough and I should have added [email protected] too?
Yeah, you generally need to make sure the subsystem maintainers are included as well as individual driver maintainers.
Quoted 11 lines
Quoted 2 lines
That doesn't seem ideal - Eric, Herbert can we get a branch with the crypto patches in them to pull into the ASoC tree or something?
We should just drop one of the patches.
If you just want to eliminate the compiler warning about stack usage in
wov_hotword_model_put(), then my patch in cryptodev would be better, as it moves the stack allocation into another function in another file.Alternatively, if you actually need to reduce the total stack usage (across all functions), then the
kmalloc()patch in sound-asoc would be better.
Well, reducing the stack usage overall seems nicer overall - heads off future problems if the struct grows or something, and if we still end up allocating just as much on the stack then we'll have trouble at runtime anyway - does that make sense?
Quoted 24 lines · Mark Brown
Quoted 10 lines · Eric Biggers
Quoted 5 lines · Mark Brown
Quoted 5 lines
from the crypto tree and commit:
a1304cba816e("ASoC:cros_ec_codec: allocateshash_descdynamically")from the sound-asoc tree.
I Cc'ed it to the people listed in
MAINTAINERSfor "CHROMEOS EC CODEC DRIVER". I guess wasn't enough and I should have added [email protected] too?Yeah, you generally need to make sure the subsystem maintainers are included as well as individual driver maintainers.
Quoted 8 lines
Quoted 2 lines
That doesn't seem ideal - Eric, Herbert can we get a branch with the crypto patches in them to pull into the ASoC tree or something?
We should just drop one of the patches.
If you just want to eliminate the compiler warning about stack usage in
wov_hotword_model_put(), then my patch in cryptodev would be better, as it moves the stack allocation into another function in another file.
Quoted 7 lines
Quoted 2 lines
Alternatively, if you actually need to reduce the total stack usage (across all functions), then the
kmalloc()patch in sound-asoc would be better.Well, reducing the stack usage overall seems nicer overall - heads off future problems if the struct grows or something, and if we still end up allocating just as much on the stack then we'll have trouble at runtime anyway - does that make sense?
If you're concerned about total stack usage, then my recommendation is that Herbert drops my patch "ASoC: cros_ec_codec: use crypto_shash_tfm_digest()" from cryptodev, and you keep the patch
"ASoC: cros_ec_codec: allocate shash_desc dynamically" in sound-asoc.
For later: if SHASH_DESC_ON_STACK is causing problems, we really ought to find a better solution, since lots of users are using this macro. A version of crypto_shash_tfm_digest() that falls back to heap allocation if the descsize is too large would be possible, but that wouldn't fully solve the problem since some users do incremental hashing.
- Eric
Quoted 7 lines · Eric Biggers
On Tue, May 12, 2020 at 06:08:01PM +0100, Mark Brown wrote:
For later: if
SHASH_DESC_ON_STACKis causing problems, we really ought to find a better solution, since lots of users are using this macro. A version ofcrypto_shash_tfm_digest()that falls back to heap allocation if the descsize is too large would be possible, but that wouldn't fully solve the problem since some users do incremental hashing.
It's hard to know how many of the users of SHASH_DESC_ON_STACK() are likely to cause problems, as multiple factors are involved:
- this one triggered the warning because it was on the stack of a function that got inlined into another that has other large variables. Whether it got inlined makes little difference to the stack usage, but does make a difference to warning about it.
- generally the structure is larger than we like it, especially on architectures with 128 byte CRYPTO_MINALIGN like ARM. This actually got worse because of b68a7ec1e9a3 ("crypto: hash - Remove VLA usage"), as the stack usage is now always the maximum of all hashes where it used to be specific to the hash that was actually used and could be smaller
- the specific instance in calculate_sha256() feels a bit silly, as this function allocates a tfm and a descriptor, runs the digest and then frees both again. I don't know how common this pattern is, but it seems a higher-level abstraction might be helpful anyway.
Arnd
Quoted 24 lines · Arnd Bergmann
Quoted 7 lines · Eric Biggers
On Tue, May 12, 2020 at 06:08:01PM +0100, Mark Brown wrote:
For later: if
SHASH_DESC_ON_STACKis causing problems, we really ought to find a better solution, since lots of users are using this macro. A version ofcrypto_shash_tfm_digest()that falls back to heap allocation if the descsize is too large would be possible, but that wouldn't fully solve the problem since some users do incremental hashing.It's hard to know how many of the users of
SHASH_DESC_ON_STACK()are likely to cause problems, as multiple factors are involved:- this one triggered the warning because it was on the stack of a function that got inlined into another that has other large variables. Whether it got inlined makes little difference to the stack usage, but does make a difference to warning about it.
- generally the structure is larger than we like it, especially on architectures with 128 byte
CRYPTO_MINALIGNlike ARM. This actually got worse because ofb68a7ec1e9a3("crypto: hash - Remove VLA usage"), as the stack usage is now always the maximum of all hashes where it used to be specific to the hash that was actually used and could be smaller
Quoted 5 lines
- the specific instance in
calculate_sha256()feels a bit silly, as this function allocates a tfm and a descriptor, runs the digest and then frees both again. I don't know how common this pattern is, but it seems a higher-level abstraction might be helpful anyway.
We are trying to move to crypto library interfaces for non-performance critical uses of hashes where the algorithm is known at compile time, and this is a good example of that pattern.
IOW, this code should just call the sha256_init/update/final routines directly.
I'll send out a patch.
Herbert Xu
maintainerQuoted 5 lines · Eric Biggers
If you're concerned about total stack usage, then my recommendation is that Herbert drops my patch "ASoC:
cros_ec_codec: usecrypto_shash_tfm_digest()" from cryptodev, and you keep the patch
"ASoC:cros_ec_codec: allocateshash_descdynamically" in sound-asoc.
OK I'll drop this patch.
Thanks,
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt