Commit 32dab682 authored by Thomas Richter's avatar Thomas Richter Committed by Vasily Gorbik

s390/cpum_sf: Use kzalloc and minor changes

Use kzalloc() to allocate auxiliary buffer structure initialized
with all zeroes to avoid random value in trace output.

Avoid double access to SBD hardware flags.
Signed-off-by: default avatarThomas Richter <tmricht@linux.ibm.com>
Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
parent ee5c4ccf
...@@ -1426,8 +1426,8 @@ static int aux_output_begin(struct perf_output_handle *handle, ...@@ -1426,8 +1426,8 @@ static int aux_output_begin(struct perf_output_handle *handle,
idx = aux->empty_mark + 1; idx = aux->empty_mark + 1;
for (i = 0; i < range_scan; i++, idx++) { for (i = 0; i < range_scan; i++, idx++) {
te = aux_sdb_trailer(aux, idx); te = aux_sdb_trailer(aux, idx);
te->flags = te->flags & ~SDB_TE_BUFFER_FULL_MASK; te->flags &= ~(SDB_TE_BUFFER_FULL_MASK |
te->flags = te->flags & ~SDB_TE_ALERT_REQ_MASK; SDB_TE_ALERT_REQ_MASK);
te->overflow = 0; te->overflow = 0;
} }
/* Save the position of empty SDBs */ /* Save the position of empty SDBs */
...@@ -1470,8 +1470,7 @@ static bool aux_set_alert(struct aux_buffer *aux, unsigned long alert_index, ...@@ -1470,8 +1470,7 @@ static bool aux_set_alert(struct aux_buffer *aux, unsigned long alert_index,
te = aux_sdb_trailer(aux, alert_index); te = aux_sdb_trailer(aux, alert_index);
do { do {
orig_flags = te->flags; orig_flags = te->flags;
orig_overflow = te->overflow; *overflow = orig_overflow = te->overflow;
*overflow = orig_overflow;
if (orig_flags & SDB_TE_BUFFER_FULL_MASK) { if (orig_flags & SDB_TE_BUFFER_FULL_MASK) {
/* /*
* SDB is already set by hardware. * SDB is already set by hardware.
...@@ -1711,7 +1710,7 @@ static void *aux_buffer_setup(struct perf_event *event, void **pages, ...@@ -1711,7 +1710,7 @@ static void *aux_buffer_setup(struct perf_event *event, void **pages,
} }
/* Allocate aux_buffer struct for the event */ /* Allocate aux_buffer struct for the event */
aux = kmalloc(sizeof(struct aux_buffer), GFP_KERNEL); aux = kzalloc(sizeof(struct aux_buffer), GFP_KERNEL);
if (!aux) if (!aux)
goto no_aux; goto no_aux;
sfb = &aux->sfb; sfb = &aux->sfb;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment