All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mikulas Patocka <mpatocka@redhat.com>
To: Ignat Korchagin <ignat@cloudflare.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	"David S. Miller" <davem@davemloft.net>
Cc: Mike Snitzer <snitzer@redhat.com>,
	agk@redhat.com, dm-devel@redhat.com, dm-crypt@saout.de,
	linux-kernel@vger.kernel.org, kernel-team@cloudflare.com
Subject: Re: [RFC PATCH 0/1] dm-crypt excessive overhead
Date: Fri, 19 Jun 2020 14:39:39 -0400 (EDT)	[thread overview]
Message-ID: <alpine.LRH.2.02.2006191429060.23991@file01.intranet.prod.int.rdu2.redhat.com> (raw)
In-Reply-To: <20200619165548.GA24779@redhat.com>



On Fri, 19 Jun 2020, Mike Snitzer wrote:

> On Fri, Jun 19 2020 at 12:41pm -0400,
> Ignat Korchagin <ignat@cloudflare.com> wrote:
> 
> > This is a follow up from the long-forgotten [1], but with some more convincing
> > evidence. Consider the following script:
> > 
> > [1]: https://www.spinics.net/lists/dm-crypt/msg07516.html
> > [2]: https://blog.cloudflare.com/speeding-up-linux-disk-encryption/
> > 
> > Ignat Korchagin (1):
> >   Add DM_CRYPT_FORCE_INLINE flag to dm-crypt target
> > 
> >  drivers/md/dm-crypt.c | 55 +++++++++++++++++++++++++++++++++----------
> >  1 file changed, 43 insertions(+), 12 deletions(-)
> > 
> > -- 
> > 2.20.1
> > 
> 
> Hi,
> 
> I saw [2] and have been expecting something from cloudflare ever since.
> Nice to see this submission.
> 
> There is useful context in your 0th patch header.  I'll likely merge
> parts of this patch header with the more terse 1/1 header (reality is
> there only needed to be a single patch submission).
> 
> Will review and stage accordingly if all looks fine to me.  Mikulas,
> please have a look too.
> 
> Thanks,
> Mike

+       if (test_bit(DM_CRYPT_FORCE_INLINE, &cc->flags)) {
+               if (in_irq()) {
+                       /* Crypto API will fail hard in hard IRQ context */
+                       tasklet_init(&io->tasklet, kcryptd_crypt_tasklet, (unsigned long)&io->work);
+                       tasklet_schedule(&io->tasklet);
+               } else
+                       kcryptd_crypt(&io->work);
+       } else {
+               INIT_WORK(&io->work, kcryptd_crypt);
+               queue_work(cc->crypt_queue, &io->work);
+       }

I'm looking at this and I'd like to know why does the crypto API fail in 
hard-irq context and why does it work in tasklet context. What's the exact 
reason behind this?

Mikulas


WARNING: multiple messages have this Message-ID (diff)
From: Mikulas Patocka <mpatocka@redhat.com>
To: Ignat Korchagin <ignat@cloudflare.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	"David S. Miller" <davem@davemloft.net>
Cc: Mike Snitzer <snitzer@redhat.com>,
	agk@redhat.com, dm-devel@redhat.com, dm-crypt@saout.de,
	linux-kernel@vger.kernel.org, kernel-team@cloudflare.com
Subject: Re: [dm-crypt] [RFC PATCH 0/1] dm-crypt excessive overhead
Date: Fri, 19 Jun 2020 14:39:39 -0400 (EDT)	[thread overview]
Message-ID: <alpine.LRH.2.02.2006191429060.23991@file01.intranet.prod.int.rdu2.redhat.com> (raw)
In-Reply-To: <20200619165548.GA24779@redhat.com>



On Fri, 19 Jun 2020, Mike Snitzer wrote:

> On Fri, Jun 19 2020 at 12:41pm -0400,
> Ignat Korchagin <ignat@cloudflare.com> wrote:
> 
> > This is a follow up from the long-forgotten [1], but with some more convincing
> > evidence. Consider the following script:
> > 
> > [1]: https://www.spinics.net/lists/dm-crypt/msg07516.html
> > [2]: https://blog.cloudflare.com/speeding-up-linux-disk-encryption/
> > 
> > Ignat Korchagin (1):
> >   Add DM_CRYPT_FORCE_INLINE flag to dm-crypt target
> > 
> >  drivers/md/dm-crypt.c | 55 +++++++++++++++++++++++++++++++++----------
> >  1 file changed, 43 insertions(+), 12 deletions(-)
> > 
> > -- 
> > 2.20.1
> > 
> 
> Hi,
> 
> I saw [2] and have been expecting something from cloudflare ever since.
> Nice to see this submission.
> 
> There is useful context in your 0th patch header.  I'll likely merge
> parts of this patch header with the more terse 1/1 header (reality is
> there only needed to be a single patch submission).
> 
> Will review and stage accordingly if all looks fine to me.  Mikulas,
> please have a look too.
> 
> Thanks,
> Mike

+       if (test_bit(DM_CRYPT_FORCE_INLINE, &cc->flags)) {
+               if (in_irq()) {
+                       /* Crypto API will fail hard in hard IRQ context */
+                       tasklet_init(&io->tasklet, kcryptd_crypt_tasklet, (unsigned long)&io->work);
+                       tasklet_schedule(&io->tasklet);
+               } else
+                       kcryptd_crypt(&io->work);
+       } else {
+               INIT_WORK(&io->work, kcryptd_crypt);
+               queue_work(cc->crypt_queue, &io->work);
+       }

I'm looking at this and I'd like to know why does the crypto API fail in 
hard-irq context and why does it work in tasklet context. What's the exact 
reason behind this?

Mikulas

  reply	other threads:[~2020-06-19 18:39 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-19 16:41 [RFC PATCH 0/1] dm-crypt excessive overhead Ignat Korchagin
2020-06-19 16:41 ` [dm-crypt] " Ignat Korchagin
2020-06-19 16:41 ` [RFC PATCH 1/1] Add DM_CRYPT_FORCE_INLINE flag to dm-crypt target Ignat Korchagin
2020-06-19 16:41   ` [dm-crypt] " Ignat Korchagin
2020-06-24  5:04   ` Eric Biggers
2020-06-24  5:21     ` [dm-devel] " Damien Le Moal
2020-06-24  5:21       ` [dm-crypt] [dm-devel] " Damien Le Moal
2020-06-24  5:27       ` [dm-devel] [dm-crypt] " Eric Biggers
2020-06-24  5:27         ` [dm-crypt] [dm-devel] " Eric Biggers
2020-06-24  6:46         ` [dm-devel] [dm-crypt] " Damien Le Moal
2020-06-24  6:46           ` [dm-crypt] [dm-devel] " Damien Le Moal
2020-06-24  7:24         ` [dm-devel] [dm-crypt] " Damien Le Moal
2020-06-24  7:24           ` [dm-crypt] [dm-devel] " Damien Le Moal
2020-06-24  7:49     ` [dm-devel] [dm-crypt] " Damien Le Moal
2020-06-24  7:49       ` [dm-crypt] [dm-devel] " Damien Le Moal
2020-06-24  8:24     ` [dm-crypt] " Ignat Korchagin
2020-06-24 16:24       ` Eric Biggers
2020-06-24 17:00         ` Ignat Korchagin
2020-06-24  5:12   ` [dm-devel] " Damien Le Moal
2020-06-24  5:12     ` [dm-crypt] " Damien Le Moal
2020-06-19 16:55 ` [RFC PATCH 0/1] dm-crypt excessive overhead Mike Snitzer
2020-06-19 16:55   ` [dm-crypt] " Mike Snitzer
2020-06-19 18:39   ` Mikulas Patocka [this message]
2020-06-19 18:39     ` Mikulas Patocka
2020-06-19 19:44     ` Ignat Korchagin
2020-06-19 19:44       ` [dm-crypt] " Ignat Korchagin
2020-06-20  1:23     ` Herbert Xu
2020-06-20  1:23       ` [dm-crypt] " Herbert Xu
2020-06-20 19:36       ` Mikulas Patocka
2020-06-20 19:36         ` Mikulas Patocka
2020-06-20 19:36         ` [dm-crypt] " Mikulas Patocka
2020-06-20 21:02         ` Ignat Korchagin
2020-06-20 21:02           ` Ignat Korchagin
2020-06-20 21:02           ` [dm-crypt] " Ignat Korchagin
2020-06-23 15:33       ` Mike Snitzer
2020-06-23 15:33         ` Mike Snitzer
2020-06-23 15:33         ` [dm-crypt] " Mike Snitzer
2020-06-23 16:24         ` Ignat Korchagin
2020-06-23 16:24           ` [dm-crypt] " Ignat Korchagin
2020-06-24  0:23           ` Herbert Xu
2020-06-24  0:23             ` [dm-crypt] " Herbert Xu
2020-06-22  0:45   ` [dm-devel] " Damien Le Moal
2020-06-22  0:45     ` Damien Le Moal
2020-06-22  0:45     ` [dm-crypt] [dm-devel] " Damien Le Moal
2020-06-22  7:55     ` Ignat Korchagin
2020-06-22  7:55       ` [dm-crypt] " Ignat Korchagin
2020-06-22  8:08       ` Damien Le Moal
2020-06-22  8:08         ` Damien Le Moal
2020-06-22  8:08         ` [dm-crypt] [dm-devel] " Damien Le Moal
2020-06-23 15:01     ` Mike Snitzer
2020-06-23 15:01       ` [dm-crypt] " Mike Snitzer
2020-06-23 15:07       ` Ignat Korchagin
2020-06-23 15:07         ` [dm-crypt] " Ignat Korchagin
2020-06-23 15:22         ` Mike Snitzer
2020-06-23 15:22           ` [dm-crypt] " Mike Snitzer
2020-06-24  4:54           ` [dm-devel] " Damien Le Moal
2020-06-24  4:54             ` [dm-crypt] " Damien Le Moal
2020-06-24  5:22             ` Mike Snitzer
2020-06-24  5:22               ` Mike Snitzer
2020-06-24  5:22               ` [dm-crypt] " Mike Snitzer
2020-06-24  8:02               ` Ignat Korchagin
2020-06-24  8:02                 ` [dm-crypt] " Ignat Korchagin
2020-06-24  4:28       ` Damien Le Moal
2020-06-24  4:28         ` Damien Le Moal
2020-06-24  4:28         ` [dm-crypt] " Damien Le Moal

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=alpine.LRH.2.02.2006191429060.23991@file01.intranet.prod.int.rdu2.redhat.com \
    --to=mpatocka@redhat.com \
    --cc=agk@redhat.com \
    --cc=davem@davemloft.net \
    --cc=dm-crypt@saout.de \
    --cc=dm-devel@redhat.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=ignat@cloudflare.com \
    --cc=kernel-team@cloudflare.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=snitzer@redhat.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 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.