usertools: show hugepages requested/set on failure
PATCH 1/1 usertools: show hugepages requested/set on failure
In case the number of requested hugepages cannot be set,
a more detailed error message is printed.
The new message does not mention "reserve" because setting can be reserving or clearing.
The filename and numbers requested/set are printed to ease debugging.
Signed-off-by Thomas Monjalon <[email protected]>
--- usertools/dpdk-hugepages.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
usertools/dpdk-hugepages.py +6 -4
@@ -57,19 +57,21 @@ def get_hugepages(path): return 0 -def set_hugepages(path, pages): +def set_hugepages(path, reqpages): '''Write the number of reserved huge pages''' filename = path + '/nr_hugepages' try: with open(filename, 'w') as nr_hugepages: - nr_hugepages.write('{}\n'.format(pages)) + nr_hugepages.write('{}\n'.format(reqpages)) except PermissionError: sys.exit('Permission denied: need to be root!') except FileNotFoundError: sys.exit("Invalid page size. Valid page sizes: {}".format( get_valid_page_sizes(path))) - if get_hugepages(path) != pages: - sys.exit('Unable to reserve required pages.') + gotpages = get_hugepages(path) + if gotpages != reqpages: + sys.exit('Unable to set pages ({} instead of {} in {}).'.format( + gotpages, reqpages, filename)) def show_numa_pages():
Signature · 1 line
2.30.1
Thomas Monjalon
Applied08/03/2021 23:25, Thomas Monjalon:
Quoted 7 lines
In case the number of requested hugepages cannot be set,
a more detailed error message is printed.
The new message does not mention "reserve" because setting can be reserving or clearing.
The filename and numbers requested/set are printed to ease debugging.Signed-off-by Thomas Monjalon <[email protected]>
Applied