提交 0dcd91a9 编写于 作者: S Sebastian Ott 提交者: Martin Schwidefsky

s390/debug: only write data once

debug_event_common memsets the active debug entry with zeros to
prevent stale data leakage. This is overwritten with the actual
debug data in the next step. Only write zeros to that part of the
debug entry that's not used by new debug data.

Micro benchmarks show a 2-10% reduction of cpu cycles with this
approach.
Signed-off-by: NSebastian Ott <sebott@linux.vnet.ibm.com>
Acked-by: NMichael Holzheu <holzheu@linux.vnet.ibm.com>
Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
上级 94158e54
...@@ -902,8 +902,9 @@ debug_entry_t *debug_event_common(debug_info_t *id, int level, const void *buf, ...@@ -902,8 +902,9 @@ debug_entry_t *debug_event_common(debug_info_t *id, int level, const void *buf,
} }
do { do {
active = get_active_entry(id); active = get_active_entry(id);
memset(DEBUG_DATA(active), 0, id->buf_size);
memcpy(DEBUG_DATA(active), buf, min(len, id->buf_size)); memcpy(DEBUG_DATA(active), buf, min(len, id->buf_size));
if (len < id->buf_size)
memset((DEBUG_DATA(active)) + len, 0, id->buf_size - len);
debug_finish_entry(id, active, level, 0); debug_finish_entry(id, active, level, 0);
len -= id->buf_size; len -= id->buf_size;
buf += id->buf_size; buf += id->buf_size;
...@@ -934,8 +935,9 @@ debug_entry_t *debug_exception_common(debug_info_t *id, int level, ...@@ -934,8 +935,9 @@ debug_entry_t *debug_exception_common(debug_info_t *id, int level,
} }
do { do {
active = get_active_entry(id); active = get_active_entry(id);
memset(DEBUG_DATA(active), 0, id->buf_size);
memcpy(DEBUG_DATA(active), buf, min(len, id->buf_size)); memcpy(DEBUG_DATA(active), buf, min(len, id->buf_size));
if (len < id->buf_size)
memset((DEBUG_DATA(active)) + len, 0, id->buf_size - len);
debug_finish_entry(id, active, level, len <= id->buf_size); debug_finish_entry(id, active, level, len <= id->buf_size);
len -= id->buf_size; len -= id->buf_size;
buf += id->buf_size; buf += id->buf_size;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册