From: Milan Broz <mbroz@redhat.com>
To: FAN ZHANG <fzhangcsc@yahoo.com>
Cc: "dm-crypt@saout.de" <dm-crypt@saout.de>
Subject: Re: [dm-crypt] dm-crypt design and decision
Date: Mon, 30 Jan 2012 08:53:06 +0100 [thread overview]
Message-ID: <4F264C62.3030105@redhat.com> (raw)
In-Reply-To: <1327876251.92493.YahooMailNeo@web161401.mail.bf1.yahoo.com>
On 01/29/2012 11:30 PM, FAN ZHANG wrote:
> I have two questions with the design of dm-crypt.
> 1. Why need call kcryptd_queue_io() and
> kcryptd_queue_crypt() to put request bio to io_queue and crypt_queue?
> Actually, for read we could clone a bio in crypt_map() and call
> generic_make_request() directly and in crypt_endio(), we simply decrypt the data
> for write, we simply encrypt data in crypt_map() and call generic_make_request() to write encrypted bio to low level block device.
Long time ago it was this way. You cannot block in crypt_map
(allocation etc), basically it is deadlock prevention.
Imagine stacked dmcrypt mappings, if one device
is blocked in crypt_map and waiting for another one to finish
IO, it will deadlock.
> 2. If we really need to queue the bio request, why we need two queues instead combining io_queueand crypt_queuetogether?
the same, deadlock prevention.
> 3. Why need to call kcryptd_crypt_write_io_submit(io, error, 1) in
> kcryptd_async_done() to do async write via io_queue instead of call
> kcryptd_crypt_write_io_submit(io, error, 0) to do sync write?
You are probably missing asynchronous encryption path
where you cannot submit (generic_make_request())
IO from async callback in interrupt mode.
Most of the users use sync path (this include
even AES_NI and similar accelerators) but
if async crypto driver is used, you have to
use separate workqueue for IO processing.
For testing, you can force crypto layer to use cryptd
and use async path im dmcrypt, just patch dmcrypt using this chunk
(and enable proper crypto switches in .config for cryptd)
@@ -1267,7 +1267,7 @@ static int crypt_ctr_cipher(struct dm_target *ti,
goto bad_mem;
ret = snprintf(cipher_api, CRYPTO_MAX_ALG_NAME,
- "%s(%s)", chainmode, cipher);
+ "cryptd(%s(%s-generic))", chainmode, cipher);
Milan
prev parent reply other threads:[~2012-01-30 7:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.1.1327748402.1421.dm-crypt@saout.de>
2012-01-29 22:30 ` [dm-crypt] dm-crypt design and decision FAN ZHANG
2012-01-30 7:53 ` Milan Broz [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=4F264C62.3030105@redhat.com \
--to=mbroz@redhat.com \
--cc=dm-crypt@saout.de \
--cc=fzhangcsc@yahoo.com \
/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