All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <jens.axboe@oracle.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>,
	Maxim Levitsky <maximlevitsky@gmail.com>,
	linux-pm <linux-pm@lists.linux-foundation.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [linux-pm] Is it supposed to be ok to call del_gendisk while userspace is frozen?
Date: Tue, 23 Feb 2010 13:33:21 +0100	[thread overview]
Message-ID: <20100223123321.GA1025@kernel.dk> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1002161126340.1281-100000@iolanthe.rowland.org>

On Tue, Feb 16 2010, Alan Stern wrote:
> On Mon, 15 Feb 2010, Rafael J. Wysocki wrote:
> 
> > On Monday 15 February 2010, Maxim Levitsky wrote:
> > > On Sat, 2010-02-13 at 15:29 +0200, Maxim Levitsky wrote: 
> > > > I noticed that currently calling del_gendisk leads to sure deadlock if
> > > > attemped from .suspend or .resume functions.
> > 
> > Well, it shouldn't be called from there, then.
> 
> Even if drivers avoid calling it from within suspend methods, they have
> to be able to call it from within resume methods.  After all, the
> resume method may find that the disk's device has vanished.

del_gendisk() needs process context at least, since it'll sleep (not
just for sync/invalidate, but other parts of the destruction as well).

> > > > Something like that:
> > > > 
> > > > [<ffffffff8106620a>] ? prepare_to_wait+0x2a/0x90
> > > > [<ffffffff810790bd>] ? trace_hardirqs_on+0xd/0x10
> > > > [<ffffffff8140db12>] ? _raw_spin_unlock_irqrestore+0x42/0x80
> > > > [<ffffffff8112a390>] ? bdi_sched_wait+0x0/0x20
> > > > [<ffffffff8112a39e>] bdi_sched_wait+0xe/0x20
> > > > [<ffffffff8140af6f>] __wait_on_bit+0x5f/0x90
> > > > [<ffffffff8112a390>] ? bdi_sched_wait+0x0/0x20
> > > > [<ffffffff8140b018>] out_of_line_wait_on_bit+0x78/0x90
> > > > [<ffffffff81065fd0>] ? wake_bit_function+0x0/0x40
> > > > [<ffffffff8112a2d3>] ? bdi_queue_work+0xa3/0xe0
> > > > [<ffffffff8112a37f>] bdi_sync_writeback+0x6f/0x80
> > > > [<ffffffff8112a3d2>] sync_inodes_sb+0x22/0x120
> > > > [<ffffffff8112f1d2>] __sync_filesystem+0x82/0x90
> > > > [<ffffffff8112f3db>] sync_filesystem+0x4b/0x70
> > > > [<ffffffff811391de>] fsync_bdev+0x2e/0x60
> > > > [<ffffffff812226be>] invalidate_partition+0x2e/0x50
> > > > [<ffffffff8116b92f>] del_gendisk+0x3f/0x140
> > > > [<ffffffffa00c0233>] mmc_blk_remove+0x33/0x60 [mmc_block]
> > > > [<ffffffff81338977>] mmc_bus_remove+0x17/0x20
> > > > [<ffffffff812ce746>] __device_release_driver+0x66/0xc0
> > > > [<ffffffff812ce89d>] device_release_driver+0x2d/0x40
> > > > [<ffffffff812cd9b5>] bus_remove_device+0xb5/0x120
> > > > [<ffffffff812cb46f>] device_del+0x12f/0x1a0
> > > > [<ffffffff81338a5b>] mmc_remove_card+0x5b/0x90
> > > > [<ffffffff8133ac27>] mmc_sd_remove+0x27/0x50
> > > > [<ffffffff81337d8c>] mmc_resume_host+0x10c/0x140
> > > > [<ffffffffa00850e9>] sdhci_resume_host+0x69/0xa0 [sdhci]
> > > > [<ffffffffa0bdc39e>] sdhci_pci_resume+0x8e/0xb0 [sdhci_pci]
> > > > 
> > > > bdi_queue_work seems to be the problem.
> > > > 
> > > > Some device drivers need to remove their cards logically in .suspend,
> > > > because the card is removable, and can be changed while system is
> > > > suspended.
> > 
> > I don't know how to resolve this right now.
> 
> This is a matter for Jens.  Is the bdi writeback task freezable?  If it
> is, should it be made unfreezable?

I'm not a big expect on what tasks should be freezable or not. As it
stands, the writeback tasks will attempt to freeze and thaw with the
system. I guess that screws the sync from resume call, since it's not
running and the sync will wait for it to retrieve and finish that work
item.

To the suspend experts - can we safely mark the writeback tasks as
non-freezable?

-- 
Jens Axboe


  parent reply	other threads:[~2010-02-23 12:33 UTC|newest]

Thread overview: 118+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-13 13:29 Is it supposed to be ok to call del_gendisk while userspace is frozen? Maxim Levitsky
2010-02-13 13:29 ` Maxim Levitsky
2010-02-15 16:00 ` Maxim Levitsky
2010-02-15 21:04   ` Rafael J. Wysocki
2010-02-15 21:04   ` Rafael J. Wysocki
2010-02-16 16:27     ` [linux-pm] " Alan Stern
2010-02-20 22:22       ` Maxim Levitsky
2010-02-20 22:22         ` [linux-pm] " Maxim Levitsky
2010-02-23 12:33       ` Jens Axboe
2010-02-23 12:33       ` Jens Axboe [this message]
2010-02-23 15:29         ` [linux-pm] " Alan Stern
2010-02-23 15:58           ` Jens Axboe
2010-02-23 15:58           ` [linux-pm] " Jens Axboe
2010-02-23 16:33             ` Alan Stern
2010-02-23 16:33             ` [linux-pm] " Alan Stern
2010-02-23 22:16               ` Jens Axboe
2010-02-24 15:59                 ` Alan Stern
2010-02-24 15:59                 ` [linux-pm] " Alan Stern
2010-02-24 19:12                   ` Jens Axboe
2010-02-24 19:12                   ` [linux-pm] " Jens Axboe
2010-02-24 20:19                     ` Alan Stern
2010-02-24 20:19                     ` Alan Stern
2010-02-23 22:16               ` Jens Axboe
2010-02-23 16:42             ` Testing for dirty buffers on a block device Alan Stern
2010-02-23 16:42             ` Alan Stern
2010-02-23 22:13               ` Jens Axboe
2010-02-24 15:51                 ` Alan Stern
2010-02-24 15:51                 ` Alan Stern
2010-02-24 19:09                   ` Jens Axboe
2010-02-24 20:09                     ` Alan Stern
2010-02-24 20:09                     ` Alan Stern
2010-02-25  8:20                       ` Jens Axboe
2010-02-25  8:20                       ` Jens Axboe
2010-02-25 22:19                         ` Dave Chinner
2010-02-25 22:19                         ` Dave Chinner
2010-02-24 19:09                   ` Jens Axboe
2010-02-23 22:13               ` Jens Axboe
2010-03-01  6:35           ` [linux-pm] Is it supposed to be ok to call del_gendisk while userspace is frozen? Pavel Machek
2010-03-01 15:23             ` Alan Stern
2010-03-03 21:50               ` Pavel Machek
2010-03-03 21:50               ` [linux-pm] " Pavel Machek
2010-03-03 22:23                 ` Alan Stern
2010-03-03 22:23                 ` [linux-pm] " Alan Stern
2010-03-04  0:23                   ` Rafael J. Wysocki
2010-03-04  2:48                     ` Alan Stern
2010-03-04  2:48                     ` [linux-pm] " Alan Stern
2010-03-04 19:26                       ` Rafael J. Wysocki
2010-03-04 19:36                         ` Alan Stern
2010-03-04 19:36                           ` [linux-pm] " Alan Stern
2010-03-04 20:04                           ` Rafael J. Wysocki
2010-03-04 20:04                           ` Rafael J. Wysocki
2010-03-04 20:15                         ` Pavel Machek
2010-03-04 20:15                           ` [linux-pm] " Pavel Machek
2010-04-22 23:40                           ` Matt Reimer
2010-04-22 23:40                           ` [linux-pm] " Matt Reimer
2010-04-23  5:17                             ` Rafael J. Wysocki
2010-05-11 23:55                               ` Matt Reimer
2010-05-11 23:55                               ` [linux-pm] " Matt Reimer
2010-05-12 14:50                                 ` Alan Stern
2010-05-12 14:50                                 ` [linux-pm] " Alan Stern
2010-05-13 21:44                                   ` Matt Reimer
2010-05-13 21:54                                     ` Alan Stern
2010-05-13 21:54                                     ` [linux-pm] " Alan Stern
2010-05-13 22:20                                       ` Matt Reimer
2010-05-13 22:20                                       ` [linux-pm] " Matt Reimer
2010-05-13 22:47                                         ` Nigel Cunningham
2010-05-13 22:47                                         ` [linux-pm] " Nigel Cunningham
2010-05-15  2:37                                           ` Alan Stern
2010-05-15  2:37                                           ` [linux-pm] " Alan Stern
2010-05-15  2:53                                             ` Nigel Cunningham
2010-05-15  2:53                                             ` [linux-pm] " Nigel Cunningham
2010-05-16 19:35                                               ` Rafael J. Wysocki
2010-05-16 19:35                                               ` Rafael J. Wysocki
2010-05-15  2:32                                         ` Alan Stern
2010-05-15  2:32                                         ` [linux-pm] " Alan Stern
2010-05-15 20:30                                           ` Rafael J. Wysocki
2010-05-16  7:49                                             ` Nigel Cunningham
2010-05-16  7:49                                             ` [linux-pm] " Nigel Cunningham
2010-05-16 19:38                                               ` Rafael J. Wysocki
2010-05-16 19:38                                               ` [linux-pm] " Rafael J. Wysocki
2010-05-16 21:32                                                 ` Nigel Cunningham
2010-05-17  2:22                                                   ` Alan Stern
2010-05-17  7:45                                                     ` Nigel Cunningham
2010-05-17  7:45                                                     ` [linux-pm] " Nigel Cunningham
2010-05-17 20:35                                                       ` Rafael J. Wysocki
2010-05-17 22:51                                                         ` Nigel Cunningham
2010-05-18 19:43                                                           ` Rafael J. Wysocki
2010-05-18 20:06                                                             ` Alan Stern
2010-05-18 20:06                                                             ` [linux-pm] " Alan Stern
2010-05-18 19:43                                                           ` Rafael J. Wysocki
2010-05-24 19:02                                                           ` Pavel Machek
2010-05-24 19:02                                                           ` [linux-pm] " Pavel Machek
2010-05-24 21:21                                                             ` Nigel Cunningham
2010-05-24 21:21                                                             ` [linux-pm] " Nigel Cunningham
2010-05-17 22:51                                                         ` Nigel Cunningham
2010-05-17 20:35                                                       ` Rafael J. Wysocki
2010-05-17  2:22                                                   ` Alan Stern
2010-05-16 21:32                                                 ` Nigel Cunningham
2010-05-15 20:30                                           ` Rafael J. Wysocki
2010-05-13 21:44                                   ` Matt Reimer
2010-04-23  5:17                             ` Rafael J. Wysocki
2010-03-04 19:26                       ` Rafael J. Wysocki
2010-03-04  0:23                   ` Rafael J. Wysocki
2010-03-04 13:53                   ` Pavel Machek
2010-03-04 13:53                   ` [linux-pm] " Pavel Machek
2010-06-04 11:20                     ` Maxim Levitsky
2010-06-04 14:59                       ` Alan Stern
2010-06-04 14:59                       ` [linux-pm] " Alan Stern
2010-06-04 15:19                         ` Maxim Levitsky
2010-06-04 17:52                           ` Alan Stern
2010-06-04 17:52                           ` [linux-pm] " Alan Stern
2010-06-04 15:19                         ` Maxim Levitsky
2010-06-04 11:20                     ` Maxim Levitsky
2010-03-01 15:23             ` Alan Stern
2010-03-01  6:35           ` Pavel Machek
2010-02-23 15:29         ` Alan Stern
2010-02-16 16:27     ` Alan Stern
2010-02-15 16:00 ` Maxim Levitsky

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=20100223123321.GA1025@kernel.dk \
    --to=jens.axboe@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=maximlevitsky@gmail.com \
    --cc=rjw@sisk.pl \
    --cc=stern@rowland.harvard.edu \
    /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.