Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Grpc
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
Container Registry
Model registry
Operate
Environments
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
tci-gateway-module
Grpc
Commits
f2e15655
Commit
f2e15655
authored
7 years ago
by
Craig Tiller
Committed by
GitHub
7 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #11547 from ctiller/epex7
Add logging, fix some bugs for epollexclusive
parents
1bec15ee
5dfc81e3
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/core/lib/iomgr/ev_epollex_linux.c
+50
-6
50 additions, 6 deletions
src/core/lib/iomgr/ev_epollex_linux.c
src/core/lib/support/log_linux.c
+3
-1
3 additions, 1 deletion
src/core/lib/support/log_linux.c
with
53 additions
and
7 deletions
src/core/lib/iomgr/ev_epollex_linux.c
+
50
−
6
View file @
f2e15655
...
...
@@ -103,6 +103,32 @@ typedef struct pollable {
grpc_pollset_worker
*
root_worker
;
}
pollable
;
static
const
char
*
polling_obj_type_string
(
polling_obj_type
t
)
{
switch
(
t
)
{
case
PO_POLLING_GROUP
:
return
"polling_group"
;
case
PO_POLLSET_SET
:
return
"pollset_set"
;
case
PO_POLLSET
:
return
"pollset"
;
case
PO_FD
:
return
"fd"
;
case
PO_EMPTY_POLLABLE
:
return
"empty_pollable"
;
case
PO_COUNT
:
return
"<invalid:count>"
;
}
return
"<invalid>"
;
}
static
char
*
pollable_desc
(
pollable
*
p
)
{
char
*
out
;
gpr_asprintf
(
&
out
,
"type=%s group=%p epfd=%d wakeup=%d"
,
polling_obj_type_string
(
p
->
po
.
type
),
p
->
po
.
group
,
p
->
epfd
,
p
->
wakeup
.
read_fd
);
return
out
;
}
static
pollable
g_empty_pollable
;
static
void
pollable_init
(
pollable
*
p
,
polling_obj_type
type
);
...
...
@@ -472,7 +498,7 @@ static grpc_error *pollable_add_fd(pollable *p, grpc_fd *fd) {
GPR_ASSERT
(
epfd
!=
-
1
);
if
(
GRPC_TRACER_ON
(
grpc_polling_trace
))
{
gpr_log
(
GPR_DEBUG
,
"add fd %p to pollable %p"
,
fd
,
p
);
gpr_log
(
GPR_DEBUG
,
"add fd %p
(%d)
to pollable %p"
,
fd
,
fd
->
fd
,
p
);
}
gpr_mu_lock
(
&
fd
->
orphaned_mu
);
...
...
@@ -537,10 +563,18 @@ static void do_kick_all(grpc_exec_ctx *exec_ctx, void *arg,
if
(
worker
->
pollable
!=
&
pollset
->
pollable
)
{
gpr_mu_lock
(
&
worker
->
pollable
->
po
.
mu
);
}
if
(
worker
->
initialized_cv
)
{
if
(
worker
->
initialized_cv
&&
worker
!=
pollset
->
root_worker
)
{
if
(
GRPC_TRACER_ON
(
grpc_polling_trace
))
{
gpr_log
(
GPR_DEBUG
,
"PS:%p kickall_via_cv %p (pollable %p vs %p)"
,
pollset
,
worker
,
&
pollset
->
pollable
,
worker
->
pollable
);
}
worker
->
kicked
=
true
;
gpr_cv_signal
(
&
worker
->
cv
);
}
else
{
if
(
GRPC_TRACER_ON
(
grpc_polling_trace
))
{
gpr_log
(
GPR_DEBUG
,
"PS:%p kickall_via_wakeup %p (pollable %p vs %p)"
,
pollset
,
worker
,
&
pollset
->
pollable
,
worker
->
pollable
);
}
append_error
(
&
error
,
grpc_wakeup_fd_wakeup
(
&
worker
->
pollable
->
wakeup
),
"pollset_shutdown"
);
}
...
...
@@ -770,7 +804,9 @@ static grpc_error *pollset_epoll(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset,
int
timeout
=
poll_deadline_to_millis_timeout
(
deadline
,
now
);
if
(
GRPC_TRACER_ON
(
grpc_polling_trace
))
{
gpr_log
(
GPR_DEBUG
,
"PS:%p poll %p for %dms"
,
pollset
,
p
,
timeout
);
char
*
desc
=
pollable_desc
(
p
);
gpr_log
(
GPR_DEBUG
,
"PS:%p poll %p[%s] for %dms"
,
pollset
,
p
,
desc
,
timeout
);
gpr_free
(
desc
);
}
if
(
timeout
!=
0
)
{
...
...
@@ -985,10 +1021,11 @@ static grpc_error *pollset_add_fd_locked(grpc_exec_ctx *exec_ctx,
static
const
char
*
err_desc
=
"pollset_add_fd"
;
grpc_error
*
error
=
GRPC_ERROR_NONE
;
if
(
pollset
->
current_pollable
==
&
g_empty_pollable
)
{
if
(
GRPC_TRACER_ON
(
grpc_polling_trace
))
if
(
GRPC_TRACER_ON
(
grpc_polling_trace
))
{
gpr_log
(
GPR_DEBUG
,
"PS:%p add fd %p; transition pollable from empty to fd"
,
pollset
,
fd
);
}
/* empty pollable --> single fd pollable */
pollset_kick_all
(
exec_ctx
,
pollset
);
pollset
->
current_pollable
=
&
fd
->
pollable
;
...
...
@@ -997,16 +1034,23 @@ static grpc_error *pollset_add_fd_locked(grpc_exec_ctx *exec_ctx,
if
(
!
fd_locked
)
gpr_mu_unlock
(
&
fd
->
pollable
.
po
.
mu
);
REF_BY
(
fd
,
2
,
"pollset_pollable"
);
}
else
if
(
pollset
->
current_pollable
==
&
pollset
->
pollable
)
{
if
(
GRPC_TRACER_ON
(
grpc_polling_trace
))
if
(
GRPC_TRACER_ON
(
grpc_polling_trace
))
{
gpr_log
(
GPR_DEBUG
,
"PS:%p add fd %p; already multipolling"
,
pollset
,
fd
);
}
append_error
(
&
error
,
pollable_add_fd
(
pollset
->
current_pollable
,
fd
),
err_desc
);
}
else
if
(
pollset
->
current_pollable
!=
&
fd
->
pollable
)
{
grpc_fd
*
had_fd
=
(
grpc_fd
*
)
pollset
->
current_pollable
;
if
(
GRPC_TRACER_ON
(
grpc_polling_trace
))
if
(
GRPC_TRACER_ON
(
grpc_polling_trace
))
{
gpr_log
(
GPR_DEBUG
,
"PS:%p add fd %p; transition pollable from fd %p to multipoller"
,
pollset
,
fd
,
had_fd
);
}
/* Introduce a spurious completion.
If we do not, then it may be that the fd-specific epoll set consumed
a completion without being polled, leading to a missed edge going up. */
grpc_lfev_set_ready
(
exec_ctx
,
&
had_fd
->
read_closure
);
grpc_lfev_set_ready
(
exec_ctx
,
&
had_fd
->
write_closure
);
pollset_kick_all
(
exec_ctx
,
pollset
);
pollset
->
current_pollable
=
&
pollset
->
pollable
;
if
(
append_error
(
&
error
,
pollable_materialize
(
&
pollset
->
pollable
),
...
...
This diff is collapsed.
Click to expand it.
src/core/lib/support/log_linux.c
+
3
−
1
View file @
f2e15655
...
...
@@ -64,6 +64,8 @@ void gpr_default_log(gpr_log_func_args *args) {
time_t
timer
;
gpr_timespec
now
=
gpr_now
(
GPR_CLOCK_REALTIME
);
struct
tm
tm
;
static
__thread
long
tid
=
0
;
if
(
tid
==
0
)
tid
=
gettid
();
timer
=
(
time_t
)
now
.
tv_sec
;
final_slash
=
strrchr
(
args
->
file
,
'/'
);
...
...
@@ -81,7 +83,7 @@ void gpr_default_log(gpr_log_func_args *args) {
gpr_asprintf
(
&
prefix
,
"%s%s.%09"
PRId32
" %7ld %s:%d]"
,
gpr_log_severity_string
(
args
->
severity
),
time_buffer
,
now
.
tv_nsec
,
get
tid
()
,
display_file
,
args
->
line
);
now
.
tv_nsec
,
tid
,
display_file
,
args
->
line
);
fprintf
(
stderr
,
"%-60s %s
\n
"
,
prefix
,
args
->
message
);
gpr_free
(
prefix
);
...
...
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