Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#1235 closed bug (invalid)

set_dprintf_enabled() always enables serial debugging

Reported by: jkloetzke Owned by: axeld
Priority: normal Milestone: R1
Component: System/Kernel Version: R1/pre-alpha1
Keywords: Cc:
Blocked By: Blocking:
Has a Patch: no Platform: All

Description

The function set_dprintf_enabled() always enables serial debug output unconditionally. This is somewhat confusing if this is was switched off in the kernel settings.

Especially it may be sometimes neccessary to _not_ use serial debugging but use the syslog method because dprintf is very slow on serial lines and the corresponding thread uses massive amounts of CPU time to wait on serial line. Furthermore the machine may have no serial output at all.

Change History (4)

comment:1 Changed 12 years ago by axeld

Resolution: invalid
Status: newclosed

That's exactly what this function is supposed to do (and that's also how it works under BeOS) - you can easily turn off serial debugging and turn on syslog output in the kernel settings file if you need that setup. There are very few cases where one would need that function, anyway.

comment:2 in reply to:  1 Changed 12 years ago by jkloetzke

Replying to axeld:

That's exactly what this function is supposed to do (and that's also how it works under BeOS) - you can easily turn off serial debugging and turn on syslog output in the kernel settings file if you need that setup. There are very few cases where one would need that function, anyway.

Maybe I didn't understand the function right. ;-)

My problem was the following: I enabled debug outputs of the USB stack and (because my laptop has no serial port) I wanted to route the dprintf() messages to syslog only. I configured the kernel settings accordingly but found out that the serial output was still active which caused the USB stack to use massive amounts of CPU time.

I found that set_dprintf_enabled(true), which was called from src/add-ons/kernel/bus_managers/usb/usb.cpp, enabled the serial output again, even though it was disabled in the kernel settings. Looking at the BeBook dprintf() is disabled by default, so the USB stack should call set_printf_enabled(true) as far as I understand. Therefore I submitted this bug because it seems that eighter the USB stack is wrong by calling set_dprinf_enabled(true) (which I do not think) or the kernel settings file should have the alone authority about the dprinf() routing.

comment:3 Changed 12 years ago by axeld

How should set_dprintf_enabled() know which output it should enable? If you've enabled the syslog output in the settings, it will just work. The USB stack is not doing the right thing here, at least not if it didn't intend to turn on serial debug output.

comment:4 Changed 12 years ago by jkloetzke

Ok, then I was really fooled by the name of the function. I thought that if you doesn't call it then dprintf is a no-op. You're right, then the USB stack is wrong at this point.

BTW: a couple of other drivers call this function too when debug is enabled for them...

Note: See TracTickets for help on using tickets.