public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Brownell <david-b@pacbell.net>
To: Kumar Gala <galak@kernel.crashing.org>
Cc: Vitaly Wool <vitalywool@gmail.com>, Greg KH <greg@kroah.com>,
	linux-kernel@vger.kernel.org,
	spi-devel-general@lists.sourceforge.net
Subject: Re: [spi-devel-general] Re: [PATCH] spi: Added spi master driver for Freescale MPC83xx SPI controller
Date: Fri, 7 Apr 2006 18:25:06 -0700	[thread overview]
Message-ID: <200604071825.06607.david-b@pacbell.net> (raw)
In-Reply-To: <CD0F0EAE-B3C0-4C03-BB90-99E65C16EC4F@kernel.crashing.org>

On Friday 07 April 2006 10:04 am, Kumar Gala wrote:

> > Well, not the _only_ way.  The polling-type txrx_word() calls are
> > also full duplex.  My point is more that it's bad/inefficient to
> > incur both IRQ _and_ task switch overheads per word, when it would
> > be a lot simpler to just have the IRQ handler do its normal job.

Not that you actually _need_ an IRQ handler to be correct, in any case.


> > (And that's even true if you've turned hard IRQ handlers into threads
> > for PREEMPT_RT or whatever.  In that case the "IRQ overhead" is a
> > task switch, but you're still saving _additional_ task switches.)
> 
> This makes more sense about what I'm doing that is wasteful.   
> However, I'm not sure exactly where I should plug into things.

Only using interfaces below the line in spi_bitbang that says
it's the "SECOND PART".


> I think you are saying to continue using spi_bitbang_transfer &  
> spi_bitbang_work, but have spi_bitbang_work call my own bitbang- 
>  >txrx_bufs().

Yes.  Consider several different ways to implement that I/O loop:

	- Interrupt plus two context switches per byte (what you have now),
	  no per-buffer context switch

	- Interrupt per byte, plus one context switch pair per buffer
	  (what I've described)

	- pure PIO per byte, no context switches (as if you polled
	  the registers rather than using an IRQ)

Any of them could be correct, but one of them is a lot worse in terms
of CPU overhead when you aim at tranfer rates of even just a few MBytes
per second.  (It's the one with lots of needless context switching.)

That pure PIO model will sometimes be very appropriate; if the SPI clock
is fast enough, it can be less overhead than the IRQ driven one.

- Dave




  reply	other threads:[~2006-04-08  1:25 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-06 18:30 [PATCH] spi: Added spi master driver for Freescale MPC83xx SPI controller Kumar Gala
2006-04-07  5:22 ` David Brownell
2006-04-07  9:16   ` [spi-devel-general] " Vitaly Wool
2006-04-07 16:09     ` David Brownell
2006-04-07 17:04       ` Kumar Gala
2006-04-08  1:25         ` David Brownell [this message]
2006-04-07 14:04   ` Kumar Gala
2006-04-07 15:54     ` David Brownell
2006-04-07 16:44       ` Kumar Gala
2006-04-10 17:38 ` [PATCH][UPDATE] " Kumar Gala
2006-04-10 19:01   ` David Brownell
2006-04-10 19:05     ` Kumar Gala
2006-04-10 19:17       ` [PATCH][2.16.17-rc1-mm2] " Kumar Gala
2006-04-10 20:03         ` [spi-devel-general] " Vitaly Wool
2006-04-10 20:22           ` Kumar Gala
2006-04-10 21:06             ` David Brownell
2006-04-10 21:10               ` Kumar Gala
2006-04-11 14:39         ` [PATCH][2.16.17-rc1-mm2][UPDATE] " Kumar Gala

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=200604071825.06607.david-b@pacbell.net \
    --to=david-b@pacbell.net \
    --cc=galak@kernel.crashing.org \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=spi-devel-general@lists.sourceforge.net \
    --cc=vitalywool@gmail.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