All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philippe Gerum <rpm@xenomai.org>
To: Jeff Weber <jweber@domain.hid>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-help] unable to load nucleus module: unknown symbol
Date: Thu, 05 Nov 2009 22:13:01 +0100	[thread overview]
Message-ID: <1257455581.2210.205.camel@domain.hid> (raw)
In-Reply-To: <4AEA590E.9070701@domain.hid>

On Thu, 2009-10-29 at 22:10 -0500, Jeff Weber wrote:
> I've built the xeno_nucleus as a module.  Neither depmod, nor modprobe
> can resolve the symbol "find_task_by_pid_ns":
> 
> depmod:
> WARNING:
> /lib/modules/2.6.31.5-xenomai-2.4.10/kernel/kernel/xenomai/nucleus/xeno_nucleus.ko
> needs unknown symbol find_task_by_pid_ns
> 
> modprobe [dmesg]:
> [  426.728630] xeno_nucleus: Unknown symbol find_task_by_pid_ns
> 
> Curiously, this symbol is in both my build System.map, and the kernel
> 
> bash # grep find_task_by_pid_ns System.map
> c102ecf6 T find_task_by_pid_ns
> 
> bash # cat /proc/kallsyms | grep find_task_by_pid_ns
> c102ecf6 T find_task_by_pid_ns
> 
> so this symbol should be publicly available.  I also noticed there is no
> EXPORT_SYMBOL() for find_task_by_pid_ns in the kernel code.
> 
> Any ideas what's keeping my xeno_nucleus.ko module from loading?
> 
> My config:
> linux-2.6.31.5 (current stable)
> xenomai-2.4.10
> adeos-ipipe-2.6.31.1-x86-2.4-06.patch

Please note that 2.6.31 is not officially supported by 2.4.x; at least,
not for all architectures. 2.5.x supports 2.6.31 and beyond.

Aside of this, the missing symbol is no more exported by 2.6.31 albeit
it used to be in 2.6.30. I guess that most people compile the nucleus
statically inside the kernel, so this has not been noticed before.

diff --git a/include/asm-generic/wrappers.h b/include/asm-generic/wrappers.h
index 18af70b..62f1d6e 100644
--- a/include/asm-generic/wrappers.h
+++ b/include/asm-generic/wrappers.h
@@ -480,8 +480,16 @@ unsigned long find_next_bit(const unsigned long *addr,
 #include <linux/semaphore.h>
 #include <linux/pid.h>
 
-#define find_task_by_pid(nr)		\
-  find_task_by_pid_ns(nr, &init_pid_ns)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)
+static inline struct task_struct *wrap_find_task_by_pid(pid_t nr)
+{
+	return pid_task(find_pid_ns(nr, &init_pid_ns), PIDTYPE_PID);
+}
+#else /* LINUX_VERSION_CODE < 2.6.31 */
+#define wrap_find_task_by_pid(nr)	\
+	find_task_by_pid_ns(nr, &init_pid_ns)
+#endif /* LINUX_VERSION_CODE < 2.6.31 */
+
 #define kill_proc(pid, sig, priv)	\
   kill_proc_info(sig, (priv) ? SEND_SIG_PRIV : SEND_SIG_NOINFO, pid)
 
diff --git a/ksrc/nucleus/shadow.c b/ksrc/nucleus/shadow.c
index d6d1203..1eae0a1 100644
--- a/ksrc/nucleus/shadow.c
+++ b/ksrc/nucleus/shadow.c
@@ -1687,7 +1687,7 @@ void xnshadow_signal_completion(xncompletion_t __user *u_completion, int err)
 
 	read_lock(&tasklist_lock);
 
-	p = find_task_by_pid(completion.pid);
+	p = wrap_find_task_by_pid(completion.pid);
 
 	if (p)
 		wake_up_process(p);

> 
> thanks,
> Jeff
> “This e-mail message and any attachments are confidential and may be privileged. 
> If you are not the intended recipient please notify American Superconductor Corporation 
> immediately by replying to this message or by sending a message to postmaster@domain.hid
> and destroy all copies of this message and any attachments. 
> Thank you.”
> 
> 
> _______________________________________________
> Xenomai-help mailing list
> Xenomai-help@domain.hid
> https://mail.gna.org/listinfo/xenomai-help


-- 
Philippe.




      reply	other threads:[~2009-11-05 21:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-30  3:10 [Xenomai-help] unable to load nucleus module: unknown symbol Jeff Weber
2009-11-05 21:13 ` Philippe Gerum [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1257455581.2210.205.camel@domain.hid \
    --to=rpm@xenomai.org \
    --cc=jweber@domain.hid \
    --cc=xenomai@xenomai.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.