All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Snitzer <snitzer@redhat.com>
To: Mikulas Patocka <mpatocka@redhat.com>
Cc: Tejun Heo <tj@kernel.org>,
	dm-devel@redhat.com, Lisa Du <chunlingdu1@gmail.com>,
	"Alasdair G. Kergon" <agk@redhat.com>
Subject: Re: dm-crypt: remove per-cpu structure
Date: Thu, 20 Feb 2014 21:32:40 -0500	[thread overview]
Message-ID: <20140221023240.GA338@redhat.com> (raw)
In-Reply-To: <alpine.LRH.2.02.1402201907120.29698@file01.intranet.prod.int.rdu2.redhat.com>

On Thu, Feb 20 2014 at  7:10pm -0500,
Mikulas Patocka <mpatocka@redhat.com> wrote:

> 
> 
> On Thu, 20 Feb 2014, Mike Snitzer wrote:
> 
> > On Thu, Feb 20 2014 at  6:01pm -0500,
> > Mikulas Patocka <mpatocka@redhat.com> wrote:
> > 
> > > Dm-crypt used per-cpu structures to hold pointers to ablkcipher_request.
> > > The code assumed that the work item keeps executing on a single CPU, so it
> > > used no synchronization when accessing this structure.
> > > 
> > > When we disable a CPU by writing zero to
> > > /sys/devices/system/cpu/cpu*/online, the work item could be moved to
> > > another CPU. This causes crashes in dm-crypt because the code starts using
> > > a wrong ablkcipher_request.
> > > 
> > > This patch fixes this bug by removing the percpu definition. The structure
> > > ablkcipher_request is accessed via a pointer from convert_context.
> > > Consequently, if the work item is rescheduled to a different CPU, the
> > > thread still uses the same ablkcipher_request.
> > 
> > Hi Mikulas,
> > 
> > Obviously avoiding crashes is more important than performance.
> > 
> > But are we losing performance by switching away from using percpu?  Do
> > we care?  I'd like to see the header to speak to the potential for
> > slowdown (if there is any).
> 
> There is one more allocation per request than before. I don't know how 
> much does it cost.

OK, any reason you didn't fix this up by using cpu hotplug hooks like
Tejun suggested?  Too complicated?
 
> We could also modify the code to use per_bio_data to save one allocation.

OK, sounds like a good win.  Can you write a separate followup patch
that makes use of per_bio_data?

  reply	other threads:[~2014-02-21  2:32 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-20 23:01 [PATCH] dm-crypt: remove per-cpu structure Mikulas Patocka
2014-02-20 23:59 ` Mike Snitzer
2014-02-21  0:10   ` Mikulas Patocka
2014-02-21  2:32     ` Mike Snitzer [this message]
2014-02-21  7:41       ` Mikulas Patocka
2014-02-22 10:28         ` Milan Broz
2014-02-22 14:25           ` Mike Snitzer
2014-02-22 17:34             ` Milan Broz
2014-02-22 18:29               ` Mike Snitzer
2014-02-22 18:58                 ` Milan Broz
2014-02-27  1:12               ` Mikulas Patocka

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=20140221023240.GA338@redhat.com \
    --to=snitzer@redhat.com \
    --cc=agk@redhat.com \
    --cc=chunlingdu1@gmail.com \
    --cc=dm-devel@redhat.com \
    --cc=mpatocka@redhat.com \
    --cc=tj@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.