Index: kernel/generic/src/console/console.c
===================================================================
--- kernel/generic/src/console/console.c	(revision 326bf65ebff26a7eb2af6a434fcb5ee4b2a7e0a0)
+++ kernel/generic/src/console/console.c	(revision 712c4bac34d2d8ac8d7e35e7e48ff1c293c0ffb8)
@@ -60,5 +60,5 @@
 
 /** Kernel log initialized */
-static bool klog_inited = false;
+static atomic_t klog_inited = {false};
 
 /** First kernel log characters */
@@ -75,5 +75,5 @@
 
 /** Kernel log spinlock */
-SPINLOCK_STATIC_INITIALIZE_NAME(klog_lock, "*klog_lock");
+SPINLOCK_STATIC_INITIALIZE_NAME(klog_lock, "klog_lock");
 
 /** Physical memory area used for klog buffer */
@@ -166,8 +166,5 @@
 	
 	event_set_unmask_callback(EVENT_KLOG, klog_update);
-	
-	spinlock_lock(&klog_lock);
-	klog_inited = true;
-	spinlock_unlock(&klog_lock);
+	atomic_set(&klog_inited, true);
 }
 
@@ -264,7 +261,10 @@
 void klog_update(void)
 {
+	if (!atomic_get(&klog_inited))
+		return;
+	
 	spinlock_lock(&klog_lock);
 	
-	if ((klog_inited) && (klog_uspace > 0)) {
+	if (klog_uspace > 0) {
 		if (event_notify_3(EVENT_KLOG, true, klog_start, klog_len,
 		    klog_uspace) == EOK)
@@ -277,12 +277,23 @@
 void putchar(const wchar_t ch)
 {
+	bool ordy = ((stdout) && (stdout->op->write));
+	
 	spinlock_lock(&klog_lock);
 	
-	if ((klog_stored > 0) && (stdout) && (stdout->op->write)) {
-		/* Print charaters stored in kernel log */
-		size_t i;
-		for (i = klog_len - klog_stored; i < klog_len; i++)
-			stdout->op->write(stdout, klog[(klog_start + i) % KLOG_LENGTH], silent);
-		klog_stored = 0;
+	/* Print charaters stored in kernel log */
+	if (ordy) {
+		while (klog_stored > 0) {
+			wchar_t tmp = klog[(klog_start + klog_len - klog_stored) % KLOG_LENGTH];
+			klog_stored--;
+			
+			/*
+			 * We need to give up the spinlock for
+			 * the physical operation of writting out
+			 * the character.
+			 */
+			spinlock_unlock(&klog_lock);
+			stdout->op->write(stdout, tmp, silent);
+			spinlock_lock(&klog_lock);
+		}
 	}
 	
@@ -294,7 +305,22 @@
 		klog_start = (klog_start + 1) % KLOG_LENGTH;
 	
-	if ((stdout) && (stdout->op->write))
+	if (!ordy) {
+		if (klog_stored < klog_len)
+			klog_stored++;
+	}
+	
+	/* The character is stored for uspace */
+	if (klog_uspace < klog_len)
+		klog_uspace++;
+	
+	spinlock_unlock(&klog_lock);
+	
+	if (ordy) {
+		/*
+		 * Output the character. In this case
+		 * it should be no longer buffered.
+		 */
 		stdout->op->write(stdout, ch, silent);
-	else {
+	} else {
 		/*
 		 * No standard output routine defined yet.
@@ -306,17 +332,7 @@
 		 * Note that the early_putc() function might be
 		 * a no-op on certain hardware configurations.
-		 *
 		 */
 		early_putchar(ch);
-		
-		if (klog_stored < klog_len)
-			klog_stored++;
-	}
-	
-	/* The character is stored for uspace */
-	if (klog_uspace < klog_len)
-		klog_uspace++;
-	
-	spinlock_unlock(&klog_lock);
+	}
 	
 	/* Force notification on newline */
Index: kernel/generic/src/printf/vprintf.c
===================================================================
--- kernel/generic/src/printf/vprintf.c	(revision 326bf65ebff26a7eb2af6a434fcb5ee4b2a7e0a0)
+++ kernel/generic/src/printf/vprintf.c	(revision 712c4bac34d2d8ac8d7e35e7e48ff1c293c0ffb8)
@@ -41,6 +41,4 @@
 #include <typedefs.h>
 #include <str.h>
-
-IRQ_SPINLOCK_STATIC_INITIALIZE_NAME(printf_lock, "*printf_lock");
 
 static int vprintf_str_write(const char *str, size_t size, void *data)
@@ -93,9 +91,5 @@
 	};
 	
-	irq_spinlock_lock(&printf_lock, true);
-	int ret = printf_core(fmt, &ps, ap);
-	irq_spinlock_unlock(&printf_lock, true);
-	
-	return ret;
+	return printf_core(fmt, &ps, ap);
 }
 
Index: kernel/generic/src/synch/spinlock.c
===================================================================
--- kernel/generic/src/synch/spinlock.c	(revision 326bf65ebff26a7eb2af6a434fcb5ee4b2a7e0a0)
+++ kernel/generic/src/synch/spinlock.c	(revision 712c4bac34d2d8ac8d7e35e7e48ff1c293c0ffb8)
@@ -84,21 +84,5 @@
 		 * This conserns especially printf_lock and the
 		 * framebuffer lock.
-		 *
-		 * Any lock whose name is prefixed by "*" will be
-		 * ignored by this deadlock detection routine
-		 * as this might cause an infinite recursion.
-		 * We trust our code that there is no possible deadlock
-		 * caused by these locks (except when an exception
-		 * is triggered for instance by printf()).
-		 *
-		 * We encountered false positives caused by very
-		 * slow framebuffer interaction (especially when
-		 * run in a simulator) that caused problems with both
-		 * printf_lock and the framebuffer lock.
-		 *
 		 */
-		if (lock->name[0] == '*')
-			continue;
-		
 		if (i++ > DEADLOCK_THRESHOLD) {
 			printf("cpu%u: looping on spinlock %p:%s, "
