All of lore.kernel.org
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Cc: linux-crypto@vger.kernel.org
Subject: Re: [PATCH v6 2/8] crypto: add driver-side scomp interface
Date: Mon, 13 Jun 2016 16:56:12 +0800	[thread overview]
Message-ID: <20160613085612.GA7333@gondor.apana.org.au> (raw)
In-Reply-To: <1465373818-29720-3-git-send-email-giovanni.cabiddu@intel.com>

On Wed, Jun 08, 2016 at 09:16:52AM +0100, Giovanni Cabiddu wrote:
>
> +static void *scomp_map(struct scatterlist *sg, unsigned int len,
> +		       gfp_t gfp_flags)
> +{
> +	void *buf;
> +
> +	if (sg_is_last(sg))
> +		return kmap_atomic(sg_page(sg)) + sg->offset;

This doesn't work, because kmap_atomic maps a single page only
bug an SG entry can be a super-page, e.g., a set of contiguous
pages.

> +	buf = kmalloc(len, gfp_flags);

The backup path is also very unlikely to work because we'll be
hitting this with 64K sizes and this just won't work with a 4K
page size.

So up until now we've getting around this 64K issue with vmalloc,
and then we try to conserve the precious vmalloc resource by using
per-cpu allocation.

This totally breaks down once you go to DMA, where an SG list is
required.  Unfortunately, this means that there is no easy way
to linearise the data for our software implementations.

There is no easy way out I'm afraid.  I think we'll have to bite
the bullet and refit our software algos so that they handle SG
lists.

Not only will this solve the problem at hand, it'll also mean that
acomp users will never have to do vmalloc so it's a win-win.  It
also means that we won't need the scomp interface at all.

This does bring up another question of who should be allocating the
output memory.  Up until now it has been up to the user to do so.
However, if our algos can actually handle SG lists then I think it
should be fairly easy to make them do the allocation instead.  What
do you think?

Thanks,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

  reply	other threads:[~2016-06-13  8:56 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-08  8:16 [PATCH v6 0/8] crypto: asynchronous compression api Giovanni Cabiddu
2016-06-08  8:16 ` [PATCH v6 1/8] crypto: add " Giovanni Cabiddu
2016-06-08  8:16 ` [PATCH v6 2/8] crypto: add driver-side scomp interface Giovanni Cabiddu
2016-06-13  8:56   ` Herbert Xu [this message]
2016-06-22 15:53     ` Giovanni Cabiddu
2016-06-23 10:50       ` Herbert Xu
2016-06-24  8:37         ` Giovanni Cabiddu
2016-06-24  9:26           ` Herbert Xu
2016-06-28  7:41             ` Giovanni Cabiddu
2016-06-28  7:51               ` Herbert Xu
2016-06-08  8:16 ` [PATCH v6 3/8] crypto: acomp - add support for lzo via scomp Giovanni Cabiddu
2016-06-08  8:16 ` [PATCH v6 4/8] crypto: acomp - add support for lz4 " Giovanni Cabiddu
2016-06-08  8:16 ` [PATCH v6 5/8] crypto: acomp - add support for lz4hc " Giovanni Cabiddu
2016-06-08  8:16 ` [PATCH v6 6/8] crypto: acomp - add support for 842 " Giovanni Cabiddu
2016-06-08  8:16 ` [PATCH v6 7/8] crypto: acomp - add support for deflate " Giovanni Cabiddu
2016-06-08  8:16 ` [PATCH v6 8/8] crypto: acomp - update testmgr with support for acomp Giovanni Cabiddu

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=20160613085612.GA7333@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=giovanni.cabiddu@intel.com \
    --cc=linux-crypto@vger.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.