badness in interruptible_sleep_on_timeout FC-3 (source code and Makefile attached)

From: Srinivas G.
Date: Wed Mar 09 2005 - 09:48:49 EST


Dear All,

I have developed a small module in Fedora Core 3 with 2.6.9-1.667 kernel
version. This module uses the interruptible_sleep_on_timeout call and
one proc entry in it. After inserting the module when I try to cat the
/proc entry I got the following messages on the screen.

<jit_init> invoked!
Badness in interruptible_sleep_on_timeout at kernel/sched.c:3005
[<02302989>] interruptible_sleep_on_timeout+0x5d/0x23a
[<0211b919>] default_wake_function+0x0/0xc
[<0aa120f9>] jit_read_queue+0x48/0x60 [badness_test]
[<021a515f>] proc_file_read+0xd1/0x1ee
[<0216554f>] vfs_read+0xb6/0xe2
[<02165762>] sys_read+0x3c/0x62
Badness in interruptible_sleep_on_timeout at kernel/sched.c:3005
[<02302989>] interruptible_sleep_on_timeout+0x5d/0x23a
[<0211b919>] default_wake_function+0x0/0xc
[<0aa120f9>] jit_read_queue+0x48/0x60 [badness_test]
[<021a515f>] proc_file_read+0xd1/0x1ee
[<0216554f>] vfs_read+0xb6/0xe2
[<02165762>] sys_read+0x3c/0x62

I tried with spinlocks also. Even though, I got the same messages.
Here is the source code for the *.c file and Makefile.

badness_test.c file
-------------------
#include <linux/config.h>
#include <linux/module.h>
#include <linux/sched.h>
#include <linux/kernel.h> /* printk() */
#include <linux/fs.h> /* everything... */
#include <linux/proc_fs.h>
#include <linux/errno.h> /* error codes */
#include <linux/types.h> /* size_t */

/*
* This module is a silly one: it only embeds short code fragments
* that show how time delays can be handled in the kernel.
*/

int jit_delay = 1; /* the default delay in read() */
char *jit_spoke = "Sample string to test various delay options.\n";

MODULE_PARM(jit_delay, "i");
MODULE_PARM(jit_spoke, "s");
MODULE_LICENSE("GPL");

#define LIMIT (PAGE_SIZE-128) /* don't print any more after this size */

static int jit_print(char *buf)
{
int len = 0;
len = sprintf(buf+len,"%s",jit_spoke);
return len;
}

int jit_read_queue(char *buf, char **start, off_t offset,
int len, int *eof, void *data)
{
wait_queue_head_t wait;

init_waitqueue_head (&wait);
interruptible_sleep_on_timeout(&wait, jit_delay*HZ);

*eof = 1;
return jit_print(buf);
}

int jit_init(void)
{
printk("<%s> invoked!\n",__FUNCTION__);

create_proc_read_entry("jitqueue", 0, NULL, jit_read_queue, NULL);

return 0; /* succeed */
}

void jit_cleanup(void)
{
printk("<%s> invoked!\n",__FUNCTION__);

remove_proc_entry ("jitqueue", 0);
}

module_init(jit_init);
module_exit(jit_cleanup);

-----------------------------------------------------------------------

Makefile
--------
#
# Makefile for badness_test.c file
#
KDIR:=/lib/modules/$(shell uname -r)/build
TRGT:=badness_testing
OBJS:=badness_test.o

obj-m += $(TRGT).o
$(TRGT)-objs := $(OBJS)

default:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
clean:
$(RM) .*.cmd *.mod.c *.ko *.o -r .tmp*

------------------------------------------------------------------------
---

Please give some advices on this issue.

Thanks and Regards,
Srinivas G
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/