Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 31805
b: refs/heads/master
c: a0f1ccf
h: refs/heads/master
i:
  31803: ec464d2
v: v3
  • Loading branch information
Ingo Molnar authored and Linus Torvalds committed Jul 3, 2006
1 parent 775abd2 commit 50d12f5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3047e99ede366298c6233d1870d12a520d4d92f3
refs/heads/master: a0f1ccfd8d37457a6d8a9e01acebeefcdfcc306e
23 changes: 18 additions & 5 deletions trunk/kernel/printk.c
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,9 @@ asmlinkage int vprintk(const char *fmt, va_list args)
zap_locks();

/* This stops the holder of console_sem just where we want him */
spin_lock_irqsave(&logbuf_lock, flags);
local_irq_save(flags);
lockdep_off();
spin_lock(&logbuf_lock);
printk_cpu = smp_processor_id();

/* Emit the output into the temporary buffer */
Expand Down Expand Up @@ -588,7 +590,7 @@ asmlinkage int vprintk(const char *fmt, va_list args)
*/
console_locked = 1;
printk_cpu = UINT_MAX;
spin_unlock_irqrestore(&logbuf_lock, flags);
spin_unlock(&logbuf_lock);

/*
* Console drivers may assume that per-cpu resources have
Expand All @@ -604,14 +606,18 @@ asmlinkage int vprintk(const char *fmt, va_list args)
console_locked = 0;
up(&console_sem);
}
lockdep_on();
local_irq_restore(flags);
} else {
/*
* Someone else owns the drivers. We drop the spinlock, which
* allows the semaphore holder to proceed and to call the
* console drivers with the output which we just produced.
*/
printk_cpu = UINT_MAX;
spin_unlock_irqrestore(&logbuf_lock, flags);
spin_unlock(&logbuf_lock);
lockdep_on();
local_irq_restore(flags);
}

preempt_enable();
Expand Down Expand Up @@ -809,8 +815,15 @@ void release_console_sem(void)
console_may_schedule = 0;
up(&console_sem);
spin_unlock_irqrestore(&logbuf_lock, flags);
if (wake_klogd && !oops_in_progress && waitqueue_active(&log_wait))
wake_up_interruptible(&log_wait);
if (wake_klogd && !oops_in_progress && waitqueue_active(&log_wait)) {
/*
* If we printk from within the lock dependency code,
* from within the scheduler code, then do not lock
* up due to self-recursion:
*/
if (!lockdep_internal())
wake_up_interruptible(&log_wait);
}
}
EXPORT_SYMBOL(release_console_sem);

Expand Down

0 comments on commit 50d12f5

Please sign in to comment.