public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Brownell <david-b@pacbell.net>
To: Vitaly Wool <vwool@ru.mvista.com>
Cc: Mark Underwood <basicmark@yahoo.com>,
	linux-kernel@vger.kernel.org, dpervushin@gmail.com,
	akpm@osdl.org, greg@kroah.com, komal_shah802003@yahoo.com,
	stephen@streetfiresound.com,
	spi-devel-general@lists.sourceforge.net, Joachim_Jaeger@digi.com
Subject: Re: [PATCH 2.6-git] SPI core refresh
Date: Thu, 1 Dec 2005 10:31:11 -0800	[thread overview]
Message-ID: <200512011031.12167.david-b@pacbell.net> (raw)
In-Reply-To: <438EA389.7030704@ru.mvista.com>

On Wednesday 30 November 2005 11:17 pm, Vitaly Wool wrote:
> Mark Underwood wrote:
> 
> >>However, there also are some advantages of our core compared to David's I'd like to mention
> >>
> >>- it can be compiled as a module
> 
> >So can David's. You can use BIOS tables in which case you must compile the SPI core into the
> >kernel but you can also use spi_new_device which allows the SPI core to be built as a module (and
> >is how I am using it).
> 
> You limit the functionality, so it's not the case.

As noted in my comparison of last week (you're still ignoring that):

 - Mine lets board-specific device tables be declared in the
   relevant arch_setup() thing (board-*.c).  Both frameworks allow
   later board specific code to dynamically declare the devices,
   with binary (Dave's) or parsed-text (Dmitry's) descriptions. 

What Mark said was that in this case he used the "late" init.  You seem
to be saying he's not allowed to do that.  Which is nonsense; there are
distinct mechanisms for the good reason that "late" init doesn't work
so well without dynamic discovery ... which SPI itself doesn't support.
Hence the need for board-specific "this hardware exists" tables.


> If there's more than one SPI controller onboard, spi_write_then_read 
> will serialize the transfers ...

Which, as has been pointed out, would be a trivial thing to fix
if anyone were actually to have a problem.  Sure it'd incur the
cost of a kmalloc on at least some paths -- serializing in the
slab layer instead! -- but that's one price of using convenience
helpers not performance oriented calls.


>	 Moreover, if, say, two  
> kernel threads with different priorities are working with two SPI 
> controllers respectively *priority inversion* will happen.

That characteristic being inherited from semaphores (or were they
updated with RT_PREEMPT?), and being in common with most I/O queues
in the system.  Not something to blame on any line of code I wrote.

Oh, and I noticed a priority inversion in your API which shows
up with one SPI controller managing two devices.  Whoops!  I'd
far rather have such inversions be implementation artifacts; it's
easy to patch an implementation, hard to change all API users.


> >>- it's more adapted for use in real-time environments
> >>- it's not so lightweight, but it leaves less effort for the bus driver developer.
> >
> >But also less flexibility. A core layer shouldn't _force_ a policy
> 
> Nope, it's just a default policy.

One that every driver pays the price for.  Allocating a task even
when it doesn't need it; every call going through a midlayer that
wants to take over queue management policy; and more.  (Unless you
made a big un-remarked change in a patch you called "refresh"...)


> >on a bus driver. I am currently developing an adapter driver for David's system and I wouldn't say
> >that the core is making me do things I think the core should do. Please could you provide examples
> >of where you think Davids SPI core requires 'effort'.
> 
> Main are
> - the need to call 'complete' in controller driver

So you think it's better to have consistent semantics be optional?

That seems to be the notion behind your spi_transfer() call, which
can't decide whether it's going to be synchronous or asynchronous.
Instead, it decided to be error prone and be both.  :)


> - the need to implement policy in controller driver

The "policy" in question is something that sometimes needs to
be board-specific -- priority to THAT device, synch with THIS
external signal, etc -- which is why I see it as a drawback
that you insist the core implement one policy.

One policy is painfully easy to implement:  FIFO, processing
the requests in the order they arrive.  Easy to implement,
even with spinlocks, in a dozen lines of code.  If anyone
has a hard time writing that, they shouldn't be trying to
write a device driver.

- Dave


  reply	other threads:[~2005-12-01 18:31 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-30 16:50 [PATCH 2.6-git] SPI core refresh Vitaly Wool
2005-11-30 19:17 ` Russell King
2005-11-30 19:54 ` Greg KH
2005-11-30 20:29 ` Mark Underwood
2005-12-01  7:17   ` Vitaly Wool
2005-12-01 18:31     ` David Brownell [this message]
2005-12-02  5:48       ` Vitaly Wool
2005-12-02 18:37         ` Mark Underwood
2005-11-30 21:26 ` David Brownell
2005-11-30 21:27 ` David Brownell
2005-12-12 16:57   ` Vitaly Wool
2005-12-13 22:16     ` David Brownell
2005-11-30 21:36 ` David Brownell
2005-11-30 21:59   ` Stephen Street
2005-12-01  7:31     ` Vitaly Wool
2005-12-01  7:24   ` Vitaly Wool
  -- strict thread matches above, loose matches on Subject: below --
2005-12-01 16:11 Vitaly Wool
2005-12-01 16:21 ` Russell King
2005-12-01 16:30   ` Vitaly Wool
2005-12-01 18:04 ` Stephen Street
2005-12-01 18:22 ` Greg KH
2005-12-02  6:06   ` Vitaly Wool
2005-12-02 18:50     ` Mark Underwood
2005-12-02 20:13     ` Greg KH
2005-12-05 18:01 ` Vitaly Wool
2005-12-08  1:59   ` David Brownell
2005-12-08  6:33     ` Vitaly Wool
2005-12-09 22:55       ` David Brownell
2005-12-10 11:15         ` Vitaly Wool
2005-12-11 12:36         ` Vitaly Wool
2005-12-03 11:44 vitalhome
2005-12-03 11:49 vitalhome
2005-12-03 17:10 ` Mark Underwood
2005-12-03 23:50   ` David Brownell

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=200512011031.12167.david-b@pacbell.net \
    --to=david-b@pacbell.net \
    --cc=Joachim_Jaeger@digi.com \
    --cc=akpm@osdl.org \
    --cc=basicmark@yahoo.com \
    --cc=dpervushin@gmail.com \
    --cc=greg@kroah.com \
    --cc=komal_shah802003@yahoo.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=spi-devel-general@lists.sourceforge.net \
    --cc=stephen@streetfiresound.com \
    --cc=vwool@ru.mvista.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