* User space <==> kernel space for device wakeups.
@ 2014-10-08 7:39 manty kuma
2014-10-08 13:29 ` Greg KH
2014-10-08 18:30 ` Jinqiang Zeng
0 siblings, 2 replies; 13+ messages in thread
From: manty kuma @ 2014-10-08 7:39 UTC (permalink / raw)
To: kernelnewbies
Hi,
I want a user process to be notified on device wakeup so that I can print
some related information.
Which framework to use for this?(events, .. ??)
One idea I get is to log the info into <debugfs> and poll(implement my
poll) on it for data. This is my last option.
Are there any better ways?
Best Regards,
Manty
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20141008/719d5163/attachment.html
^ permalink raw reply [flat|nested] 13+ messages in thread
* User space <==> kernel space for device wakeups.
2014-10-08 7:39 User space <==> kernel space for device wakeups manty kuma
@ 2014-10-08 13:29 ` Greg KH
2014-10-08 15:44 ` Jeshwanth Kumar N K
2014-10-08 18:30 ` Jinqiang Zeng
1 sibling, 1 reply; 13+ messages in thread
From: Greg KH @ 2014-10-08 13:29 UTC (permalink / raw)
To: kernelnewbies
On Wed, Oct 08, 2014 at 04:39:17PM +0900, manty kuma wrote:
> Hi,
> I want a user process to be notified on device wakeup so that I can print some
> related information.
Really? My device can "wakeup" thousands of times a second, what are
you going to do with that type of information?
> Which framework to use for this?(events, .. ??)
>
> One idea I get is to log the info into <debugfs> and poll(implement my poll) on
> it for data. This is my last option.
>
> Are there any better ways?
What problem are you trying to solve here?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 13+ messages in thread
* User space <==> kernel space for device wakeups.
2014-10-08 13:29 ` Greg KH
@ 2014-10-08 15:44 ` Jeshwanth Kumar N K
2014-10-08 15:57 ` Kristof Provost
0 siblings, 1 reply; 13+ messages in thread
From: Jeshwanth Kumar N K @ 2014-10-08 15:44 UTC (permalink / raw)
To: kernelnewbies
Wayback when I was working on some project to wake up userspace program for
every rising edge in GPIO pin (hall sensor), I use to send signal to the
PID from kernel, before that userspace has to register its PID with kernel
module. Max interrupts I have tested is some 100 times per second I.e. 100
times wakes up userspace application per second. It was working quite
well.. But today also I don't know what other thing can be used for this
case, as it is asynchronous.
Sent from my Android phone with Gmail. Please excuse my brevity.
On 08-Oct-2014 7:03 pm, "Greg KH" <greg@kroah.com> wrote:
> On Wed, Oct 08, 2014 at 04:39:17PM +0900, manty kuma wrote:
> > Hi,
> > I want a user process to be notified on device wakeup so that I can
> print some
> > related information.
>
> Really? My device can "wakeup" thousands of times a second, what are
> you going to do with that type of information?
>
> > Which framework to use for this?(events, .. ??)
> >
> > One idea I get is to log the info into <debugfs> and poll(implement my
> poll) on
> > it for data. This is my last option.
> >
> > Are there any better ways?
>
> What problem are you trying to solve here?
>
> thanks,
>
> greg k-h
>
> _______________________________________________
> 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/20141008/c06b7009/attachment.html
^ permalink raw reply [flat|nested] 13+ messages in thread
* User space <==> kernel space for device wakeups.
2014-10-08 15:44 ` Jeshwanth Kumar N K
@ 2014-10-08 15:57 ` Kristof Provost
2014-10-08 16:25 ` Greg Kroah-Hartman
0 siblings, 1 reply; 13+ messages in thread
From: Kristof Provost @ 2014-10-08 15:57 UTC (permalink / raw)
To: kernelnewbies
On 2014-10-08 21:14:43 (+0530), Jeshwanth Kumar N K <jeshkumar555@gmail.com> wrote:
> Wayback when I was working on some project to wake up userspace program for
> every rising edge in GPIO pin (hall sensor), I use to send signal to the
> PID from kernel, before that userspace has to register its PID with kernel
> module.
>
I've seen a certain vendor[1] do something similar. They saved the task
pointer for whichever process made the magical ioctl() call and used it
to send signals from the interrupt handler. It worked, right up to the
point where the process went away and then the kernel panicked.
Regards,
Kristof
[1] Who shall remain nameless here. Naming them would only give people
the impression that other vendors might be better.
^ permalink raw reply [flat|nested] 13+ messages in thread
* User space <==> kernel space for device wakeups.
2014-10-08 15:57 ` Kristof Provost
@ 2014-10-08 16:25 ` Greg Kroah-Hartman
2014-10-08 16:31 ` Jeshwanth Kumar N K
0 siblings, 1 reply; 13+ messages in thread
From: Greg Kroah-Hartman @ 2014-10-08 16:25 UTC (permalink / raw)
To: kernelnewbies
On Wed, Oct 08, 2014 at 05:57:50PM +0200, Kristof Provost wrote:
> On 2014-10-08 21:14:43 (+0530), Jeshwanth Kumar N K <jeshkumar555@gmail.com> wrote:
> > Wayback when I was working on some project to wake up userspace program for
> > every rising edge in GPIO pin (hall sensor), I use to send signal to the
> > PID from kernel, before that userspace has to register its PID with kernel
> > module.
> >
> I've seen a certain vendor[1] do something similar. They saved the task
> pointer for whichever process made the magical ioctl() call and used it
> to send signals from the interrupt handler. It worked, right up to the
> point where the process went away and then the kernel panicked.
Exactly, don't do that :)
Finding out the real problem that is attempting to be solved would be
good...
greg k-h
^ permalink raw reply [flat|nested] 13+ messages in thread
* User space <==> kernel space for device wakeups.
2014-10-08 16:25 ` Greg Kroah-Hartman
@ 2014-10-08 16:31 ` Jeshwanth Kumar N K
2014-10-08 16:38 ` Greg Kroah-Hartman
0 siblings, 1 reply; 13+ messages in thread
From: Jeshwanth Kumar N K @ 2014-10-08 16:31 UTC (permalink / raw)
To: kernelnewbies
Greg, then what will you suggest for my case? I mean any alternative ?
Thanks
On Wed, Oct 8, 2014 at 9:55 PM, Greg Kroah-Hartman <greg@kroah.com> wrote:
> On Wed, Oct 08, 2014 at 05:57:50PM +0200, Kristof Provost wrote:
> > On 2014-10-08 21:14:43 (+0530), Jeshwanth Kumar N K <
> jeshkumar555 at gmail.com> wrote:
> > > Wayback when I was working on some project to wake up userspace
> program for
> > > every rising edge in GPIO pin (hall sensor), I use to send signal to
> the
> > > PID from kernel, before that userspace has to register its PID with
> kernel
> > > module.
> > >
> > I've seen a certain vendor[1] do something similar. They saved the task
> > pointer for whichever process made the magical ioctl() call and used it
> > to send signals from the interrupt handler. It worked, right up to the
> > point where the process went away and then the kernel panicked.
>
> Exactly, don't do that :)
>
> Finding out the real problem that is attempting to be solved would be
> good...
>
> greg k-h
>
--
Regards
Jeshwanth Kumar N K
Bangalore, India
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20141008/e315390e/attachment.html
^ permalink raw reply [flat|nested] 13+ messages in thread
* User space <==> kernel space for device wakeups.
2014-10-08 16:31 ` Jeshwanth Kumar N K
@ 2014-10-08 16:38 ` Greg Kroah-Hartman
2014-10-08 16:53 ` Jeshwanth Kumar N K
0 siblings, 1 reply; 13+ messages in thread
From: Greg Kroah-Hartman @ 2014-10-08 16:38 UTC (permalink / raw)
To: kernelnewbies
A: No.
Q: Should I include quotations after my reply?
http://daringfireball.net/2007/07/on_top
On Wed, Oct 08, 2014 at 10:01:43PM +0530, Jeshwanth Kumar N K wrote:
> Greg, then what will you suggest for my case? I mean any alternative ?
What "case"? What problem are you trying to solve?
greg k-h
^ permalink raw reply [flat|nested] 13+ messages in thread
* User space <==> kernel space for device wakeups.
2014-10-08 16:38 ` Greg Kroah-Hartman
@ 2014-10-08 16:53 ` Jeshwanth Kumar N K
2014-10-08 17:32 ` Greg Kroah-Hartman
2014-10-09 15:18 ` buyitian
0 siblings, 2 replies; 13+ messages in thread
From: Jeshwanth Kumar N K @ 2014-10-08 16:53 UTC (permalink / raw)
To: kernelnewbies
On Wed, Oct 8, 2014 at 10:08 PM, Greg Kroah-Hartman <greg@kroah.com> wrote:
>
> A: No.
> Q: Should I include quotations after my reply?
>
> http://daringfireball.net/2007/07/on_top
>
> On Wed, Oct 08, 2014 at 10:01:43PM +0530, Jeshwanth Kumar N K wrote:
> > Greg, then what will you suggest for my case? I mean any alternative ?
>
> What "case"? What problem are you trying to solve?
>
> greg k-h
>
Oh, correct. 2nd time I am warned on this (may be practise by using
outlook). Will reply bottom now onwards - sorry.
My case was: I have a hall sensor connected to Beaglebone black, And
Userspace needed a wakeup once the interrupt occur (example: every rising
edge of GPIO). Before that, the program will register (ioctl) the User
space task pointer with my kernel module, then my kernel module start
sending signal for every interrupt occur. We can consider roughly around
100 to 200 interrupts per second maximum. ( I have not done this, but may
be we can consider kernel will get notified when userspace program stops.
so that it will not send any signal). So for this case, any other
alternative implementation ?
Thanks
--
Regards
Jeshwanth Kumar N K
Bangalore, India
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20141008/6189aa67/attachment.html
^ permalink raw reply [flat|nested] 13+ messages in thread
* User space <==> kernel space for device wakeups.
2014-10-08 16:53 ` Jeshwanth Kumar N K
@ 2014-10-08 17:32 ` Greg Kroah-Hartman
2014-10-08 17:47 ` Jeshwanth Kumar N K
2014-10-09 15:18 ` buyitian
1 sibling, 1 reply; 13+ messages in thread
From: Greg Kroah-Hartman @ 2014-10-08 17:32 UTC (permalink / raw)
To: kernelnewbies
On Wed, Oct 08, 2014 at 10:23:32PM +0530, Jeshwanth Kumar N K wrote:
> My case was: I have a hall sensor connected to Beaglebone black, And Userspace
> needed a wakeup once the interrupt occur (example: every rising edge of GPIO).
> Before that, the program will register (ioctl) the User space task pointer with
> my kernel module, then my kernel module start sending signal for every
> interrupt occur. We can consider roughly around 100 to 200 interrupts per
> second maximum. ( I have not done this, but may be we can consider kernel will
> get notified when userspace program stops. so that it will not send any
> signal). So for this case, any other alternative implementation ?
select() on the GPIO sysfs file instead of a custom ioctl?
And what do you do in userspace with that information?
greg k-h
^ permalink raw reply [flat|nested] 13+ messages in thread
* User space <==> kernel space for device wakeups.
2014-10-08 17:32 ` Greg Kroah-Hartman
@ 2014-10-08 17:47 ` Jeshwanth Kumar N K
0 siblings, 0 replies; 13+ messages in thread
From: Jeshwanth Kumar N K @ 2014-10-08 17:47 UTC (permalink / raw)
To: kernelnewbies
On Wed, Oct 8, 2014 at 11:02 PM, Greg Kroah-Hartman <greg@kroah.com> wrote:
> On Wed, Oct 08, 2014 at 10:23:32PM +0530, Jeshwanth Kumar N K wrote:
> > My case was: I have a hall sensor connected to Beaglebone black, And
> Userspace
> > needed a wakeup once the interrupt occur (example: every rising edge of
> GPIO).
> > Before that, the program will register (ioctl) the User space task
> pointer with
> > my kernel module, then my kernel module start sending signal for every
> > interrupt occur. We can consider roughly around 100 to 200 interrupts per
> > second maximum. ( I have not done this, but may be we can consider
> kernel will
> > get notified when userspace program stops. so that it will not send any
> > signal). So for this case, any other alternative implementation ?
>
> select() on the GPIO sysfs file instead of a custom ioctl?
>
> And what do you do in userspace with that information?
>
> greg k-h
>
With hall sensor input I can get the position of motor, and in userspace I
drive the motor (brushless) for next position by passing the values to
sysfs attribute of PWM driver. It's a closed loop, until I drive the PWM I
will not get an interrupt. But what solution I had was, anyway PWM driver
is available, my sensor driver sends the current position to the PWM driver
(altered), then it will send to the motor directly (no need to user space
intervention in driving PWM), But controlling through application in
userspace like start/stop/speed etc. But I have not implemented and tested
this.
--
Regards
Jeshwanth Kumar N K
Bangalore, India
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20141008/f9579604/attachment.html
^ permalink raw reply [flat|nested] 13+ messages in thread
* User space <==> kernel space for device wakeups.
2014-10-08 7:39 User space <==> kernel space for device wakeups manty kuma
2014-10-08 13:29 ` Greg KH
@ 2014-10-08 18:30 ` Jinqiang Zeng
2014-10-09 1:38 ` manty kuma
1 sibling, 1 reply; 13+ messages in thread
From: Jinqiang Zeng @ 2014-10-08 18:30 UTC (permalink / raw)
To: kernelnewbies
2014-10-08 0:39 GMT-07:00 manty kuma <mantykuma@gmail.com>:
> Hi,
> I want a user process to be notified on device wakeup so that I can print
> some related information.
>
> Which framework to use for this?(events, .. ??)
You can use netlink and uevent to do this job.
But just as Greg has pointed out, if your device notify frequently,
your system will get slow down obviously.
>
> One idea I get is to log the info into <debugfs> and poll(implement my poll)
> on it for data. This is my last option.
>
> Are there any better ways?
>
> Best Regards,
> Manty
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* User space <==> kernel space for device wakeups.
2014-10-08 18:30 ` Jinqiang Zeng
@ 2014-10-09 1:38 ` manty kuma
0 siblings, 0 replies; 13+ messages in thread
From: manty kuma @ 2014-10-09 1:38 UTC (permalink / raw)
To: kernelnewbies
Hi All,
Thank you for the replies. I understand that I can use netlink sockets.
Also, i have gone through various other possible ways :
http://people.ee.ethz.ch/~arkeller/linux/kernel_user_space_howto.html
I am looking for a simpler solution which uses existing information of sys
entries. That is, I am looking for a sys entry which is incremented for
every device wakeup or some other sys entry that I can use to get notified
on wakeup.
Greg,
>> Really? My device can "wakeup" thousands of times a second, what are
you going to do with that type of information?
I am talking of device as a whole not individual devices in the device. In
kernel log, we can see a print stating
"PM: suspend of devices complete after xxx msecs" --> *Prints from
kernel/kernel/power/main.c*
Similarly I get a print for resume stating
"PM: resume of devices complete after xxx msecs" --> *Prints from
kernel/kernel/power/main.c*
Ideally after the above print of resume i want my stats to be printed..
Programatically after dpm_resume_end().
Best Regards,
Manty
On Thu, Oct 9, 2014 at 3:30 AM, Jinqiang Zeng <jinqiangzeng@gmail.com>
wrote:
> 2014-10-08 0:39 GMT-07:00 manty kuma <mantykuma@gmail.com>:
> > Hi,
> > I want a user process to be notified on device wakeup so that I can print
> > some related information.
> >
> > Which framework to use for this?(events, .. ??)
>
> You can use netlink and uevent to do this job.
>
> But just as Greg has pointed out, if your device notify frequently,
> your system will get slow down obviously.
>
> >
> > One idea I get is to log the info into <debugfs> and poll(implement my
> poll)
> > on it for data. This is my last option.
> >
> > Are there any better ways?
> >
> > Best Regards,
> > Manty
> >
> > _______________________________________________
> > 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/20141009/366ea6e8/attachment-0001.html
^ permalink raw reply [flat|nested] 13+ messages in thread
* User space <==> kernel space for device wakeups.
2014-10-08 16:53 ` Jeshwanth Kumar N K
2014-10-08 17:32 ` Greg Kroah-Hartman
@ 2014-10-09 15:18 ` buyitian
1 sibling, 0 replies; 13+ messages in thread
From: buyitian @ 2014-10-09 15:18 UTC (permalink / raw)
To: kernelnewbies
> My case was: I have a hall sensor connected to Beaglebone black, And Userspace needed a wakeup once the interrupt occur (example: every rising edge of GPIO). Before that, the program will register (ioctl) the User space task pointer with my kernel module, then my kernel module start sending signal for every interrupt occur. We can consider roughly around 100 to 200 interrupts per second maximum. ( I have not done this, but may be we can consider kernel will get notified when userspace program stops. so that it will not send any signal). So for this case, any other alternative
Once kernel gets interrupt, it can use netlink to notify user space, if you are using Android, it is using UEVENT.
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2014-10-09 15:18 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-08 7:39 User space <==> kernel space for device wakeups manty kuma
2014-10-08 13:29 ` Greg KH
2014-10-08 15:44 ` Jeshwanth Kumar N K
2014-10-08 15:57 ` Kristof Provost
2014-10-08 16:25 ` Greg Kroah-Hartman
2014-10-08 16:31 ` Jeshwanth Kumar N K
2014-10-08 16:38 ` Greg Kroah-Hartman
2014-10-08 16:53 ` Jeshwanth Kumar N K
2014-10-08 17:32 ` Greg Kroah-Hartman
2014-10-08 17:47 ` Jeshwanth Kumar N K
2014-10-09 15:18 ` buyitian
2014-10-08 18:30 ` Jinqiang Zeng
2014-10-09 1:38 ` manty kuma
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).