mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Maxim Levitsky <maximlevitsky@gmail.com>
Cc: linux-mmc@vger.kernel.org, Philip Langdale <philipl@overt.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Jorg Schummer <ext-jorg.2.schummer@nokia.com>,
	linux-pm <linux-pm@lists.linux-foundation.org>
Subject: Re: [PATCH] MMC: fix hang if card was removed during suspend and unsafe resume was enabled
Date: Fri, 5 Feb 2010 06:13:35 -0800	[thread overview]
Message-ID: <20100205061335.b664aa20.akpm@linux-foundation.org> (raw)
In-Reply-To: <1265358702.3424.8.camel@maxim-laptop>

On Fri, 05 Feb 2010 10:31:42 +0200 Maxim Levitsky <maximlevitsky@gmail.com> wrote:

> On Thu, 2010-02-04 at 16:09 -0800, Andrew Morton wrote: 
> > On Fri,  5 Feb 2010 01:18:15 +0200 Maxim Levitsky <maximlevitsky@gmail.com> wrote:
> > 
> > > Currently removal of the card leads to del_disk called indirectly by mmc core.
> > > This function expects userspace to be running, which isn't when .resume is called
> > > 
> > > Fix that by removing the code that did that in mmc_resume_host. It is possible
> > > because card detection logic will kick it later and remove the card.
> > 
> > I don't really understand.  The above implies that to trigger this bug,
> > one needs to physically remove the card during a resume operation.  ie:
> > a human-vs-computer race.  Sounds unlikely?
> > 
> > So...  exactly what steps does the user need to take to trigger this
> 
> Sorry for describing this poorly.
> The steps are:
> 
> -> Have a kernel with CONFIG_MMC_UNSAFE_RESUME
> -> Insert MMC/SD card
> -> Suspend/hibernate the system
> -> While system is hibernated/suspended pull the card off
> -> Resume the system
> -> Hang
> 
> 
> if CONFIG_MMC_UNSAFE_RESUME is set, mmc core allows the user to
> suspend/resume the card normally assuming he won't change the card or
> modify it in another system. The former case is actually handled quite
> well.
> 
> if CONFIG_MMC_UNSAFE_RESUME isn't set, it removes the card during
> suspend, and I now think (and will test) that this will still hang the
> system this time on suspend.
> 
> Maybe we can make del_disk behave well if called with userspace frozen?
> After all if user calls it, very likely that hardware is absent thus
> there is no point in syncing (which I think triggers the hang)....
> 

There is no del_disk in the kernel.  Let's be more specific (and
accurate!) about the hang.  I assume it's
mmc_remove_card->device_del->kobject_uevent?

Yes, I'd have thought that it would be a good idea for the
kobject_uevent code (or lower, in call_usermodehelper) to take avoiding
action if userspace is frozen.  However such action would probably
involve doing a WARN_ON() too, so we'd still need MMC changes to avoid
that.



  reply	other threads:[~2010-02-05 14:13 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-03 17:47 Hand on resume if sd/mmc card was removed while system was suspended/hibernated Maxim Levitsky
2010-02-04 23:18 ` [PATCH] MMC: fix hang if card was removed during suspend and unsafe resume was enabled Maxim Levitsky
2010-02-05  0:09   ` Andrew Morton
2010-02-05  8:31     ` Maxim Levitsky
2010-02-05 14:13       ` Andrew Morton [this message]
2010-02-05 14:19         ` Maxim Levitsky
2010-02-05 14:39           ` Andrew Morton
2010-02-05 15:52             ` Maxim Levitsky
2010-02-05 16:19               ` Madhusudhan
2010-02-05 16:32                 ` Maxim Levitsky
2010-02-05 18:26               ` Andrew Morton
2010-02-05 19:58                 ` Maxim Levitsky
2010-02-05 10:17     ` Adrian Hunter
2010-02-05 13:42       ` 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=20100205061335.b664aa20.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=ext-jorg.2.schummer@nokia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=maximlevitsky@gmail.com \
    --cc=philipl@overt.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®