-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vchiq: Missing commits from downstream #63
Changes from all commits
c7884ae
1bc256a
e5afc1b
474b510
76f2eaf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -610,22 +610,24 @@ process_free_queue(VCHIQ_STATE_T *state) | |
BITSET_T service_found[BITSET_SIZE(VCHIQ_MAX_SERVICES)]; | ||
int slot_queue_available; | ||
|
||
/* Use a read memory barrier to ensure that any state that may have | ||
** been modified by another thread is not masked by stale prefetched | ||
** values. */ | ||
rmb(); | ||
|
||
/* Find slots which have been freed by the other side, and return them | ||
** to the available queue. */ | ||
slot_queue_available = state->slot_queue_available; | ||
|
||
/* Use a memory barrier to ensure that any state that may have been | ||
** modified by another thread is not masked by stale prefetched | ||
** values. */ | ||
mb(); | ||
|
||
while (slot_queue_available != local->slot_queue_recycle) { | ||
unsigned int pos; | ||
int slot_index = local->slot_queue[slot_queue_available++ & | ||
VCHIQ_SLOT_QUEUE_MASK]; | ||
char *data = (char *)SLOT_DATA_FROM_INDEX(state, slot_index); | ||
int data_found = 0; | ||
|
||
rmb(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @pelwell I've rebased and rearranged this series. But checkpatch complains about a missing comment why this read memory barrier is necessary. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
vchiq_log_trace(vchiq_core_log_level, "%d: pfq %d=%x %x %x", | ||
state->id, slot_index, (unsigned int)data, | ||
local->slot_queue_recycle, slot_queue_available); | ||
|
@@ -741,6 +743,8 @@ process_free_queue(VCHIQ_STATE_T *state) | |
up(&state->data_quota_event); | ||
} | ||
|
||
mb(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @pelwell checkpatch complains here, too There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
state->slot_queue_available = slot_queue_available; | ||
up(&state->slot_available_event); | ||
} | ||
|
@@ -891,16 +895,14 @@ queue_message(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T *service, | |
error_count); | ||
return VCHIQ_ERROR; | ||
} | ||
if (i == 0) { | ||
if (SRVTRACE_ENABLED(service, | ||
VCHIQ_LOG_INFO)) | ||
vchiq_log_dump_mem("Sent", 0, | ||
header->data + pos, | ||
min(64u, | ||
elements[0].size)); | ||
} | ||
} | ||
|
||
if (SRVTRACE_ENABLED(service, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This needs a commit message which explain why this complete patch is necessary. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Signed-off-by: Phil Elwell [email protected] There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks. It seems that the first part has already been applied. |
||
VCHIQ_LOG_INFO)) | ||
vchiq_log_dump_mem("Sent", 0, | ||
header->data, | ||
min(16, pos)); | ||
|
||
spin_lock("a_spinlock); | ||
service_quota->message_use_count++; | ||
|
||
|
@@ -1039,16 +1041,13 @@ queue_message_sync(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T *service, | |
error_count); | ||
return VCHIQ_ERROR; | ||
} | ||
if (i == 0) { | ||
if (vchiq_sync_log_level >= | ||
VCHIQ_LOG_TRACE) | ||
vchiq_log_dump_mem("Sent Sync", | ||
0, header->data + pos, | ||
min(64u, | ||
elements[0].size)); | ||
} | ||
} | ||
|
||
if (vchiq_sync_log_level >= VCHIQ_LOG_TRACE) | ||
vchiq_log_dump_mem("Sent Sync", | ||
0, header->data, | ||
min(16, pos)); | ||
|
||
VCHIQ_SERVICE_STATS_INC(service, ctrl_tx_count); | ||
VCHIQ_SERVICE_STATS_ADD(service, ctrl_tx_bytes, size); | ||
} else { | ||
|
@@ -1720,7 +1719,7 @@ parse_rx_slots(VCHIQ_STATE_T *state) | |
remoteport, localport, size); | ||
if (size > 0) | ||
vchiq_log_dump_mem("Rcvd", 0, header->data, | ||
min(64, size)); | ||
min(16, size)); | ||
} | ||
|
||
if (((unsigned int)header & VCHIQ_SLOT_MASK) + calc_stride(size) | ||
|
@@ -2187,7 +2186,7 @@ sync_func(void *v) | |
remoteport, localport, size); | ||
if (size > 0) | ||
vchiq_log_dump_mem("Rcvd", 0, header->data, | ||
min(64, size)); | ||
min(16, size)); | ||
} | ||
|
||
switch (type) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The commit messages doesn't explain why it's increased. So this should be a separate patch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pelwell Thanks for the other comment, but the changes to MAX_COMPLETIONS and MSG_QUEUE_SIZE needs a separate commit message, too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
vchiq_arm: Avoid premature stalls
The constants MAX_COMPLETIONS and MSG_QUEUE_SIZE control the number of
messages that can be outstanding to each client before the system as a
whole stalls. If the numbers are too small then unnecessary thread
switching will occur while waiting for a (potentially low priority)
client thread to consume some data; badly written clients can even
lead to deadlock.
For services that carry many short messages, 16 messages can represent
a very small amount of data. Since the resources are small - 16 bytes
for a completion, 4 bytes for a message pointer - increase the limits
so they are unlikely to be hit except in exceptional circumstances.
Signed-off-by: Phil Elwell [email protected]