Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-davinci
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linux
linux-davinci
Commits
0835f1f8
Commit
0835f1f8
authored
Jul 25, 2009
by
Thomas Gleixner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
printk: Connvert logbuf_lock to atomic_spinlock
Signed-off-by:
Thomas Gleixner
<
tglx@linutronix.de
>
parent
fd2bde5d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
23 deletions
+23
-23
kernel/printk.c
kernel/printk.c
+19
-19
lib/ratelimit.c
lib/ratelimit.c
+4
-4
No files found.
kernel/printk.c
View file @
0835f1f8
...
...
@@ -92,7 +92,7 @@ static int console_locked, console_suspended;
* It is also used in interesting ways to provide interlocking in
* release_console_sem().
*/
static
DEFINE_SPINLOCK
(
logbuf_lock
);
static
DEFINE_
ATOMIC_
SPINLOCK
(
logbuf_lock
);
#define LOG_BUF_MASK (log_buf_len-1)
#define LOG_BUF(idx) (log_buf[(idx) & LOG_BUF_MASK])
...
...
@@ -171,7 +171,7 @@ static int __init log_buf_len_setup(char *str)
goto
out
;
}
spin_lock_irqsave
(
&
logbuf_lock
,
flags
);
atomic_
spin_lock_irqsave
(
&
logbuf_lock
,
flags
);
log_buf_len
=
size
;
log_buf
=
new_log_buf
;
...
...
@@ -185,7 +185,7 @@ static int __init log_buf_len_setup(char *str)
log_start
-=
offset
;
con_start
-=
offset
;
log_end
-=
offset
;
spin_unlock_irqrestore
(
&
logbuf_lock
,
flags
);
atomic_
spin_unlock_irqrestore
(
&
logbuf_lock
,
flags
);
printk
(
KERN_NOTICE
"log_buf_len: %d
\n
"
,
log_buf_len
);
}
...
...
@@ -297,18 +297,18 @@ int do_syslog(int type, char __user *buf, int len)
if
(
error
)
goto
out
;
i
=
0
;
spin_lock_irq
(
&
logbuf_lock
);
atomic_
spin_lock_irq
(
&
logbuf_lock
);
while
(
!
error
&&
(
log_start
!=
log_end
)
&&
i
<
len
)
{
c
=
LOG_BUF
(
log_start
);
log_start
++
;
spin_unlock_irq
(
&
logbuf_lock
);
atomic_
spin_unlock_irq
(
&
logbuf_lock
);
error
=
__put_user
(
c
,
buf
);
buf
++
;
i
++
;
cond_resched
();
spin_lock_irq
(
&
logbuf_lock
);
atomic_
spin_lock_irq
(
&
logbuf_lock
);
}
spin_unlock_irq
(
&
logbuf_lock
);
atomic_
spin_unlock_irq
(
&
logbuf_lock
);
if
(
!
error
)
error
=
i
;
break
;
...
...
@@ -329,7 +329,7 @@ int do_syslog(int type, char __user *buf, int len)
count
=
len
;
if
(
count
>
log_buf_len
)
count
=
log_buf_len
;
spin_lock_irq
(
&
logbuf_lock
);
atomic_
spin_lock_irq
(
&
logbuf_lock
);
if
(
count
>
logged_chars
)
count
=
logged_chars
;
if
(
do_clear
)
...
...
@@ -346,12 +346,12 @@ int do_syslog(int type, char __user *buf, int len)
if
(
j
+
log_buf_len
<
log_end
)
break
;
c
=
LOG_BUF
(
j
);
spin_unlock_irq
(
&
logbuf_lock
);
atomic_
spin_unlock_irq
(
&
logbuf_lock
);
error
=
__put_user
(
c
,
&
buf
[
count
-
1
-
i
]);
cond_resched
();
spin_lock_irq
(
&
logbuf_lock
);
atomic_
spin_lock_irq
(
&
logbuf_lock
);
}
spin_unlock_irq
(
&
logbuf_lock
);
atomic_
spin_unlock_irq
(
&
logbuf_lock
);
if
(
error
)
break
;
error
=
i
;
...
...
@@ -527,7 +527,7 @@ static void zap_locks(void)
oops_timestamp
=
jiffies
;
/* If a crash is occurring, make sure we can't deadlock */
spin_lock_init
(
&
logbuf_lock
);
atomic_
spin_lock_init
(
&
logbuf_lock
);
/* And make sure that we print immediately */
init_MUTEX
(
&
console_sem
);
}
...
...
@@ -631,7 +631,7 @@ static int acquire_console_semaphore_for_printk(unsigned int cpu)
}
}
printk_cpu
=
UINT_MAX
;
spin_unlock
(
&
logbuf_lock
);
atomic_
spin_unlock
(
&
logbuf_lock
);
return
retval
;
}
static
const
char
recursion_bug_msg
[]
=
...
...
@@ -674,7 +674,7 @@ asmlinkage int vprintk(const char *fmt, va_list args)
}
lockdep_off
();
spin_lock
(
&
logbuf_lock
);
atomic_
spin_lock
(
&
logbuf_lock
);
printk_cpu
=
this_cpu
;
if
(
recursion_bug
)
{
...
...
@@ -1023,14 +1023,14 @@ void release_console_sem(void)
console_may_schedule
=
0
;
for
(
;
;
)
{
spin_lock_irqsave
(
&
logbuf_lock
,
flags
);
atomic_
spin_lock_irqsave
(
&
logbuf_lock
,
flags
);
wake_klogd
|=
log_start
-
log_end
;
if
(
con_start
==
log_end
)
break
;
/* Nothing to print */
_con_start
=
con_start
;
_log_end
=
log_end
;
con_start
=
log_end
;
/* Flush */
spin_unlock
(
&
logbuf_lock
);
atomic_
spin_unlock
(
&
logbuf_lock
);
stop_critical_timings
();
/* don't trace print latency */
call_console_drivers
(
_con_start
,
_log_end
);
start_critical_timings
();
...
...
@@ -1038,7 +1038,7 @@ void release_console_sem(void)
}
console_locked
=
0
;
up
(
&
console_sem
);
spin_unlock_irqrestore
(
&
logbuf_lock
,
flags
);
atomic_
spin_unlock_irqrestore
(
&
logbuf_lock
,
flags
);
if
(
wake_klogd
)
wake_up_klogd
();
}
...
...
@@ -1240,9 +1240,9 @@ void register_console(struct console *console)
* release_console_sem() will print out the buffered messages
* for us.
*/
spin_lock_irqsave
(
&
logbuf_lock
,
flags
);
atomic_
spin_lock_irqsave
(
&
logbuf_lock
,
flags
);
con_start
=
log_start
;
spin_unlock_irqrestore
(
&
logbuf_lock
,
flags
);
atomic_
spin_unlock_irqrestore
(
&
logbuf_lock
,
flags
);
}
release_console_sem
();
}
...
...
lib/ratelimit.c
View file @
0835f1f8
...
...
@@ -14,7 +14,7 @@
#include <linux/jiffies.h>
#include <linux/module.h>
static
DEFINE_SPINLOCK
(
ratelimit_lock
);
static
DEFINE_
ATOMIC_
SPINLOCK
(
ratelimit_lock
);
/*
* __ratelimit - rate limiting
...
...
@@ -30,7 +30,7 @@ int __ratelimit(struct ratelimit_state *rs)
if
(
!
rs
->
interval
)
return
1
;
spin_lock_irqsave
(
&
ratelimit_lock
,
flags
);
atomic_
spin_lock_irqsave
(
&
ratelimit_lock
,
flags
);
if
(
!
rs
->
begin
)
rs
->
begin
=
jiffies
;
...
...
@@ -46,12 +46,12 @@ int __ratelimit(struct ratelimit_state *rs)
goto
print
;
rs
->
missed
++
;
spin_unlock_irqrestore
(
&
ratelimit_lock
,
flags
);
atomic_
spin_unlock_irqrestore
(
&
ratelimit_lock
,
flags
);
return
0
;
print:
rs
->
printed
++
;
spin_unlock_irqrestore
(
&
ratelimit_lock
,
flags
);
atomic_
spin_unlock_irqrestore
(
&
ratelimit_lock
,
flags
);
return
1
;
}
EXPORT_SYMBOL
(
__ratelimit
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment