All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Snitzer <snitzer@redhat.com>
To: Mikulas Patocka <mpatocka@redhat.com>
Cc: device-mapper development <dm-devel@redhat.com>,
	"Bryn M. Reeves" <breeves@redhat.com>,
	ejt@redhat.com, Alasdair G Kergon <agk@redhat.com>,
	Zdenek Kabelac <zkabelac@redhat.com>
Subject: Re: staged dm_internal_{suspend, resume} related changes for wider review
Date: Mon, 5 Jan 2015 10:50:43 -0500	[thread overview]
Message-ID: <20150105155043.GA2260@redhat.com> (raw)
In-Reply-To: <alpine.LRH.2.02.1501021741470.23294@file01.intranet.prod.int.rdu2.redhat.com>

On Fri, Jan 02 2015 at  5:56pm -0500,
Mikulas Patocka <mpatocka@redhat.com> wrote:

> Hi, I'm back.
> 
> I looked at current internal suspend code in 3.19.
> 
> One thing that seems strange is this:
> 
> static void __dm_internal_suspend(struct mapped_device *md, unsigned suspend_flags)
> {
>         struct dm_table *map = NULL;
> 
>         if (dm_suspended_internally_md(md))
>                 return; /* nested internal suspend */
> ....
> static void __dm_internal_resume(struct mapped_device *md)
> {
>         if (!dm_suspended_internally_md(md))
>                 return; /* resume from nested internal suspend */
> 
> - the comments imply that the code supports nested internal suspend, while 
> in fact it doesn't. If the caller calls:
> * dm_internal_suspend_noflush
> * dm_internal_suspend_noflush
> * dm_internal_resume
> the device is not suspended while it should be.

Yes, very true, it should.  But IIRC in practice it doesn't hurt us to
not be bothered about being so precise given the current caller.

> The "if" branch in __dm_internal_resume has nothing to do with nested 
> suspend, it's called if the caller calls dm_internal_resume without 
> dm_internal_suspend_noflush - that shouldn't happen, so there should be 
> WARN or BUG.

The first internal resume would've cleared the DM_INTERNAL_SUSPEND_FLAG,
etc.  So AFAICT the code in question does also cover multiple internal
suspends/resumes (albeit without the counter you've suggested).

But I did narrowly define "nested suspend" as an internal suspend that
arrives _after_ a normal suspend.

From the header of commit ffcc39364 ("dm: enhance internal suspend and
resume interface"):

    Both DM_SUSPEND_FLAG and DM_INTERNAL_SUSPEND_FLAG may be set if a device
    was already suspended when dm_internal_suspend_noflush() was called --
    this can be thought of as a "nested suspend".  A "nested suspend" can
    occur with legacy userspace dm-thin code that might suspend all active
    thin volumes before suspending the pool for resize.

Could be the reality is "nested suspend" is also supporting the case of
multiple internal suspends.

> If you want to support multiple internal suspends (which is needed if one 
> table can have multiple dm-thin targets), you need a counter that counts 
> how many times the device was suspended - the counter doesn't have to be 
> atomic because the code already holds md->suspend_lock. If you don't want 
> to support multiple internal suspends, there should be at least WARN when 
> the caller attempts to do it.

I'll have a look.  Will need some time to revisit this line of work.

FYI, the device-mapper-test-suite has fairly comprehensive test coverage
for all supported scenarios, e.g.:

# dmtest run --suite thin-provisioning -t /SuspendTests/
Loaded suite thin-provisioning
Started
SuspendTests
  nested_internal_suspend_using_inactive_table...PASS
  suspend_pool_active_thins_no_io...PASS
  suspend_pool_after_suspend_thin...PASS
  suspend_pool_concurrent_suspend...PASS
  suspend_pool_no_active_thins...PASS
  suspend_pool_no_thins...PASS
  suspend_pool_resume_thin...PASS
  suspend_pool_suspended_thin...PASS
  wait_on_bit_during_resume...PASS
  wait_on_bit_during_suspend...PASS

# dmtest run --suite thin-provisioning -n activate_thin_while_pool_suspended_fails
Loaded suite thin-provisioning
Started
CreationTests
  activate_thin_while_pool_suspended_fails...PASS

So any changes in this area need to be verified using dmts.

  reply	other threads:[~2015-01-05 15:50 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20141028014825.GA21949@redhat.com>
     [not found] ` <544F988D.7090901@redhat.com>
     [not found]   ` <20141028134012.GA25229@redhat.com>
     [not found]     ` <20141028141749.GD25229@redhat.com>
     [not found]       ` <20141028143742.GE25229@redhat.com>
     [not found]         ` <20141028171003.GG25229@redhat.com>
     [not found]           ` <20141028224753.GA29288@redhat.com>
     [not found]             ` <20141028232638.GB29288@redhat.com>
     [not found]               ` <20141029002125.GC29288@redhat.com>
2014-10-29  1:22                 ` staged dm_internal_{suspend, resume} related changes for wider review Mike Snitzer
2014-10-29 19:06                   ` Mike Snitzer
2014-10-29 20:49                     ` Mike Snitzer
2014-11-03 23:25                   ` Mikulas Patocka
2014-11-04  0:17                     ` Mike Snitzer
2014-11-05  1:16                       ` Mike Snitzer
2014-11-05 12:43                         ` Mikulas Patocka
2014-11-05 13:05                           ` Mikulas Patocka
2014-11-05 14:11                             ` Mike Snitzer
2014-11-05 14:37                               ` Mikulas Patocka
2014-11-05 14:50                                 ` Zdenek Kabelac
2014-11-05 16:10                                 ` Mike Snitzer
2014-11-05 16:56                                   ` Mike Snitzer
2014-11-05 20:16                                     ` Mike Snitzer
2014-11-05 16:29                                 ` Mike Snitzer
2014-11-07 16:20                                   ` Mikulas Patocka
2014-11-07 18:33                                     ` Mike Snitzer
2015-01-02 22:56                                       ` Mikulas Patocka
2015-01-05 15:50                                         ` Mike Snitzer [this message]
2015-01-08 23:52                                           ` [PATCH] dm: handle multiple internal suspends correctly (was: staged dm_internal_{suspend, resume} related changes for wider review) Mikulas Patocka
2014-11-07 23:16                                     ` [PATCH] Suspend all active bios when the pool is suspended " Mikulas Patocka
2014-11-07 23:29                                       ` Mike Snitzer
2014-11-09  1:17                                       ` [PATCH] " Mike Snitzer

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=20150105155043.GA2260@redhat.com \
    --to=snitzer@redhat.com \
    --cc=agk@redhat.com \
    --cc=breeves@redhat.com \
    --cc=dm-devel@redhat.com \
    --cc=ejt@redhat.com \
    --cc=mpatocka@redhat.com \
    --cc=zkabelac@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.