Linux-Wireless Archive on
 help / color / Atom feed
From: Doug Anderson <>
To: Ulf Hansson <>
Cc: Linux MMC List <>,
	Adrian Hunter <>,
	Brian Norris <>,
	Shawn Lin <>,
	Guenter Roeck <>,
	Heiko Stuebner <>,
	Kalle Valo <>,
	linux-wireless <>,
	"# 4.0+" <>
Subject: Re: [PATCH] mmc: core: Prevent processing SDIO IRQs when the card is suspended
Date: Fri, 14 Jun 2019 08:41:58 -0700
Message-ID: <> (raw)
In-Reply-To: <>


On Fri, Jun 14, 2019 at 4:56 AM Ulf Hansson <> wrote:
> > I was more worried about the safety of mmc_card_set_suspended()
> > itself.  That is:
> >
> > #define mmc_card_set_suspended(c) ((c)->state |= MMC_STATE_SUSPENDED)
> >
> > it's doing a read-modify-write of "state".  Is that safe to do
> > without any type of locking?
> In this case, yes I think so.
> The point is, it really doesn't matter if the reader (work or thread),
> reads a non-updated value, because the synchronization is managed by
> the later mmc_claim_host() and the cancel_delayed_work_sync().

If this were just an "int" then perhaps, but this is a bitfield.  So
if someone else updates the bitfield at the same time then we can
fully clobber their modification or they can clobber ours, right?

task 1: load "state" from memory into CPU register on cpu0
task 2: load "state" from memory into CPU register on cpu1
task 1: write "state" from CPU register on cpu0
task 2: write "state" from CPU register on cpu1 now we've clobbered MMC_CARD_REMOVED.  ...or am I just being
paranoid here and everything else in "state" is somehow guaranteed to
not be touched at the same time this function is running?


  reply index

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-11 12:32 Ulf Hansson
2019-06-12 22:20 ` Doug Anderson
2019-06-13  9:29   ` Ulf Hansson
2019-06-13 18:05     ` Doug Anderson
2019-06-14 11:55       ` Ulf Hansson
2019-06-14 15:41         ` Doug Anderson [this message]
2019-06-17  9:56           ` Ulf Hansson

Reply instructions:

You may reply publically 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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='' \ \ \ \ \ \ \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-Wireless Archive on

Archives are clonable:
	git clone --mirror linux-wireless/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-wireless linux-wireless/ \
	public-inbox-index linux-wireless

Newsgroup available over NNTP:

AGPL code for this site: git clone public-inbox