Skip to contentSkip to conversation

MMC updates

GIT PULL Pierre Ossman 4 participants 9 messages May 8, 2007 – May 9, 2007 MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

Linus, please pull from

git://git.kernel.org/pub/scm/linux/kernel/git/drzeus/mmc.git for-linus

to receive the following updates:

 drivers/misc/tifm_7xx1.c   |   27 ++++++++++++++++++++++++---
 drivers/mmc/Kconfig        |   10 +++++-----
 drivers/mmc/card/Kconfig   |    3 +--
 drivers/mmc/core/Kconfig   |    1 -
 drivers/mmc/core/core.c    |   10 ++++++----
 drivers/mmc/host/Kconfig   |   19 +++++++++----------
 drivers/mmc/host/tifm_sd.c |   13 +------------
 include/linux/tifm.h       |    1 +
 8 files changed, 47 insertions(+), 37 deletions(-)

Alex Dubov (1):
disable socket power in adapter driver instead of media one

Jan Engelhardt (1):
mmc: Use menuconfig objects

Pierre Ossman (1):
mmc: use lock instead of claim in debug check

#1 lore raw
Quoted 4 lines · Pierre Ossman

Linus, please pull from

git://git.kernel.org/pub/scm/linux/kernel/git/drzeus/mmc.git for-linus

fsck! I pushed the wrong branch :/

This fix should have been in the last commit.

Sorry,

Signature · 5 lines
     -- Pierre Ossman

  Linux kernel, MMC maintainer        http://www.kernel.org
  PulseAudio, core developer          http://pulseaudio.org
  rdesktop, core developer          http://www.rdesktop.org

commit 3b9a6d78eb439016728c598a1373b50328f5e9fe

Author: Pierre Ossman <[email protected]>
Date:   Wed May 9 07:53:28 2007 +0200

mmc: fix wrong call to spinlock

Fix silly typo in spinlock calls.

drivers/mmc/core/core.c +2 -2
index b6c1670..7385acf 100644
@@ -501,9 +501,9 @@ void mmc_detect_change(struct mmc_host *host, unsigned long delay)
 {
 #ifdef CONFIG_MMC_DEBUG
 	unsigned long flags;
-	spin_lock_irqsave(host->lock, flags);
+	spin_lock_irqsave(&host->lock, flags);
 	BUG_ON(host->removed);
-	spin_unlock_irqrestore(host->lock, flags);
+	spin_unlock_irqrestore(&host->lock, flags);
 #endif
 
 	mmc_schedule_delayed_work(&host->detect, delay);
#2 lore raw
Quoted 32 lines · Pierre Ossman
Quoted 4 lines · Pierre Ossman

Linus, please pull from

git://git.kernel.org/pub/scm/linux/kernel/git/drzeus/mmc.git for-linus

fsck! I pushed the wrong branch :/

This fix should have been in the last commit.

Sorry,

------------------------------------------------------------------------

commit 3b9a6d78eb439016728c598a1373b50328f5e9fe

Author: Pierre Ossman <[email protected]>
Date:   Wed May 9 07:53:28 2007 +0200

mmc: fix wrong call to spinlock

Fix silly typo in spinlock calls.

drivers/mmc/core/core.c +0 -0
index b6c1670..7385acf 100644

drivers/mmc/core/core.c void mmc_detect_change(struct mmc_host *host, unsigned long delay) · line 507

Quoted 9 lines
drivers/mmc/core/core.c +2 -2
@@ -501,9 +501,9 @@ void mmc_detect_change(struct mmc_host *host, unsigned long delay)
 {
 #ifdef CONFIG_MMC_DEBUG
 	unsigned long flags;
-	spin_lock_irqsave(host->lock, flags);
+	spin_lock_irqsave(&host->lock, flags);
 	BUG_ON(host->removed);
-	spin_unlock_irqrestore(host->lock, flags);
+	spin_unlock_irqrestore(&host->lock, flags);
 #endif

Do you actually need the lock there at all? What is it protecting?

Signature · 1 line
SUSE Labs, Novell Inc.
#3 lore raw
Quoted 5 lines · Nick Piggin
Quoted 5 lines
drivers/mmc/core/core.c +0 -0
@@ -501,9 +501,9 @@ void mmc_detect_change(struct mmc_host *host,
 unsigned long delay)
 {
 #ifdef CONFIG_MMC_DEBUG
     unsigned long flags;
Quoted 9 lines

drivers/mmc/core/core.c void mmc_detect_change(struct mmc_host *host, unsigned long delay) · line 507

Quoted 6 lines
drivers/mmc/core/core.c +2 -2
-    spin_lock_irqsave(host->lock, flags);
+    spin_lock_irqsave(&host->lock, flags);
     BUG_ON(host->removed);
-    spin_unlock_irqrestore(host->lock, flags);
+    spin_unlock_irqrestore(&host->lock, flags);
 #endif

Do you actually need the lock there at all? What is it protecting?

It makes sure we don't have any race when it comes to modifying host->removed. We had some problems where controllers reported card insertion events even after they'd signaled to be removed, causing all kind of odd problems. This check was added to easier spot it should it arise again.

Rgds

Signature · 5 lines
     -- Pierre Ossman

  Linux kernel, MMC maintainer        http://www.kernel.org
  PulseAudio, core developer          http://pulseaudio.org
  rdesktop, core developer          http://www.rdesktop.org
#4 lore raw
Quoted 18 lines · Pierre Ossman
Quoted 5 lines · Nick Piggin
Quoted 5 lines
drivers/mmc/core/core.c +0 -0
@@ -501,9 +501,9 @@ void mmc_detect_change(struct mmc_host *host,
 unsigned long delay)
 {
 #ifdef CONFIG_MMC_DEBUG
    unsigned long flags;
Quoted 9 lines

drivers/mmc/core/core.c void mmc_detect_change(struct mmc_host *host, unsigned long delay) · line 507

Quoted 6 lines
drivers/mmc/core/core.c +2 -2
-    spin_lock_irqsave(host->lock, flags);
+    spin_lock_irqsave(&host->lock, flags);
    BUG_ON(host->removed);
-    spin_unlock_irqrestore(host->lock, flags);
+    spin_unlock_irqrestore(&host->lock, flags);
 #endif

Do you actually need the lock there at all? What is it protecting?

Quoted 2 lines

It makes sure we don't have any race when it comes to modifying host->removed.

If you want to ensure you always only modify host->removed from under the spinlock, it would be enforcable by introducing an accessor function and doing a BUG_ON(!spin_is_locked()) in there.

If you just want to ensure that host->removed is 0 at this point, you shouldn't need any spinlocks AFAIKS... that way you can probably afford to move it out from CONFIG_MMC_DEBUG and get wider testing.

Signature · 1 line
SUSE Labs, Novell Inc.
#5 lore raw
Quoted 9 lines · Nick Piggin

If you want to ensure you always only modify host->removed from under the spinlock, it would be enforcable by introducing an accessor function and doing a BUG_ON(!spin_is_locked()) in there.

If you just want to ensure that host->removed is 0 at this point, you shouldn't need any spinlocks AFAIKS... that way you can probably afford to move it out from CONFIG_MMC_DEBUG and get wider testing.

The host->removed member is only used for this simple test. It is set in mmc_host_remove() to indicate that the removal process has begun. At this point it is invalid to call mmc_detect_change() (the place this patch fixes). So the spinlocks are mostly there so that things are properly ordered when we go SMP. Some creative barriers would probably work as well, but I find spinlocks more "normal" and hence more readable.

Rgds

Signature · 5 lines
     -- Pierre Ossman

  Linux kernel, MMC maintainer        http://www.kernel.org
  PulseAudio, core developer          http://pulseaudio.org
  rdesktop, core developer          http://www.rdesktop.org
#6 lore raw
Quoted 12 lines · Pierre Ossman
Quoted 8 lines · Nick Piggin

If you want to ensure you always only modify host->removed from under the spinlock, it would be enforcable by introducing an accessor function and doing a BUG_ON(!spin_is_locked()) in there.

If you just want to ensure that host->removed is 0 at this point, you shouldn't need any spinlocks AFAIKS... that way you can probably afford to move it out from CONFIG_MMC_DEBUG and get wider testing.

Quoted 6 lines

The host->removed member is only used for this simple test. It is set in mmc_host_remove() to indicate that the removal process has begun. At this point it is invalid to call mmc_detect_change() (the place this patch fixes). So the spinlocks are mostly there so that things are properly ordered when we go SMP. Some creative barriers would probably work as well, but I find spinlocks more "normal" and hence more readable.

Fair enough. No big deal :)

Signature · 1 line
SUSE Labs, Novell Inc.
#7 lore raw
In reply to Pierre Ossman
Quoted 6 lines · Pierre Ossman

The host->removed member is only used for this simple test. It is set in mmc_host_remove() to indicate that the removal process has begun. At this point it is invalid to call mmc_detect_change() (the place this patch fixes). So the spinlocks are mostly there so that things are properly ordered when we go SMP. Some creative barriers would probably work as well, but I find spinlocks more "normal" and hence more readable.

Sounds to me like either struct xyz_host { atomic_t removed; } would do the job, or that actually wider regions of mmc_host_remove() and mmc_detect_change() need to be serialized.

Signature · 3 lines
Stefan Richter
-=====-=-=== -=-= -=--=
http://arcgraph.de/sr/
#8 lore raw
Quoted 4 lines · Stefan Richter

Sounds to me like either struct xyz_host { atomic_t removed; } would do the job, or that actually wider regions of mmc_host_remove() and mmc_detect_change() need to be serialized.

AFAIK, an atomic_t doesn't guarantee any ordering, just atomicity. So an atomic_t with a barrier would be sufficient. But barriers are mostly voodoo that few people understand ;)

Signature · 5 lines
     -- Pierre Ossman

  Linux kernel, MMC maintainer        http://www.kernel.org
  PulseAudio, core developer          http://pulseaudio.org
  rdesktop, core developer          http://www.rdesktop.org