From: Ian Abbott <abbotti@mev.co.uk>
To: Hartley Sweeten <HartleyS@visionengravers.com>,
"driverdev-devel@linuxdriverproject.org"
<driverdev-devel@linuxdriverproject.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 7/7] staging: comedi: comedi_fops: extend spin-lock scope in comedi_event()
Date: Wed, 01 Apr 2015 10:10:53 +0100 [thread overview]
Message-ID: <551BB61D.8090306@mev.co.uk> (raw)
In-Reply-To: <DC148C5AA1CEBA4E87973D432B1C2D8826188277@P3PWEX4MB008.ex4.secureserver.net>
On 31/03/15 17:13, Hartley Sweeten wrote:
> On Tuesday, March 31, 2015 2:43 AM, Ian Abbott wrote:
>> On 30/03/15 17:47, Hartley Sweeten wrote:
>>> On Friday, March 27, 2015 8:13 AM, Ian Abbott wrote:
>>>> `comedi_event()` is called from low-level drivers to handle comedi
>>>> asynchronous command event flags. As a safety check, it checks the
>>>> subdevice's "run" flags to make sure an asynchronous command is running.
>>>> It can also change the run flags to mark the command as no longer
>>>> running (possibly also marking it as terminated with an error).
>>>> Checking the runflags and modifying them involves two uses of the
>>>> subdevice's spin-lock. It seems better to do it with a single use of
>>>> the spin-lock. This also avoids possible interactions with
>>>> `do_become_nonbusy()`.
>>>>
>>>> Acquire the subdevice's spin-lock at the start of `comedi_event()` and
>>>> release it near the end, before a possible call to `kill_fasync()` (but
>>>> after it's parameter values have been determined).
>>>>
>>>> Add and make use of few new inline helper functions:
>>>>
>>>> * `__comedi_clear_subdevice_runflags()` -- clears some run flags without
>>>> using the spin-lock
>>>> * `__comedi_set_subdevice_runflags()` -- sets some run flags without
>>>> using the spin-lock
>>>> * `__comedi_get_subdevice_runflags()` -- a spin-lockless version of
>>>> `comedi_get_subdevice_runflags()
>>>> * `__comedi_is_subdevice_running()` -- a spin-lockless version of
>>>> * `comedi_is_subdevice_running()`
>>>>
>>>> Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
>>>
>>> Ian,
>>>
>>> For completeness, the comedi_alloc_spriv() helper should probably use
>>> __comedi_set_subdevice_runflags() to set the COMEDI_SRF_FREE_SPRIV
>>> bit.
>>
>> Good point. "drivers/staging/comedi/drivers.c" also reads the runflags
>> directly, so perhaps __comedi_clear_subdevice_runflags(),
>> __comedi_set_subdevice_runflags() and __comedi_get_subdevice_runflags()
>> should be placed in "drivers/staging/comedi/comedi_internal.h". Or we
>> could ditch all three of those inline functions as they are just simple
>> one-liners.
>
> comedi_internal.h works for mw. We just don't want to expose those functions
> to the drivers.
Okay, I'll do that in a separate patch since you've already signed off
on this one.
--
-=( Ian Abbott @ MEV Ltd. E-mail: <abbotti@mev.co.uk> )=-
-=( Web: http://www.mev.co.uk/ )=-
next prev parent reply other threads:[~2015-04-01 9:10 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-27 15:12 [PATCH 0/7] staging: comedi: comedi_fops: some runflag and event handling changes Ian Abbott
2015-03-27 15:13 ` [PATCH 1/7] staging: comedi: comedi_fops: rename comedi_set_subdevice_runflags() Ian Abbott
2015-03-27 15:13 ` [PATCH 2/7] staging: comedi: comedi_fops: eliminate a use of subdevice spin-lock Ian Abbott
2015-03-27 15:13 ` [PATCH 3/7] staging: comedi: comedi_fops: simplify comedi_is_subdevice_idle() Ian Abbott
2015-03-27 15:13 ` [PATCH 4/7] staging: comedi: comedi_fops: remove unnecessary s->async use Ian Abbott
2015-03-27 15:13 ` [PATCH 5/7] staging: comedi: comedi_fops: always clear events Ian Abbott
2015-03-27 15:13 ` [PATCH 6/7] staging: comedi: comedi_fops: send SIGIO according to command direction Ian Abbott
2015-03-27 15:13 ` [PATCH 7/7] staging: comedi: comedi_fops: extend spin-lock scope in comedi_event() Ian Abbott
2015-03-30 16:47 ` Hartley Sweeten
2015-03-31 9:42 ` Ian Abbott
2015-03-31 16:13 ` Hartley Sweeten
2015-04-01 9:10 ` Ian Abbott [this message]
2015-03-30 17:13 ` [PATCH 0/7] staging: comedi: comedi_fops: some runflag and event handling changes Hartley Sweeten
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=551BB61D.8090306@mev.co.uk \
--to=abbotti@mev.co.uk \
--cc=HartleyS@visionengravers.com \
--cc=driverdev-devel@linuxdriverproject.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@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;
as well as URLs for NNTP newsgroup(s).