Hello
In my environment running Genode on top of
OKL4 V2.1 I occasionally observed cluttered debug output on the serial console,
sometimes accompanied by a roottask page fault. A close inspection of the
system showed that this happens when core writes debug output messages
on its own while in parallel debug messages are sent by other protection
domains. In core debug messages processed by Genode::printf() and
Genode::vprintf() are processed by Okl4_console::vprintf() which infact
is the call of the base class methode Console::vprintf(). The
implementation in the files okl4_console.cc and console.cc shows
that there is no lock to serialize trace output from different sources. The
outcome is that core’s trace server and any other core thread
can concurrently write to OKL4’s character-oriented debug interface
leading to the mix-up of two debug messages.
I could solve the problem by simply copying
the solution from the class Log_console used by the other protection
domains:
· Adding a Lock object to the class Okl4_console
private:
Lock
_lock;
· Substituting the call of the base class method Console::vprintf()
by providing a dedicated method Okl4_console::vprintf()
public:
inline
void vprintf(const char *format, va_list list)
{
Lock::Guard
lock_guard(_lock);
Console::vprintf(format,
list);
}
These two changes fix the problem w/o
affecting any caller code using Okl4_console::vprintf(). It leaves the
base class methode Console::vprintf() unmodified so that its usage in
different derived classes is not compromised.
I’d appreciate if this or an
equivalent fix could find its way into one of the next Genode baselines on
Sourceforge.
Regards
Frank