* how to process data recvd from a device that wont give interrupts
@ 2012-10-04 12:03 devendra.aaru
2012-10-04 17:50 ` Mulyadi Santosa
0 siblings, 1 reply; 6+ messages in thread
From: devendra.aaru @ 2012-10-04 12:03 UTC (permalink / raw)
To: kernelnewbies
Hi all,
I found that you can use a kernel timer and poll for the hardware
interrupt registers whether the interrupt flag is set or not,
but this will take atleast some good amount of CPU.
are there any ways other than using the kernel timer?
thanks,
^ permalink raw reply [flat|nested] 6+ messages in thread
* how to process data recvd from a device that wont give interrupts
2012-10-04 12:03 how to process data recvd from a device that wont give interrupts devendra.aaru
@ 2012-10-04 17:50 ` Mulyadi Santosa
2012-10-05 4:54 ` devendra.aaru
0 siblings, 1 reply; 6+ messages in thread
From: Mulyadi Santosa @ 2012-10-04 17:50 UTC (permalink / raw)
To: kernelnewbies
Hi...
On Thu, Oct 4, 2012 at 7:03 PM, devendra.aaru <devendra.aaru@gmail.com> wrote:
> Hi all,
>
> I found that you can use a kernel timer and poll for the hardware
> interrupt registers whether the interrupt flag is set or not,
>
> but this will take atleast some good amount of CPU.
yeah, thing is, as you know, timer fires interrupt and CPU will
certainly have to service it. So, it's impossible to work around it
IMHO
> are there any ways other than using the kernel timer?
perhaps something less intrusive like creating kernel thread and its
function is solely checking register state?
--
regards,
Mulyadi Santosa
Freelance Linux trainer and consultant
blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* how to process data recvd from a device that wont give interrupts
2012-10-04 17:50 ` Mulyadi Santosa
@ 2012-10-05 4:54 ` devendra.aaru
2012-10-05 6:15 ` Kshemendra KP
0 siblings, 1 reply; 6+ messages in thread
From: devendra.aaru @ 2012-10-05 4:54 UTC (permalink / raw)
To: kernelnewbies
On Thu, Oct 4, 2012 at 1:50 PM, Mulyadi Santosa
<mulyadi.santosa@gmail.com> wrote:
> Hi...
>
> On Thu, Oct 4, 2012 at 7:03 PM, devendra.aaru <devendra.aaru@gmail.com> wrote:
>> Hi all,
>>
>> I found that you can use a kernel timer and poll for the hardware
>> interrupt registers whether the interrupt flag is set or not,
>>
>> but this will take atleast some good amount of CPU.
>
> yeah, thing is, as you know, timer fires interrupt and CPU will
> certainly have to service it. So, it's impossible to work around it
> IMHO
>
>> are there any ways other than using the kernel timer?
>
> perhaps something less intrusive like creating kernel thread and its
> function is solely checking register state?
>
yes, more or less similar to what the kernel timer does, :)
I think actually when i get the data , i am just copying it to my
local structures,
This job is done in the kernel timer itself, with this itself its
taking a 10% of cpu
which is actually too much.
let me try with softirqs, i am going to use tasklets, what do you think ? :)
> --
> regards,
>
> Mulyadi Santosa
> Freelance Linux trainer and consultant
>
> blog: the-hydra.blogspot.com
> training: mulyaditraining.blogspot.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* how to process data recvd from a device that wont give interrupts
2012-10-05 4:54 ` devendra.aaru
@ 2012-10-05 6:15 ` Kshemendra KP
2012-10-05 6:32 ` Kshemendra KP
0 siblings, 1 reply; 6+ messages in thread
From: Kshemendra KP @ 2012-10-05 6:15 UTC (permalink / raw)
To: kernelnewbies
softirqs and tasklets run in interrupt context and must not sleep.
One cannot use copy_from_user() and copy_to_user() in both of them.
Regards
Kshemendra
On Fri, Oct 5, 2012 at 10:24 AM, devendra.aaru <devendra.aaru@gmail.com>wrote:
> On Thu, Oct 4, 2012 at 1:50 PM, Mulyadi Santosa
> <mulyadi.santosa@gmail.com> wrote:
> > Hi...
> >
> > On Thu, Oct 4, 2012 at 7:03 PM, devendra.aaru <devendra.aaru@gmail.com>
> wrote:
> >> Hi all,
> >>
> >> I found that you can use a kernel timer and poll for the hardware
> >> interrupt registers whether the interrupt flag is set or not,
> >>
> >> but this will take atleast some good amount of CPU.
> >
> > yeah, thing is, as you know, timer fires interrupt and CPU will
> > certainly have to service it. So, it's impossible to work around it
> > IMHO
> >
> >> are there any ways other than using the kernel timer?
> >
> > perhaps something less intrusive like creating kernel thread and its
> > function is solely checking register state?
> >
>
> yes, more or less similar to what the kernel timer does, :)
>
> I think actually when i get the data , i am just copying it to my
> local structures,
>
> This job is done in the kernel timer itself, with this itself its
> taking a 10% of cpu
> which is actually too much.
>
> let me try with softirqs, i am going to use tasklets, what do you think ?
> :)
> > --
> > regards,
> >
> > Mulyadi Santosa
> > Freelance Linux trainer and consultant
> >
> > blog: the-hydra.blogspot.com
> > training: mulyaditraining.blogspot.com
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20121005/2eb1b85b/attachment.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* how to process data recvd from a device that wont give interrupts
2012-10-05 6:15 ` Kshemendra KP
@ 2012-10-05 6:32 ` Kshemendra KP
2012-10-05 9:46 ` devendra.aaru
0 siblings, 1 reply; 6+ messages in thread
From: Kshemendra KP @ 2012-10-05 6:32 UTC (permalink / raw)
To: kernelnewbies
Hi Devendra,
In the kernel thread if you continuously in a loop read a register it
will increase
the CPU usage. After every register read if data is not ready call a
schedule() (or related
call). This may help to reduce CPU utilization
Regards
Kshemendra
On Fri, Oct 5, 2012 at 11:45 AM, Kshemendra KP <kshemendra@suphalaam.com>wrote:
>
> softirqs and tasklets run in interrupt context and must not sleep.
> One cannot use copy_from_user() and copy_to_user() in both of them.
>
>
> Regards
>
> Kshemendra
>
>
>
> On Fri, Oct 5, 2012 at 10:24 AM, devendra.aaru <devendra.aaru@gmail.com>wrote:
>
>> On Thu, Oct 4, 2012 at 1:50 PM, Mulyadi Santosa
>> <mulyadi.santosa@gmail.com> wrote:
>> > Hi...
>> >
>> > On Thu, Oct 4, 2012 at 7:03 PM, devendra.aaru <devendra.aaru@gmail.com>
>> wrote:
>> >> Hi all,
>> >>
>> >> I found that you can use a kernel timer and poll for the hardware
>> >> interrupt registers whether the interrupt flag is set or not,
>> >>
>> >> but this will take atleast some good amount of CPU.
>> >
>> > yeah, thing is, as you know, timer fires interrupt and CPU will
>> > certainly have to service it. So, it's impossible to work around it
>> > IMHO
>> >
>> >> are there any ways other than using the kernel timer?
>> >
>> > perhaps something less intrusive like creating kernel thread and its
>> > function is solely checking register state?
>> >
>>
>> yes, more or less similar to what the kernel timer does, :)
>>
>> I think actually when i get the data , i am just copying it to my
>> local structures,
>>
>> This job is done in the kernel timer itself, with this itself its
>> taking a 10% of cpu
>> which is actually too much.
>>
>> let me try with softirqs, i am going to use tasklets, what do you think ?
>> :)
>> > --
>> > regards,
>> >
>> > Mulyadi Santosa
>> > Freelance Linux trainer and consultant
>> >
>> > blog: the-hydra.blogspot.com
>> > training: mulyaditraining.blogspot.com
>>
>> _______________________________________________
>> Kernelnewbies mailing list
>> Kernelnewbies at kernelnewbies.org
>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20121005/cab98310/attachment.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* how to process data recvd from a device that wont give interrupts
2012-10-05 6:32 ` Kshemendra KP
@ 2012-10-05 9:46 ` devendra.aaru
0 siblings, 0 replies; 6+ messages in thread
From: devendra.aaru @ 2012-10-05 9:46 UTC (permalink / raw)
To: kernelnewbies
On Fri, Oct 5, 2012 at 2:32 AM, Kshemendra KP <kshemendra@suphalaam.com> wrote:
>
> Hi Devendra,
>
> In the kernel thread if you continuously in a loop read a register it
> will increase
> the CPU usage. After every register read if data is not ready call a
> schedule() (or related
> call). This may help to reduce CPU utilization
>
[please no top posting],
I Know, i didn't say i use copy_from(to)user in the softirqs. its
wrong, and you can use the copy to (from) user in a different context,
ie our fops callbacks.
coming to threads,
these are also one and the same as your timers,
and your threading is wrong, since there is only register read, should
be checking at every 10 - 20 msec,
so coming back to timers :) no?
anyways thanks for letting me know .
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-10-05 9:46 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-04 12:03 how to process data recvd from a device that wont give interrupts devendra.aaru
2012-10-04 17:50 ` Mulyadi Santosa
2012-10-05 4:54 ` devendra.aaru
2012-10-05 6:15 ` Kshemendra KP
2012-10-05 6:32 ` Kshemendra KP
2012-10-05 9:46 ` devendra.aaru
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.