* __put_task_struct unresolved when being used in modules
@ 2004-10-13 10:17 Thomas Spatzier
2004-10-13 10:29 ` Christoph Hellwig
0 siblings, 1 reply; 4+ messages in thread
From: Thomas Spatzier @ 2004-10-13 10:17 UTC (permalink / raw)
To: linux-kernel
I have a module that keeps a reference to a task_struct and uses
get_task_struct and put_task_struct to increment/decrement the
task_struct's ref count.
Function __put_task_struct defined in kernel/fork.c does not have
an associated EXPORT_SYMBOL , so I get an unresolved symbol
error.
Is there a reason why __put_task_struct is not exported? Otherwise,
I would just add the missing EXPORT_SYMBOL. There are a number
of EXPORT_SYMBOLs already defined in fork.c anyway.
Regards,
Thomas
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: __put_task_struct unresolved when being used in modules
2004-10-13 10:17 __put_task_struct unresolved when being used in modules Thomas Spatzier
@ 2004-10-13 10:29 ` Christoph Hellwig
2004-10-13 10:49 ` Thomas Spatzier
0 siblings, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2004-10-13 10:29 UTC (permalink / raw)
To: Thomas Spatzier; +Cc: linux-kernel
On Wed, Oct 13, 2004 at 12:17:54PM +0200, Thomas Spatzier wrote:
>
>
>
>
> I have a module that keeps a reference to a task_struct and uses
> get_task_struct and put_task_struct to increment/decrement the
> task_struct's ref count.
> Function __put_task_struct defined in kernel/fork.c does not have
> an associated EXPORT_SYMBOL , so I get an unresolved symbol
> error.
> Is there a reason why __put_task_struct is not exported? Otherwise,
> I would just add the missing EXPORT_SYMBOL. There are a number
> of EXPORT_SYMBOLs already defined in fork.c anyway.
In general module shouldn't deal with task reference counts. If we decide
you have a legitimate reason for doing this from a module after a review here
on lkml we could add an EXPORT_SYMBOL_GPL at the same time your module gets
merged.
p.s. this is really becoming a FAQ ;-)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: __put_task_struct unresolved when being used in modules
2004-10-13 10:29 ` Christoph Hellwig
@ 2004-10-13 10:49 ` Thomas Spatzier
2004-10-13 20:52 ` Andrew Morton
0 siblings, 1 reply; 4+ messages in thread
From: Thomas Spatzier @ 2004-10-13 10:49 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: linux-kernel
Christoph Hellwig <hch@infradead.org> wrote on 13.10.2004 12:29:55:
>
> In general module shouldn't deal with task reference counts. If we
decide
> you have a legitimate reason for doing this from a module after a review
here
> on lkml we could add an EXPORT_SYMBOL_GPL at the same time your module
gets
> merged.
>
The module is actually already in the kernel (drivers/s390/net/qeth.ko).
We have a userspace daemon that registers with the kernel module and we
need to send a signal to that daemon, whenever the device driver detects
some
change in its managed devices. This is done in qeth_notify_processes (just
in
case you want to take a look ;-) ).
For this purpose, we store a pointer to the daemon's task_struct, so we can
send a signal to that task. However, if the daemon crashes for some reason,
we have an invalid task_struct pointer. If we had a counted reference, we
could check the state of the task before signaling. In case of the task
being gone, we would release our reference.
We had another idea for solving the problem: is there a possibility that
our module gets notified when the task dies, i.e. is there a notifier_chain
defined for task states? In that case we could do the cleanup of our
notifier list when we receive the notification.
Thomas
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: __put_task_struct unresolved when being used in modules
2004-10-13 10:49 ` Thomas Spatzier
@ 2004-10-13 20:52 ` Andrew Morton
0 siblings, 0 replies; 4+ messages in thread
From: Andrew Morton @ 2004-10-13 20:52 UTC (permalink / raw)
To: Thomas Spatzier; +Cc: hch, linux-kernel
Thomas Spatzier <thomas.spatzier@de.ibm.com> wrote:
>
> Christoph Hellwig <hch@infradead.org> wrote on 13.10.2004 12:29:55:
> >
> > In general module shouldn't deal with task reference counts. If we
> decide
> > you have a legitimate reason for doing this from a module after a review
> here
> > on lkml we could add an EXPORT_SYMBOL_GPL at the same time your module
> gets
> > merged.
> >
> The module is actually already in the kernel (drivers/s390/net/qeth.ko).
> We have a userspace daemon that registers with the kernel module and we
> need to send a signal to that daemon, whenever the device driver detects
> some
> change in its managed devices. This is done in qeth_notify_processes (just
> in
> case you want to take a look ;-) ).
> For this purpose, we store a pointer to the daemon's task_struct, so we can
> send a signal to that task. However, if the daemon crashes for some reason,
> we have an invalid task_struct pointer.
Drivers should not be holding references to userspace processes. Your
daemons should instead be holding references to resources within the
driver.
IOW: the daemon should be holding an open file descriptor and should be
blocked in read() or select/poll waiting for activity on that fd.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2004-10-13 20:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-13 10:17 __put_task_struct unresolved when being used in modules Thomas Spatzier
2004-10-13 10:29 ` Christoph Hellwig
2004-10-13 10:49 ` Thomas Spatzier
2004-10-13 20:52 ` Andrew Morton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®