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
dc23e836
Commit
dc23e836
authored
Jul 25, 2009
by
Thomas Gleixner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kprobes: Convert to atomic_spinlock
Signed-off-by:
Thomas Gleixner
<
tglx@linutronix.de
>
parent
b20de918
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
18 deletions
+18
-18
include/linux/kprobes.h
include/linux/kprobes.h
+1
-1
kernel/kprobes.c
kernel/kprobes.c
+17
-17
No files found.
include/linux/kprobes.h
View file @
dc23e836
...
...
@@ -170,7 +170,7 @@ struct kretprobe {
int
nmissed
;
size_t
data_size
;
struct
hlist_head
free_instances
;
spinlock_t
lock
;
atomic_
spinlock_t
lock
;
};
struct
kretprobe_instance
{
...
...
kernel/kprobes.c
View file @
dc23e836
...
...
@@ -73,10 +73,10 @@ static bool kprobes_all_disarmed;
static
DEFINE_MUTEX
(
kprobe_mutex
);
/* Protects kprobe_table */
static
DEFINE_PER_CPU
(
struct
kprobe
*
,
kprobe_instance
)
=
NULL
;
static
struct
{
spinlock_t
lock
____cacheline_aligned_in_smp
;
atomic_
spinlock_t
lock
____cacheline_aligned_in_smp
;
}
kretprobe_table_locks
[
KPROBE_TABLE_SIZE
];
static
spinlock_t
*
kretprobe_table_lock_ptr
(
unsigned
long
hash
)
static
atomic_
spinlock_t
*
kretprobe_table_lock_ptr
(
unsigned
long
hash
)
{
return
&
(
kretprobe_table_locks
[
hash
].
lock
);
}
...
...
@@ -415,9 +415,9 @@ void __kprobes recycle_rp_inst(struct kretprobe_instance *ri,
hlist_del
(
&
ri
->
hlist
);
INIT_HLIST_NODE
(
&
ri
->
hlist
);
if
(
likely
(
rp
))
{
spin_lock
(
&
rp
->
lock
);
atomic_
spin_lock
(
&
rp
->
lock
);
hlist_add_head
(
&
ri
->
hlist
,
&
rp
->
free_instances
);
spin_unlock
(
&
rp
->
lock
);
atomic_
spin_unlock
(
&
rp
->
lock
);
}
else
/* Unregistering */
hlist_add_head
(
&
ri
->
hlist
,
head
);
...
...
@@ -427,34 +427,34 @@ void __kprobes kretprobe_hash_lock(struct task_struct *tsk,
struct
hlist_head
**
head
,
unsigned
long
*
flags
)
{
unsigned
long
hash
=
hash_ptr
(
tsk
,
KPROBE_HASH_BITS
);
spinlock_t
*
hlist_lock
;
atomic_
spinlock_t
*
hlist_lock
;
*
head
=
&
kretprobe_inst_table
[
hash
];
hlist_lock
=
kretprobe_table_lock_ptr
(
hash
);
spin_lock_irqsave
(
hlist_lock
,
*
flags
);
atomic_
spin_lock_irqsave
(
hlist_lock
,
*
flags
);
}
static
void
__kprobes
kretprobe_table_lock
(
unsigned
long
hash
,
unsigned
long
*
flags
)
{
spinlock_t
*
hlist_lock
=
kretprobe_table_lock_ptr
(
hash
);
spin_lock_irqsave
(
hlist_lock
,
*
flags
);
atomic_
spinlock_t
*
hlist_lock
=
kretprobe_table_lock_ptr
(
hash
);
atomic_
spin_lock_irqsave
(
hlist_lock
,
*
flags
);
}
void
__kprobes
kretprobe_hash_unlock
(
struct
task_struct
*
tsk
,
unsigned
long
*
flags
)
{
unsigned
long
hash
=
hash_ptr
(
tsk
,
KPROBE_HASH_BITS
);
spinlock_t
*
hlist_lock
;
atomic_
spinlock_t
*
hlist_lock
;
hlist_lock
=
kretprobe_table_lock_ptr
(
hash
);
spin_unlock_irqrestore
(
hlist_lock
,
*
flags
);
atomic_
spin_unlock_irqrestore
(
hlist_lock
,
*
flags
);
}
void
__kprobes
kretprobe_table_unlock
(
unsigned
long
hash
,
unsigned
long
*
flags
)
{
spinlock_t
*
hlist_lock
=
kretprobe_table_lock_ptr
(
hash
);
spin_unlock_irqrestore
(
hlist_lock
,
*
flags
);
atomic_
spinlock_t
*
hlist_lock
=
kretprobe_table_lock_ptr
(
hash
);
atomic_
spin_unlock_irqrestore
(
hlist_lock
,
*
flags
);
}
/*
...
...
@@ -969,12 +969,12 @@ static int __kprobes pre_handler_kretprobe(struct kprobe *p,
/*TODO: consider to only swap the RA after the last pre_handler fired */
hash
=
hash_ptr
(
current
,
KPROBE_HASH_BITS
);
spin_lock_irqsave
(
&
rp
->
lock
,
flags
);
atomic_
spin_lock_irqsave
(
&
rp
->
lock
,
flags
);
if
(
!
hlist_empty
(
&
rp
->
free_instances
))
{
ri
=
hlist_entry
(
rp
->
free_instances
.
first
,
struct
kretprobe_instance
,
hlist
);
hlist_del
(
&
ri
->
hlist
);
spin_unlock_irqrestore
(
&
rp
->
lock
,
flags
);
atomic_
spin_unlock_irqrestore
(
&
rp
->
lock
,
flags
);
ri
->
rp
=
rp
;
ri
->
task
=
current
;
...
...
@@ -991,7 +991,7 @@ static int __kprobes pre_handler_kretprobe(struct kprobe *p,
kretprobe_table_unlock
(
hash
,
&
flags
);
}
else
{
rp
->
nmissed
++
;
spin_unlock_irqrestore
(
&
rp
->
lock
,
flags
);
atomic_
spin_unlock_irqrestore
(
&
rp
->
lock
,
flags
);
}
return
0
;
}
...
...
@@ -1027,7 +1027,7 @@ int __kprobes register_kretprobe(struct kretprobe *rp)
rp
->
maxactive
=
NR_CPUS
;
#endif
}
spin_lock_init
(
&
rp
->
lock
);
atomic_
spin_lock_init
(
&
rp
->
lock
);
INIT_HLIST_HEAD
(
&
rp
->
free_instances
);
for
(
i
=
0
;
i
<
rp
->
maxactive
;
i
++
)
{
inst
=
kmalloc
(
sizeof
(
struct
kretprobe_instance
)
+
...
...
@@ -1207,7 +1207,7 @@ static int __init init_kprobes(void)
for
(
i
=
0
;
i
<
KPROBE_TABLE_SIZE
;
i
++
)
{
INIT_HLIST_HEAD
(
&
kprobe_table
[
i
]);
INIT_HLIST_HEAD
(
&
kretprobe_inst_table
[
i
]);
spin_lock_init
(
&
(
kretprobe_table_locks
[
i
].
lock
));
atomic_
spin_lock_init
(
&
(
kretprobe_table_locks
[
i
].
lock
));
}
/*
...
...
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