Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
osv
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Verlässliche Systemsoftware
projects
osv
Commits
6542bc76
Commit
6542bc76
authored
12 years ago
by
Avi Kivity
Browse files
Options
Downloads
Patches
Plain Diff
sched: prevent concurrent wakeups
parent
492e38d6
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
core/sched.cc
+6
-8
6 additions, 8 deletions
core/sched.cc
include/sched.hh
+2
-1
2 additions, 1 deletion
include/sched.hh
scripts/loader.py
+1
-1
1 addition, 1 deletion
scripts/loader.py
with
9 additions
and
10 deletions
core/sched.cc
+
6
−
8
View file @
6542bc76
...
@@ -110,16 +110,14 @@ void thread::prepare_wait()
...
@@ -110,16 +110,14 @@ void thread::prepare_wait()
void
thread
::
wake
()
void
thread
::
wake
()
{
{
// prevent two concurrent wakeups
if
(
!
_waiting
.
exchange
(
false
))
{
return
;
}
irq_save_lock_type
irq_lock
;
irq_save_lock_type
irq_lock
;
with_lock
(
irq_lock
,
[
this
]
{
with_lock
(
irq_lock
,
[
this
]
{
if
(
!
_waiting
)
{
_on_runqueue
=
true
;
return
;
_cpu
->
runqueue
.
push_back
(
*
this
);
}
_waiting
=
false
;
if
(
!
_on_runqueue
)
{
_on_runqueue
=
true
;
_cpu
->
runqueue
.
push_back
(
*
this
);
}
});
});
}
}
...
...
This diff is collapsed.
Click to expand it.
include/sched.hh
+
2
−
1
View file @
6542bc76
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
#include
<boost/intrusive/set.hpp>
#include
<boost/intrusive/set.hpp>
#include
<boost/intrusive/list.hpp>
#include
<boost/intrusive/list.hpp>
#include
"mutex.hh"
#include
"mutex.hh"
#include
<atomic>
extern
"C"
{
extern
"C"
{
void
smp_main
();
void
smp_main
();
...
@@ -63,7 +64,7 @@ private:
...
@@ -63,7 +64,7 @@ private:
thread_state
_state
;
thread_state
_state
;
thread_control_block
*
_tcb
;
thread_control_block
*
_tcb
;
bool
_on_runqueue
;
bool
_on_runqueue
;
bool
_waiting
;
std
::
atomic_
bool
_waiting
;
stack_info
_stack
;
stack_info
_stack
;
cpu
*
_cpu
;
cpu
*
_cpu
;
friend
void
thread_main_c
(
thread
*
t
);
friend
void
thread_main_c
(
thread
*
t
);
...
...
This diff is collapsed.
Click to expand it.
scripts/loader.py
+
1
−
1
View file @
6542bc76
...
@@ -128,7 +128,7 @@ class thread_context(object):
...
@@ -128,7 +128,7 @@ class thread_context(object):
self
.
new_frame
=
gdb
.
newest_frame
()
self
.
new_frame
=
gdb
.
newest_frame
()
self
.
new_frame
.
select
()
self
.
new_frame
.
select
()
self
.
running
=
(
not
long
(
thread
[
'
_on_runqueue
'
])
self
.
running
=
(
not
long
(
thread
[
'
_on_runqueue
'
])
and
not
long
(
thread
[
'
_waiting
'
]))
and
not
long
(
thread
[
'
_waiting
'
]
[
'
_M_base
'
][
'
_M_i
'
]
))
self
.
old_rsp
=
ulong
(
gdb
.
parse_and_eval
(
'
$rsp
'
).
cast
(
ulong_type
))
self
.
old_rsp
=
ulong
(
gdb
.
parse_and_eval
(
'
$rsp
'
).
cast
(
ulong_type
))
self
.
old_rip
=
ulong
(
gdb
.
parse_and_eval
(
'
$rip
'
).
cast
(
ulong_type
))
self
.
old_rip
=
ulong
(
gdb
.
parse_and_eval
(
'
$rip
'
).
cast
(
ulong_type
))
self
.
old_rbp
=
ulong
(
gdb
.
parse_and_eval
(
'
$rbp
'
).
cast
(
ulong_type
))
self
.
old_rbp
=
ulong
(
gdb
.
parse_and_eval
(
'
$rbp
'
).
cast
(
ulong_type
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment