Inconsistency with printk output

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

In order to keep my debug logging from becoming overwhelming I've created a bit mask that determines what statements to print. I can dynamically change the bit mask via the /proc interface. The problem I'm seeing is that with certain bits set, no output occurs.

    1. with all bits set, no debug is output
    2. with different combinations of bits set (other than all set),
       debug is output, but not the same each time
    3. with all bits set a second time, debug *is* output.

My question is: Why is this occurring????? I've run this test with CONFIG_LOG_BUF_SHIFT set to the default (15 on my system) and 20 so I think this eliminates overwrites of the ring buffer. I've also tried using /etc/syslog.conf to specific a separate file for kern.debug messages, but that doesn't help either.

My test case is the following:

    # Clear the previous logging
    rm -f /var/log/messages
    /etc/init.d/syslog restart

    for i in {d, 5, 7, f, d}	// Pseudo-script-code
        echo i > /proc/mmdebug/flags
        sleep 1
        cat install.log > /dev/null
        sleep 1
        echo 0 > /proc/mmdebug/flags
        sleep 3
        grep install /var/log/messages

The grep shows the timestamps of the output and by this I can see if it's changed.

My code is very generic without any funny business (that I know of):

    /* Set via /procs/mmdebug/flags */
    static unsigned int flags = 0;

    #define MM_FLAG_VMA (unsigned int)1 << 0;
    #define MM_FLAG_MMAP (unsigned int)1 << 1;
    #define MM_FLAG_PAGE_CACHE (unsigned int)1 << 2;
    #define MM_FLAG_LRU (unsigned int)1 << 3;

    int is_mm_flag_set(unsigned int flag) {
	return flags & flag;
    }

I use these flags only in mm/filemap.c at present.

In __remove_from_page_cache:

    if (is_mm_flag_set(MM_FLAG_VMA))
        printk of file name of mapping

In add_to_page_cache:

    if (is_mm_flag_set(MM_FLAG_VMA))
        printk of file name of mapping

In find_get_page:

    if (is_mm_flag_set(MM_FLAG_MMAP))
        printk("%s (%d)\n", __FUNCTION__, __LINE__);

    if (is_mm_flag_set(MM_FLAG_LRU))
        printk of file name of mapping

In do_generic_mapping_read:

    if (is_mm_flag_set(MM_FLAG_PAGE_CACHE))
        printk of file name of struct file

I was suspicious of the function to get the file name from the struct file or mapping, but that's been eliminated as the problem.

Any help or pointers would be greatly appreciated.

Thanks,
Kirk



--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux