From: Mark Lord <mlord@pobox.com>
To: Andy Walls <awalls@md.metrocast.net>
Cc: Hans Verkuil <hverkuil@xs4all.nl>,
linux-media@vger.kernel.org, ivtv-devel@ivtvdriver.org,
Darren Blaber <dmbtech@gmail.com>
Subject: Re: cx18: "missing audio" for analog recordings
Date: Thu, 15 Apr 2010 01:16:37 -0400 [thread overview]
Message-ID: <4BC6A135.4070400@pobox.com> (raw)
In-Reply-To: <1271306803.7643.67.camel@palomino.walls.org>
On 15/04/10 12:46 AM, Andy Walls wrote:
> On Wed, 2010-04-14 at 18:26 -0400, Mark Lord wrote:
..
>> Oddly, none of those spinlocks use _irq or _irq_save/restore,
>> which means they aren't providing any sort of mutual exclusion
>> against the interrupt handler.
>
> There is no need. The hard irq handler only really deals with firmware
> mailbox ack and firmware mailbox ready notifications. It sucks off the
> mailbox contents and shoves it over to the cx18-NN-in workhandler via
> work orders placed on a workqueue. The work handler does grab the
> spinlocks, but it is from a non-irq context.
..
Mmmm.. but it does do read-modify-write on several registers inside the IRQ handling.
I suppose those might be "safe" groups, written to _only_ by the IRQ handler,
but maybe not.
From what I can see, (nearly?) all registers are read/written as full 32-bit units.
So when code wants to modify an 8-bit "register", this is converted into a read-
modify-write of the corresponding 32-bit register.
So if two threads, or any thread and the irq handler, want to modify parts
of the same 32-bit register, then there's a race. The code _appears_ to mostly
not have such a problem, but it would conveniently explain the sporadic failures. :)
So, for now, I've added lower level spinlock protection onto all register writes,
as well as to routines that themselves do a higher level read-modify-write:
eg. the routines to enable/disable specific IRQ sources.
This was easy enough to do, and it'll give us confidence that the r-m-w sequences
are not the issue. Or perhaps it'll cure some problems. Time will tell.
I'll run with that patch on top of yours for the next couple of days,
or until I see a "fallback" log again. None so far, though.
Cheers
--
Mark Lord
Real-Time Remedies Inc.
mlord@pobox.com
next prev parent reply other threads:[~2010-04-15 5:16 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-01 16:07 cx18: Unable to find blank work order form to schedule incoming mailbox Mark Lord
2010-03-02 1:34 ` Andy Walls
2010-03-02 5:57 ` Mark Lord
2010-03-02 12:40 ` Andy Walls
2010-03-02 15:00 ` Mark Lord
2010-03-03 1:05 ` Andy Walls
2010-03-15 2:48 ` cx18: "missing audio" for analog recordings Mark Lord
2010-03-15 11:51 ` Andy Walls
2010-03-16 4:49 ` Mark Lord
2010-03-16 11:11 ` Andy Walls
2010-04-10 22:28 ` Mark Lord
2010-04-10 22:54 ` Andy Walls
2010-04-11 0:58 ` Andy Walls
2010-04-11 3:21 ` Mark Lord
2010-04-11 4:56 ` Andy Walls
2010-04-11 5:03 ` [ivtv-devel] " Andy Walls
2010-04-11 11:47 ` Andy Walls
2010-04-11 13:24 ` Mark Lord
2010-04-11 19:01 ` Andy Walls
2010-04-11 20:52 ` Mark Lord
2010-04-12 20:08 ` Mark Lord
2010-04-12 21:17 ` Andy Walls
2010-04-13 2:22 ` Mark Lord
2010-04-13 2:30 ` Mark Lord
2010-04-13 2:34 ` Mark Lord
2010-04-13 10:35 ` Andy Walls
2010-04-13 12:42 ` Mark Lord
2010-04-14 1:45 ` Andy Walls
2010-04-14 4:32 ` Mark Lord
2010-04-14 4:34 ` Mark Lord
2010-04-14 22:26 ` Mark Lord
2010-04-15 4:46 ` Andy Walls
2010-04-15 5:16 ` Mark Lord [this message]
2010-04-15 14:15 ` Mark Lord
2010-04-17 4:43 ` Andy Walls
2010-04-17 12:09 ` Mark Lord
2010-04-17 13:01 ` Mark Lord
2010-04-17 17:18 ` Andy Walls
2010-04-17 17:03 ` Andy Walls
2010-04-16 12:59 ` Andy Walls
2010-04-17 12:18 ` Mark Lord
2010-04-17 17:37 ` Andy Walls
2010-04-16 13:15 ` Andy Walls
2010-04-16 13:29 ` Andy Walls
2010-04-11 19:49 ` Darren Blaber
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=4BC6A135.4070400@pobox.com \
--to=mlord@pobox.com \
--cc=awalls@md.metrocast.net \
--cc=dmbtech@gmail.com \
--cc=hverkuil@xs4all.nl \
--cc=ivtv-devel@ivtvdriver.org \
--cc=linux-media@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox