From: Amit Uttamchandani <amit.uttam-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Ned Forrester <nforrester-/d+BM93fTQY@public.gmane.org>
Cc: spi-devel
<spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
Subject: Re: Spinlock vs mutexes for spi network driver
Date: Thu, 18 Mar 2010 09:46:41 -0700 [thread overview]
Message-ID: <20100318164641.GA22298@canoga.com> (raw)
In-Reply-To: <4BA14970.3050603-/d+BM93fTQY@public.gmane.org>
On Wed, Mar 17, 2010 at 05:28:16PM -0400, Ned Forrester wrote:
[...]
> If I recall correctly, the work queue does NOT run in interrupt context
> (are allowed to sleep), and therefore mutexs are permitted (for locking
> with other non-interrupt activity). The interrupt handler definitely
> runs in interrupt context. If the locking protects data that is shared
> between interrupt context and non-interrupt context, then it will have
> to be done with a spinlock. pxa2xx_spi.c (the driver I am familiar
> with) does not use any mutexes, because the protected data structure is
> used in the interrupt handlers.
>
Thanks for the explanation. It fixed a few issues I was having.
Regarding mutexes and spi reads and transfers. Is it possible for
multiple SPI reads to be 'overwriting' each other thus resulting in
wrong reads? Which is why mutexes should be used to lock SPI bus? I
understand there is a patch waiting to be included to the mainline that
has functions to lock the bus before doing a transfer.
e.g. You issue a read and while that read is happening, a second spi
read call from another function uses the bus and thus results in wrong
data being returned to the first read.
> It has been a while since I have dealt with this stuff, so I have said
> something wrong, above, I'm sure I will be quickly corrected.
>
Thanks again.
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
next prev parent reply other threads:[~2010-03-18 16:46 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-17 20:49 Spinlock vs mutexes for spi network driver Amit Uttamchandani
[not found] ` <20100317204915.GB6358-QCuvCd35e3/QT0dZR+AlfA@public.gmane.org>
2010-03-17 21:28 ` Ned Forrester
[not found] ` <4BA14970.3050603-/d+BM93fTQY@public.gmane.org>
2010-03-18 16:46 ` Amit Uttamchandani [this message]
[not found] ` <20100318164641.GA22298-QCuvCd35e3/QT0dZR+AlfA@public.gmane.org>
2010-03-18 17:28 ` Ned Forrester
[not found] ` <4BA262B1.5050001-/d+BM93fTQY@public.gmane.org>
2010-03-18 20:09 ` Amit Uttamchandani
[not found] ` <20100318200940.GC16834-QCuvCd35e3/QT0dZR+AlfA@public.gmane.org>
2010-03-18 22:11 ` Ned Forrester
[not found] ` <4BA2A4F4.60207-/d+BM93fTQY@public.gmane.org>
2010-03-18 23:14 ` Ned Forrester
2010-03-19 9:35 ` Amit Uttamchandani
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=20100318164641.GA22298@canoga.com \
--to=amit.uttam-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=nforrester-/d+BM93fTQY@public.gmane.org \
--cc=spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.