- patches.fixes/patch-2.6.11-rc1: 2.6.11-rc1.
[linux-flexiantxendom0-3.2.10.git] / kernel / printk.c
index ff87194..d914a90 100644 (file)
@@ -78,7 +78,7 @@ static int console_locked;
  * It is also used in interesting ways to provide interlocking in
  * release_console_sem().
  */
-static spinlock_t logbuf_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(logbuf_lock);
 
 static char __log_buf[__LOG_BUF_LEN];
 static char *log_buf = __log_buf;
@@ -284,6 +284,7 @@ int do_syslog(int type, char __user * buf, int len)
                        error = __put_user(c,buf);
                        buf++;
                        i++;
+                       cond_resched();
                        spin_lock_irq(&logbuf_lock);
                }
                spin_unlock_irq(&logbuf_lock);
@@ -325,6 +326,7 @@ int do_syslog(int type, char __user * buf, int len)
                        c = LOG_BUF(j);
                        spin_unlock_irq(&logbuf_lock);
                        error = __put_user(c,&buf[count-1-i]);
+                       cond_resched();
                        spin_lock_irq(&logbuf_lock);
                }
                spin_unlock_irq(&logbuf_lock);
@@ -340,6 +342,7 @@ int do_syslog(int type, char __user * buf, int len)
                                        error = -EFAULT;
                                        break;
                                }
+                               cond_resched();
                        }
                }
                break;
@@ -375,20 +378,6 @@ out:
        return error;
 }
 
-#ifdef CONFIG_KDB
-/* kdb dmesg command needs access to the syslog buffer.  do_syslog() uses locks
- * so it cannot be used during debugging.  Just tell kdb where the start and
- * end of the physical and logical logs are.  This is equivalent to do_syslog(3).
- */
-void kdb_syslog_data(char *syslog_data[4])
-{
-       syslog_data[0] = log_buf;
-       syslog_data[1] = log_buf + log_buf_len;
-       syslog_data[2] = log_buf + log_end - (logged_chars < log_buf_len ? logged_chars : log_buf_len);
-       syslog_data[3] = log_buf + log_end;
-}
-#endif /* CONFIG_KDB */
-
 asmlinkage long sys_syslog(int type, char __user * buf, int len)
 {
        return do_syslog(type, buf, len);
@@ -656,8 +645,9 @@ void release_console_sem(void)
                _con_start = con_start;
                _log_end = log_end;
                con_start = log_end;            /* Flush */
-               spin_unlock_irqrestore(&logbuf_lock, flags);
+               spin_unlock(&logbuf_lock);
                call_console_drivers(_con_start, _log_end);
+               local_irq_restore(flags);
        }
        console_locked = 0;
        console_may_schedule = 0;
@@ -885,7 +875,7 @@ void tty_write_message(struct tty_struct *tty, char *msg)
  */
 int __printk_ratelimit(int ratelimit_jiffies, int ratelimit_burst)
 {
-       static spinlock_t ratelimit_lock = SPIN_LOCK_UNLOCKED;
+       static DEFINE_SPINLOCK(ratelimit_lock);
        static unsigned long toks = 10*5*HZ;
        static unsigned long last_msg;
        static int missed;