Skip to contentSkip to conversation

Can't load batman-module on 2.6.26

B.A.T.M.A.N. In review Linus Lüssing 3 participants 8 messages Feb 8, 2010 – Feb 13, 2010

lore
Share & tools
lore
#0 lore raw

And next thing, batman-adv is crashing on Debian stable with a 2.6.26 kernel. The call trace is showing bat_printk() right after insmodding the batman-adv kernel module from the current maintenance branch.

(And also thanks to Chris/|x|, I guess you've been experiencing the same problem on your router with the maintenance branch.)

Cheers, Linus

#1 lore raw

And here are a couple of manual call traces :) (don't have a device with a 2.6.26 + seriel console at the moment, hehe):

---
__run_hrtimer
hrtimer_interrupt
smp_apic_timer_interrupt
apic_timer_interrupt
strnlen
string
bat_printk
bat_printk
bat_printk
bat_printk
bat_printk
bat_printk
ktime_get_ts
ktime_get
blk_rq_map_sg
getnstimeofday
bat_printk
schedule_timer_interrupt
add_wait_queue
unix_poll
bat_printk
ext3_getblk
ext3_getblk
bat_printk
hrtimer_start
hrtick_set
do_notify_resume
bat_printk
---

Cheers, Linus

Quoted 10 lines · Linus Lüssing

And next thing, batman-adv is crashing on Debian stable with a 2.6.26 kernel. The call trace is showing bat_printk() right after insmodding the batman-adv kernel module from the current maintenance branch.

(And also thanks to Chris/|x|, I guess you've been experiencing the same problem on your router with the maintenance branch.)

Cheers, Linus

#2 lore raw

PATCH 1/1 batman-adv: use original printk in bat_printk

bat_printk is calling a printk which got previously substituted because of the define in compat.h. This patch removes the define for the scope of bat_printk.c.

---

batman-adv-kernelland/bat_printk.c +12 -0
index a55eff3..556620a 100644
@@ -35,6 +35,13 @@
 /* Works only for digits and letters, but small and fast */
 #define TOLOWER(x) ((x) | 0x20)
 
+/* We don't want to recursively call bat_printk here
+   because of the previous define in compat.h */
+#ifdef printk
+#define ___printk printk
+#undef printk
+#endif
+
 static int skip_atoi(const char **s)
 {
 	int i = 0;
@@ -853,3 +860,8 @@ asmlinkage int bat_printk(const char *fmt, ...)
 
 	return printk("foo:%s", buf);
 }
+
+#ifdef ___printk
+#define printk ___printk
+#undef ___printk
+#endif
#3 lore raw

Re: [B.A.T.M.A.N.] [PATCH] batman-adv: use original printk in bat_printk

Quoted 4 lines · On Wednesday 10 February 2010 10:36:41 Linus Lüssing wrote:

bat_printk is calling a printk which got previously substituted because of the define in compat.h. This patch removes the define for the scope of bat_printk.c.

After seeing your patch I understand the issue. We redefine printk() to bat_printk() which works fine for all functions except for bat_printk() itself. I think your approach seems to be a solution although we don't need to define printk at the end again, do we ?

Regards,
Marek

#4 lore raw

Re: [B.A.T.M.A.N.] [PATCH] batman-adv: use original printk in bat_printk

Quoted 10 lines · Marek Lindner
Quoted 4 lines · On Wednesday 10 February 2010 10:36:41 Linus L??ssing wrote:

bat_printk is calling a printk which got previously substituted because of the define in compat.h. This patch removes the define for the scope of bat_printk.c.

After seeing your patch I understand the issue. We redefine printk() to bat_printk() which works fine for all functions except for bat_printk() itself. I think your approach seems to be a solution although we don't need to define printk at the end again, do we ?

I think Simon added compat.h when he reworked the patch. My original version did not use it to avoid this recursion problem. Linus's solution looks O.K, but as you said it is not necessary to redefine it at the end. I also don't see why the ___printk is needed.

While we are at it, please also remove the "foo:". That i do claim responsibility for. I developed the patch on a kernel which is %pM capable and i wanted to be sure it was using bat_printk and not the native printk when testing. So i put in the foo. It never got removed :-(

Andrew

#5 lore raw

PATCH 1/2 batman-adv: use original printk in bat_printk

bat_printk is calling a printk which got previously substituted because of the define in compat.h. This patch removes the define for the scope of bat_printk.c.

---
 bat_printk.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
bat_printk.c +6 -0
index a55eff3..845391d 100644
@@ -35,6 +35,12 @@
 /* Works only for digits and letters, but small and fast */
 #define TOLOWER(x) ((x) | 0x20)
 
+/* We don't want to recursively call bat_printk here
+   because of the previous define in compat.h */
+#ifdef printk
+#undef printk
+#endif
+
 static int skip_atoi(const char **s)
 {
 	int i = 0;
Signature · 1 line
1.6.6.1
#6 lore raw

PATCH 2/2 batman-adv: remove "foo" from bat_printk strings

Some missed debug output, removing it.

---
 bat_printk.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
bat_printk.c +1 -1
index 845391d..55c351a 100644
@@ -857,5 +857,5 @@ asmlinkage int bat_printk(const char *fmt, ...)
 	r = bat_vsnprintf(buf, sizeof(buf), fmt, args);
 	va_end(args);
 
-	return printk("foo:%s", buf);
+	return printk("%s", buf);
 }
Signature · 1 line
1.6.6.1