Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libvdp-pesi
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Jobs
Commits
Open sidebar
uplex-varnish
libvdp-pesi
Commits
39fe0933
Unverified
Commit
39fe0933
authored
Jan 28, 2023
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use the shared nodes_lock also for final nodes
parent
e1d456a7
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
19 deletions
+19
-19
node.c
src/node.c
+9
-9
node.h
src/node.h
+4
-4
vdp_pesi.c
src/vdp_pesi.c
+6
-6
No files found.
src/node.c
View file @
39fe0933
...
@@ -581,7 +581,7 @@ fini_final(struct vdp_ctx *vdx, struct node *node)
...
@@ -581,7 +581,7 @@ fini_final(struct vdp_ctx *vdx, struct node *node)
if
(
node
->
final
.
fi_state
==
FI_DESTROYED
)
if
(
node
->
final
.
fi_state
==
FI_DESTROYED
)
return
;
return
;
AZ
(
pthread_mutex_lock
(
&
node
->
final
.
fi_mtx
)
);
Lck_Lock
(
node
->
final
.
shared_lock
);
if
(
node
->
final
.
fi_state
<
FI_GO
)
{
if
(
node
->
final
.
fi_state
<
FI_GO
)
{
node
->
final
.
fi_state
=
FI_GO
;
node
->
final
.
fi_state
=
FI_GO
;
...
@@ -589,15 +589,15 @@ fini_final(struct vdp_ctx *vdx, struct node *node)
...
@@ -589,15 +589,15 @@ fini_final(struct vdp_ctx *vdx, struct node *node)
}
}
if
(
node
->
final
.
fi_state
<
FI_DONE
)
if
(
node
->
final
.
fi_state
<
FI_DONE
)
AZ
(
pthread_cond_w
ait
(
&
node
->
final
.
fi_cond
,
AZ
(
Lck_CondW
ait
(
&
node
->
final
.
fi_cond
,
&
node
->
final
.
fi_mtx
));
node
->
final
.
shared_lock
));
AZ
(
pthread_mutex_unlock
(
&
node
->
final
.
fi_mtx
)
);
Lck_Unlock
(
node
->
final
.
shared_lock
);
assert
(
node
->
final
.
fi_state
==
FI_DONE
);
assert
(
node
->
final
.
fi_state
==
FI_DONE
);
AZ
(
pthread_cond_destroy
(
&
node
->
final
.
fi_cond
));
AZ
(
pthread_cond_destroy
(
&
node
->
final
.
fi_cond
));
AZ
(
pthread_mutex_destroy
(
&
node
->
final
.
fi_mtx
))
;
node
->
final
.
shared_lock
=
NULL
;
node
->
final
.
fi_state
=
FI_DESTROYED
;
node
->
final
.
fi_state
=
FI_DESTROYED
;
}
}
...
@@ -690,16 +690,16 @@ push_final(struct vdp_ctx *vdx, struct bytes_tree *tree,
...
@@ -690,16 +690,16 @@ push_final(struct vdp_ctx *vdx, struct bytes_tree *tree,
assert
(
node
->
type
==
T_FINAL
);
assert
(
node
->
type
==
T_FINAL
);
assert
(
node
->
final
.
fi_state
==
FI_READY
);
assert
(
node
->
final
.
fi_state
==
FI_READY
);
AZ
(
pthread_mutex_lock
(
&
node
->
final
.
fi_mtx
)
);
Lck_Lock
(
node
->
final
.
shared_lock
);
node
->
final
.
fi_state
=
FI_GO
;
node
->
final
.
fi_state
=
FI_GO
;
AZ
(
pthread_cond_signal
(
&
node
->
final
.
fi_cond
));
AZ
(
pthread_cond_signal
(
&
node
->
final
.
fi_cond
));
if
(
node
->
final
.
fi_state
<
FI_DONE
)
if
(
node
->
final
.
fi_state
<
FI_DONE
)
AZ
(
pthread_cond_w
ait
(
&
node
->
final
.
fi_cond
,
AZ
(
Lck_CondW
ait
(
&
node
->
final
.
fi_cond
,
&
node
->
final
.
fi_mtx
));
node
->
final
.
shared_lock
));
AZ
(
pthread_mutex_unlock
(
&
node
->
final
.
fi_mtx
)
);
Lck_Unlock
(
node
->
final
.
shared_lock
);
assert
(
node
->
final
.
fi_state
==
FI_DONE
);
assert
(
node
->
final
.
fi_state
==
FI_DONE
);
return
(
tree
->
retval
);
return
(
tree
->
retval
);
...
...
src/node.h
View file @
39fe0933
...
@@ -173,9 +173,9 @@ enum fi_state {
...
@@ -173,9 +173,9 @@ enum fi_state {
/* we block the sub-thread when it's ready for delivery and continue when the
/* we block the sub-thread when it's ready for delivery and continue when the
* topreqp tells it to */
* topreqp tells it to */
struct
node_final
{
struct
node_final
{
enum
fi_state
fi_state
;
struct
lock
*
shared_lock
;
// == &tree->nodes_lock
pthread_mutex_t
fi_mtx
;
pthread_cond_t
fi_cond
;
pthread_cond_t
fi_cond
;
enum
fi_state
fi_state
;
};
};
enum
n_alloc
{
enum
n_alloc
{
...
@@ -184,7 +184,7 @@ enum n_alloc {
...
@@ -184,7 +184,7 @@ enum n_alloc {
NA_MPL
NA_MPL
}
__attribute__
((
__packed__
));
}
__attribute__
((
__packed__
));
struct
node
{
// 12
8
b
struct
node
{
// 12
0
b
unsigned
magic
;
unsigned
magic
;
#define NODE_MAGIC 0xe31edef3
#define NODE_MAGIC 0xe31edef3
enum
n_type
type
;
enum
n_type
type
;
...
@@ -199,7 +199,7 @@ struct node { // 128b
...
@@ -199,7 +199,7 @@ struct node { // 128b
struct
node_nexus
nexus
;
// T_NEXUS 72b
struct
node_nexus
nexus
;
// T_NEXUS 72b
struct
node_data
data
;
// T_DATA 32b
struct
node_data
data
;
// T_DATA 32b
struct
node_subreq
subreq
;
// T_SUBREQ 88b
struct
node_subreq
subreq
;
// T_SUBREQ 88b
struct
node_final
final
;
// T_FINAL
96
b
struct
node_final
final
;
// T_FINAL
64
b
struct
node_crc
crc
;
// T_CRC 16b
struct
node_crc
crc
;
// T_CRC 16b
};
};
};
};
...
...
src/vdp_pesi.c
View file @
39fe0933
...
@@ -1440,24 +1440,24 @@ vped_deliver(struct req *req, struct boc *boc, int wantbody)
...
@@ -1440,24 +1440,24 @@ vped_deliver(struct req *req, struct boc *boc, int wantbody)
node_mutate_prep
(
tree
,
node
);
node_mutate_prep
(
tree
,
node
);
AZ
(
pthread_mutex_init
(
&
node
->
final
.
fi_mtx
,
NULL
))
;
node
->
final
.
shared_lock
=
&
tree
->
nodes_lock
;
AZ
(
pthread_cond_init
(
&
node
->
final
.
fi_cond
,
NULL
));
AZ
(
pthread_cond_init
(
&
node
->
final
.
fi_cond
,
NULL
));
assert
(
node
->
final
.
fi_state
==
FI_READY
);
assert
(
node
->
final
.
fi_state
==
FI_READY
);
node_mutate_lock
(
tree
,
node
,
T_FINAL
,
ST_DATA
);
node_mutate_lock
(
tree
,
node
,
T_FINAL
,
ST_DATA
);
/*
/*
* we deliberately take the
fi_mtx
under the tree mutex (via
* we deliberately take the
nodes lock
under the tree mutex (via
* node_mutate_lock) to ensure unpending never gets unlocked
* node_mutate_lock) to ensure unpending never gets unlocked
* access to ensure we get the signal
* access to ensure we get the signal
*/
*/
AZ
(
pthread_mutex_lock
(
&
node
->
final
.
fi_mtx
)
);
Lck_Lock
(
node
->
final
.
shared_lock
);
node_mutate_unlock
(
tree
);
node_mutate_unlock
(
tree
);
if
(
node
->
final
.
fi_state
<
FI_GO
)
if
(
node
->
final
.
fi_state
<
FI_GO
)
AZ
(
pthread_cond_w
ait
(
&
node
->
final
.
fi_cond
,
AZ
(
Lck_CondW
ait
(
&
node
->
final
.
fi_cond
,
&
node
->
final
.
fi_mtx
));
node
->
final
.
shared_lock
));
assert
(
node
->
final
.
fi_state
==
FI_GO
);
assert
(
node
->
final
.
fi_state
==
FI_GO
);
...
@@ -1467,7 +1467,7 @@ vped_deliver(struct req *req, struct boc *boc, int wantbody)
...
@@ -1467,7 +1467,7 @@ vped_deliver(struct req *req, struct boc *boc, int wantbody)
node
->
final
.
fi_state
=
FI_DONE
;
node
->
final
.
fi_state
=
FI_DONE
;
AZ
(
pthread_cond_signal
(
&
node
->
final
.
fi_cond
));
AZ
(
pthread_cond_signal
(
&
node
->
final
.
fi_cond
));
AZ
(
pthread_mutex_unlock
(
&
node
->
final
.
fi_mtx
)
);
Lck_Unlock
(
node
->
final
.
shared_lock
);
return
;
return
;
}
}
...
...
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