public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Courtney Cavin <courtney.cavin@sonymobile.com>
Cc: Rob Herring <robherring2@gmail.com>,
	Josh Cartwright <joshc@codeaurora.org>,
	"s-anna@ti.com" <s-anna@ti.com>,
	Rob Herring <rob.herring@calxeda.com>,
	"Wysocki, Rafael J" <rafael.j.wysocki@intel.com>,
	Mark Langsdorf <mark.langsdorf@calxeda.com>,
	Tony Lindgren <tony@atomide.com>,
	"omar.ramirez@copitl.com" <omar.ramirez@copitl.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	Pawel Moll <pawel.moll@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Ian Campbell <ijc+devicetree@hellion.org.uk>,
	Kumar Gala <galak@codeaurora.org>, Rob Landley <rob@landley.net>,
	"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [RFC 1/6] mailbox: add core framework
Date: Fri, 14 Feb 2014 20:48:25 +0100	[thread overview]
Message-ID: <201402142048.25456.arnd@arndb.de> (raw)
In-Reply-To: <20140212183143.GD1706@sonymobile.com>

On Wednesday 12 February 2014, Courtney Cavin wrote:
> On Tue, Feb 11, 2014 at 09:35:01AM +0100, Arnd Bergmann wrote:
> > On Monday 10 February 2014 16:23:48 Courtney Cavin wrote:

> Then again, I think that the context management stuff is the exception as well,
> and I think that can/should also be handled in a higher level.  Regardless, I
> went ahead and drafted the async flags idea out anyway, so here's some
> pseudo-code.  I also tried to shoe-horn in 'peek', and you can see how that
> turns out.  Let me know if this is something like what you had in mind.

The async implementation looks good to me, assuming we actually need both
sync and async operations, which I can't tell for sure.

For the peek operation, it wouldn't work for the ethernet case, which
has to call it from atomic context in net_rx_action.

> 	/**
> 	 * so this is where this lock makes things difficult, as this function
> 	 * might_sleep(), but only really because of the lock.  Either we can
> 	 * remove the lock and force the adapter to do its own locking
> 	 * spinlock-style, or we can accept the sleep here, which seems a bit
> 	 * stupid in a peek function.  Neither option is good.  Additionally,
> 	 * there's no guarantee that the adapter doesn't operate over a bus
> 	 * which itself might_sleep(), exacerbating the problem.
> 	 */
> 	mutex_lock(&mbox->adapter->lock);
> 	rc = mbox->adapter->ops->peek_message(mbox->adapter, mbox->chan, msg);
> 	mutex_lock(&mbox->adapter->lock);

If we decide that peek() must not sleep, any driver that operates on a
slow bus could just always report "no data" here.
 
Moving the locking into the mbox driver here sounds appropriate.

	Arnd

  reply	other threads:[~2014-02-14 19:50 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-08  0:50 [RFC 0/6] mailbox: add common framework and port drivers Courtney Cavin
2014-02-08  0:50 ` [RFC 1/6] mailbox: add core framework Courtney Cavin
2014-02-10 14:11   ` Arnd Bergmann
2014-02-10 17:17     ` Courtney Cavin
2014-02-10 17:52     ` Rob Herring
2014-02-10 19:09       ` Josh Cartwright
2014-02-10 19:59         ` Courtney Cavin
2014-02-10 20:45           ` Rob Herring
2014-02-11  0:23             ` Courtney Cavin
2014-02-11  8:35               ` Arnd Bergmann
2014-02-12 18:31                 ` Courtney Cavin
2014-02-14 19:48                   ` Arnd Bergmann [this message]
2014-02-14 20:16                     ` Courtney Cavin
2014-02-08  0:50 ` [RFC 2/6] mailbox: document bindings Courtney Cavin
2014-02-08  0:50 ` [RFC 3/6] mailbox: pl320: migrate to mbox framework Courtney Cavin
2014-02-10 18:28   ` Rob Herring
2014-02-10 19:12     ` Courtney Cavin
2014-02-08  0:50 ` [RFC 4/6] mailbox: omap: remove omap-specific framework Courtney Cavin
2014-02-08  0:50 ` [RFC 5/6] mailbox: omap1: move to common mbox framework Courtney Cavin
2014-02-08  0:50 ` [RFC 6/6] mailbox: omap2+: " Courtney Cavin
2014-02-15  3:32 ` [RFC 0/6] mailbox: add common framework and port drivers Jassi Brar
2014-02-15  3:40   ` Greg Kroah-Hartman
2014-02-15  3:57     ` Jassi Brar
2014-02-15  4:11       ` Greg Kroah-Hartman
2014-02-15  4:14         ` Jassi Brar

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=201402142048.25456.arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=courtney.cavin@sonymobile.com \
    --cc=devicetree@vger.kernel.org \
    --cc=galak@codeaurora.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=joshc@codeaurora.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.langsdorf@calxeda.com \
    --cc=mark.rutland@arm.com \
    --cc=omar.ramirez@copitl.com \
    --cc=pawel.moll@arm.com \
    --cc=rafael.j.wysocki@intel.com \
    --cc=rob.herring@calxeda.com \
    --cc=rob@landley.net \
    --cc=robherring2@gmail.com \
    --cc=s-anna@ti.com \
    --cc=tony@atomide.com \
    /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