* RE: iio_buffer length [not found] <C0999E24-1BF1-4B7D-835B-8E3AC76C61F8@gmail.com> @ 2012-09-26 1:32 ` Ge Gao 2012-09-26 7:27 ` Jonathan Cameron 0 siblings, 1 reply; 9+ messages in thread From: Ge Gao @ 2012-09-26 1:32 UTC (permalink / raw) To: Denis Ciocca, jic23; +Cc: linux-iio To use KFIFO, you need Jonanthan's KFIFO poll patch, you probably also need a patch from me that fixed the industrial-buffer.c. But that buffer is not well tested and is only used by me. The original KFIFO does not have poll functionality and has some other minor bug. Ge -----Original Message----- From: linux-iio-owner@vger.kernel.org [mailto:linux-iio-owner@vger.kernel.org] On Behalf Of Denis Ciocca Sent: Tuesday, September 25, 2012 2:35 PM To: jic23@jic23.retrosnub.co.uk Cc: linux-iio@vger.kernel.org Subject: iio_buffer length Hi Jon, > Firstly please confirm you are using a kfifo buffer? No, I use sw-ring. > Swring is deprecated but will do precisely what you are seeing I think. It uses a half full watershead to decide to signal userspace. If you wait till the buffer is full, unless your sampling is very slow you will have data coming in before userspace has read the whole buffer out. Hence you will loose data. You are right. I saw exatly what you said. > Kfifo has a more conventional poll and will fire off userspace > whenever any data is in the buffer. Hence kfifo will work for your usecase. I would like to have a fill level capable buffer again in the future as they are very useful in high speed uses where latency doesn't matter. Ok, I will change my sw-ring buffer to kfifo! Thanks, Denis -- To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: iio_buffer length 2012-09-26 1:32 ` iio_buffer length Ge Gao @ 2012-09-26 7:27 ` Jonathan Cameron 2012-09-26 8:04 ` Lars-Peter Clausen 2012-09-26 12:37 ` Denis Ciocca 0 siblings, 2 replies; 9+ messages in thread From: Jonathan Cameron @ 2012-09-26 7:27 UTC (permalink / raw) To: Ge Gao; +Cc: Denis Ciocca, linux-iio On 26/09/12 02:32, Ge Gao wrote: > To use KFIFO, you need Jonanthan's KFIFO poll patch, That's in staging-next now and will merge into mainline in the next merge window (about 1 to 2 weeks time). > you probably also > need a patch from me that fixed the industrial-buffer.c. But that buffer > is not well tested and is only used by me. There are a lot of drivers using kfifo. It's hidden in many of them as they use it via the industrialio-triggered-buffer helper functions that deal with the most common use cases. With that I count 9 in drivers/iio and 6 in drivers/staging/iio vs 10 in total for sw_ring most of which will go away once someone has a spare couple of hours. Basically any driver that has come along since we moved to kfifo is the preferred choice and any that anyone has touched since then. > The original KFIFO does not > have poll functionality and has some other minor bug. If I've missed any patches from you on this (or just forgotten them ;) please do keep pestering me. > > Ge > > > -----Original Message----- > From: linux-iio-owner@vger.kernel.org > [mailto:linux-iio-owner@vger.kernel.org] On Behalf Of Denis Ciocca > Sent: Tuesday, September 25, 2012 2:35 PM > To: jic23@jic23.retrosnub.co.uk > Cc: linux-iio@vger.kernel.org > Subject: iio_buffer length > > Hi Jon, > >> Firstly please confirm you are using a kfifo buffer? > > No, I use sw-ring. > > >> Swring is deprecated but will do precisely what you are seeing I think. > It uses a half full watershead to decide to signal userspace. If you wait > till the buffer is full, unless your sampling is very slow you will have > data coming in before userspace has read the whole buffer out. Hence you > will loose data. > > You are right. I saw exatly what you said. > > >> Kfifo has a more conventional poll and will fire off userspace >> whenever > any data is in the buffer. Hence kfifo will work for your usecase. I > would like to have a fill level capable buffer again in the future as they > are very useful in high speed uses where latency doesn't matter. > > Ok, I will change my sw-ring buffer to kfifo! > > Thanks, > Denis > -- > To unsubscribe from this list: send the line "unsubscribe linux-iio" in > the body of a message to majordomo@vger.kernel.org More majordomo info at > http://vger.kernel.org/majordomo-info.html > -- > To unsubscribe from this list: send the line "unsubscribe linux-iio" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: iio_buffer length 2012-09-26 7:27 ` Jonathan Cameron @ 2012-09-26 8:04 ` Lars-Peter Clausen 2012-09-26 12:37 ` Denis Ciocca 1 sibling, 0 replies; 9+ messages in thread From: Lars-Peter Clausen @ 2012-09-26 8:04 UTC (permalink / raw) To: Jonathan Cameron; +Cc: Ge Gao, Denis Ciocca, linux-iio On 09/26/2012 09:27 AM, Jonathan Cameron wrote: > On 26/09/12 02:32, Ge Gao wrote: >> To use KFIFO, you need Jonanthan's KFIFO poll patch, > That's in staging-next now and will merge into mainline in the > next merge window (about 1 to 2 weeks time). >> you probably also >> need a patch from me that fixed the industrial-buffer.c. But that buffer >> is not well tested and is only used by me. > There are a lot of drivers using kfifo. It's hidden in many of them as they > use it via the industrialio-triggered-buffer helper functions that > deal with the most common use cases. > > With that I count 9 in drivers/iio and 6 in drivers/staging/iio vs 10 > in total for sw_ring most of which will go away once someone has a spare > couple of hours. I've already converted all the adis* drivers locally, so it's basically down to 4 remaining users. - Lars ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: iio_buffer length 2012-09-26 7:27 ` Jonathan Cameron 2012-09-26 8:04 ` Lars-Peter Clausen @ 2012-09-26 12:37 ` Denis Ciocca 2012-09-26 14:23 ` Jonathan Cameron 1 sibling, 1 reply; 9+ messages in thread From: Denis Ciocca @ 2012-09-26 12:37 UTC (permalink / raw) To: Jonathan Cameron; +Cc: Ge Gao, linux-iio Hi Jon and Ge, I switched my driver code by using kfifo (using code on linux-next), now what I see is: using generic-buffer application, I catch every sample independently by the value of buffer length, is that what you tell me by "Kfifo has a more conventional poll and will fire off userspace whenever any data is in the buffer."? To catch data only when the buffer is full, I must catch a particular signal event in /dev/iio:deviceX? Thanks Denis 2012/9/26 Jonathan Cameron <jic23@jic23.retrosnub.co.uk>: > On 26/09/12 02:32, Ge Gao wrote: >> >> To use KFIFO, you need Jonanthan's KFIFO poll patch, > > That's in staging-next now and will merge into mainline in the > next merge window (about 1 to 2 weeks time). > >> you probably also >> need a patch from me that fixed the industrial-buffer.c. But that buffer >> is not well tested and is only used by me. > > There are a lot of drivers using kfifo. It's hidden in many of them as they > use it via the industrialio-triggered-buffer helper functions that > deal with the most common use cases. > > With that I count 9 in drivers/iio and 6 in drivers/staging/iio vs 10 > in total for sw_ring most of which will go away once someone has a spare > couple of hours. > > Basically any driver that has come along since we moved to kfifo is the > preferred choice and any that anyone has touched since then. > > >> The original KFIFO does not >> have poll functionality and has some other minor bug. > > If I've missed any patches from you on this (or just forgotten them ;) > please do keep pestering me. > >> >> Ge >> >> >> -----Original Message----- >> From: linux-iio-owner@vger.kernel.org >> [mailto:linux-iio-owner@vger.kernel.org] On Behalf Of Denis Ciocca >> Sent: Tuesday, September 25, 2012 2:35 PM >> To: jic23@jic23.retrosnub.co.uk >> Cc: linux-iio@vger.kernel.org >> Subject: iio_buffer length >> >> Hi Jon, >> >>> Firstly please confirm you are using a kfifo buffer? >> >> >> No, I use sw-ring. >> >> >>> Swring is deprecated but will do precisely what you are seeing I think. >> >> It uses a half full watershead to decide to signal userspace. If you wait >> till the buffer is full, unless your sampling is very slow you will have >> data coming in before userspace has read the whole buffer out. Hence you >> will loose data. >> >> You are right. I saw exatly what you said. >> >> >>> Kfifo has a more conventional poll and will fire off userspace >>> whenever >> >> any data is in the buffer. Hence kfifo will work for your usecase. I >> would like to have a fill level capable buffer again in the future as they >> are very useful in high speed uses where latency doesn't matter. >> >> Ok, I will change my sw-ring buffer to kfifo! >> >> Thanks, >> Denis >> -- >> To unsubscribe from this list: send the line "unsubscribe linux-iio" in >> the body of a message to majordomo@vger.kernel.org More majordomo info at >> http://vger.kernel.org/majordomo-info.html >> -- >> To unsubscribe from this list: send the line "unsubscribe linux-iio" in >> the body of a message to majordomo@vger.kernel.org >> More majordomo info at http://vger.kernel.org/majordomo-info.html >> > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: iio_buffer length 2012-09-26 12:37 ` Denis Ciocca @ 2012-09-26 14:23 ` Jonathan Cameron 2012-09-26 18:10 ` Ge Gao 0 siblings, 1 reply; 9+ messages in thread From: Jonathan Cameron @ 2012-09-26 14:23 UTC (permalink / raw) To: Denis Ciocca; +Cc: Ge Gao, linux-iio On 26/09/12 13:37, Denis Ciocca wrote: > Hi Jon and Ge, > > I switched my driver code by using kfifo (using code on linux-next), > now what I see is: > > using generic-buffer application, I catch every sample independently > by the value of buffer length, is that what you tell me by "Kfifo has > a more conventional poll and will fire off userspace whenever any data > is in the buffer."? > To catch data only when the buffer is full, I must catch a particular > signal event in /dev/iio:deviceX? > You never want the buffer to be full. If it is you WILL loose data due to unlucky timing sooner or later. Only real option if you want to grab data in chunks from that buffer is to deadreckon the timing using a userspace timer. > Thanks > > Denis > > > > > 2012/9/26 Jonathan Cameron <jic23@jic23.retrosnub.co.uk>: >> On 26/09/12 02:32, Ge Gao wrote: >>> >>> To use KFIFO, you need Jonanthan's KFIFO poll patch, >> >> That's in staging-next now and will merge into mainline in the >> next merge window (about 1 to 2 weeks time). >> >>> you probably also >>> need a patch from me that fixed the industrial-buffer.c. But that buffer >>> is not well tested and is only used by me. >> >> There are a lot of drivers using kfifo. It's hidden in many of them as they >> use it via the industrialio-triggered-buffer helper functions that >> deal with the most common use cases. >> >> With that I count 9 in drivers/iio and 6 in drivers/staging/iio vs 10 >> in total for sw_ring most of which will go away once someone has a spare >> couple of hours. >> >> Basically any driver that has come along since we moved to kfifo is the >> preferred choice and any that anyone has touched since then. >> >> >>> The original KFIFO does not >>> have poll functionality and has some other minor bug. >> >> If I've missed any patches from you on this (or just forgotten them ;) >> please do keep pestering me. >> >>> >>> Ge >>> >>> >>> -----Original Message----- >>> From: linux-iio-owner@vger.kernel.org >>> [mailto:linux-iio-owner@vger.kernel.org] On Behalf Of Denis Ciocca >>> Sent: Tuesday, September 25, 2012 2:35 PM >>> To: jic23@jic23.retrosnub.co.uk >>> Cc: linux-iio@vger.kernel.org >>> Subject: iio_buffer length >>> >>> Hi Jon, >>> >>>> Firstly please confirm you are using a kfifo buffer? >>> >>> >>> No, I use sw-ring. >>> >>> >>>> Swring is deprecated but will do precisely what you are seeing I think. >>> >>> It uses a half full watershead to decide to signal userspace. If you wait >>> till the buffer is full, unless your sampling is very slow you will have >>> data coming in before userspace has read the whole buffer out. Hence you >>> will loose data. >>> >>> You are right. I saw exatly what you said. >>> >>> >>>> Kfifo has a more conventional poll and will fire off userspace >>>> whenever >>> >>> any data is in the buffer. Hence kfifo will work for your usecase. I >>> would like to have a fill level capable buffer again in the future as they >>> are very useful in high speed uses where latency doesn't matter. >>> >>> Ok, I will change my sw-ring buffer to kfifo! >>> >>> Thanks, >>> Denis >>> -- >>> To unsubscribe from this list: send the line "unsubscribe linux-iio" in >>> the body of a message to majordomo@vger.kernel.org More majordomo info at >>> http://vger.kernel.org/majordomo-info.html >>> -- >>> To unsubscribe from this list: send the line "unsubscribe linux-iio" in >>> the body of a message to majordomo@vger.kernel.org >>> More majordomo info at http://vger.kernel.org/majordomo-info.html >>> >> > -- > To unsubscribe from this list: send the line "unsubscribe linux-iio" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > ^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: iio_buffer length 2012-09-26 14:23 ` Jonathan Cameron @ 2012-09-26 18:10 ` Ge Gao 0 siblings, 0 replies; 9+ messages in thread From: Ge Gao @ 2012-09-26 18:10 UTC (permalink / raw) To: Jonathan Cameron, Denis Ciocca; +Cc: linux-iio I updated the latest the staging next and noticed that your patch is already in the kfifo along with other fixes. One thing I don't understand why in the "iio_store_to_kfifo", only 1 byte is stored vs. bytes_per_datum is stored before. Isn't KFIFO using bytes_per_datum when reading and writing? I send a patch for industrial-buffer to you. Thanks. Best Regards, Ge GAO -----Original Message----- From: J.I. Cameron [mailto:jic23@hermes.cam.ac.uk] On Behalf Of Jonathan Cameron Sent: Wednesday, September 26, 2012 7:23 AM To: Denis Ciocca Cc: Ge Gao; linux-iio@vger.kernel.org Subject: Re: iio_buffer length On 26/09/12 13:37, Denis Ciocca wrote: > Hi Jon and Ge, > > I switched my driver code by using kfifo (using code on linux-next), > now what I see is: > > using generic-buffer application, I catch every sample independently > by the value of buffer length, is that what you tell me by "Kfifo has > a more conventional poll and will fire off userspace whenever any data > is in the buffer."? > To catch data only when the buffer is full, I must catch a particular > signal event in /dev/iio:deviceX? > You never want the buffer to be full. If it is you WILL loose data due to unlucky timing sooner or later. Only real option if you want to grab data in chunks from that buffer is to deadreckon the timing using a userspace timer. > Thanks > > Denis > > > > > 2012/9/26 Jonathan Cameron <jic23@jic23.retrosnub.co.uk>: >> On 26/09/12 02:32, Ge Gao wrote: >>> >>> To use KFIFO, you need Jonanthan's KFIFO poll patch, >> >> That's in staging-next now and will merge into mainline in the next >> merge window (about 1 to 2 weeks time). >> >>> you probably also >>> need a patch from me that fixed the industrial-buffer.c. But that >>> buffer is not well tested and is only used by me. >> >> There are a lot of drivers using kfifo. It's hidden in many of them >> as they use it via the industrialio-triggered-buffer helper functions >> that deal with the most common use cases. >> >> With that I count 9 in drivers/iio and 6 in drivers/staging/iio vs 10 >> in total for sw_ring most of which will go away once someone has a >> spare couple of hours. >> >> Basically any driver that has come along since we moved to kfifo is >> the preferred choice and any that anyone has touched since then. >> >> >>> The original KFIFO does not >>> have poll functionality and has some other minor bug. >> >> If I've missed any patches from you on this (or just forgotten them >> ;) please do keep pestering me. >> >>> >>> Ge >>> >>> >>> -----Original Message----- >>> From: linux-iio-owner@vger.kernel.org >>> [mailto:linux-iio-owner@vger.kernel.org] On Behalf Of Denis Ciocca >>> Sent: Tuesday, September 25, 2012 2:35 PM >>> To: jic23@jic23.retrosnub.co.uk >>> Cc: linux-iio@vger.kernel.org >>> Subject: iio_buffer length >>> >>> Hi Jon, >>> >>>> Firstly please confirm you are using a kfifo buffer? >>> >>> >>> No, I use sw-ring. >>> >>> >>>> Swring is deprecated but will do precisely what you are seeing I think. >>> >>> It uses a half full watershead to decide to signal userspace. If >>> you wait till the buffer is full, unless your sampling is very slow >>> you will have data coming in before userspace has read the whole >>> buffer out. Hence you will loose data. >>> >>> You are right. I saw exatly what you said. >>> >>> >>>> Kfifo has a more conventional poll and will fire off userspace >>>> whenever >>> >>> any data is in the buffer. Hence kfifo will work for your usecase. >>> I would like to have a fill level capable buffer again in the future >>> as they are very useful in high speed uses where latency doesn't matter. >>> >>> Ok, I will change my sw-ring buffer to kfifo! >>> >>> Thanks, >>> Denis >>> -- >>> To unsubscribe from this list: send the line "unsubscribe linux-iio" >>> in the body of a message to majordomo@vger.kernel.org More majordomo >>> info at http://vger.kernel.org/majordomo-info.html >>> -- >>> To unsubscribe from this list: send the line "unsubscribe linux-iio" >>> in the body of a message to majordomo@vger.kernel.org More majordomo >>> info at http://vger.kernel.org/majordomo-info.html >>> >> > -- > To unsubscribe from this list: send the line "unsubscribe linux-iio" > in the body of a message to majordomo@vger.kernel.org More majordomo > info at http://vger.kernel.org/majordomo-info.html > ^ permalink raw reply [flat|nested] 9+ messages in thread
* iio_buffer length @ 2012-09-25 14:05 Denis Ciocca 2012-09-25 16:20 ` Jonathan Cameron 0 siblings, 1 reply; 9+ messages in thread From: Denis Ciocca @ 2012-09-25 14:05 UTC (permalink / raw) To: linux-iio Hi guys, I finally managed to resolve the issues about iio_trigger and iio_buffer. Now I ask please you if you can clarify to me about use of iio_generic_buffer and how I can use the /dev/iio:deviceX char-event to catch data from buffer. I compiled the generic-buffer program and I don't understand how datas come out. My driver has 4 channels: - 3 for accelerometer raw data (x,y,z) - 1 for timestamp The application set up the length of buffer to 32, but when I run the application I don't see 32 samples but only 16. What means 32? It is possible the use of buffer to catch every sample? (buffer length = 1)? When I set buffer length to 1 the application doesn't work! Thanks, Denis ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: iio_buffer length 2012-09-25 14:05 Denis Ciocca @ 2012-09-25 16:20 ` Jonathan Cameron 2012-09-25 21:20 ` Denis Ciocca 0 siblings, 1 reply; 9+ messages in thread From: Jonathan Cameron @ 2012-09-25 16:20 UTC (permalink / raw) To: Denis Ciocca, linux-iio Denis Ciocca <denis.ciocca@gmail.com> wrote: >Hi guys, > >I finally managed to resolve the issues about iio_trigger and >iio_buffer. >Now I ask please you if you can clarify to me about use of >iio_generic_buffer and how I can use the /dev/iio:deviceX char-event >to catch data from buffer. >I compiled the generic-buffer program and I don't understand how datas >come out. My driver has 4 channels: >- 3 for accelerometer raw data (x,y,z) >- 1 for timestamp > >The application set up the length of buffer to 32, but when I run the >application I don't see 32 samples but only 16. What means 32? >It is possible the use of buffer to catch every sample? (buffer length >= 1)? >When I set buffer length to 1 the application doesn't work! Firstly please confirm you are using a kfifo buffer? Swring is deprecated but will do precisely what you are seeing I think. It uses a half full watershead to decide to signal userspace. If you wait till the buffer is full, unless your sampling is very slow you will have data coming in before userspace has read the whole buffer out. Hence you will loose data. Kfifo has a more conventional poll and will fire off userspace whenever any data is in the buffer. Hence kfifo will work for your usecase. I would like to have a fill level capable buffer again in the future as they are very useful in high speed uses where latency doesn't matter. If you are using kfifo then something odd is going on! Its trivial to switch a driver between them. > >Thanks, >Denis >-- >To unsubscribe from this list: send the line "unsubscribe linux-iio" in >the body of a message to majordomo@vger.kernel.org >More majordomo info at http://vger.kernel.org/majordomo-info.html -- Sent from my Android phone with K-9 Mail. Please excuse my brevity. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: iio_buffer length 2012-09-25 16:20 ` Jonathan Cameron @ 2012-09-25 21:20 ` Denis Ciocca 0 siblings, 0 replies; 9+ messages in thread From: Denis Ciocca @ 2012-09-25 21:20 UTC (permalink / raw) To: Jonathan Cameron; +Cc: linux-iio [-- Attachment #1: Type: text/plain, Size: 787 bytes --] Hi Jon, > Firstly please confirm you are using a kfifo buffer? No, I use sw-ring. > Swring is deprecated but will do precisely what you are seeing I think. It uses a half full watershead to decide to signal userspace. If you wait till the buffer is full, unless your sampling is very slow you will have data coming in before userspace has read the whole buffer out. Hence you will loose data. You are right. I saw exatly what you said. Kfifo has a more conventional poll and will fire off userspace whenever any data is in the buffer. Hence kfifo will work for your usecase. I would like to have a fill level capable buffer again in the future as they are very useful in high speed uses where latency doesn't matter. Ok, I will change my sw-ring buffer to kfifo! Thanks, Denis [-- Attachment #2: Type: text/html, Size: 876 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2012-09-26 18:10 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <C0999E24-1BF1-4B7D-835B-8E3AC76C61F8@gmail.com>
2012-09-26 1:32 ` iio_buffer length Ge Gao
2012-09-26 7:27 ` Jonathan Cameron
2012-09-26 8:04 ` Lars-Peter Clausen
2012-09-26 12:37 ` Denis Ciocca
2012-09-26 14:23 ` Jonathan Cameron
2012-09-26 18:10 ` Ge Gao
2012-09-25 14:05 Denis Ciocca
2012-09-25 16:20 ` Jonathan Cameron
2012-09-25 21:20 ` Denis Ciocca
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).