All of lore.kernel.org
 help / color / mirror / Atom feed
* Userspace agent crash and kernel module
@ 2014-11-18  7:49 Kevin Wilson
  2014-11-18  8:15 ` Pranay Srivastava
  2014-11-21 18:37 ` Jeff Haran
  0 siblings, 2 replies; 7+ messages in thread
From: Kevin Wilson @ 2014-11-18  7:49 UTC (permalink / raw)
  To: kernelnewbies

Hi,
I want to write a kernel module which interacts with a userspace daemon.
There are cases when the userspace daemon can terminate by some signals.
There are also cases where the userspace daemon can crash (in some abnormal
cases). Is there a way that the kernel module will be aware of such
userspace agent crash, in order to reset its state ?

Regards,
Kevin

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Userspace agent crash and kernel module
  2014-11-18  7:49 Userspace agent crash and kernel module Kevin Wilson
@ 2014-11-18  8:15 ` Pranay Srivastava
  2014-11-21 10:55   ` Kevin Wilson
  2014-11-21 18:37 ` Jeff Haran
  1 sibling, 1 reply; 7+ messages in thread
From: Pranay Srivastava @ 2014-11-18  8:15 UTC (permalink / raw)
  To: kernelnewbies

Hi Kevin




On Tue, Nov 18, 2014 at 1:19 PM, Kevin Wilson <wkevils@gmail.com> wrote:
> Hi,
> I want to write a kernel module which interacts with a userspace daemon.
> There are cases when the userspace daemon can terminate by some signals.
> There are also cases where the userspace daemon can crash (in some abnormal
> cases). Is there a way that the kernel module will be aware of such
> userspace agent crash, in order to reset its state ?

Can't you reset it when the daemon is about to be killed from the
userspace itself? Depends on how complex/simple you want
this but there are several possibilities. Care to tell me how you
thought about doing this and where you got stuck?


>
> Regards,
> Kevin
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Regards
-- 
        ---P.K.S

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Userspace agent crash and kernel module
  2014-11-18  8:15 ` Pranay Srivastava
@ 2014-11-21 10:55   ` Kevin Wilson
  2014-11-21 12:07     ` Pranay Srivastava
  2014-11-21 14:00     ` Greg KH
  0 siblings, 2 replies; 7+ messages in thread
From: Kevin Wilson @ 2014-11-21 10:55 UTC (permalink / raw)
  To: kernelnewbies

The thing is that crash of the daemon sometimes occur, from this
reason or other.
The question is how the kernel module will be aware of such
userspace agent crash, in order to reset its state ?

Regards,
Kevin


On Tue, Nov 18, 2014 at 10:15 AM, Pranay Srivastava <pranjas@gmail.com> wrote:
> Hi Kevin
>
>
>
>
> On Tue, Nov 18, 2014 at 1:19 PM, Kevin Wilson <wkevils@gmail.com> wrote:
>> Hi,
>> I want to write a kernel module which interacts with a userspace daemon.
>> There are cases when the userspace daemon can terminate by some signals.
>> There are also cases where the userspace daemon can crash (in some abnormal
>> cases). Is there a way that the kernel module will be aware of such
>> userspace agent crash, in order to reset its state ?
>
> Can't you reset it when the daemon is about to be killed from the
> userspace itself? Depends on how complex/simple you want
> this but there are several possibilities. Care to tell me how you
> thought about doing this and where you got stuck?
>
>
>>
>> Regards,
>> Kevin
>>
>> _______________________________________________
>> Kernelnewbies mailing list
>> Kernelnewbies at kernelnewbies.org
>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>
> Regards
> --
>         ---P.K.S

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Userspace agent crash and kernel module
  2014-11-21 10:55   ` Kevin Wilson
@ 2014-11-21 12:07     ` Pranay Srivastava
  2014-11-21 13:53       ` Kevin Wilson
  2014-11-21 14:00     ` Greg KH
  1 sibling, 1 reply; 7+ messages in thread
From: Pranay Srivastava @ 2014-11-21 12:07 UTC (permalink / raw)
  To: kernelnewbies

Hi Kevin,

Request you not to top post :-) .

> On Tue, Nov 18, 2014 at 10:15 AM, Pranay Srivastava <pranjas@gmail.com> wrote:
>> Hi Kevin
>>
>>
>>
>>
>> On Tue, Nov 18, 2014 at 1:19 PM, Kevin Wilson <wkevils@gmail.com> wrote:
>>> Hi,
>>> I want to write a kernel module which interacts with a userspace daemon.
>>> There are cases when the userspace daemon can terminate by some signals.
>>> There are also cases where the userspace daemon can crash (in some abnormal
>>> cases). Is there a way that the kernel module will be aware of such
>>> userspace agent crash, in order to reset its state ?
>>
>> Can't you reset it when the daemon is about to be killed from the
>> userspace itself? Depends on how complex/simple you want
>> this but there are several possibilities. Care to tell me how you
>> thought about doing this and where you got stuck?
>>
>>
>>>
>>> Regards,
>>> Kevin
>>>
>>> _______________________________________________
>>> Kernelnewbies mailing list
>>> Kernelnewbies at kernelnewbies.org
>>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>>
>>
>> Regards
>> --
>>         ---P.K.S
>
>On Fri, Nov 21, 2014 at 4:25 PM, Kevin Wilson <wkevils@gmail.com> wrote:
> The thing is that crash of the daemon sometimes occur, from this
> reason or other.
> The question is how the kernel module will be aware of such
> userspace agent crash, in order to reset its state ?

I don't think kernel will know itself. The simplest you can do is put
a fault handler in userspace code
and have it do a write on a sysfs/procfs file or an ioctl or maybe
send signal or enqueue something
to another heartbeat daemon , etc, whatever method seems most
appropriate to you.

Does this sound useful?

>
> Regards,
> Kevin
>
>


-- 
        ---P.K.S

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Userspace agent crash and kernel module
  2014-11-21 12:07     ` Pranay Srivastava
@ 2014-11-21 13:53       ` Kevin Wilson
  0 siblings, 0 replies; 7+ messages in thread
From: Kevin Wilson @ 2014-11-21 13:53 UTC (permalink / raw)
  To: kernelnewbies

But how can you be sure that this fault handler will be called when
the agent crashes


On Fri, Nov 21, 2014 at 2:07 PM, Pranay Srivastava <pranjas@gmail.com> wrote:
> Hi Kevin,
>
> Request you not to top post :-) .
>
>> On Tue, Nov 18, 2014 at 10:15 AM, Pranay Srivastava <pranjas@gmail.com> wrote:
>>> Hi Kevin
>>>
>>>
>>>
>>>
>>> On Tue, Nov 18, 2014 at 1:19 PM, Kevin Wilson <wkevils@gmail.com> wrote:
>>>> Hi,
>>>> I want to write a kernel module which interacts with a userspace daemon.
>>>> There are cases when the userspace daemon can terminate by some signals.
>>>> There are also cases where the userspace daemon can crash (in some abnormal
>>>> cases). Is there a way that the kernel module will be aware of such
>>>> userspace agent crash, in order to reset its state ?
>>>
>>> Can't you reset it when the daemon is about to be killed from the
>>> userspace itself? Depends on how complex/simple you want
>>> this but there are several possibilities. Care to tell me how you
>>> thought about doing this and where you got stuck?
>>>
>>>
>>>>
>>>> Regards,
>>>> Kevin
>>>>
>>>> _______________________________________________
>>>> Kernelnewbies mailing list
>>>> Kernelnewbies at kernelnewbies.org
>>>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>>>
>>>
>>> Regards
>>> --
>>>         ---P.K.S
>>
>>On Fri, Nov 21, 2014 at 4:25 PM, Kevin Wilson <wkevils@gmail.com> wrote:
>> The thing is that crash of the daemon sometimes occur, from this
>> reason or other.
>> The question is how the kernel module will be aware of such
>> userspace agent crash, in order to reset its state ?
>
> I don't think kernel will know itself. The simplest you can do is put
> a fault handler in userspace code
> and have it do a write on a sysfs/procfs file or an ioctl or maybe
> send signal or enqueue something
> to another heartbeat daemon , etc, whatever method seems most
> appropriate to you.
>
> Does this sound useful?
>
>>
>> Regards,
>> Kevin
>>
>>
>
>
> --
>         ---P.K.S

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Userspace agent crash and kernel module
  2014-11-21 10:55   ` Kevin Wilson
  2014-11-21 12:07     ` Pranay Srivastava
@ 2014-11-21 14:00     ` Greg KH
  1 sibling, 0 replies; 7+ messages in thread
From: Greg KH @ 2014-11-21 14:00 UTC (permalink / raw)
  To: kernelnewbies

On Fri, Nov 21, 2014 at 12:55:46PM +0200, Kevin Wilson wrote:
> The thing is that crash of the daemon sometimes occur, from this
> reason or other.
> The question is how the kernel module will be aware of such
> userspace agent crash, in order to reset its state ?

Sounds like a horrible design, and I wouldn't recommend you doing that
at all.

best of luck,

greg k-h

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Userspace agent crash and kernel module
  2014-11-18  7:49 Userspace agent crash and kernel module Kevin Wilson
  2014-11-18  8:15 ` Pranay Srivastava
@ 2014-11-21 18:37 ` Jeff Haran
  1 sibling, 0 replies; 7+ messages in thread
From: Jeff Haran @ 2014-11-21 18:37 UTC (permalink / raw)
  To: kernelnewbies

> -----Original Message-----
> From: kernelnewbies-bounces at kernelnewbies.org [mailto:kernelnewbies-
> bounces at kernelnewbies.org] On Behalf Of Kevin Wilson
> Sent: Monday, November 17, 2014 11:50 PM
> To: kernelnewbies at kernelnewbies.org
> Subject: Userspace agent crash and kernel module
> 
> Hi,
> I want to write a kernel module which interacts with a userspace daemon.
> There are cases when the userspace daemon can terminate by some signals.
> There are also cases where the userspace daemon can crash (in some
> abnormal cases). Is there a way that the kernel module will be aware of such
> userspace agent crash, in order to reset its state ?
> 
> Regards,
> Kevin

If your module provided an fd to user space I suppose you could leverage the os's attempt to close all open fds of a process when that process terminates. I believe a character driver's release callback will get called in this case. Not sure how reliable this would be though. Generally it does sound like an awkward way to manage a device.

Jeff Haran

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-11-21 18:37 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-18  7:49 Userspace agent crash and kernel module Kevin Wilson
2014-11-18  8:15 ` Pranay Srivastava
2014-11-21 10:55   ` Kevin Wilson
2014-11-21 12:07     ` Pranay Srivastava
2014-11-21 13:53       ` Kevin Wilson
2014-11-21 14:00     ` Greg KH
2014-11-21 18:37 ` Jeff Haran

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.