[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAD=FV=V+-DwCjGoookySCazazBBYOoRO+=G5Q_WXAw+SrXNc-A@mail.gmail.com>
Date: Fri, 15 Mar 2013 17:37:54 -0700
From: Doug Anderson <dianders@...omium.org>
To: Lars-Peter Clausen <lars@...afoo.de>
Cc: Naveen Krishna Chatradhi <ch.naveen@...sung.com>,
linux-iio <linux-iio@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
linux-samsung-soc@...r.kernel.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Naveen Krishna <naveenkrishna.ch@...il.com>
Subject: Re: [RFC: PATCH 2/2] iio: adc: exynos_adc: Handle timeout and race conditions
On Fri, Mar 15, 2013 at 2:53 PM, Lars-Peter Clausen <lars@...afoo.de> wrote:
> What exactly is the spinlock protecting against here? Concurrent runs of
> exynos_adc_isr? This is probably not issue in the first place.
>
> What you want to protect against is that completion is completed between the
> call to INIT_COMPLETION() and the start of a new conversion. So the sections
> that need to be under the spinlock are the complete call here and the point
> from INIT_COMPLETION until the transfer is started in exynos_read_raw(). Make
> sure to use spin_lock_irq there.
...and at that point I _think_ you won't also need the mutex.
A reasonable way to test to see if you've got this all correct would be to:
* Start two processes that are reading from different ADCs that will
report very different values (maybe add a device tree node for adc1 or
adc7 and use those since they're not really connected to
thermistors?).
* Have your two processes read as fast as they can. This could just
be "while true; do cat /sys/class/hwmon/hwmon0/device/temp1_input;
done"
* Decrease your timeout and maybe(?) sprinkle some random udelays in
the irq handler so that the timeouts happen sometimes but not others.
* Periodically cancel one of the readers with Ctrl-C
If all is working well then you should always get back the right value
from the right reader (and get no crashes).
-Doug
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists