diff --git a/0001-change-script-from-py2-to-py3.patch b/0001-change-script-from-py2-to-py3.patch deleted file mode 100644 index 0536961..0000000 --- a/0001-change-script-from-py2-to-py3.patch +++ /dev/null @@ -1,1897 +0,0 @@ -Subject: [PATCH] [PATCH openEuler-1.0] : arm64/scripts: covert scripts from py2 to py3 - -euler inclusion -category:scripts -bugzilla:NA -CVE:NA ---- -Modify whole python2 scripts to python3, to remove the python2 dependencies. - -Signed-off-by:lihongjiang ---- - Documentation/networking/cxacru-cf.py | 2 +- - Documentation/target/tcm_mod_builder.py | 44 ++-- - Documentation/trace/postprocess/decode_msr.py | 4 +- - arch/ia64/scripts/unwcheck.py | 10 +- - drivers/staging/greybus/tools/lbtest | 6 +- - scripts/bloat-o-meter | 12 +- - scripts/check-kabi | 34 +-- - scripts/diffconfig | 14 +- - scripts/show_delta | 10 +- - scripts/spdxcheck.py | 2 +- - scripts/tracing/draw_functrace.py | 4 +- - tools/hv/lsvmbus | 14 +- - tools/kvm/kvm_stat/kvm_stat | 24 +- - tools/perf/python/tracepoint.py | 6 +- - tools/perf/python/twatch.py | 6 +- - tools/perf/scripts/python/call-graph-from-sql.py | 10 +- - tools/perf/scripts/python/sched-migration.py | 6 +- - tools/perf/scripts/python/stat-cpi.py | 4 +- - tools/perf/tests/attr.py | 36 +-- - tools/perf/util/setup.py | 4 +- - tools/power/pm-graph/bootgraph.py | 62 +++--- - tools/power/pm-graph/sleepgraph.py | 244 ++++++++++----------- - .../x86/intel_pstate_tracer/intel_pstate_tracer.py | 4 +- - 23 files changed, 281 insertions(+), 281 deletions(-) - -diff --git a/Documentation/networking/cxacru-cf.py b/Documentation/networking/cxacru-cf.py -index b41d298..1b960fb 100644 ---- a/Documentation/networking/cxacru-cf.py -+++ b/Documentation/networking/cxacru-cf.py -@@ -1,4 +1,4 @@ --#!/usr/bin/env python -+#!/usr/bin/env python3 - # Copyright 2009 Simon Arlott - # - # This program is free software; you can redistribute it and/or modify it -diff --git a/Documentation/target/tcm_mod_builder.py b/Documentation/target/tcm_mod_builder.py -index 94bf694..3180283 100755 ---- a/Documentation/target/tcm_mod_builder.py -+++ b/Documentation/target/tcm_mod_builder.py -@@ -1,4 +1,4 @@ --#!/usr/bin/python -+#!/usr/bin/python3 - # The TCM v4 multi-protocol fabric module generation script for drivers/target/$NEW_MOD - # - # Copyright (c) 2010 Rising Tide Systems -@@ -20,7 +20,7 @@ fabric_mod_port = "" - fabric_mod_init_port = "" - - def tcm_mod_err(msg): -- print msg -+ print(msg) - sys.exit(1) - - def tcm_mod_create_module_subdir(fabric_mod_dir_var): -@@ -28,7 +28,7 @@ def tcm_mod_create_module_subdir(fabric_mod_dir_var): - if os.path.isdir(fabric_mod_dir_var) == True: - return 1 - -- print "Creating fabric_mod_dir: " + fabric_mod_dir_var -+ print("Creating fabric_mod_dir: " + fabric_mod_dir_var) - ret = os.mkdir(fabric_mod_dir_var) - if ret: - tcm_mod_err("Unable to mkdir " + fabric_mod_dir_var) -@@ -41,7 +41,7 @@ def tcm_mod_build_FC_include(fabric_mod_dir_var, fabric_mod_name): - buf = "" - - f = fabric_mod_dir_var + "/" + fabric_mod_name + "_base.h" -- print "Writing file: " + f -+ print("Writing file: " + f) - - p = open(f, 'w'); - if not p: -@@ -85,7 +85,7 @@ def tcm_mod_build_SAS_include(fabric_mod_dir_var, fabric_mod_name): - buf = "" - - f = fabric_mod_dir_var + "/" + fabric_mod_name + "_base.h" -- print "Writing file: " + f -+ print("Writing file: " + f) - - p = open(f, 'w'); - if not p: -@@ -128,7 +128,7 @@ def tcm_mod_build_iSCSI_include(fabric_mod_dir_var, fabric_mod_name): - buf = "" - - f = fabric_mod_dir_var + "/" + fabric_mod_name + "_base.h" -- print "Writing file: " + f -+ print("Writing file: " + f) - - p = open(f, 'w'); - if not p: -@@ -172,7 +172,7 @@ def tcm_mod_build_base_includes(proto_ident, fabric_mod_dir_val, fabric_mod_name - elif proto_ident == "iSCSI": - tcm_mod_build_iSCSI_include(fabric_mod_dir_val, fabric_mod_name) - else: -- print "Unsupported proto_ident: " + proto_ident -+ print("Unsupported proto_ident: " + proto_ident) - sys.exit(1) - - return -@@ -181,7 +181,7 @@ def tcm_mod_build_configfs(proto_ident, fabric_mod_dir_var, fabric_mod_name): - buf = "" - - f = fabric_mod_dir_var + "/" + fabric_mod_name + "_configfs.c" -- print "Writing file: " + f -+ print("Writing file: " + f) - - p = open(f, 'w'); - if not p: -@@ -340,7 +340,7 @@ def tcm_mod_scan_fabric_ops(tcm_dir): - - fabric_ops_api = tcm_dir + "include/target/target_core_fabric.h" - -- print "Using tcm_mod_scan_fabric_ops: " + fabric_ops_api -+ print("Using tcm_mod_scan_fabric_ops: " + fabric_ops_api) - process_fo = 0; - - p = open(fabric_ops_api, 'r') -@@ -376,14 +376,14 @@ def tcm_mod_dump_fabric_ops(proto_ident, fabric_mod_dir_var, fabric_mod_name): - bufi = "" - - f = fabric_mod_dir_var + "/" + fabric_mod_name + "_fabric.c" -- print "Writing file: " + f -+ print("Writing file: " + f) - - p = open(f, 'w') - if not p: - tcm_mod_err("Unable to open file: " + f) - - fi = fabric_mod_dir_var + "/" + fabric_mod_name + "_fabric.h" -- print "Writing file: " + fi -+ print("Writing file: " + fi) - - pi = open(fi, 'w') - if not pi: -@@ -545,7 +545,7 @@ def tcm_mod_build_kbuild(fabric_mod_dir_var, fabric_mod_name): - - buf = "" - f = fabric_mod_dir_var + "/Makefile" -- print "Writing file: " + f -+ print("Writing file: " + f) - - p = open(f, 'w') - if not p: -@@ -566,7 +566,7 @@ def tcm_mod_build_kconfig(fabric_mod_dir_var, fabric_mod_name): - - buf = "" - f = fabric_mod_dir_var + "/Kconfig" -- print "Writing file: " + f -+ print("Writing file: " + f) - - p = open(f, 'w') - if not p: -@@ -611,20 +611,20 @@ def main(modname, proto_ident): - - tcm_dir = os.getcwd(); - tcm_dir += "/../../" -- print "tcm_dir: " + tcm_dir -+ print("tcm_dir: " + tcm_dir) - fabric_mod_name = modname - fabric_mod_dir = tcm_dir + "drivers/target/" + fabric_mod_name -- print "Set fabric_mod_name: " + fabric_mod_name -- print "Set fabric_mod_dir: " + fabric_mod_dir -- print "Using proto_ident: " + proto_ident -+ print("Set fabric_mod_name: " + fabric_mod_name) -+ print("Set fabric_mod_dir: " + fabric_mod_dir) -+ print("Using proto_ident: " + proto_ident) - - if proto_ident != "FC" and proto_ident != "SAS" and proto_ident != "iSCSI": -- print "Unsupported proto_ident: " + proto_ident -+ print("Unsupported proto_ident: " + proto_ident) - sys.exit(1) - - ret = tcm_mod_create_module_subdir(fabric_mod_dir) - if ret: -- print "tcm_mod_create_module_subdir() failed because module already exists!" -+ print("tcm_mod_create_module_subdir() failed because module already exists!") - sys.exit(1) - - tcm_mod_build_base_includes(proto_ident, fabric_mod_dir, fabric_mod_name) -@@ -634,11 +634,11 @@ def main(modname, proto_ident): - tcm_mod_build_kbuild(fabric_mod_dir, fabric_mod_name) - tcm_mod_build_kconfig(fabric_mod_dir, fabric_mod_name) - -- input = raw_input("Would you like to add " + fabric_mod_name + " to drivers/target/Makefile..? [yes,no]: ") -+ input = input("Would you like to add " + fabric_mod_name + " to drivers/target/Makefile..? [yes,no]: ") - if input == "yes" or input == "y": - tcm_mod_add_kbuild(tcm_dir, fabric_mod_name) - -- input = raw_input("Would you like to add " + fabric_mod_name + " to drivers/target/Kconfig..? [yes,no]: ") -+ input = input("Would you like to add " + fabric_mod_name + " to drivers/target/Kconfig..? [yes,no]: ") - if input == "yes" or input == "y": - tcm_mod_add_kconfig(tcm_dir, fabric_mod_name) - -@@ -655,7 +655,7 @@ parser.add_option('-p', '--protoident', help='Protocol Ident', dest='protoident' - mandatories = ['modname', 'protoident'] - for m in mandatories: - if not opts.__dict__[m]: -- print "mandatory option is missing\n" -+ print("mandatory option is missing\n") - parser.print_help() - exit(-1) - -diff --git a/Documentation/trace/postprocess/decode_msr.py b/Documentation/trace/postprocess/decode_msr.py -index 0ab40e0..dc58c58 100644 ---- a/Documentation/trace/postprocess/decode_msr.py -+++ b/Documentation/trace/postprocess/decode_msr.py -@@ -1,4 +1,4 @@ --#!/usr/bin/python -+#!/usr/bin/python3 - # add symbolic names to read_msr / write_msr in trace - # decode_msr msr-index.h < trace - import sys -@@ -32,6 +32,6 @@ for j in sys.stdin: - break - if r: - j = j.replace(" " + m.group(2), " " + r + "(" + m.group(2) + ")") -- print j, -+ print(j, end=' ') - - -diff --git a/arch/ia64/scripts/unwcheck.py b/arch/ia64/scripts/unwcheck.py -index c55276e..b7ecaf7 100644 ---- a/arch/ia64/scripts/unwcheck.py -+++ b/arch/ia64/scripts/unwcheck.py -@@ -1,4 +1,4 @@ --#!/usr/bin/python -+#!/usr/bin/python3 - # SPDX-License-Identifier: GPL-2.0 - # - # Usage: unwcheck.py FILE -@@ -16,7 +16,7 @@ import re - import sys - - if len(sys.argv) != 2: -- print("Usage: %s FILE" % sys.argv[0]) -+ print(("Usage: %s FILE" % sys.argv[0])) - sys.exit(2) - - readelf = os.getenv("READELF", "readelf") -@@ -29,7 +29,7 @@ def check_func (func, slots, rlen_sum): - global num_errors - num_errors += 1 - if not func: func = "[%#x-%#x]" % (start, end) -- print("ERROR: %s: %lu slots, total region length = %lu" % (func, slots, rlen_sum)) -+ print(("ERROR: %s: %lu slots, total region length = %lu" % (func, slots, rlen_sum))) - return - - num_funcs = 0 -@@ -55,11 +55,11 @@ for line in os.popen("%s -u %s" % (readelf, sys.argv[1])): - check_func(func, slots, rlen_sum) - - if num_errors == 0: -- print("No errors detected in %u functions." % num_funcs) -+ print(("No errors detected in %u functions." % num_funcs)) - else: - if num_errors > 1: - err="errors" - else: - err="error" -- print("%u %s detected in %u functions." % (num_errors, err, num_funcs)) -+ print(("%u %s detected in %u functions." % (num_errors, err, num_funcs))) - sys.exit(1) -diff --git a/drivers/staging/greybus/tools/lbtest b/drivers/staging/greybus/tools/lbtest -index 47c4812..ed71c6e 100755 ---- a/drivers/staging/greybus/tools/lbtest -+++ b/drivers/staging/greybus/tools/lbtest -@@ -1,4 +1,4 @@ --#!/usr/bin/env python -+#!/usr/bin/env python3 - # SPDX-License-Identifier: BSD-3-Clause - - # Copyright (c) 2015 Google, Inc. -@@ -28,7 +28,7 @@ - # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - --from __future__ import print_function -+ - import csv - import datetime - import sys -@@ -161,7 +161,7 @@ def main(): - if len(sys.argv) < 5: - usage() - -- if sys.argv[1] in dict.keys(): -+ if sys.argv[1] in list(dict.keys()): - loopback_run(sys.argv[1], sys.argv[2], int(sys.argv[3]), sys.argv[4]) - else: - usage() -diff --git a/scripts/bloat-o-meter b/scripts/bloat-o-meter -index a923f05..cbd267d 100755 ---- a/scripts/bloat-o-meter -+++ b/scripts/bloat-o-meter -@@ -1,4 +1,4 @@ --#!/usr/bin/python -+#!/usr/bin/python3 - # - # Copyright 2004 Matt Mackall - # -@@ -77,17 +77,17 @@ def print_result(symboltype, symbolformat, argc): - grow, shrink, add, remove, up, down, delta, old, new, otot, ntot = \ - calc(sys.argv[argc - 1], sys.argv[argc], symbolformat) - -- print("add/remove: %s/%s grow/shrink: %s/%s up/down: %s/%s (%s)" % \ -- (add, remove, grow, shrink, up, -down, up-down)) -- print("%-40s %7s %7s %+7s" % (symboltype, "old", "new", "delta")) -+ print(("add/remove: %s/%s grow/shrink: %s/%s up/down: %s/%s (%s)" % \ -+ (add, remove, grow, shrink, up, -down, up-down))) -+ print(("%-40s %7s %7s %+7s" % (symboltype, "old", "new", "delta"))) - for d, n in delta: -- if d: print("%-40s %7s %7s %+7d" % (n, old.get(n,"-"), new.get(n,"-"), d)) -+ if d: print(("%-40s %7s %7s %+7d" % (n, old.get(n,"-"), new.get(n,"-"), d))) - - if otot: - percent = (ntot - otot) * 100.0 / otot - else: - percent = 0 -- print("Total: Before=%d, After=%d, chg %+.2f%%" % (otot, ntot, percent)) -+ print(("Total: Before=%d, After=%d, chg %+.2f%%" % (otot, ntot, percent))) - - if sys.argv[1] == "-c": - print_result("Function", "tT", 3) -diff --git a/scripts/check-kabi b/scripts/check-kabi -index e3ec97c..b173422 100755 ---- a/scripts/check-kabi -+++ b/scripts/check-kabi -@@ -1,4 +1,4 @@ --#!/usr/bin/python -+#!/usr/bin/python3 - # SPDX-License-Identifier: GPL-2.0 - # - # check-kabi - Red Hat kABI reference checking tool -@@ -71,7 +71,7 @@ def check_kabi(symvers,kabi): - - for symbol in kabi: - abi_hash,abi_sym,abi_dir,abi_type = string.split(kabi[symbol]) -- if symvers.has_key(symbol): -+ if symbol in symvers: - sym_hash,sym_sym,sym_dir,sym_type = string.split(symvers[symbol]) - if abi_hash != sym_hash: - fail=1 -@@ -85,23 +85,23 @@ def check_kabi(symvers,kabi): - changed_symbols.append(symbol) - - if fail: -- print "*** ERROR - ABI BREAKAGE WAS DETECTED ***" -- print "" -- print "The following symbols have been changed (this will cause an ABI breakage):" -- print "" -+ print("*** ERROR - ABI BREAKAGE WAS DETECTED ***") -+ print("") -+ print("The following symbols have been changed (this will cause an ABI breakage):") -+ print("") - for symbol in changed_symbols: -- print symbol -- print "" -+ print(symbol) -+ print("") - - if warn: -- print "*** WARNING - ABI SYMBOLS MOVED ***" -- print "" -- print "The following symbols moved (typically caused by moving a symbol from being" -- print "provided by the kernel vmlinux out to a loadable module):" -- print "" -+ print("*** WARNING - ABI SYMBOLS MOVED ***") -+ print("") -+ print("The following symbols moved (typically caused by moving a symbol from being") -+ print("provided by the kernel vmlinux out to a loadable module):") -+ print("") - for symbol in moved_symbols: -- print symbol -- print "" -+ print(symbol) -+ print("") - - """Halt the build, if we got errors and/or warnings. In either case, - double-checkig is required to avoid introducing / concealing -@@ -111,12 +111,12 @@ def check_kabi(symvers,kabi): - sys.exit(0) - - def usage(): -- print """ -+ print(""" - check-kabi: check Module.kabi and Module.symvers files. - - check-kabi [ -k Module.kabi ] [ -s Module.symvers ] - --""" -+""") - - if __name__ == "__main__": - -diff --git a/scripts/diffconfig b/scripts/diffconfig -index 89abf77..5c07d57 100755 ---- a/scripts/diffconfig -+++ b/scripts/diffconfig -@@ -1,4 +1,4 @@ --#!/usr/bin/python -+#!/usr/bin/python3 - # SPDX-License-Identifier: GPL-2.0 - # - # diffconfig - a tool to compare .config files. -@@ -54,16 +54,16 @@ def print_config(op, config, value, new_value): - if merge_style: - if new_value: - if new_value=="n": -- print("# CONFIG_%s is not set" % config) -+ print(("# CONFIG_%s is not set" % config)) - else: -- print("CONFIG_%s=%s" % (config, new_value)) -+ print(("CONFIG_%s=%s" % (config, new_value))) - else: - if op=="-": -- print("-%s %s" % (config, value)) -+ print(("-%s %s" % (config, value))) - elif op=="+": -- print("+%s %s" % (config, new_value)) -+ print(("+%s %s" % (config, new_value))) - else: -- print(" %s %s -> %s" % (config, value, new_value)) -+ print((" %s %s -> %s" % (config, value, new_value))) - - def main(): - global merge_style -@@ -98,7 +98,7 @@ def main(): - b = readconfig(open(configb_filename)) - except (IOError): - e = sys.exc_info()[1] -- print("I/O error[%s]: %s\n" % (e.args[0],e.args[1])) -+ print(("I/O error[%s]: %s\n" % (e.args[0],e.args[1]))) - usage() - - # print items in a but not b (accumulate, sort and print) -diff --git a/scripts/show_delta b/scripts/show_delta -index 5b36500..78b4b73 100755 ---- a/scripts/show_delta -+++ b/scripts/show_delta -@@ -1,4 +1,4 @@ --#!/usr/bin/python -+#!/usr/bin/python3 - # - # show_deltas: Read list of printk messages instrumented with - # time data, and format with time deltas. -@@ -94,11 +94,11 @@ def main(): - try: - lines = open(filein,"r").readlines() - except: -- print ("Problem opening file: %s" % filein) -+ print(("Problem opening file: %s" % filein)) - sys.exit(1) - - if base_str: -- print ('base= "%s"' % base_str) -+ print(('base= "%s"' % base_str)) - # assume a numeric base. If that fails, try searching - # for a matching line. - try: -@@ -117,12 +117,12 @@ def main(): - # stop at first match - break - if not found: -- print ('Couldn\'t find line matching base pattern "%s"' % base_str) -+ print(('Couldn\'t find line matching base pattern "%s"' % base_str)) - sys.exit(1) - else: - base_time = 0.0 - - for line in lines: -- print (convert_line(line, base_time),) -+ print((convert_line(line, base_time),)) - - main() -diff --git a/scripts/spdxcheck.py b/scripts/spdxcheck.py -index e559c62..1b88b6b 100755 ---- a/scripts/spdxcheck.py -+++ b/scripts/spdxcheck.py -@@ -1,4 +1,4 @@ --#!/usr/bin/env python -+#!/usr/bin/env python3 - # SPDX-License-Identifier: GPL-2.0 - # Copyright Thomas Gleixner - -diff --git a/scripts/tracing/draw_functrace.py b/scripts/tracing/draw_functrace.py -index 9b6dd4f..87974cc 100755 ---- a/scripts/tracing/draw_functrace.py -+++ b/scripts/tracing/draw_functrace.py -@@ -1,4 +1,4 @@ --#!/usr/bin/python -+#!/usr/bin/python3 - - """ - Copyright 2008 (c) Frederic Weisbecker -@@ -123,7 +123,7 @@ def main(): - tree = tree.getParent(caller) - tree = tree.calls(callee, calltime) - -- print(CallTree.ROOT) -+ print((CallTree.ROOT)) - - if __name__ == "__main__": - main() -diff --git a/tools/hv/lsvmbus b/tools/hv/lsvmbus -index 099f2c4..80517ab 100644 ---- a/tools/hv/lsvmbus -+++ b/tools/hv/lsvmbus -@@ -1,4 +1,4 @@ --#!/usr/bin/env python -+#!/usr/bin/env python3 - # SPDX-License-Identifier: GPL-2.0 - - import os -@@ -17,7 +17,7 @@ if options.verbose is not None: - - vmbus_sys_path = '/sys/bus/vmbus/devices' - if not os.path.isdir(vmbus_sys_path): -- print("%s doesn't exist: exiting..." % vmbus_sys_path) -+ print(("%s doesn't exist: exiting..." % vmbus_sys_path)) - exit(-1) - - vmbus_dev_dict = { -@@ -96,17 +96,17 @@ format2 = '%2s: Class_ID = %s - %s\n\tDevice_ID = %s\n\tSysfs path: %s\n%s' - - for d in vmbus_dev_list: - if verbose == 0: -- print(('VMBUS ID ' + format0) % (d.vmbus_id, d.dev_desc)) -+ print((('VMBUS ID ' + format0) % (d.vmbus_id, d.dev_desc))) - elif verbose == 1: -- print( -+ print(( - ('VMBUS ID ' + format1) % - (d.vmbus_id, d.class_id, d.dev_desc, d.chn_vp_mapping) -- ) -+ )) - else: -- print( -+ print(( - ('VMBUS ID ' + format2) % - ( - d.vmbus_id, d.class_id, d.dev_desc, - d.device_id, d.sysfs_path, d.chn_vp_mapping - ) -- ) -+ )) -diff --git a/tools/kvm/kvm_stat/kvm_stat b/tools/kvm/kvm_stat/kvm_stat -index f6ca0a2..054c80f 100755 ---- a/tools/kvm/kvm_stat/kvm_stat -+++ b/tools/kvm/kvm_stat/kvm_stat -@@ -1,4 +1,4 @@ --#!/usr/bin/python -+#!/usr/bin/python3 - # - # top-like utility for displaying kvm statistics - # -@@ -19,7 +19,7 @@ Three different ways of output formatting are available: - - The data is sampled from the KVM's debugfs entries and its perf events. - """ --from __future__ import print_function -+ - - import curses - import sys -@@ -388,9 +388,9 @@ class Group(object): - """ - length = 8 * (1 + len(self.events)) - read_format = 'xxxxxxxx' + 'Q' * len(self.events) -- return dict(zip([event.name for event in self.events], -+ return dict(list(zip([event.name for event in self.events], - struct.unpack(read_format, -- os.read(self.events[0].fd, length)))) -+ os.read(self.events[0].fd, length))))) - - - class Event(object): -@@ -600,8 +600,8 @@ class TracepointProvider(Provider): - integers.append(int(member)) - else: - int_range = member.split('-') -- integers.extend(range(int(int_range[0]), -- int(int_range[1]) + 1)) -+ integers.extend(list(range(int(int_range[0]), -+ int(int_range[1]) + 1))) - - return integers - -@@ -704,7 +704,7 @@ class TracepointProvider(Provider): - """Returns 'event name: current value' for all enabled events.""" - ret = defaultdict(int) - for group in self.group_leaders: -- for name, val in group.read().items(): -+ for name, val in list(group.read().items()): - if name not in self._fields: - continue - parent = ARCH.tracepoint_is_child(name) -@@ -771,7 +771,7 @@ class DebugfsProvider(Provider): - if len(vms) == 0: - self.do_read = False - -- self.paths = list(filter(lambda x: "{}-".format(pid) in x, vms)) -+ self.paths = list([x for x in vms if "{}-".format(pid) in x]) - - else: - self.paths = [] -@@ -959,7 +959,7 @@ class Stats(object): - for provider in self.providers: - if isinstance(provider, DebugfsProvider): - for key in provider.fields: -- if key in self.values.keys(): -+ if key in list(self.values.keys()): - del self.values[key] - else: - oldvals = self.values.copy() -@@ -1165,7 +1165,7 @@ class Tui(object): - sorted_items = [] - # we can't rule out child events to appear prior to parents even - # when sorted - separate out all children first, and add in later -- for key, values in sorted(stats.items(), key=sortkey, -+ for key, values in sorted(list(stats.items()), key=sortkey, - reverse=True): - if values == (0, 0): - continue -@@ -1201,7 +1201,7 @@ class Tui(object): - stats = self.stats.get(self._display_guests) - total = 0. - ctotal = 0. -- for key, values in stats.items(): -+ for key, values in list(stats.items()): - if self._display_guests: - if self.get_gname_from_pid(key): - total += values.value -@@ -1699,7 +1699,7 @@ def main(): - if options.fields == 'help': - stats.fields_filter = None - event_list = [] -- for key in stats.get().keys(): -+ for key in list(stats.get().keys()): - event_list.append(key.split('(', 1)[0]) - sys.stdout.write(' ' + '\n '.join(sorted(set(event_list))) + '\n') - sys.exit(0) -diff --git a/tools/perf/python/tracepoint.py b/tools/perf/python/tracepoint.py -index eb76f65..4afbeeb 100755 ---- a/tools/perf/python/tracepoint.py -+++ b/tools/perf/python/tracepoint.py -@@ -1,4 +1,4 @@ --#! /usr/bin/python -+#!/usr/bin/python3 - # SPDX-License-Identifier: GPL-2.0 - # -*- python -*- - # -*- coding: utf-8 -*- -@@ -34,7 +34,7 @@ def main(): - if not isinstance(event, perf.sample_event): - continue - -- print "time %u prev_comm=%s prev_pid=%d prev_prio=%d prev_state=0x%x ==> next_comm=%s next_pid=%d next_prio=%d" % ( -+ print("time %u prev_comm=%s prev_pid=%d prev_prio=%d prev_state=0x%x ==> next_comm=%s next_pid=%d next_prio=%d" % ( - event.sample_time, - event.prev_comm, - event.prev_pid, -@@ -42,7 +42,7 @@ def main(): - event.prev_state, - event.next_comm, - event.next_pid, -- event.next_prio) -+ event.next_prio)) - - if __name__ == '__main__': - main() -diff --git a/tools/perf/python/twatch.py b/tools/perf/python/twatch.py -index 0a29c5c..987ddf7 100755 ---- a/tools/perf/python/twatch.py -+++ b/tools/perf/python/twatch.py -@@ -1,4 +1,4 @@ --#! /usr/bin/python -+#!/usr/bin/python3 - # -*- python -*- - # -*- coding: utf-8 -*- - # twatch - Experimental use of the perf python interface -@@ -42,10 +42,10 @@ def main(context_switch = 0, thread = -1): - event = evlist.read_on_cpu(cpu) - if not event: - continue -- print("cpu: {0}, pid: {1}, tid: {2} {3}".format(event.sample_cpu, -+ print(("cpu: {0}, pid: {1}, tid: {2} {3}".format(event.sample_cpu, - event.sample_pid, - event.sample_tid, -- event)) -+ event))) - - if __name__ == '__main__': - """ -diff --git a/tools/perf/scripts/python/call-graph-from-sql.py b/tools/perf/scripts/python/call-graph-from-sql.py -index b494a67..d30af15 100644 ---- a/tools/perf/scripts/python/call-graph-from-sql.py -+++ b/tools/perf/scripts/python/call-graph-from-sql.py -@@ -1,4 +1,4 @@ --#!/usr/bin/python2 -+#!/usr/bin/python3 - # call-graph-from-sql.py: create call-graph from sql database - # Copyright (c) 2014-2017, Intel Corporation. - # -@@ -84,7 +84,7 @@ class TreeItem(): - ret = query.exec_('SELECT id, comm FROM comms') - if not ret: - raise Exception("Query failed: " + query.lastError().text()) -- while query.next(): -+ while next(query): - if not query.value(0): - continue - child_item = TreeItem(self.db, self.child_count, self) -@@ -102,7 +102,7 @@ class TreeItem(): - ret = query.exec_('SELECT thread_id, ( SELECT pid FROM threads WHERE id = thread_id ), ( SELECT tid FROM threads WHERE id = thread_id ) FROM comm_threads WHERE comm_id = ' + str(comm_id)) - if not ret: - raise Exception("Query failed: " + query.lastError().text()) -- while query.next(): -+ while next(query): - child_item = TreeItem(self.db, self.child_count, self) - self.child_items.append(child_item) - self.child_count += 1 -@@ -172,7 +172,7 @@ class TreeItem(): - total_branch_count = 0 - time = 0 - total_time = 0 -- while query.next(): -+ while next(query): - if query.value(1) == last_call_path_id: - count += 1 - branch_count += query.value(2) -@@ -292,7 +292,7 @@ class MainWindow(QMainWindow): - - if __name__ == '__main__': - if (len(sys.argv) < 2): -- print >> sys.stderr, "Usage is: call-graph-from-sql.py " -+ print("Usage is: call-graph-from-sql.py ", file=sys.stderr) - raise Exception("Too few arguments") - - dbname = sys.argv[1] -diff --git a/tools/perf/scripts/python/sched-migration.py b/tools/perf/scripts/python/sched-migration.py -index 3473e7f..981562c 100644 ---- a/tools/perf/scripts/python/sched-migration.py -+++ b/tools/perf/scripts/python/sched-migration.py -@@ -1,4 +1,4 @@ --#!/usr/bin/python -+#!/usr/bin/python3 - # - # Cpu task migration overview toy - # -@@ -9,14 +9,14 @@ - # This software is distributed under the terms of the GNU General - # Public License ("GPL") version 2 as published by the Free Software - # Foundation. --from __future__ import print_function -+ - - import os - import sys - - from collections import defaultdict - try: -- from UserList import UserList -+ from collections import UserList - except ImportError: - # Python 3: UserList moved to the collections package - from collections import UserList -diff --git a/tools/perf/scripts/python/stat-cpi.py b/tools/perf/scripts/python/stat-cpi.py -index 8410672..246ce58 100644 ---- a/tools/perf/scripts/python/stat-cpi.py -+++ b/tools/perf/scripts/python/stat-cpi.py -@@ -1,4 +1,4 @@ --#!/usr/bin/env python -+#!/usr/bin/env python3 - # SPDX-License-Identifier: GPL-2.0 - - data = {} -@@ -59,7 +59,7 @@ def stat__interval(time): - if ins != 0: - cpi = cyc/float(ins) - -- print "%15f: cpu %d, thread %d -> cpi %f (%d/%d)" % (time/(float(1000000000)), cpu, thread, cpi, cyc, ins) -+ print("%15f: cpu %d, thread %d -> cpi %f (%d/%d)" % (time/(float(1000000000)), cpu, thread, cpi, cyc, ins)) - - def trace_end(): - pass -diff --git a/tools/perf/tests/attr.py b/tools/perf/tests/attr.py -index 44090a9..42c241e 100644 ---- a/tools/perf/tests/attr.py -+++ b/tools/perf/tests/attr.py -@@ -1,4 +1,4 @@ --#! /usr/bin/python -+#!/usr/bin/python3 - # SPDX-License-Identifier: GPL-2.0 - - import os -@@ -8,7 +8,7 @@ import optparse - import tempfile - import logging - import shutil --import ConfigParser -+import configparser - - def data_equal(a, b): - # Allow multiple values in assignment separated by '|' -@@ -100,20 +100,20 @@ class Event(dict): - def equal(self, other): - for t in Event.terms: - log.debug(" [%s] %s %s" % (t, self[t], other[t])); -- if not self.has_key(t) or not other.has_key(t): -+ if t not in self or t not in other: - return False - if not data_equal(self[t], other[t]): - return False - return True - - def optional(self): -- if self.has_key('optional') and self['optional'] == '1': -+ if 'optional' in self and self['optional'] == '1': - return True - return False - - def diff(self, other): - for t in Event.terms: -- if not self.has_key(t) or not other.has_key(t): -+ if t not in self or t not in other: - continue - if not data_equal(self[t], other[t]): - log.warning("expected %s=%s, got %s" % (t, self[t], other[t])) -@@ -134,7 +134,7 @@ class Event(dict): - # - expected values assignments - class Test(object): - def __init__(self, path, options): -- parser = ConfigParser.SafeConfigParser() -+ parser = configparser.SafeConfigParser() - parser.read(path) - - log.warning("running '%s'" % path) -@@ -193,7 +193,7 @@ class Test(object): - return True - - def load_events(self, path, events): -- parser_event = ConfigParser.SafeConfigParser() -+ parser_event = configparser.SafeConfigParser() - parser_event.read(path) - - # The event record section header contains 'event' word, -@@ -207,7 +207,7 @@ class Test(object): - # Read parent event if there's any - if (':' in section): - base = section[section.index(':') + 1:] -- parser_base = ConfigParser.SafeConfigParser() -+ parser_base = configparser.SafeConfigParser() - parser_base.read(self.test_dir + '/' + base) - base_items = parser_base.items('event') - -@@ -236,11 +236,11 @@ class Test(object): - - # For each expected event find all matching - # events in result. Fail if there's not any. -- for exp_name, exp_event in expect.items(): -+ for exp_name, exp_event in list(expect.items()): - exp_list = [] - res_event = {} - log.debug(" matching [%s]" % exp_name) -- for res_name, res_event in result.items(): -+ for res_name, res_event in list(result.items()): - log.debug(" to [%s]" % res_name) - if (exp_event.equal(res_event)): - exp_list.append(res_name) -@@ -265,7 +265,7 @@ class Test(object): - - # For each defined group in the expected events - # check we match the same group in the result. -- for exp_name, exp_event in expect.items(): -+ for exp_name, exp_event in list(expect.items()): - group = exp_event.group - - if (group == ''): -@@ -282,12 +282,12 @@ class Test(object): - log.debug(" matched") - - def resolve_groups(self, events): -- for name, event in events.items(): -+ for name, event in list(events.items()): - group_fd = event['group_fd']; - if group_fd == '-1': - continue; - -- for iname, ievent in events.items(): -+ for iname, ievent in list(events.items()): - if (ievent['fd'] == group_fd): - event.group = iname - log.debug('[%s] has group leader [%s]' % (name, iname)) -@@ -322,9 +322,9 @@ def run_tests(options): - for f in glob.glob(options.test_dir + '/' + options.test): - try: - Test(f, options).run() -- except Unsup, obj: -+ except Unsup as obj: - log.warning("unsupp %s" % obj.getMsg()) -- except Notest, obj: -+ except Notest as obj: - log.warning("skipped %s" % obj.getMsg()) - - def setup_log(verbose): -@@ -373,7 +373,7 @@ def main(): - setup_log(options.verbose) - - if not options.test_dir: -- print 'FAILED no -d option specified' -+ print('FAILED no -d option specified') - sys.exit(-1) - - if not options.test: -@@ -382,8 +382,8 @@ def main(): - try: - run_tests(options) - -- except Fail, obj: -- print "FAILED %s" % obj.getMsg(); -+ except Fail as obj: -+ print("FAILED %s" % obj.getMsg()); - sys.exit(-1) - - sys.exit(0) -diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py -index 1942f6d..383a9fb 100644 ---- a/tools/perf/util/setup.py -+++ b/tools/perf/util/setup.py -@@ -1,4 +1,4 @@ --#!/usr/bin/python -+#!/usr/bin/python3 - - from os import getenv - from subprocess import Popen, PIPE -@@ -49,7 +49,7 @@ ext_sources = [f.strip() for f in open('util/python-ext-sources') - if len(f.strip()) > 0 and f[0] != '#'] - - # use full paths with source files --ext_sources = list(map(lambda x: '%s/%s' % (src_perf, x) , ext_sources)) -+ext_sources = list(['%s/%s' % (src_perf, x) for x in ext_sources]) - - perf = Extension('perf', - sources = ext_sources, -diff --git a/tools/power/pm-graph/bootgraph.py b/tools/power/pm-graph/bootgraph.py -index 8ee626c..9a174e0 100755 ---- a/tools/power/pm-graph/bootgraph.py -+++ b/tools/power/pm-graph/bootgraph.py -@@ -1,4 +1,4 @@ --#!/usr/bin/python2 -+#!/usr/bin/python3 - # - # Tool for analyzing boot timing - # Copyright (c) 2013, Intel Corporation. -@@ -141,13 +141,13 @@ class SystemValues(aslib.SystemValues): - if arg in ['-h', '-v', '-cronjob', '-reboot', '-verbose']: - continue - elif arg in ['-o', '-dmesg', '-ftrace', '-func']: -- args.next() -+ next(args) - continue - elif arg == '-result': -- cmdline += ' %s "%s"' % (arg, os.path.abspath(args.next())) -+ cmdline += ' %s "%s"' % (arg, os.path.abspath(next(args))) - continue - elif arg == '-cgskip': -- file = self.configFile(args.next()) -+ file = self.configFile(next(args)) - cmdline += ' %s "%s"' % (arg, os.path.abspath(file)) - continue - cmdline += ' '+arg -@@ -157,11 +157,11 @@ class SystemValues(aslib.SystemValues): - return cmdline - def manualRebootRequired(self): - cmdline = self.kernelParams() -- print 'To generate a new timeline manually, follow these steps:\n' -- print '1. Add the CMDLINE string to your kernel command line.' -- print '2. Reboot the system.' -- print '3. After reboot, re-run this tool with the same arguments but no command (w/o -reboot or -manual).\n' -- print 'CMDLINE="%s"' % cmdline -+ print('To generate a new timeline manually, follow these steps:\n') -+ print('1. Add the CMDLINE string to your kernel command line.') -+ print('2. Reboot the system.') -+ print('3. After reboot, re-run this tool with the same arguments but no command (w/o -reboot or -manual).\n') -+ print('CMDLINE="%s"' % cmdline) - sys.exit() - def blGrub(self): - blcmd = '' -@@ -431,7 +431,7 @@ def parseTraceLog(data): - if len(cg.list) < 1 or cg.invalid or (cg.end - cg.start == 0): - continue - if(not cg.postProcess()): -- print('Sanity check failed for %s-%d' % (proc, pid)) -+ print(('Sanity check failed for %s-%d' % (proc, pid))) - continue - # match cg data to devices - devname = data.deviceMatch(pid, cg) -@@ -442,8 +442,8 @@ def parseTraceLog(data): - sysvals.vprint('%s callgraph found for %s %s-%d [%f - %f]' %\ - (kind, cg.name, proc, pid, cg.start, cg.end)) - elif len(cg.list) > 1000000: -- print 'WARNING: the callgraph found for %s is massive! (%d lines)' %\ -- (devname, len(cg.list)) -+ print('WARNING: the callgraph found for %s is massive! (%d lines)' %\ -+ (devname, len(cg.list))) - - # Function: retrieveLogs - # Description: -@@ -733,8 +733,8 @@ def updateCron(restore=False): - op.write('@reboot python %s\n' % sysvals.cronjobCmdString()) - op.close() - res = call([cmd, cronfile]) -- except Exception, e: -- print 'Exception: %s' % str(e) -+ except Exception as e: -+ print('Exception: %s' % str(e)) - shutil.move(backfile, cronfile) - res = -1 - if res != 0: -@@ -749,8 +749,8 @@ def updateGrub(restore=False): - try: - call(sysvals.blexec, stderr=PIPE, stdout=PIPE, - env={'PATH': '.:/sbin:/usr/sbin:/usr/bin:/sbin:/bin'}) -- except Exception, e: -- print 'Exception: %s\n' % str(e) -+ except Exception as e: -+ print('Exception: %s\n' % str(e)) - return - # extract the option and create a grub config without it - sysvals.rootUser(True) -@@ -796,8 +796,8 @@ def updateGrub(restore=False): - op.close() - res = call(sysvals.blexec) - os.remove(grubfile) -- except Exception, e: -- print 'Exception: %s' % str(e) -+ except Exception as e: -+ print('Exception: %s' % str(e)) - res = -1 - # cleanup - shutil.move(tempfile, grubfile) -@@ -821,7 +821,7 @@ def updateKernelParams(restore=False): - def doError(msg, help=False): - if help == True: - printHelp() -- print 'ERROR: %s\n' % msg -+ print('ERROR: %s\n' % msg) - sysvals.outputResult({'error':msg}) - sys.exit() - -@@ -830,7 +830,7 @@ def doError(msg, help=False): - # print out the help text - def printHelp(): - print('') -- print('%s v%s' % (sysvals.title, sysvals.version)) -+ print(('%s v%s' % (sysvals.title, sysvals.version))) - print('Usage: bootgraph ') - print('') - print('Description:') -@@ -895,7 +895,7 @@ if __name__ == '__main__': - printHelp() - sys.exit() - elif(arg == '-v'): -- print("Version %s" % sysvals.version) -+ print(("Version %s" % sysvals.version)) - sys.exit() - elif(arg == '-verbose'): - sysvals.verbose = True -@@ -912,13 +912,13 @@ if __name__ == '__main__': - sysvals.mincglen = aslib.getArgFloat('-mincg', args, 0.0, 10000.0) - elif(arg == '-cgfilter'): - try: -- val = args.next() -+ val = next(args) - except: - doError('No callgraph functions supplied', True) - sysvals.setCallgraphFilter(val) - elif(arg == '-cgskip'): - try: -- val = args.next() -+ val = next(args) - except: - doError('No file supplied', True) - if val.lower() in switchoff: -@@ -929,7 +929,7 @@ if __name__ == '__main__': - doError('%s does not exist' % cgskip) - elif(arg == '-bl'): - try: -- val = args.next() -+ val = next(args) - except: - doError('No boot loader name supplied', True) - if val.lower() not in ['grub']: -@@ -942,7 +942,7 @@ if __name__ == '__main__': - sysvals.max_graph_depth = aslib.getArgInt('-maxdepth', args, 0, 1000) - elif(arg == '-func'): - try: -- val = args.next() -+ val = next(args) - except: - doError('No filter functions supplied', True) - sysvals.useftrace = True -@@ -951,7 +951,7 @@ if __name__ == '__main__': - sysvals.setGraphFilter(val) - elif(arg == '-ftrace'): - try: -- val = args.next() -+ val = next(args) - except: - doError('No ftrace file supplied', True) - if(os.path.exists(val) == False): -@@ -964,7 +964,7 @@ if __name__ == '__main__': - sysvals.cgexp = True - elif(arg == '-dmesg'): - try: -- val = args.next() -+ val = next(args) - except: - doError('No dmesg file supplied', True) - if(os.path.exists(val) == False): -@@ -973,13 +973,13 @@ if __name__ == '__main__': - sysvals.dmesgfile = val - elif(arg == '-o'): - try: -- val = args.next() -+ val = next(args) - except: - doError('No subdirectory name supplied', True) - sysvals.testdir = sysvals.setOutputFolder(val) - elif(arg == '-result'): - try: -- val = args.next() -+ val = next(args) - except: - doError('No result file supplied', True) - sysvals.result = val -@@ -1013,10 +1013,10 @@ if __name__ == '__main__': - updateKernelParams() - elif cmd == 'flistall': - for f in sysvals.getBootFtraceFilterFunctions(): -- print f -+ print(f) - elif cmd == 'checkbl': - sysvals.getBootLoader() -- print 'Boot Loader: %s\n%s' % (sysvals.bootloader, sysvals.blexec) -+ print('Boot Loader: %s\n%s' % (sysvals.bootloader, sysvals.blexec)) - elif(cmd == 'sysinfo'): - sysvals.printSystemInfo(True) - sys.exit() -diff --git a/tools/power/pm-graph/sleepgraph.py b/tools/power/pm-graph/sleepgraph.py -index 0c76047..3a6c07f 100755 ---- a/tools/power/pm-graph/sleepgraph.py -+++ b/tools/power/pm-graph/sleepgraph.py -@@ -1,4 +1,4 @@ --#!/usr/bin/python2 -+#!/usr/bin/python3 - # - # Tool for analyzing suspend/resume timing - # Copyright (c) 2013, Intel Corporation. -@@ -56,7 +56,7 @@ import re - import platform - from datetime import datetime - import struct --import ConfigParser -+import configparser - import gzip - from threading import Thread - from subprocess import call, Popen, PIPE -@@ -265,7 +265,7 @@ class SystemValues: - return True - if fatal: - msg = 'This command requires sysfs mount and root access' -- print('ERROR: %s\n') % msg -+ print(('ERROR: %s\n') % msg) - self.outputResult({'error':msg}) - sys.exit() - return False -@@ -274,7 +274,7 @@ class SystemValues: - return True - if fatal: - msg = 'This command must be run as root' -- print('ERROR: %s\n') % msg -+ print(('ERROR: %s\n') % msg) - self.outputResult({'error':msg}) - sys.exit() - return False -@@ -329,10 +329,10 @@ class SystemValues: - return - fmt = '%-24s: %s' - for name in sorted(out): -- print fmt % (name, out[name]) -- print fmt % ('cpucount', ('%d' % self.cpucount)) -- print fmt % ('memtotal', ('%d kB' % self.memtotal)) -- print fmt % ('memfree', ('%d kB' % self.memfree)) -+ print(fmt % (name, out[name])) -+ print(fmt % ('cpucount', ('%d' % self.cpucount))) -+ print(fmt % ('memtotal', ('%d kB' % self.memtotal))) -+ print(fmt % ('memfree', ('%d kB' % self.memfree))) - def cpuInfo(self): - self.cpucount = 0 - fp = open('/proc/cpuinfo', 'r') -@@ -447,9 +447,9 @@ class SystemValues: - if 'func' in self.tracefuncs[i]: - i = self.tracefuncs[i]['func'] - if i in master: -- print i -+ print(i) - else: -- print self.colorText(i) -+ print(self.colorText(i)) - def setFtraceFilterFunctions(self, list): - master = self.listFromFile(self.tpath+'available_filter_functions') - flist = '' -@@ -557,7 +557,7 @@ class SystemValues: - else: - kpl[2].append(name) - if output: -- print(' %s: %s' % (name, res)) -+ print((' %s: %s' % (name, res))) - kplist = kpl[0] + kpl[1] + kpl[2] + kpl[3] - # remove all failed ones from the list - for name in rejects: -@@ -571,7 +571,7 @@ class SystemValues: - if output: - check = self.fgetVal('kprobe_events') - linesack = (len(check.split('\n')) - 1) / 2 -- print(' kprobe functions enabled: %d/%d' % (linesack, linesout)) -+ print((' kprobe functions enabled: %d/%d' % (linesack, linesout))) - self.fsetVal('1', 'events/kprobes/enable') - def testKprobe(self, kname, kprobe): - self.fsetVal('0', 'events/kprobes/enable') -@@ -658,7 +658,7 @@ class SystemValues: - if tgtsize < 65536: - tgtsize = int(self.fgetVal('buffer_size_kb')) * cpus - break -- print 'Setting trace buffers to %d kB (%d kB per cpu)' % (tgtsize, tgtsize/cpus) -+ print('Setting trace buffers to %d kB (%d kB per cpu)' % (tgtsize, tgtsize/cpus)) - # initialize the callgraph trace - if(self.usecallgraph): - # set trace type -@@ -808,7 +808,7 @@ class DevProps: - def out(self, dev): - return '%s,%s,%d;' % (dev, self.altname, self.async) - def debug(self, dev): -- print '%s:\n\taltname = %s\n\t async = %s' % (dev, self.altname, self.async) -+ print('%s:\n\taltname = %s\n\t async = %s' % (dev, self.altname, self.async)) - def altName(self, dev): - if not self.altname or self.altname == dev: - return dev -@@ -1633,14 +1633,14 @@ class FTraceLine: - return len(str)/2 - def debugPrint(self, info=''): - if self.isLeaf(): -- print(' -- %12.6f (depth=%02d): %s(); (%.3f us) %s' % (self.time, \ -- self.depth, self.name, self.length*1000000, info)) -+ print((' -- %12.6f (depth=%02d): %s(); (%.3f us) %s' % (self.time, \ -+ self.depth, self.name, self.length*1000000, info))) - elif self.freturn: -- print(' -- %12.6f (depth=%02d): %s} (%.3f us) %s' % (self.time, \ -- self.depth, self.name, self.length*1000000, info)) -+ print((' -- %12.6f (depth=%02d): %s} (%.3f us) %s' % (self.time, \ -+ self.depth, self.name, self.length*1000000, info))) - else: -- print(' -- %12.6f (depth=%02d): %s() { (%.3f us) %s' % (self.time, \ -- self.depth, self.name, self.length*1000000, info)) -+ print((' -- %12.6f (depth=%02d): %s() { (%.3f us) %s' % (self.time, \ -+ self.depth, self.name, self.length*1000000, info))) - def startMarker(self): - # Is this the starting line of a suspend? - if not self.fevent: -@@ -1786,7 +1786,7 @@ class FTraceCallGraph: - if warning and ('[make leaf]', line) not in info: - info.append(('', line)) - if warning: -- print 'WARNING: ftrace data missing, corrections made:' -+ print('WARNING: ftrace data missing, corrections made:') - for i in info: - t, obj = i - if obj: -@@ -1846,11 +1846,11 @@ class FTraceCallGraph: - id = 'task %s' % (self.pid) - window = '(%f - %f)' % (self.start, line.time) - if(self.depth < 0): -- print('Data misalignment for '+id+\ -- ' (buffer overflow), ignoring this callback') -+ print(('Data misalignment for '+id+\ -+ ' (buffer overflow), ignoring this callback')) - else: -- print('Too much data for '+id+\ -- ' '+window+', ignoring this callback') -+ print(('Too much data for '+id+\ -+ ' '+window+', ignoring this callback')) - def slice(self, dev): - minicg = FTraceCallGraph(dev['pid'], self.sv) - minicg.name = self.name -@@ -1875,7 +1875,7 @@ class FTraceCallGraph: - # bring the depth back to 0 with additional returns - fixed = False - last = self.list[-1] -- for i in reversed(range(enddepth)): -+ for i in reversed(list(range(enddepth))): - t = FTraceLine(last.time) - t.depth = i - t.freturn = True -@@ -1902,7 +1902,7 @@ class FTraceCallGraph: - elif l.isReturn(): - if(l.depth not in stack): - if self.sv.verbose: -- print 'Post Process Error: Depth missing' -+ print('Post Process Error: Depth missing') - l.debugPrint() - return False - # calculate call length from call/return lines -@@ -1919,7 +1919,7 @@ class FTraceCallGraph: - return True - elif(cnt < 0): - if self.sv.verbose: -- print 'Post Process Error: Depth is less than 0' -+ print('Post Process Error: Depth is less than 0') - return False - # trace ended before call tree finished - return self.repair(cnt) -@@ -1978,19 +1978,19 @@ class FTraceCallGraph: - phase, myname = out - data.dmesg[phase]['list'][myname]['ftrace'] = self - def debugPrint(self, info=''): -- print('%s pid=%d [%f - %f] %.3f us') % \ -+ print(('%s pid=%d [%f - %f] %.3f us') % \ - (self.name, self.pid, self.start, self.end, -- (self.end - self.start)*1000000) -+ (self.end - self.start)*1000000)) - for l in self.list: - if l.isLeaf(): -- print('%f (%02d): %s(); (%.3f us)%s' % (l.time, \ -- l.depth, l.name, l.length*1000000, info)) -+ print(('%f (%02d): %s(); (%.3f us)%s' % (l.time, \ -+ l.depth, l.name, l.length*1000000, info))) - elif l.freturn: -- print('%f (%02d): %s} (%.3f us)%s' % (l.time, \ -- l.depth, l.name, l.length*1000000, info)) -+ print(('%f (%02d): %s} (%.3f us)%s' % (l.time, \ -+ l.depth, l.name, l.length*1000000, info))) - else: -- print('%f (%02d): %s() { (%.3f us)%s' % (l.time, \ -- l.depth, l.name, l.length*1000000, info)) -+ print(('%f (%02d): %s() { (%.3f us)%s' % (l.time, \ -+ l.depth, l.name, l.length*1000000, info))) - print(' ') - - class DevItem: -@@ -3040,8 +3040,8 @@ def parseTraceLog(live=False): - sortkey = '%f%f%d' % (cg.start, cg.end, pid) - sortlist[sortkey] = cg - elif len(cg.list) > 1000000: -- print 'WARNING: the callgraph for %s is massive (%d lines)' %\ -- (devname, len(cg.list)) -+ print('WARNING: the callgraph for %s is massive (%d lines)' %\ -+ (devname, len(cg.list))) - # create blocks for orphan cg data - for sortkey in sorted(sortlist): - cg = sortlist[sortkey] -@@ -3061,7 +3061,7 @@ def parseTraceLog(live=False): - for p in data.phases: - if(data.dmesg[p]['start'] < 0 and data.dmesg[p]['end'] < 0): - if not terr: -- print 'TEST%s FAILED: %s failed in %s phase' % (tn, sysvals.suspendmode, lp) -+ print('TEST%s FAILED: %s failed in %s phase' % (tn, sysvals.suspendmode, lp)) - terr = '%s%s failed in %s phase' % (sysvals.suspendmode, tn, lp) - error.append(terr) - sysvals.vprint('WARNING: phase "%s" is missing!' % p) -@@ -3158,8 +3158,8 @@ def loadKernelLog(): - if data: - testruns.append(data) - if len(testruns) < 1: -- print('ERROR: dmesg log has no suspend/resume data: %s' \ -- % sysvals.dmesgfile) -+ print(('ERROR: dmesg log has no suspend/resume data: %s' \ -+ % sysvals.dmesgfile)) - - # fix lines with same timestamp/function with the call and return swapped - for data in testruns: -@@ -3401,10 +3401,10 @@ def parseKernelLog(data): - lp = data.phases[0] - for p in data.phases: - if(data.dmesg[p]['start'] < 0 and data.dmesg[p]['end'] < 0): -- print('WARNING: phase "%s" is missing, something went wrong!' % p) -- print(' In %s, this dmesg line denotes the start of %s:' % \ -- (sysvals.suspendmode, p)) -- print(' "%s"' % dm[p]) -+ print(('WARNING: phase "%s" is missing, something went wrong!' % p)) -+ print((' In %s, this dmesg line denotes the start of %s:' % \ -+ (sysvals.suspendmode, p))) -+ print((' "%s"' % dm[p])) - if(data.dmesg[p]['start'] < 0): - data.dmesg[p]['start'] = data.dmesg[lp]['end'] - if(p == 'resume_machine'): -@@ -4526,14 +4526,14 @@ def setRuntimeSuspend(before=True): - sv.rslist = deviceInfo(sv.rstgt) - for i in sv.rslist: - sv.setVal(sv.rsval, i) -- print('runtime suspend %s on all devices (%d changed)' % (sv.rsdir, len(sv.rslist))) -+ print(('runtime suspend %s on all devices (%d changed)' % (sv.rsdir, len(sv.rslist)))) - print('waiting 5 seconds...') - time.sleep(5) - else: - # runtime suspend re-enable or re-disable - for i in sv.rslist: - sv.setVal(sv.rstgt, i) -- print('runtime suspend settings restored on %d devices' % len(sv.rslist)) -+ print(('runtime suspend settings restored on %d devices' % len(sv.rslist))) - - # Function: executeSuspend - # Description: -@@ -4581,7 +4581,7 @@ def executeSuspend(): - print('SUSPEND START (press a key to resume)') - # set rtcwake - if(sysvals.rtcwake): -- print('will issue an rtcwake in %d seconds' % sysvals.rtcwaketime) -+ print(('will issue an rtcwake in %d seconds' % sysvals.rtcwaketime)) - sysvals.rtcWakeAlarmOn() - # start of suspend trace marker - if(sysvals.usecallgraph or sysvals.usetraceevents): -@@ -4723,7 +4723,7 @@ def deviceInfo(output=''): - ms2nice(power['runtime_active_time']), \ - ms2nice(power['runtime_suspended_time'])) - for i in sorted(lines): -- print lines[i] -+ print(lines[i]) - return res - - # Function: devProps -@@ -5056,16 +5056,16 @@ def getFPDT(output): - table = struct.unpack('4sIBB6s8sI4sI', buf[0:36]) - if(output): - print('') -- print('Firmware Performance Data Table (%s)' % table[0]) -- print(' Signature : %s' % table[0]) -- print(' Table Length : %u' % table[1]) -- print(' Revision : %u' % table[2]) -- print(' Checksum : 0x%x' % table[3]) -- print(' OEM ID : %s' % table[4]) -- print(' OEM Table ID : %s' % table[5]) -- print(' OEM Revision : %u' % table[6]) -- print(' Creator ID : %s' % table[7]) -- print(' Creator Revision : 0x%x' % table[8]) -+ print(('Firmware Performance Data Table (%s)' % table[0])) -+ print((' Signature : %s' % table[0])) -+ print((' Table Length : %u' % table[1])) -+ print((' Revision : %u' % table[2])) -+ print((' Checksum : 0x%x' % table[3])) -+ print((' OEM ID : %s' % table[4])) -+ print((' OEM Table ID : %s' % table[5])) -+ print((' OEM Revision : %u' % table[6])) -+ print((' Creator ID : %s' % table[7])) -+ print((' Creator Revision : 0x%x' % table[8])) - print('') - - if(table[0] != 'FPDT'): -@@ -5092,22 +5092,22 @@ def getFPDT(output): - first = fp.read(8) - except: - if(output): -- print('Bad address 0x%x in %s' % (addr, sysvals.mempath)) -+ print(('Bad address 0x%x in %s' % (addr, sysvals.mempath))) - return [0, 0] - rechead = struct.unpack('4sI', first) - recdata = fp.read(rechead[1]-8) - if(rechead[0] == 'FBPT'): - record = struct.unpack('HBBIQQQQQ', recdata) - if(output): -- print('%s (%s)' % (rectype[header[0]], rechead[0])) -- print(' Reset END : %u ns' % record[4]) -- print(' OS Loader LoadImage Start : %u ns' % record[5]) -- print(' OS Loader StartImage Start : %u ns' % record[6]) -- print(' ExitBootServices Entry : %u ns' % record[7]) -- print(' ExitBootServices Exit : %u ns' % record[8]) -+ print(('%s (%s)' % (rectype[header[0]], rechead[0]))) -+ print((' Reset END : %u ns' % record[4])) -+ print((' OS Loader LoadImage Start : %u ns' % record[5])) -+ print((' OS Loader StartImage Start : %u ns' % record[6])) -+ print((' ExitBootServices Entry : %u ns' % record[7])) -+ print((' ExitBootServices Exit : %u ns' % record[8])) - elif(rechead[0] == 'S3PT'): - if(output): -- print('%s (%s)' % (rectype[header[0]], rechead[0])) -+ print(('%s (%s)' % (rectype[header[0]], rechead[0]))) - j = 0 - while(j < len(recdata)): - prechead = struct.unpack('HBB', recdata[j:j+4]) -@@ -5117,24 +5117,24 @@ def getFPDT(output): - record = struct.unpack('IIQQ', recdata[j:j+prechead[1]]) - fwData[1] = record[2] - if(output): -- print(' %s' % prectype[prechead[0]]) -- print(' Resume Count : %u' % \ -- record[1]) -- print(' FullResume : %u ns' % \ -- record[2]) -- print(' AverageResume : %u ns' % \ -- record[3]) -+ print((' %s' % prectype[prechead[0]])) -+ print((' Resume Count : %u' % \ -+ record[1])) -+ print((' FullResume : %u ns' % \ -+ record[2])) -+ print((' AverageResume : %u ns' % \ -+ record[3])) - elif(prechead[0] == 1): - record = struct.unpack('QQ', recdata[j+4:j+prechead[1]]) - fwData[0] = record[1] - record[0] - if(output): -- print(' %s' % prectype[prechead[0]]) -- print(' SuspendStart : %u ns' % \ -- record[0]) -- print(' SuspendEnd : %u ns' % \ -- record[1]) -- print(' SuspendTime : %u ns' % \ -- fwData[0]) -+ print((' %s' % prectype[prechead[0]])) -+ print((' SuspendStart : %u ns' % \ -+ record[0])) -+ print((' SuspendEnd : %u ns' % \ -+ record[1])) -+ print((' SuspendTime : %u ns' % \ -+ fwData[0])) - j += prechead[1] - if(output): - print('') -@@ -5151,13 +5151,13 @@ def getFPDT(output): - def statusCheck(probecheck=False): - status = True - -- print('Checking this system (%s)...' % platform.node()) -+ print(('Checking this system (%s)...' % platform.node())) - - # check we have root access - res = sysvals.colorText('NO (No features of this tool will work!)') - if(sysvals.rootCheck(False)): - res = 'YES' -- print(' have root access: %s' % res) -+ print((' have root access: %s' % res)) - if(res != 'YES'): - print(' Try running this script with sudo') - return False -@@ -5166,7 +5166,7 @@ def statusCheck(probecheck=False): - res = sysvals.colorText('NO (No features of this tool will work!)') - if(os.path.exists(sysvals.powerfile)): - res = 'YES' -- print(' is sysfs mounted: %s' % res) -+ print((' is sysfs mounted: %s' % res)) - if(res != 'YES'): - return False - -@@ -5178,9 +5178,9 @@ def statusCheck(probecheck=False): - res = 'YES' - else: - status = False -- print(' is "%s" a valid power mode: %s' % (sysvals.suspendmode, res)) -+ print((' is "%s" a valid power mode: %s' % (sysvals.suspendmode, res))) - if(res == 'NO'): -- print(' valid power modes are: %s' % modes) -+ print((' valid power modes are: %s' % modes)) - print(' please choose one with -m') - - # check if ftrace is available -@@ -5190,7 +5190,7 @@ def statusCheck(probecheck=False): - res = 'YES' - elif(sysvals.usecallgraph): - status = False -- print(' is ftrace supported: %s' % res) -+ print((' is ftrace supported: %s' % res)) - - # check if kprobes are available - res = sysvals.colorText('NO') -@@ -5199,7 +5199,7 @@ def statusCheck(probecheck=False): - res = 'YES' - else: - sysvals.usedevsrc = False -- print(' are kprobes supported: %s' % res) -+ print((' are kprobes supported: %s' % res)) - - # what data source are we using - res = 'DMESG' -@@ -5210,7 +5210,7 @@ def statusCheck(probecheck=False): - sysvals.usetraceevents = False - if(sysvals.usetraceevents): - res = 'FTRACE (all trace events found)' -- print(' timeline data source: %s' % res) -+ print((' timeline data source: %s' % res)) - - # check if rtcwake - res = sysvals.colorText('NO') -@@ -5218,7 +5218,7 @@ def statusCheck(probecheck=False): - res = 'YES' - elif(sysvals.rtcwake): - status = False -- print(' is rtcwake supported: %s' % res) -+ print((' is rtcwake supported: %s' % res)) - - if not probecheck: - return status -@@ -5243,7 +5243,7 @@ def statusCheck(probecheck=False): - def doError(msg, help=False): - if(help == True): - printHelp() -- print('ERROR: %s\n') % msg -+ print(('ERROR: %s\n') % msg) - sysvals.outputResult({'error':msg}) - sys.exit() - -@@ -5253,7 +5253,7 @@ def doError(msg, help=False): - def getArgInt(name, args, min, max, main=True): - if main: - try: -- arg = args.next() -+ arg = next(args) - except: - doError(name+': no argument supplied', True) - else: -@@ -5272,7 +5272,7 @@ def getArgInt(name, args, min, max, main=True): - def getArgFloat(name, args, min, max, main=True): - if main: - try: -- arg = args.next() -+ arg = next(args) - except: - doError(name+': no argument supplied', True) - else: -@@ -5388,7 +5388,7 @@ def runSummary(subdir, local=True, genhtml=False): - outpath = inpath - if local: - outpath = os.path.abspath('.') -- print('Generating a summary of folder "%s"' % inpath) -+ print(('Generating a summary of folder "%s"' % inpath)) - if genhtml: - for dirname, dirnames, filenames in os.walk(subdir): - sysvals.dmesgfile = sysvals.ftracefile = sysvals.htmlfile = '' -@@ -5400,9 +5400,9 @@ def runSummary(subdir, local=True, genhtml=False): - sysvals.setOutputFile() - if sysvals.ftracefile and sysvals.htmlfile and \ - not os.path.exists(sysvals.htmlfile): -- print('FTRACE: %s' % sysvals.ftracefile) -+ print(('FTRACE: %s' % sysvals.ftracefile)) - if sysvals.dmesgfile: -- print('DMESG : %s' % sysvals.dmesgfile) -+ print(('DMESG : %s' % sysvals.dmesgfile)) - rerunTest() - testruns = [] - for dirname, dirnames, filenames in os.walk(subdir): -@@ -5441,7 +5441,7 @@ def runSummary(subdir, local=True, genhtml=False): - } - testruns.append(data) - outfile = os.path.join(outpath, 'summary.html') -- print('Summary file: %s' % outfile) -+ print(('Summary file: %s' % outfile)) - createHTMLSummarySimple(testruns, outfile, inpath) - - # Function: checkArgBool -@@ -5459,7 +5459,7 @@ def checkArgBool(name, value): - # Description: - # Configure the script via the info in a config file - def configFromFile(file): -- Config = ConfigParser.ConfigParser() -+ Config = configparser.ConfigParser() - - Config.read(file) - sections = Config.sections() -@@ -5661,7 +5661,7 @@ def configFromFile(file): - # print out the help text - def printHelp(): - print('') -- print('%s v%s' % (sysvals.title, sysvals.version)) -+ print(('%s v%s' % (sysvals.title, sysvals.version))) - print('Usage: sudo sleepgraph ') - print('') - print('Description:') -@@ -5686,7 +5686,7 @@ def printHelp(): - print(' -v Print the current tool version') - print(' -config fn Pull arguments and config options from file fn') - print(' -verbose Print extra information during execution and analysis') -- print(' -m mode Mode to initiate for suspend (default: %s)') % (sysvals.suspendmode) -+ print((' -m mode Mode to initiate for suspend (default: %s)') % (sysvals.suspendmode)) - print(' -o name Overrides the output subdirectory name when running a new test') - print(' default: suspend-{date}-{time}') - print(' -rtcwake t Wakeup t seconds after suspend, set t to "off" to disable (default: 15)') -@@ -5753,7 +5753,7 @@ if __name__ == '__main__': - for arg in args: - if(arg == '-m'): - try: -- val = args.next() -+ val = next(args) - except: - doError('No mode supplied', True) - if val == 'command' and not sysvals.testcommand: -@@ -5765,7 +5765,7 @@ if __name__ == '__main__': - printHelp() - sys.exit() - elif(arg == '-v'): -- print("Version %s" % sysvals.version) -+ print(("Version %s" % sysvals.version)) - sys.exit() - elif(arg == '-x2'): - sysvals.execcount = 2 -@@ -5797,7 +5797,7 @@ if __name__ == '__main__': - sysvals.gzip = True - elif(arg == '-rs'): - try: -- val = args.next() -+ val = next(args) - except: - doError('-rs requires "enable" or "disable"', True) - if val.lower() in switchvalues: -@@ -5809,7 +5809,7 @@ if __name__ == '__main__': - doError('invalid option: %s, use "enable/disable" or "on/off"' % val, True) - elif(arg == '-display'): - try: -- val = args.next() -+ val = next(args) - except: - doError('-display requires "on" or "off"', True) - if val.lower() in switchvalues: -@@ -5823,7 +5823,7 @@ if __name__ == '__main__': - sysvals.max_graph_depth = getArgInt('-maxdepth', args, 0, 1000) - elif(arg == '-rtcwake'): - try: -- val = args.next() -+ val = next(args) - except: - doError('No rtcwake time supplied', True) - if val.lower() in switchoff: -@@ -5843,7 +5843,7 @@ if __name__ == '__main__': - sysvals.cgtest = getArgInt('-cgtest', args, 0, 1) - elif(arg == '-cgphase'): - try: -- val = args.next() -+ val = next(args) - except: - doError('No phase name supplied', True) - d = Data(0) -@@ -5853,13 +5853,13 @@ if __name__ == '__main__': - sysvals.cgphase = val - elif(arg == '-cgfilter'): - try: -- val = args.next() -+ val = next(args) - except: - doError('No callgraph functions supplied', True) - sysvals.setCallgraphFilter(val) - elif(arg == '-cgskip'): - try: -- val = args.next() -+ val = next(args) - except: - doError('No file supplied', True) - if val.lower() in switchoff: -@@ -5874,7 +5874,7 @@ if __name__ == '__main__': - sysvals.callloopmaxlen = getArgFloat('-callloop-maxlen', args, 0.0, 1.0) - elif(arg == '-cmd'): - try: -- val = args.next() -+ val = next(args) - except: - doError('No command string supplied', True) - sysvals.testcommand = val -@@ -5889,13 +5889,13 @@ if __name__ == '__main__': - sysvals.multitest['delay'] = getArgInt('-multi n d (delay between tests)', args, 0, 3600) - elif(arg == '-o'): - try: -- val = args.next() -+ val = next(args) - except: - doError('No subdirectory name supplied', True) - sysvals.outdir = sysvals.setOutputFolder(val) - elif(arg == '-config'): - try: -- val = args.next() -+ val = next(args) - except: - doError('No text file supplied', True) - file = sysvals.configFile(val) -@@ -5904,7 +5904,7 @@ if __name__ == '__main__': - configFromFile(file) - elif(arg == '-fadd'): - try: -- val = args.next() -+ val = next(args) - except: - doError('No text file supplied', True) - file = sysvals.configFile(val) -@@ -5913,7 +5913,7 @@ if __name__ == '__main__': - sysvals.addFtraceFilterFunctions(file) - elif(arg == '-dmesg'): - try: -- val = args.next() -+ val = next(args) - except: - doError('No dmesg file supplied', True) - sysvals.notestrun = True -@@ -5922,7 +5922,7 @@ if __name__ == '__main__': - doError('%s does not exist' % sysvals.dmesgfile) - elif(arg == '-ftrace'): - try: -- val = args.next() -+ val = next(args) - except: - doError('No ftrace file supplied', True) - sysvals.notestrun = True -@@ -5931,7 +5931,7 @@ if __name__ == '__main__': - doError('%s does not exist' % sysvals.ftracefile) - elif(arg == '-summary'): - try: -- val = args.next() -+ val = next(args) - except: - doError('No directory supplied', True) - cmd = 'summary' -@@ -5941,13 +5941,13 @@ if __name__ == '__main__': - doError('%s is not accesible' % val) - elif(arg == '-filter'): - try: -- val = args.next() -+ val = next(args) - except: - doError('No devnames supplied', True) - sysvals.setDeviceFilter(val) - elif(arg == '-result'): - try: -- val = args.next() -+ val = next(args) - except: - doError('No result file supplied', True) - sysvals.result = val -@@ -5980,13 +5980,13 @@ if __name__ == '__main__': - elif(cmd == 'fpdt'): - getFPDT(True) - elif(cmd == 'battery'): -- print 'AC Connect: %s\nCharge: %d' % getBattery() -+ print('AC Connect: %s\nCharge: %d' % getBattery()) - elif(cmd == 'sysinfo'): - sysvals.printSystemInfo(True) - elif(cmd == 'devinfo'): - deviceInfo() - elif(cmd == 'modes'): -- print getModes() -+ print(getModes()) - elif(cmd == 'flist'): - sysvals.getFtraceFilterFunctions(True) - elif(cmd == 'flistall'): -@@ -6036,13 +6036,13 @@ if __name__ == '__main__': - os.mkdir(sysvals.outdir) - for i in range(sysvals.multitest['count']): - if(i != 0): -- print('Waiting %d seconds...' % (sysvals.multitest['delay'])) -+ print(('Waiting %d seconds...' % (sysvals.multitest['delay']))) - time.sleep(sysvals.multitest['delay']) -- print('TEST (%d/%d) START' % (i+1, sysvals.multitest['count'])) -+ print(('TEST (%d/%d) START' % (i+1, sysvals.multitest['count']))) - fmt = 'suspend-%y%m%d-%H%M%S' - sysvals.testdir = os.path.join(sysvals.outdir, datetime.now().strftime(fmt)) - runTest(i+1) -- print('TEST (%d/%d) COMPLETE' % (i+1, sysvals.multitest['count'])) -+ print(('TEST (%d/%d) COMPLETE' % (i+1, sysvals.multitest['count']))) - sysvals.logmsg = '' - if not sysvals.skiphtml: - runSummary(sysvals.outdir, False, False) -diff --git a/tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py b/tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py -index 2fa3c57..b1e2abc 100755 ---- a/tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py -+++ b/tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py -@@ -1,4 +1,4 @@ --#!/usr/bin/python -+#!/usr/bin/python3 - # -*- coding: utf-8 -*- - # - """ This utility can be used to debug and tune the performance of the -@@ -22,7 +22,7 @@ Prerequisites: - see print_help(): for Usage and Output details - - """ --from __future__ import print_function -+ - from datetime import datetime - import subprocess - import os --- -1.8.3.1 - diff --git a/0002-libhugetlbfs-2.16-makefile_cflags.patch b/0002-libhugetlbfs-2.16-makefile_cflags.patch deleted file mode 100644 index de95b12..0000000 --- a/0002-libhugetlbfs-2.16-makefile_cflags.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -up libhugetlbfs-2.16/Makefile.orig libhugetlbfs-2.16/Makefile ---- libhugetlbfs-2.16/Makefile.orig 2014-03-03 12:50:43.408107252 +0100 -+++ libhugetlbfs-2.16/Makefile 2014-03-03 12:52:01.070230134 +0100 -@@ -29,7 +29,7 @@ INSTALL = install - - LDFLAGS += -Wl,-z,noexecstack -ldl - CFLAGS ?= -O2 -g --CFLAGS += -Wall -fPIC -+CFLAGS += -Wall -fPIC -fstack-protector-strong - CPPFLAGS += -D__LIBHUGETLBFS__ -DFORTIFY_SOURCE - - ARCH = $(shell uname -m | sed -e s/i.86/i386/) diff --git a/0003-fix-behavior-while-shrinking.patch b/0003-fix-behavior-while-shrinking.patch deleted file mode 100644 index 051c88d..0000000 --- a/0003-fix-behavior-while-shrinking.patch +++ /dev/null @@ -1,80 +0,0 @@ -From 26c6b9b99d8f8d7897687a2192be4920a44c1eff Mon Sep 17 00:00:00 2001 -From: Guillaume Morin -Date: Tue, 1 Nov 2016 22:41:22 +0100 -Subject: [PATCH 16/28] fix behavior while shrinking - -Adjust mapsize as we're unmapping pages. Do not lie to glibc about -shrinking by less than a page. It's unnecessary because we are not -giving back any memory to the kernel, but also it forces us to zero -out this memory because morecore() assumes by default that "new" -memory is already zero'd. - -Signed-off-by: Guillaume Morin -Signed-off-by: Eric B Munson ---- - morecore.c | 37 +++++++++++++++++++++++++++---------- - 1 file changed, 27 insertions(+), 10 deletions(-) - -diff --git a/morecore.c b/morecore.c -index 62ad252..6563bbd 100644 ---- a/morecore.c -+++ b/morecore.c -@@ -178,20 +178,37 @@ static void *hugetlbfs_morecore(ptrdiff_t increment) - if (ret) { - WARNING("Unmapping failed while shrinking heap: " - "%s\n", strerror(errno)); -- } else if (!__hugetlb_opts.map_hugetlb && !using_default_pagesize){ -- -- /* -- * Now shrink the hugetlbfs file. -- */ -+ } else { - mapsize += delta; -- ret = ftruncate(heap_fd, mapsize); -- if (ret) { -- WARNING("Could not truncate hugetlbfs file to " -- "shrink heap: %s\n", strerror(errno)); -+ /* -+ * the glibc assumes by default that newly allocated -+ * memory by morecore() will be zeroed. It would be -+ * wasteful to do it for allocation so we only shrink -+ * the top by the size of a page. -+ */ -+ increment = heapbase - heaptop + mapsize; -+ -+ if (!__hugetlb_opts.map_hugetlb && !using_default_pagesize){ -+ -+ /* -+ * Now shrink the hugetlbfs file. -+ */ -+ ret = ftruncate(heap_fd, mapsize); -+ if (ret) { -+ WARNING("Could not truncate hugetlbfs file to " -+ "shrink heap: %s\n", strerror(errno)); -+ } - } - } - - } -+ else if (increment < 0) { -+ /* Don't shrink by less than a page to avoid having to zero -+ * the memory. There is no point in lying to glibc since -+ * we're not freeing any memory. -+ */ -+ increment = 0; -+ } - - /* heap is continuous */ - p = heaptop; -@@ -355,7 +372,7 @@ void hugetlbfs_setup_morecore(void) - /* Set some allocator options more appropriate for hugepages */ - - if (__hugetlb_opts.shrink_ok) -- mallopt(M_TRIM_THRESHOLD, hpage_size / 2); -+ mallopt(M_TRIM_THRESHOLD, hpage_size + hpage_size / 2); - else - mallopt(M_TRIM_THRESHOLD, -1); - mallopt(M_TOP_PAD, hpage_size / 2); --- -1.8.3.1 - diff --git a/0004-ld.hugetlbfs-pick-an-emulation-if-m-is-not-present.patch b/0004-ld.hugetlbfs-pick-an-emulation-if-m-is-not-present.patch deleted file mode 100644 index 4a14a3b..0000000 --- a/0004-ld.hugetlbfs-pick-an-emulation-if-m-is-not-present.patch +++ /dev/null @@ -1,42 +0,0 @@ -From a979e0b01a76f199974c76c9799b0210562147ec Mon Sep 17 00:00:00 2001 -From: Jan Stancek -Date: Thu, 2 Feb 2017 11:04:08 +0100 -Subject: [PATCH 17/28] ld.hugetlbfs: pick an emulation if -m is not present - -If -m is not passed on command line $EMU ends up empty -and as result HPAGE_SIZE and SLICE_SIZE are left uninitialized. - -Try environment variable LDEMULATION and if it's not defined -pick first from "Supported emulations" list of ld -V. - -Signed-off-by: Jan Stancek -Signed-off-by: Eric B Munson ---- - ld.hugetlbfs | 11 +++++++++++ - 1 file changed, 11 insertions(+) - -diff --git a/ld.hugetlbfs b/ld.hugetlbfs -index 32bc6fb..2dda451 100755 ---- a/ld.hugetlbfs -+++ b/ld.hugetlbfs -@@ -81,6 +81,17 @@ if [ -n "$HTLB_LINK" ]; then - HTLBOPTS="-T${HUGETLB_LDSCRIPT_PATH}/${LDSCRIPT}" - fi - -+# if -m is not present on command line -+if [ -z "$EMU" ]; then -+ if [ -n "$LDEMULATION" ]; then -+ # try env. variable -+ EMU="$LDEMULATION" -+ else -+ # pick first supported -+ EMU="$(ld -V | sed -n '/Supported emulations/{n;p}' | tr -d ' ')" -+ fi -+fi -+ - MB=$((1024*1024)) - case "$EMU" in - elf32ppclinux|elf64ppc) HPAGE_SIZE=$((16*$MB)) SLICE_SIZE=$((256*$MB)) ;; --- -1.8.3.1 - diff --git a/0005-ld.hugetlbfs-support-512M-hugepages-on-aarch64.patch b/0005-ld.hugetlbfs-support-512M-hugepages-on-aarch64.patch deleted file mode 100644 index 7a18ad1..0000000 --- a/0005-ld.hugetlbfs-support-512M-hugepages-on-aarch64.patch +++ /dev/null @@ -1,44 +0,0 @@ -From ff12744922d0b13ef0373fb00ca057bb4424da23 Mon Sep 17 00:00:00 2001 -From: Jan Stancek -Date: Wed, 15 Feb 2017 14:10:19 +0100 -Subject: [PATCH 21/28] ld.hugetlbfs: support 512M hugepages on aarch64 - -aarch64 supports multiple hugepage sizes, if default is 512M, -then all linkhuge_rw tests segfault. This patch detects -default huge page size from /proc/meminfo output, rather than -using hardcoded value of 2M. - -Signed-off-by: Jan Stancek -Signed-off-by: Eric B Munson ---- - ld.hugetlbfs | 7 +++++-- - 1 file changed, 5 insertions(+), 2 deletions(-) - -diff --git a/ld.hugetlbfs b/ld.hugetlbfs -index 8ee917b..388f7b4 100755 ---- a/ld.hugetlbfs -+++ b/ld.hugetlbfs -@@ -109,7 +109,10 @@ elf32ppclinux|elf64ppc) HPAGE_SIZE=$((16*$MB)) SLICE_SIZE=$((256*$MB)) ;; - elf64lppc) HPAGE_SIZE=$((16*$MB)) SLICE_SIZE=$((256*$MB)) ;; - elf_i386|elf_x86_64) HPAGE_SIZE=$((4*$MB)) SLICE_SIZE=$HPAGE_SIZE ;; - elf_s390|elf64_s390) HPAGE_SIZE=$((1*$MB)) SLICE_SIZE=$HPAGE_SIZE ;; --armelf*_linux_eabi|aarch64elf*|aarch64linux*) HPAGE_SIZE=$((2*$MB)) SLICE_SIZE=$HPAGE_SIZE ;; -+armelf*_linux_eabi|aarch64elf*|aarch64linux*) -+ hpage_kb=$(cat /proc/meminfo | grep Hugepagesize: | awk '{print $2}') -+ HPAGE_SIZE=$((hpage_kb * 1024)) -+ SLICE_SIZE=$HPAGE_SIZE ;; - esac - - if [ "$HTLB_ALIGN" == "slice" ]; then -@@ -119,7 +122,7 @@ if [ "$HTLB_ALIGN" == "slice" ]; then - # targeting the ARM platform one needs to explicitly set the text segment offset - # otherwise it will be NULL. - case "$EMU" in -- armelf*_linux_eabi) HTLBOPTS="$HTLBOPTS -Ttext-segment=$SLICE_SIZE" ;; -+ armelf*_linux_eabi|aarch64elf*|aarch64linux*) HTLBOPTS="$HTLBOPTS -Ttext-segment=$SLICE_SIZE" ;; - esac - fi - --- -1.8.3.1 - diff --git a/0006-libhugetlbfs-fix-tests-with-heapshrink-fail.patch b/0006-libhugetlbfs-fix-tests-with-heapshrink-fail.patch deleted file mode 100644 index 9f907f0..0000000 --- a/0006-libhugetlbfs-fix-tests-with-heapshrink-fail.patch +++ /dev/null @@ -1,65 +0,0 @@ -From e1c5a625a5d82aed84fdd5db0643fb865d21b5bf Mon Sep 17 00:00:00 2001 -From: lihongjiang -Date: Mon, 22 Apr 2019 22:11:55 +0800 -Subject: [PATCH] libhugetlbfs: fix tests with heapshrink fail - -reason:fix tests with heapshrink fail - -Signed-off-by: lihongjiang ---- - tests/heapshrink.c | 12 +++++++++--- - tests/run_tests.py | 2 +- - 2 files changed, 10 insertions(+), 4 deletions(-) - -diff --git a/tests/heapshrink.c b/tests/heapshrink.c -index 0644c78..bd2e62b 100644 ---- a/tests/heapshrink.c -+++ b/tests/heapshrink.c -@@ -34,7 +34,7 @@ - - int main(int argc, char **argv) - { -- int is_huge, have_env, shrink_ok, have_helper; -+ int is_huge, have_env, shrink_ok, have_helper, tcache_enabled; - unsigned long long mapping_size; - void *p; - -@@ -45,6 +45,8 @@ int main(int argc, char **argv) - p = getenv("LD_PRELOAD"); - have_helper = p != NULL && strstr(p, "heapshrink") != NULL; - -+ p=getenv("GLIBC_TUNABLES"); -+ tcache_enabled = p != NULL && strstr(p, "malloc.tcache_count=0"); - p = malloc(SIZE); - if (!p) { - if (shrink_ok && have_helper) { -@@ -68,7 +70,11 @@ int main(int argc, char **argv) - - free(p); - mapping_size = get_mapping_page_size(p+SIZE-1); -- if (shrink_ok && mapping_size > MIN_PAGE_SIZE) -- FAIL("Heap did not shrink"); -+ if (shrink_ok && mapping_size > MIN_PAGE_SIZE) { -+ if (tcache_enabled) -+ FAIL("Heap did not shrink"); -+ else -+ FAIL("Heap didn't shrink. Check malloc.tcache_count=0"); -+ } - PASS(); - } -diff --git a/tests/run_tests.py b/tests/run_tests.py -index 22e74c8..8cc6d43 100755 ---- a/tests/run_tests.py -+++ b/tests/run_tests.py -@@ -575,7 +575,7 @@ def functional_tests(): - HUGETLB_MORECORE="yes") - do_test("heapshrink", LD_PRELOAD="libheapshrink.so", HUGETLB_MORECORE="yes", - HUGETLB_MORECORE_SHRINK="yes") -- do_test("heapshrink", LD_PRELOAD="libhugetlbfs.so libheapshrink.so", -+ do_test("heapshrink", GLIBC_TUNABLES="glibc.malloc.tcache_count=0", LD_PRELOAD="libhugetlbfs.so libheapshrink.so", - HUGETLB_MORECORE="yes", HUGETLB_MORECORE_SHRINK="yes") - do_test("heap-overflow", HUGETLB_VERBOSE="1", HUGETLB_MORECORE="yes") - --- -1.8.3.1 - diff --git a/0007-libhugetlbfs-2.20-change-scripts-to-py3.patch b/0007-libhugetlbfs-2.20-change-scripts-to-py3.patch deleted file mode 100644 index 2c74c1b..0000000 --- a/0007-libhugetlbfs-2.20-change-scripts-to-py3.patch +++ /dev/null @@ -1,306 +0,0 @@ -From ea54bafb9552a561f7dc746f5dec33cca62419f7 Mon Sep 17 00:00:00 2001 -From: lihongjiang -Date: Tue, 25 Feb 2020 10:51:17 +0800 -Subject: [PATCH] change script from py2 to py3 - -diff --git a/huge_page_setup_helper.py b/huge_page_setup_helper.py -index 43c9916..a9ba2bf 100755 ---- a/huge_page_setup_helper.py -+++ b/huge_page_setup_helper.py -@@ -14,13 +14,13 @@ debug = False - - # must be executed under the root to operate - if os.geteuid() != 0: -- print "You must be root to setup hugepages!" -+ print("You must be root to setup hugepages!") - os._exit(1) - - # config files we need access to - sysctlConf = "/etc/sysctl.conf" - if not os.access(sysctlConf, os.W_OK): -- print "Cannot access %s" % sysctlConf -+ print("Cannot access %s" % sysctlConf) - if debug == False: - os._exit(1) - -@@ -41,7 +41,7 @@ for line in hugeadmexplain: - break - - if memTotal == 0: -- print "Your version of libhugetlbfs' hugeadm utility is too old!" -+ print("Your version of libhugetlbfs' hugeadm utility is too old!") - os._exit(1) - - -@@ -54,7 +54,7 @@ for line in poolList: - break - - if hugePageSize == 0: -- print "Aborting, cannot determine system huge page size!" -+ print("Aborting, cannot determine system huge page size!") - os._exit(1) - - # Get initial sysctl settings -@@ -83,22 +83,22 @@ for line in groupNames: - - - # dump system config as we see it before we start tweaking it --print "Current configuration:" --print " * Total System Memory......: %6d MB" % memTotal --print " * Shared Mem Max Mapping...: %6d MB" % (shmmax / (1024 * 1024)) --print " * System Huge Page Size....: %6d MB" % (hugePageSize / (1024 * 1024)) --print " * Number of Huge Pages.....: %6d" % hugePages --print " * Total size of Huge Pages.: %6d MB" % (hugePages * hugePageSize / (1024 * 1024)) --print " * Remaining System Memory..: %6d MB" % (memTotal - (hugePages * hugePageSize / (1024 * 1024))) --print " * Huge Page User Group.....: %s (%d)" % (hugeGIDName, hugeGID) --print -+print("Current configuration:") -+print(" * Total System Memory......: %6d MB" % memTotal) -+print(" * Shared Mem Max Mapping...: %6d MB" % (shmmax / (1024 * 1024))) -+print(" * System Huge Page Size....: %6d MB" % (hugePageSize / (1024 * 1024))) -+print(" * Number of Huge Pages.....: %6d" % hugePages) -+print(" * Total size of Huge Pages.: %6d MB" % (hugePages * hugePageSize / (1024 * 1024))) -+print(" * Remaining System Memory..: %6d MB" % (memTotal - (hugePages * hugePageSize / (1024 * 1024)))) -+print(" * Huge Page User Group.....: %s (%d)" % (hugeGIDName, hugeGID)) -+print() - - - # ask how memory they want to allocate for huge pages - userIn = None - while not userIn: - try: -- userIn = raw_input("How much memory would you like to allocate for huge pages? " -+ userIn = input("How much memory would you like to allocate for huge pages? " - "(input in MB, unless postfixed with GB): ") - if userIn[-2:] == "GB": - userHugePageReqMB = int(userIn[0:-2]) * 1024 -@@ -113,19 +113,19 @@ while not userIn: - # As a sanity safeguard, require at least 128M not be allocated to huge pages - if userHugePageReqMB > (memTotal - 128): - userIn = None -- print "Refusing to allocate %d, you must leave at least 128MB for the system" % userHugePageReqMB -+ print("Refusing to allocate %d, you must leave at least 128MB for the system" % userHugePageReqMB) - elif userHugePageReqMB < (hugePageSize / (1024 * 1024)): - userIn = None -- print "Sorry, allocation must be at least a page's worth!" -+ print("Sorry, allocation must be at least a page's worth!") - else: - break - except ValueError: - userIn = None -- print "Input must be an integer, please try again!" -+ print("Input must be an integer, please try again!") - userHugePageReqKB = userHugePageReqMB * 1024 - userHugePagesReq = userHugePageReqKB / (hugePageSize / 1024) --print "Okay, we'll try to allocate %d MB for huge pages..." % userHugePageReqMB --print -+print("Okay, we'll try to allocate %d MB for huge pages..." % userHugePageReqMB) -+print() - - - # some basic user input validation -@@ -134,24 +134,24 @@ inputIsValid = False - # ask for the name of the group allowed access to huge pages - while inputIsValid == False: - foundbad = False -- userGroupReq = raw_input("What group should have access to the huge pages?" -+ userGroupReq = input("What group should have access to the huge pages?" - "(The group will be created, if need be) [hugepages]: ") - if userGroupReq is '': - userGroupReq = 'hugepages' - if userGroupReq[0].isdigit() or userGroupReq[0] == "-": - foundbad = True -- print "Group names cannot start with a number or dash, please try again!" -+ print("Group names cannot start with a number or dash, please try again!") - for char in badchars: - if char in userGroupReq: - foundbad = True -- print "Illegal characters in group name, please try again!" -+ print("Illegal characters in group name, please try again!") - break - if len(userGroupReq) > 16: - foundbad = True -- print "Group names can't be more than 16 characaters, please try again!" -+ print("Group names can't be more than 16 characaters, please try again!") - if foundbad == False: - inputIsValid = True --print "Okay, we'll give group %s access to the huge pages" % userGroupReq -+print("Okay, we'll give group %s access to the huge pages" % userGroupReq) - - - # see if group already exists, use it if it does, if not, create it -@@ -163,20 +163,20 @@ for line in groupNames: - break - - if userGIDReq > -1: -- print "Group %s (gid %d) already exists, we'll use it" % (userGroupReq, userGIDReq) -+ print("Group %s (gid %d) already exists, we'll use it" % (userGroupReq, userGIDReq)) - else: - if debug == False: - os.popen("/usr/sbin/groupadd %s" % userGroupReq) - else: -- print "/usr/sbin/groupadd %s" % userGroupReq -+ print("/usr/sbin/groupadd %s" % userGroupReq) - groupNames = os.popen("/usr/bin/getent group %s" % userGroupReq).readlines() - for line in groupNames: - curGroupName = line.split(":")[0] - if curGroupName == userGroupReq: - userGIDReq = int(line.split(":")[2]) - break -- print "Created group %s (gid %d) for huge page use" % (userGroupReq, userGIDReq) --print -+ print("Created group %s (gid %d) for huge page use" % (userGroupReq, userGIDReq)) -+print() - - - # basic user input validation, take 2 -@@ -186,20 +186,20 @@ inputIsValid = False - # ask for user(s) that should be in the huge page access group - while inputIsValid == False: - foundbad = False -- userUsersReq = raw_input("What user(s) should have access to the huge pages (space-delimited list, users created as needed)? ") -+ userUsersReq = input("What user(s) should have access to the huge pages (space-delimited list, users created as needed)? ") - for char in badchars: - if char in userUsersReq: - foundbad = True -- print "Illegal characters in user name(s) or invalid list format, please try again!" -+ print("Illegal characters in user name(s) or invalid list format, please try again!") - break - for n in userUsersReq.split(): - if len(n) > 32: - foundbad = True -- print "User names can't be more than 32 characaters, please try again!" -+ print("User names can't be more than 32 characaters, please try again!") - break - if n[0] == "-": - foundbad = True -- print "User names cannot start with a dash, please try again!" -+ print("User names cannot start with a dash, please try again!") - break - if foundbad == False: - inputIsValid = True -@@ -211,24 +211,24 @@ for hugeUser in hugePageUserList: - for line in curUserList: - curUser = line.split(":")[0] - if curUser == hugeUser: -- print "Adding user %s to huge page group" % hugeUser -+ print("Adding user %s to huge page group" % hugeUser) - userExists = True - if debug == False: - os.popen("/usr/sbin/usermod -a -G %s %s" % (userGroupReq, hugeUser)) - else: -- print "/usr/sbin/usermod -a -G %s %s" % (userGroupReq, hugeUser) -+ print("/usr/sbin/usermod -a -G %s %s" % (userGroupReq, hugeUser)) - if userExists == True: - break - if userExists == False: -- print "Creating user %s with membership in huge page group" % hugeUser -+ print("Creating user %s with membership in huge page group" % hugeUser) - if debug == False: - if hugeUser == userGroupReq: - os.popen("/usr/sbin/useradd %s -g %s" % (hugeUser, userGroupReq)) - else: - os.popen("/usr/sbin/useradd %s -G %s" % (hugeUser, userGroupReq)) - else: -- print "/usr/sbin/useradd %s -G %s" % (hugeUser, userGroupReq) --print -+ print("/usr/sbin/useradd %s -G %s" % (hugeUser, userGroupReq)) -+print() - - - # set values for the current running environment -@@ -238,11 +238,11 @@ if debug == False: - os.popen("/usr/bin/hugeadm --set-shm-group %d" % userGIDReq) - os.popen("/usr/bin/hugeadm --set-recommended-shmmax") - else: -- print "/usr/bin/hugeadm --pool-pages-min DEFAULT:%sM" % userHugePageReqMB -- print "/usr/bin/hugeadm --pool-pages-max DEFAULT:%sM" % userHugePageReqMB -- print "/usr/bin/hugeadm --set-shm-group %d" % userGIDReq -- print "/usr/bin/hugeadm --set-recommended-shmmax" -- print -+ print("/usr/bin/hugeadm --pool-pages-min DEFAULT:%sM" % userHugePageReqMB) -+ print("/usr/bin/hugeadm --pool-pages-max DEFAULT:%sM" % userHugePageReqMB) -+ print("/usr/bin/hugeadm --set-shm-group %d" % userGIDReq) -+ print("/usr/bin/hugeadm --set-recommended-shmmax") -+ print() - - # figure out what that shmmax value we just set was - hugeadmexplain = os.popen("/usr/bin/hugeadm --explain 2>/dev/null").readlines() -@@ -258,7 +258,7 @@ if debug == False: - try: - sysctlConfLines = open(sysctlConf).readlines() - os.rename(sysctlConf, sysctlConf + ".backup") -- print("Saved original %s as %s.backup" % (sysctlConf, sysctlConf)) -+ print(("Saved original %s as %s.backup" % (sysctlConf, sysctlConf))) - except: - pass - -@@ -279,11 +279,11 @@ if debug == False: - fd.close() - - else: -- print "Add to %s:" % sysctlConf -- print "kernel.shmmax = %d" % shmmax -- print "vm.nr_hugepages = %d" % userHugePagesReq -- print "vm.hugetlb_shm_group = %d" % userGIDReq -- print -+ print("Add to %s:" % sysctlConf) -+ print("kernel.shmmax = %d" % shmmax) -+ print("vm.nr_hugepages = %d" % userHugePagesReq) -+ print("vm.hugetlb_shm_group = %d" % userGIDReq) -+ print() - - - # write out limits.conf changes to persist across reboot -@@ -293,7 +293,7 @@ if debug == False: - try: - limitsConfLines = open(limitsConf).readlines() - os.rename(limitsConf, limitsConf + ".backup") -- print("Saved original %s as %s.backup" % (limitsConf, limitsConf)) -+ print(("Saved original %s as %s.backup" % (limitsConf, limitsConf))) - except: - pass - -@@ -319,25 +319,25 @@ if debug == False: - fd.close() - - else: -- print "Add to %s:" % limitsConf -+ print("Add to %s:" % limitsConf) - for hugeUser in hugePageUserList: -- print "%s soft memlock %d" % (hugeUser, userHugePageReqKB) -- print "%s hard memlock %d" % (hugeUser, userHugePageReqKB) -+ print("%s soft memlock %d" % (hugeUser, userHugePageReqKB)) -+ print("%s hard memlock %d" % (hugeUser, userHugePageReqKB)) - - - # dump the final configuration of things now that we're done tweaking --print --print "Final configuration:" --print " * Total System Memory......: %6d MB" % memTotal -+print() -+print("Final configuration:") -+print(" * Total System Memory......: %6d MB" % memTotal) - if debug == False: -- print " * Shared Mem Max Mapping...: %6d MB" % (shmmax / (1024 * 1024)) -+ print(" * Shared Mem Max Mapping...: %6d MB" % (shmmax / (1024 * 1024))) - else: - # This should be what we *would* have set it to, had we actually run hugeadm --set-recommended-shmmax -- print " * Shared Mem Max Mapping...: %6d MB" % (userHugePagesReq * hugePageSize / (1024 * 1024)) --print " * System Huge Page Size....: %6d MB" % (hugePageSize / (1024 * 1024)) --print " * Available Huge Pages.....: %6d" % userHugePagesReq --print " * Total size of Huge Pages.: %6d MB" % (userHugePagesReq * hugePageSize / (1024 * 1024)) --print " * Remaining System Memory..: %6d MB" % (memTotal - userHugePageReqMB) --print " * Huge Page User Group.....: %s (%d)" % (userGroupReq, userGIDReq) --print -+ print(" * Shared Mem Max Mapping...: %6d MB" % (userHugePagesReq * hugePageSize / (1024 * 1024))) -+print(" * System Huge Page Size....: %6d MB" % (hugePageSize / (1024 * 1024))) -+print(" * Available Huge Pages.....: %6d" % userHugePagesReq) -+print(" * Total size of Huge Pages.: %6d MB" % (userHugePagesReq * hugePageSize / (1024 * 1024))) -+print(" * Remaining System Memory..: %6d MB" % (memTotal - userHugePageReqMB)) -+print(" * Huge Page User Group.....: %s (%d)" % (userGroupReq, userGIDReq)) -+print() - --- -1.8.3.1 - diff --git a/libhugetlbfs-2.20.tar.gz b/libhugetlbfs-2.20.tar.gz deleted file mode 100644 index 2f3ee87..0000000 Binary files a/libhugetlbfs-2.20.tar.gz and /dev/null differ diff --git a/libhugetlbfs-2.22.tar.gz b/libhugetlbfs-2.22.tar.gz new file mode 100644 index 0000000..f7907b5 Binary files /dev/null and b/libhugetlbfs-2.22.tar.gz differ diff --git a/0001-libhugetlbfs-2.15-fortify.patch b/libhugetlbfs-make-cflags.patch similarity index 53% rename from 0001-libhugetlbfs-2.15-fortify.patch rename to libhugetlbfs-make-cflags.patch index 8b505d6..344b85e 100644 --- a/0001-libhugetlbfs-2.15-fortify.patch +++ b/libhugetlbfs-make-cflags.patch @@ -2,12 +2,14 @@ diff --git a/Makefile b/Makefile index 73ebad7..3735440 100644 --- a/Makefile +++ b/Makefile -@@ -30,7 +30,7 @@ INSTALL = install - LDFLAGS += -Wl,-z,noexecstack -ldl +@@ -30,8 +30,8 @@ INSTALL = install + + LDFLAGS += -ldl CFLAGS ?= -O2 -g - CFLAGS += -Wall -fPIC +-CFLAGS += -Wall -fPIC -CPPFLAGS += -D__LIBHUGETLBFS__ ++CFLAGS += -Wall -fPIC -fstack-protector-strong +CPPFLAGS += -D__LIBHUGETLBFS__ -DFORTIFY_SOURCE - - ARCH = $(shell uname -m | sed -e s/i.86/i386/) + + ARCH ?= $(shell uname -m | sed -e s/i.86/i386/) CC ?= gcc diff --git a/libhugetlbfs.spec b/libhugetlbfs.spec index 0232829..4e49f7b 100644 --- a/libhugetlbfs.spec +++ b/libhugetlbfs.spec @@ -1,24 +1,18 @@ %global ldscriptdir %{_datadir}/%{name}/ldscripts Name: libhugetlbfs -Version: 2.20 -Release: 14 +Version: 2.22 +Release: 1 Summary: A library which provides easy access to huge pages of memory License: LGPLv2+ URL: https://github.com/libhugetlbfs/libhugetlbfs Source0: https://github.com/libhugetlbfs/libhugetlbfs/releases/download/%{version}/%{name}-%{version}.tar.gz Patch0000: 0000-build_flags.patch -Patch0001: 0001-libhugetlbfs-2.15-fortify.patch -Patch0002: 0002-libhugetlbfs-2.16-makefile_cflags.patch -Patch0003: 0003-fix-behavior-while-shrinking.patch -Patch0004: 0004-ld.hugetlbfs-pick-an-emulation-if-m-is-not-present.patch -Patch0005: 0005-ld.hugetlbfs-support-512M-hugepages-on-aarch64.patch -Patch0006: 0006-libhugetlbfs-fix-tests-with-heapshrink-fail.patch -Patch0007: 0007-libhugetlbfs-2.20-change-scripts-to-py3.patch Patch9000:libhugetlbfs-2.16-remap_segments_with_MAP_SHARED.patch Patch9001:libhugetlbfs-2.16-remap_segments_with_MAP_SHARED-2.patch +Patch9002:libhugetlbfs-make-cflags.patch BuildRequires: gcc glibc-devel glibc-static @@ -90,6 +84,12 @@ touch $RPM_BUILD_ROOT%{_sysconfdir}/security/limits.d/hugepages.conf %changelog +* Fri Apr 24 2020 lihongjiang - 2.22-1 +- Type:enhancement +- ID:NA +- SUG:restart +- DESC:update version to 2.22 + * Tue Feb 25 2020 lihongjiang - 2.20-14 - Type:enhancement - ID:NA