IIO Coding Task 2 ?
Daniel,
I'm working on IIO coding task #2.
In 'auditing IIO device state updates to locking' I believe that in addition to "Updates to state changes must always take mlock", any checks of device state must also take mlock. And that is, what you are asking us to do in this task. (iio_buffer_enabled is checking device state, not setting)
Basically, anywhere iio_dev->currentmode is set|checked use mlock.
Right track?
For this task, I'm not clear on why we are doing RFC. In practice, mlock is used very consistently for protecting device state. Can you clarify the controversial aspect?
Thanks!
alisons
A message that is not in the archive (sent off-list or not yet received): [email protected]
<resending answer due to outreachy-kernel delivery failure>
Quoted 39 lines · Daniel Baluta
Quoted 10 lines · Alison Schofield
Daniel,
I'm working on IIO coding task #2.
In 'auditing IIO device state updates to locking' I believe that in addition to "Updates to state changes must always take mlock", any checks of device state must also take mlock. And that is, what you are asking us to do in this task. (
iio_buffer_enabledis checking device state, not setting)Quoted 3 lines
Basically, anywhere
iio_dev->currentmodeis set|checked use mlock.Right track?
Correct.
Quoted 3 lines
For this task, I'm not clear on why we are doing RFC. In practice, mlock is used very consistently for protecting device state. Can you clarify the controversial aspect?
As agreed on this thread: http://www.spinics.net/lists/linux-iio/msg18540.html
we will try to propose some API like:/iio_device_claim_direct_mode //iio_device_release_direct_mode/
which will try to make code easier to read and hide the inner details of taking/releasing mlock.
We will make this in two steps:
* introduce API
* find a place where locking is not done
* use new APIAfter IIO maintainer says this is OK:
* update all places with the new API.thanks,
Daniel.
Quoted 44 lines · Daniel Baluta
<resending answer due to outreachy-kernel delivery failure>
Quoted 41 lines · Daniel Baluta
Quoted 10 lines · Alison Schofield
Daniel,
I'm working on IIO coding task #2.
In 'auditing IIO device state updates to locking' I believe that in addition to "Updates to state changes must always take mlock", any checks of device state must also take mlock. And that is, what you are asking us to do in this task. (
iio_buffer_enabledis checking device state, not setting)Quoted 3 lines
Basically, anywhere
iio_dev->currentmodeis set|checked use mlock.Right track?
Correct.
Quoted 3 lines
For this task, I'm not clear on why we are doing RFC. In practice, mlock is used very consistently for protecting device state. Can you clarify the controversial aspect?
As agreed on this thread:
http://www.spinics.net/lists/linux-iio/msg18540.html
we will try to propose some API like:/iio_device_claim_direct_mode //iio_device_release_direct_mode/
which will try to make code easier to read and hide the inner details of taking/releasing mlock.
We will make this in two steps:
* introduce API
* find a place where locking is not done
* use new APIAfter IIO maintainer says this is OK:
* update all places with the new API.thanks,
Daniel.
Thanks for the directon. I am working on that first step. alisons
Quoted 1 line
.........................snip...................
Quoted 7 lines
Quoted 1 line
Quoted 1 line
t > >We will make this in two steps:
Quoted 5 lines
Quoted 5 lines
* introduce API
* find a place where locking is not done
* use new API
Quoted 9 lines
Quoted 5 lines
Quoted 5 lines
After IIO maintainer says this is OK:
* update all places with the new API.thanks,
Daniel.Thanks for the directon. I am working on that first step. alisons
Quoted 1 line
Hi Daniel,
I'm ready to send out the RFC PATCH, but I wasn't able to meet one of your requests. I did not find a place where the locking was not done. The 'sample' is one where mlock was used with iio_buffer_enabled. I think it illustrates the API well because it clearly shows the before/after that would occur in other drivers. Send it?
Thanks,
alisons
Quoted 13 lines · Alison Schofield
.........................snip...................
Quoted 5 lines
t > >We will make this in two steps:
Quoted 4 lines
Quoted 4 lines
* introduce API
* find a place where locking is not done
* use new APIQuoted 7 lines
Quoted 5 lines
Quoted 5 lines
After IIO maintainer says this is OK:
* update all places with the new API.thanks,
Daniel.Thanks for the directon. I am working on that first step. alisons
Quoted 10 lines
Hi Daniel,
I'm ready to send out the RFC PATCH, but I wasn't able to meet one of your requests. I did not find a place where the locking was not done. The 'sample' is one where mlock was used withiio_buffer_enabled. I think it illustrates the API well because it clearly shows the before/after that would occur in other drivers. Send it?
Thanks,
alisons
Yes please :). Send the patches as RFC's, don't forget to Cc linux-iio mailing list. Also, you can expand your searches to drivers/iio/.
thanks,
Daniel.