Skip to content

Commit

Permalink
DAOS-6926 logging: Do not check for facility used in alloc/free. (#4839)
Browse files Browse the repository at this point in the history
The cost of keeping the whitelist up to date is greater than the benefit
from having the check so simply remove it.

Signed-off-by: Ashley Pittman <ashley.m.pittman@intel.com>
  • Loading branch information
ashleypittman committed Mar 16, 2021
1 parent 5d32856 commit f96e276
Showing 1 changed file with 3 additions and 73 deletions.
76 changes: 3 additions & 73 deletions src/tests/ftest/cart/util/cart_logtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,47 +164,6 @@ def __str__(self):
# error lines.
shown_logs = set()

# List of known areas where there may be a mismatch between the facility used
# for alloc vs free. Typically this is where memory is allocated in one file
# but freed in another, however allocations in header file also feature.

# First is a lookup dict of commonly shared facilities, key is allocation
# facility, value is set of free facilities.

# Second part is a unordered dict of functions which are whitelisted
# specifically, key is function name, value is list of variables.
# Both the alloc and free function need to be whitelisted.

mismatch_table = {'client': ('array'),
'daos': ('common', 'container', 'pool'),
'common': ('container', 'pool'),
'container': ('common'),
'mgmt': ('common', 'daos', 'pool', 'rsvc'),
'misc': ('common', 'mgmt'),
'pool': ('common'),
'server': ('daos')}

mismatch_alloc_ok = {'crt_self_uri_get': ('tmp_uri'),
'crt_rpc_handler_common': ('rpc_priv'),
'bio_sgl_init': ('sgl->bs_iovs'),
'pool_svc_name_cb': ('s'),
'daos_iov_copy': ('dst->iov_buf'),
'ds_pool_tgt_map_update': ('arg'),
'enum_cont_cb': ('ptr'),
'path_gen': ('*fpath'),
'd_sgl_init': ('sgl->sg_iovs'),
'iod_fetch': ('biovs')}

mismatch_free_ok = {'crt_rpc_priv_free': ('rpc_priv'),
'bio_sgl_fini': ('sgl->bs_iovs'),
'fini_free': ('svc->s_name',
'svc->s_db_path'),
'd_sgl_fini': ('sgl->sg_iovs[i].iov_buf',
'sgl->sg_iovs'),
'dtx_resync_ult': ('arg'),
'ds_pool_list_cont_handler': ('cont_buf'),
'notify_ready': ('req.uri')}

wf = None

def show_line(line, sev, msg, custom=None):
Expand Down Expand Up @@ -370,8 +329,8 @@ def check_dfuse_io(self):
else:
client_pids[pid].add(start, end, line.ts)

for pid in client_pids:
print('{}:{}'.format(pid, client_pids[pid]))
for cpid in client_pids:
print('{}:{}'.format(cpid, client_pids[pid]))

#pylint: disable=too-many-branches,too-many-nested-blocks
def _check_pid_from_log_file(self,
Expand Down Expand Up @@ -432,7 +391,7 @@ def _check_pid_from_log_file(self,
if line.filename == self.fi_location.filename:
src_offset = line.lineno
src_offset -= self.fi_location.lineno
if src_offset > 0 and src_offset < 5:
if 0 < src_offset < 5:
show_line(line, 'NORMAL',
'Logging allocation failure')

Expand Down Expand Up @@ -533,35 +492,6 @@ def _check_pid_from_log_file(self,
if pointer in active_desc:
del active_desc[pointer]
if pointer in regions:
if line.fac != regions[pointer].fac:
fvar = line.get_field(3).strip("'")
afunc = regions[pointer].function
avar = regions[pointer].get_field(3).strip("':")
if line.function in mismatch_free_ok and \
fvar in mismatch_free_ok[line.function] and \
afunc in mismatch_alloc_ok and \
avar in mismatch_alloc_ok[afunc]:
pass
elif regions[pointer].fac in mismatch_table \
and line.fac in \
mismatch_table[regions[pointer].fac]:
pass
else:
show_line(regions[pointer], 'LOW',
'facility mismatch in alloc/free ' +
'{} != {}'.format(
regions[pointer].fac, line.fac))
show_line(line, 'LOW',
'facility mismatch in alloc/free ' +
'{} != {}'.format(
regions[pointer].fac, line.fac))
err_count += 1
if line.level != regions[pointer].level:
show_line(regions[pointer], 'LOW',
'level mismatch in alloc/free')
show_line(line, 'LOW',
'level mismatch in alloc/free')
err_count += 1
memsize.subtract(regions[pointer].calloc_size())
old_regions[pointer] = [regions[pointer], line]
del regions[pointer]
Expand Down

0 comments on commit f96e276

Please sign in to comment.