06 Aug, 2006

1 commit

  • Reported by: Dave Jones

    Whilst printk'ing to both console and serial console, I got this...
    (2.6.18rc1)

    BUG: sleeping function called from invalid context at kernel/sched.c:4438
    in_atomic():0, irqs_disabled():1

    Call Trace:
    [] show_trace+0xaa/0x23d
    [] dump_stack+0x15/0x17
    [] __might_sleep+0xb2/0xb4
    [] __cond_resched+0x15/0x55
    [] cond_resched+0x3b/0x42
    [] console_conditional_schedule+0x12/0x14
    [] fbcon_redraw+0xf6/0x160
    [] fbcon_scroll+0x5d9/0xb52
    [] scrup+0x6b/0xd6
    [] lf+0x24/0x44
    [] vt_console_print+0x166/0x23d
    [] __call_console_drivers+0x65/0x76
    [] _call_console_drivers+0x5e/0x62
    [] release_console_sem+0x14b/0x232
    [] fb_flashcursor+0x279/0x2a6
    [] run_workqueue+0xa8/0xfb
    [] worker_thread+0xef/0x122
    [] kthread+0x100/0x136
    [] child_rip+0x8/0x12

    This can occur when release_console_sem() is called but the log
    buffer still has contents that need to be flushed. The console drivers
    are called while the console_may_schedule flag is still true. The
    might_sleep() is triggered when fbcon calls console_conditional_schedule().

    Fix by setting console_may_schedule to zero earlier, before the call to the
    console drivers.

    Signed-off-by: Antonino Daplas
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Antonino A. Daplas
     

11 Jul, 2006

1 commit


04 Jul, 2006

1 commit


01 Jul, 2006

1 commit


26 Jun, 2006

2 commits

  • Currently, enabling/disabling printk timestamps is only possible through
    reboot (bootparam) or recompile. I normally do not run with timestamps
    (since syslog handles that in a good manner), but for measuring small
    kernel delays (e.g. irq probing - see parport thread) I needed subsecond
    precision, but then again, just for some minutes rather than all kernel
    messages to come. The following patch adds a module_param() with which the
    timestamps can be en-/disabled in a live system through
    /sys/modules/printk/parameters/printk_time.

    Signed-off-by: Jan Engelhardt
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jan Engelhardt
     
  • Currently printk is no use for early debugging because it refuses to
    actually print anything to the console unless
    cpu_online(smp_processor_id()) is true.

    The stated explanation is that console drivers may require per-cpu
    resources, or otherwise barf, because the system is not yet setup
    correctly. Fair enough.

    However some console drivers might be quite happy running early during
    boot, in fact we have one, and so it'd be nice if printk understood that.

    So I added a flag (which I would have called CON_BOOT, but that's taken)
    called CON_ANYTIME, which indicates that a console is happy to be called
    anytime, even if the cpu is not yet online.

    Tested on a Power 5 machine, with both a CON_ANYTIME driver and a bogus
    console driver that BUG()s if called while offline. No problems AFAICT.
    Built for i386 UP & SMP.

    Signed-off-by: Michael Ellerman
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Michael Ellerman
     

20 Jun, 2006

1 commit


01 Apr, 2006

1 commit


24 Mar, 2006

1 commit

  • It appears that console_setup() code only gets compiled into the kernel if
    CONFIG_PRINTK is enabled. One detrimental side-effect of this is that
    serial8250_console_setup() never gets invoked when CONFIG_PRINTK is not
    set, resulting in baud rate not being read/parsed from command line (i.e.
    console=ttyS0,115200n8 is ignored, at least the baud rate part...)

    Attached patch moves console_setup() code from inside

    #ifdef CONFIG_PRINTK

    to outside (in printk.c), removing dependence on said config. option.

    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    John Z. Bohach
     

15 Jan, 2006

1 commit


09 Jan, 2006

1 commit

  • What's the true meaning of the printk return value? Should it include the
    priority prefix length of 3? and what about the timing information? In
    both cases it was broken:

    strace -e write echo 1 > /dev/kmsg
    => write(1, "1\n", 2) = 5
    strace -e write echo "1" > /dev/kmsg
    => write(1, "1\n", 5) = 8

    The returned length was "length of input string + 3", I made it "length
    of string output to the log buffer".

    Note that I couldn't find any printk caller in the kernel interested by its
    return value besides kmsg_write.

    Signed-off-by: Guillaume Chazarain
    Acked-By: Tim Bird
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Guillaume Chazarain
     

24 Nov, 2005

1 commit

  • If unregister_console() is inadvertently called while no consoles are
    registered, it will crash trying to dereference NULL pointer. It is
    necessary to fix that because register_console() provides no indication
    that it actually registered the console passed in. In fact, it may well
    decide not to register it based on various things...

    (akpm: It'd be better to make register_console() return something and fix the
    callers. All 106 of them...)

    Signed-off-by: Benjamin Herrenschmidt
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Benjamin Herrenschmidt
     

14 Nov, 2005

1 commit


07 Nov, 2005

1 commit


31 Oct, 2005

1 commit

  • - Removes some trailing whitespace

    - Breaks long lines and make other small changes to conform to CodingStyle

    - Add explicit printk loglevels in two places.

    Signed-off-by: Jesper Juhl
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jesper Juhl
     

22 Sep, 2005

1 commit

  • ia64's sched_clock() accesses per-cpu data which isn't set up at boot time.
    Hence ia64 cannot use printk timestamping, because printk() will crash in
    sched_clock().

    So make printk() use printk_clock(), defaulting to sched_clock(), overrideable
    by the architecture via attribute(weak).

    Cc: "Luck, Tony"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrew Morton
     

08 Sep, 2005

1 commit

  • The attached patch prevents oopses interleaving with characters from
    other printks on other CPUs by only breaking the lock if the oops is
    happening on the machine holding the lock.

    It might be better if the oops generator got the lock and then called an
    inner vprintk routine that assumed the caller holds the lock, thus
    making oops reports "atomic".

    Signed-Off-By: David Howells
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Howells
     

26 Jun, 2005

1 commit

  • In the cpu hotplug case, per-cpu data possibly isn't initialized even the
    system state is 'running'. As the comments say in the original code, some
    console drivers assume per-cpu resources have been allocated. radeon fb is
    one such driver, which uses kmalloc. After a CPU is down, the per-cpu data
    of slab is freed, so the system crashed when printing some info.

    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Shaohua Li
     

24 Jun, 2005

1 commit

  • According to include/linux/console.h, CON_CONSDEV flag should be set on
    the last console specified on the boot command line:

    86 #define CON_PRINTBUFFER (1)
    87 #define CON_CONSDEV (2) /* Last on the command line */
    88 #define CON_ENABLED (4)
    89 #define CON_BOOT (8)

    This does not currently happen if there is more than one console specified
    on the boot commandline. Instead, it gets set on the first console on the
    command line. This can cause problems for things like kdb that look for
    the CON_CONSDEV flag to see if the console is valid.

    Additionaly, it doesn't look like CON_CONSDEV is reassigned to the next
    preferred console at unregister time if the console being unregistered
    currently has that bit set.

    Example (from sn2 ia64):

    elilo vmlinuz root= console=ttyS0 console=ttySG0

    in this case, the flags on ttySG console struct will be 0x4 (should be
    0x6).

    Attached patch against bk fixes both issues for the cases I looked at. It
    uses selected_console (which gets incremented for each console specified on
    the command line) as the indicator of which console to set CON_CONSDEV on.
    When adding the console to the list, if the previous one had CON_CONSDEV
    set, it masks it out. Tested on ia64 and x86.

    The problem with the current behavior is it breaks overriding the default from
    the boot line. In the ia64 case, there may be a global append line defining
    console=a in elilo.conf. Then you want to boot your kernel, and want to
    override the default by passing console=b on the boot line. elilo constructs
    the kernel cmdline by starting with the value of the global append line, then
    tacks on whatever else you specify, which puts console=b last.

    Signed-off-by: Greg Edwards
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Greg Edwards
     

17 May, 2005

1 commit


01 May, 2005

1 commit

  • Arrange for all kernel printks to be no-ops. Only available if
    CONFIG_EMBEDDED.

    This patch saves about 375k on my laptop config and nearly 100k on minimal
    configs.

    Signed-off-by: Matt Mackall
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Matt Mackall
     

17 Apr, 2005

1 commit

  • Initial git repository build. I'm not bothering with the full history,
    even though we have it. We can create a separate "historical" git
    archive of that later if we want to, and in the meantime it's about
    3.2GB when imported into git - space that would just make the early
    git days unnecessarily complicated, when we don't have a lot of good
    infrastructure for it.

    Let it rip!

    Linus Torvalds