Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mmc: core: Avoid bitfield RMW for claim/retune flags

Move claimed and retune control flags out of the bitfield word to
avoid unrelated RMW side effects in asynchronous contexts.

The host->claimed bit shared a word with retune flags. Writes to claimed
in __mmc_claim_host() or retune_now in mmc_mq_queue_rq() can overwrite
other bits when concurrent updates happen in other contexts, triggering
spurious WARN_ON(!host->claimed). Convert claimed, can_retune,
retune_now and retune_paused to bool to remove shared-word coupling.

Fixes: 6c0cedd1ef952 ("mmc: core: Introduce host claiming by context")
Fixes: 1e8e55b67030c ("mmc: block: Add CQE support")
Cc: stable@vger.kernel.org
Suggested-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Penghe Geng <pgeng@nvidia.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

authored by

Penghe Geng and committed by
Ulf Hansson
901084c5 79ad4715

+5 -4
+5 -4
include/linux/mmc/host.h
··· 486 486 487 487 struct mmc_ios ios; /* current io bus settings */ 488 488 489 + bool claimed; /* host exclusively claimed */ 490 + 489 491 /* group bitfields together to minimize padding */ 490 492 unsigned int use_spi_crc:1; 491 - unsigned int claimed:1; /* host exclusively claimed */ 492 493 unsigned int doing_init_tune:1; /* initial tuning in progress */ 493 - unsigned int can_retune:1; /* re-tuning can be used */ 494 494 unsigned int doing_retune:1; /* re-tuning in progress */ 495 - unsigned int retune_now:1; /* do re-tuning at next req */ 496 - unsigned int retune_paused:1; /* re-tuning is temporarily disabled */ 497 495 unsigned int retune_crc_disable:1; /* don't trigger retune upon crc */ 498 496 unsigned int can_dma_map_merge:1; /* merging can be used */ 499 497 unsigned int vqmmc_enabled:1; /* vqmmc regulator is enabled */ ··· 506 508 int rescan_disable; /* disable card detection */ 507 509 int rescan_entered; /* used with nonremovable devices */ 508 510 511 + bool can_retune; /* re-tuning can be used */ 512 + bool retune_now; /* do re-tuning at next req */ 513 + bool retune_paused; /* re-tuning is temporarily disabled */ 509 514 int need_retune; /* re-tuning is needed */ 510 515 int hold_retune; /* hold off re-tuning */ 511 516 unsigned int retune_period; /* re-tuning period in secs */