diff --git a/.github/scripts/install-libkdumpfile.sh b/.github/scripts/install-libkdumpfile.sh index de7471f6..98727516 100755 --- a/.github/scripts/install-libkdumpfile.sh +++ b/.github/scripts/install-libkdumpfile.sh @@ -8,7 +8,7 @@ # sudo apt update sudo apt install autoconf automake liblzo2-dev libsnappy1v5 libtool pkg-config zlib1g-dev -sudo apt install python3.6-dev python3.7-dev python3.8-dev +sudo apt install python3.8-dev git clone https://github.com/ptesarik/libkdumpfile.git diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index aaff060e..fe44a0c5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -9,10 +9,10 @@ jobs: # Verify the build and installation of SDB. # install: - runs-on: ubuntu-18.04 + runs-on: ubuntu-20.04 strategy: matrix: - python-version: [3.6, 3.7, 3.8] + python-version: [3.8] steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v1 @@ -31,12 +31,12 @@ jobs: # the "drgn" from source (there's no package currently available). # pylint: - runs-on: ubuntu-18.04 + runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v1 with: - python-version: '3.6' + python-version: '3.8' - run: ./.github/scripts/install-drgn.sh - run: python3 -m pip install pylint pytest - run: pylint -d duplicate-code -d invalid-name sdb @@ -52,10 +52,12 @@ jobs: # can open kdump-compressed crash dumps for the integration tests. # pytest: - runs-on: ubuntu-18.04 + runs-on: ubuntu-20.04 strategy: matrix: - python-version: [3.6, 3.7, 3.8] + python-version: [3.8] + env: + AWS_DEFAULT_REGION: 'us-west-2' steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v1 @@ -73,12 +75,12 @@ jobs: # Verify "yapf" runs successfully. # yapf: - runs-on: ubuntu-18.04 + runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v1 with: - python-version: '3.6' + python-version: '3.8' - run: python3 -m pip install yapf - run: yapf --diff --style google --recursive sdb - run: yapf --diff --style google --recursive tests @@ -98,12 +100,12 @@ jobs: # pytest doesn't provide stubs on typeshed. # mypy: - runs-on: ubuntu-18.04 + runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v1 with: - python-version: '3.6' + python-version: '3.8' - run: ./.github/scripts/install-drgn.sh - run: python3 -m pip install mypy==0.730 - run: python3 -m mypy --strict --show-error-codes -p sdb @@ -112,7 +114,7 @@ jobs: # Verify that "shfmt" ran successfully against our shell scripts. # shfmt: - runs-on: ubuntu-18.04 + runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 - uses: delphix/actions/shfmt@master diff --git a/sdb/command.py b/sdb/command.py index 670b6037..fd69c82f 100644 --- a/sdb/command.py +++ b/sdb/command.py @@ -30,7 +30,7 @@ from sdb.target import type_canonicalize_name, type_canonical_name, type_canonicalize, get_prog from sdb.error import CommandError, SymbolNotFoundError -import sdb.target as target +from sdb import target # # The register_command is used by the Command class when its @@ -45,8 +45,6 @@ def register_command(name: str, class_: Type["Command"]) -> None: Register the specified command name and command class, such that the command will be available from the SDB REPL. """ - # pylint: disable=global-statement - global all_commands all_commands[name] = class_ @@ -54,8 +52,6 @@ def get_registered_commands() -> Dict[str, Type["Command"]]: """ Return a dictionary of command names to command classes. """ - # pylint: disable=global-statement - global all_commands return all_commands @@ -108,11 +104,12 @@ def help(cls, name: str) -> None: # if i == 0: line = line.replace('usage: ', '') - print(" {}".format(line)) + print(f" {line}") if len(cls.names) > 1: + aliases = ", ".join(cls.names) print("ALIASES") - print(" {}".format(", ".join(cls.names))) + print(f" {aliases}") print() indent = " " @@ -168,7 +165,7 @@ def help(cls, name: str) -> None: f" case it will consume no objects as input; instead it" f" will locate all objects of type '{cls.output_type}'," f" and emit them as output.") - types = list() + types = [] for (_, method) in inspect.getmembers(cls, inspect.isroutine): if hasattr(method, "input_typename_handled"): types.append(method.input_typename_handled) @@ -203,7 +200,7 @@ def help(cls, name: str) -> None: # for line in inspect.getdoc( # type: ignore[union-attr] cls).splitlines()[2:]: - print("{}".format(line)) + print(f"{line}") print() # @@ -588,12 +585,11 @@ class Walk(Command): def _help_message(input_type: drgn.Type = None) -> str: msg = "" if input_type is not None: - msg = msg + "no walker found for input of type {}\n".format( - input_type) - msg = msg + "The following types have walkers:\n" - msg = msg + "\t%-20s %-20s\n" % ("WALKER", "TYPE") + msg += f"no walker found for input of type {input_type}\n" + msg += "The following types have walkers:\n" + msg += f"\t{'WALKER':-20s} {'TYPE':-20s}\n" for type_, class_ in Walker.allWalkers.items(): - msg = msg + "\t%-20s %-20s\n" % (class_.names[0], type_) + msg += f"\t{class_.names[0]:-20s} {type_:-20s}\n" return msg def _call(self, objs: Iterable[drgn.Object]) -> Iterable[drgn.Object]: @@ -645,11 +641,12 @@ def _call(self, objs: Iterable[drgn.Object]) -> Iterable[drgn.Object]: assert self.input_type is not None expected_type = type_canonicalize_name(self.input_type) for obj in objs: - if type_canonical_name(obj.type_) != expected_type: + canonical_type = type_canonical_name(obj.type_) + if canonical_type != expected_type: raise CommandError( self.name, - 'expected input of type {}, but received {}'.format( - expected_type, type_canonical_name(obj.type_))) + f'expected input of type {expected_type}, but received {canonical_type}' + ) yield from self.walk(obj) @@ -724,7 +721,7 @@ def caller(self, objs: Iterable[drgn.Object]) -> Iterable[drgn.Object]: out_type = None if self.output_type is not None: out_type = target.get_type(self.output_type) - baked = dict() + baked = {} for (_, method) in inspect.getmembers(self, inspect.ismethod): if not hasattr(method, "input_typename_handled"): continue @@ -762,8 +759,8 @@ def caller(self, objs: Iterable[drgn.Object]) -> Iterable[drgn.Object]: pass # error - raise CommandError( - self.name, 'no handler for input of type {}'.format(i.type_)) + raise CommandError(self.name, + f'no handler for input of type {i.type_}') def _call(self, objs: Iterable[drgn.Object]) -> Optional[Iterable[drgn.Object]]: diff --git a/sdb/commands/__init__.py b/sdb/commands/__init__.py index 911a0546..31b5a6b0 100644 --- a/sdb/commands/__init__.py +++ b/sdb/commands/__init__.py @@ -20,11 +20,11 @@ import importlib import os -for path in glob.glob("{}/*.py".format(os.path.dirname(__file__))): +for path in glob.glob(f"{os.path.dirname(__file__)}/*.py"): if path != __file__: module = os.path.splitext(os.path.basename(path))[0] - importlib.import_module("sdb.commands.{}".format(module)) + importlib.import_module(f"sdb.commands.{module}") -for path in glob.glob("{}/*/__init__.py".format(os.path.dirname(__file__))): +for path in glob.glob(f"{os.path.dirname(__file__)}/*/__init__.py"): module = os.path.basename(os.path.dirname(path)) - importlib.import_module("sdb.commands.{}".format(module)) + importlib.import_module(f"sdb.commands.{module}") diff --git a/sdb/commands/exit.py b/sdb/commands/exit.py index 4ca7905c..6577681d 100644 --- a/sdb/commands/exit.py +++ b/sdb/commands/exit.py @@ -23,7 +23,6 @@ class Exit(sdb.Command): - "Exit the application" names = ["exit", "quit"] diff --git a/sdb/commands/filter.py b/sdb/commands/filter.py index 195e7e5d..21471328 100644 --- a/sdb/commands/filter.py +++ b/sdb/commands/filter.py @@ -113,8 +113,8 @@ def _call_one(self, obj: drgn.Object) -> Iterable[drgn.Object]: if not isinstance(lhs, drgn.Object): raise sdb.CommandInvalidInputError( self.name, - "left hand side has unsupported type ({})".format( - type(lhs).__name__)) + f"left hand side has unsupported type ({type(lhs).__name__})" + ) if isinstance(rhs, str): lhs = lhs.string_().decode("utf-8") @@ -127,10 +127,10 @@ def _call_one(self, obj: drgn.Object) -> Iterable[drgn.Object]: else: raise sdb.CommandInvalidInputError( self.name, - "right hand side has unsupported type ({})".format( - type(rhs).__name__)) + f"right hand side has unsupported type ({type(rhs).__name__})" + ) - if eval("lhs {} rhs".format(self.compare), {'__builtins__': None}, { + if eval(f"lhs {self.compare} rhs", {'__builtins__': None}, { 'lhs': lhs, 'rhs': rhs }): diff --git a/sdb/commands/internal/__init__.py b/sdb/commands/internal/__init__.py index 9bafcd66..d824545a 100644 --- a/sdb/commands/internal/__init__.py +++ b/sdb/commands/internal/__init__.py @@ -20,7 +20,7 @@ import importlib import os -for path in glob.glob("{}/*.py".format(os.path.dirname(__file__))): +for path in glob.glob(f"{os.path.dirname(__file__)}/*.py"): if path != __file__: module = os.path.splitext(os.path.basename(path))[0] - importlib.import_module("sdb.commands.internal.{}".format(module)) + importlib.import_module(f"sdb.commands.internal.{module}") diff --git a/sdb/commands/linux/__init__.py b/sdb/commands/linux/__init__.py index 06502bef..fb12fdbd 100644 --- a/sdb/commands/linux/__init__.py +++ b/sdb/commands/linux/__init__.py @@ -20,11 +20,11 @@ import importlib import os -for path in glob.glob("{}/*.py".format(os.path.dirname(__file__))): +for path in glob.glob(f"{os.path.dirname(__file__)}/*.py"): if path != __file__: module = os.path.splitext(os.path.basename(path))[0] - importlib.import_module("sdb.commands.linux.{}".format(module)) + importlib.import_module(f"sdb.commands.linux.{module}") -for path in glob.glob("{}/*/__init__.py".format(os.path.dirname(__file__))): +for path in glob.glob(f"{os.path.dirname(__file__)}/*/__init__.py"): module = os.path.basename(os.path.dirname(path)) - importlib.import_module("sdb.commands.linux.{}".format(module)) + importlib.import_module(f"sdb.commands.linux.{module}") diff --git a/sdb/commands/linux/dmesg.py b/sdb/commands/linux/dmesg.py index b3311488..4f74aabf 100644 --- a/sdb/commands/linux/dmesg.py +++ b/sdb/commands/linux/dmesg.py @@ -54,4 +54,4 @@ def pretty_print(self, objs: Iterable[drgn.Object]) -> None: message = drgn.cast("char *", obj) + obj.type_.type.size text = message.string_().decode('utf-8', 'ignore') - print("[{:5d}.{:06d}]: {:s}".format(secs, usecs, text)) + print(f"[{secs:5d}.{usecs:06d}]: {text}") diff --git a/sdb/commands/linux/internal/__init__.py b/sdb/commands/linux/internal/__init__.py index f3764e35..78fbfa4f 100644 --- a/sdb/commands/linux/internal/__init__.py +++ b/sdb/commands/linux/internal/__init__.py @@ -20,7 +20,7 @@ import importlib import os -for path in glob.glob("{}/*.py".format(os.path.dirname(__file__))): +for path in glob.glob(f"{os.path.dirname(__file__)}/*.py"): if path != __file__: module = os.path.splitext(os.path.basename(path))[0] - importlib.import_module("sdb.commands.linux.internal.{}".format(module)) + importlib.import_module(f"sdb.commands.linux.internal.{module}") diff --git a/sdb/commands/linux/slabs.py b/sdb/commands/linux/slabs.py index f22ee2c8..ea925638 100644 --- a/sdb/commands/linux/slabs.py +++ b/sdb/commands/linux/slabs.py @@ -104,7 +104,7 @@ def no_input(self) -> Iterable[drgn.Object]: # that will be the input of the next command in the pipeline. # if self.args.s and not self.islast: - if self.args.s not in Slabs.FIELDS.keys(): + if Slabs.FIELDS[self.args.s] is None: raise sdb.CommandInvalidInputError( self.name, f"'{self.args.s}' is not a valid field") yield from sorted( @@ -154,8 +154,8 @@ def __pp_parse_args(self) -> Tuple[str, List[str], Dict[str, Any]]: for field in fields: if field not in self.FIELDS: - raise sdb.CommandError( - self.name, "'{:s}' is not a valid field".format(field)) + raise sdb.CommandError(self.name, + f"'{field}' is not a valid field") sort_field = "" if self.args.s: diff --git a/sdb/commands/member.py b/sdb/commands/member.py index 5cbd3d1b..e3d1a11c 100644 --- a/sdb/commands/member.py +++ b/sdb/commands/member.py @@ -178,8 +178,7 @@ def _parse_member_tokens( if not tokens[1].isdigit(): raise sdb.CommandError( self.name, - "incorrect index: '{}' is not a number".format( - tokens[1])) + f"incorrect index: '{tokens[1]}' is not a number") is_index = True idx = tokens[1] sep = MemberExprSep.ARRAY @@ -191,8 +190,7 @@ def _parse_member_tokens( if not is_index and not identifier.isidentifier(): raise sdb.CommandError( - self.name, - "{} is not an acceptable identifier".format(identifier)) + self.name, f"{identifier} is not an acceptable identifier") if not is_index: assert idx == "" @@ -238,8 +236,8 @@ def _validate_type_dereference(self, obj: drgn.Object, if kind == drgn.TypeKind.STRUCT and sep != MemberExprSep.DOT: raise sdb.CommandError( self.name, - "'{}' is a struct - use the dot(.) notation for member access". - format(obj.type_)) + f"'{obj.type_}' is a struct - use the dot(.) notation for member access" + ) if kind == drgn.TypeKind.POINTER: assert sep in [ @@ -249,8 +247,9 @@ def _validate_type_dereference(self, obj: drgn.Object, if kind == drgn.TypeKind.ARRAY and sep != MemberExprSep.ARRAY: raise sdb.CommandError( - self.name, "'{}' is an array - cannot use '{}' notation".format( - obj.type_, sep.value)) + self.name, + f"'{obj.type_}' is an array - cannot use '{sep.value}' notation" + ) def _validate_array_index(self, type_: drgn.Type, idx: int) -> None: """ diff --git a/sdb/commands/pretty_print.py b/sdb/commands/pretty_print.py index bcf23c0f..b1d5a617 100644 --- a/sdb/commands/pretty_print.py +++ b/sdb/commands/pretty_print.py @@ -41,8 +41,7 @@ def _call(self, objs: Iterable[drgn.Object]) -> None: if handling_class is None: if first_obj_type is not None: - msg = 'could not find pretty-printer for type {}\n'.format( - first_obj_type) + msg = f'could not find pretty-printer for type {first_obj_type}\n' else: msg = 'could not find pretty-printer\n' msg += "The following types have pretty-printers:\n" diff --git a/sdb/commands/pyfilter.py b/sdb/commands/pyfilter.py index c71f0be6..15de24ce 100644 --- a/sdb/commands/pyfilter.py +++ b/sdb/commands/pyfilter.py @@ -46,9 +46,12 @@ def __init__(self, raise sdb.CommandEvalSyntaxError(self.name, err) def _call(self, objs: Iterable[drgn.Object]) -> Iterable[drgn.Object]: - # pylint: disable=eval-used - func = lambda obj: eval(self.code, {'__builtins__': None}, {'obj': obj}) + + def filter_cb(obj: drgn.Object) -> Optional[drgn.Object]: + # pylint: disable=eval-used + return eval(self.code, {'__builtins__': None}, {'obj': obj}) + try: - yield from filter(func, objs) + yield from filter(filter_cb, objs) except (TypeError, AttributeError) as err: raise sdb.CommandError(self.name, str(err)) diff --git a/sdb/commands/spl/__init__.py b/sdb/commands/spl/__init__.py index 0531f47e..79d04557 100644 --- a/sdb/commands/spl/__init__.py +++ b/sdb/commands/spl/__init__.py @@ -20,7 +20,7 @@ import importlib import os -for path in glob.glob("{}/*.py".format(os.path.dirname(__file__))): +for path in glob.glob(f"{os.path.dirname(__file__)}/*.py"): if path != __file__: module = os.path.splitext(os.path.basename(path))[0] - importlib.import_module("sdb.commands.spl.{}".format(module)) + importlib.import_module(f"sdb.commands.spl.{module}") diff --git a/sdb/commands/spl/internal/__init__.py b/sdb/commands/spl/internal/__init__.py index 8733bb3f..bca8c1c5 100644 --- a/sdb/commands/spl/internal/__init__.py +++ b/sdb/commands/spl/internal/__init__.py @@ -20,7 +20,7 @@ import importlib import os -for path in glob.glob("{}/*.py".format(os.path.dirname(__file__))): +for path in glob.glob(f"{os.path.dirname(__file__)}/*.py"): if path != __file__: module = os.path.splitext(os.path.basename(path))[0] - importlib.import_module("sdb.commands.spl.internal.{}".format(module)) + importlib.import_module(f"sdb.commands.spl.internal.{module}") diff --git a/sdb/commands/spl/spl_kmem_caches.py b/sdb/commands/spl/spl_kmem_caches.py index 17ad8253..ff41743d 100644 --- a/sdb/commands/spl/spl_kmem_caches.py +++ b/sdb/commands/spl/spl_kmem_caches.py @@ -94,7 +94,7 @@ def no_input(self) -> Iterable[drgn.Object]: # that will be the input of the next command in the pipeline. # if self.args.s and not self.islast: - if self.args.s not in SplKmemCaches.FIELDS.keys(): + if SplKmemCaches.FIELDS[self.args.s] is None: raise sdb.CommandInvalidInputError( self.name, f"'{self.args.s}' is not a valid field") yield from sorted( @@ -154,8 +154,8 @@ def __pp_parse_args(self) -> Tuple[str, List[str], Dict[str, Any]]: for field in fields: if field not in SplKmemCaches.FIELDS: - raise sdb.CommandError( - self.name, "'{:s}' is not a valid field".format(field)) + raise sdb.CommandError(self.name, + f"'{field}' is not a valid field") sort_field = "" if self.args.s: diff --git a/sdb/commands/stacks.py b/sdb/commands/stacks.py index 3e06efcf..0fa105ae 100644 --- a/sdb/commands/stacks.py +++ b/sdb/commands/stacks.py @@ -173,8 +173,7 @@ def _init_parser(cls, name: str) -> argparse.ArgumentParser: "-t", "--tstate", help="only print threads which are in TSTATE thread state") - parser.epilog = "TSTATE := [{:s}]".format(", ".join( - Stacks.TASK_STATES.values())) + parser.epilog = f'TSTATE := [{", ".join(Stacks.TASK_STATES.values()):s}]' return parser # @@ -346,9 +345,9 @@ def match_stack(self, task: drgn.Object) -> bool: return False def print_header(self) -> None: - header = "{:<18} {:<16s}".format("TASK_STRUCT", "STATE") + header = f"{'TASK_STRUCT':<18} {'STATE':<16s}" if not self.args.all: - header += " {:>6s}".format("COUNT") + header += f" {'COUNT':>6s}" print(header) print("=" * 42) @@ -377,11 +376,10 @@ def print_stacks(self, objs: Iterable[drgn.Object]) -> None: if self.args.all: for task in tasks: - stacktrace_info += "{:<18s} {:<16s}\n".format( - hex(task.value_()), task_state) + stacktrace_info += f"{hex(task.value_()):<18s} {task_state:<16s}\n" else: - stacktrace_info += "{:<18s} {:<16s} {:6d}\n".format( - hex(tasks[0].value_()), task_state, len(tasks)) + task_ptr = hex(tasks[0].value_()) + stacktrace_info += f"{task_ptr:<18s} {task_state:<16s} {len(tasks):6d}\n" frame_pcs: Tuple[int, ...] = stack_key[1] for frame_pc in frame_pcs: @@ -392,7 +390,7 @@ def print_stacks(self, objs: Iterable[drgn.Object]) -> None: except LookupError: func = hex(frame_pc) offset = 0x0 - stacktrace_info += "{:18s}{}+{}\n".format("", func, hex(offset)) + stacktrace_info += f"{'':18s}{func}+{hex(offset)}\n" print(stacktrace_info) def pretty_print(self, objs: Iterable[drgn.Object]) -> None: diff --git a/sdb/commands/sum.py b/sdb/commands/sum.py index eace748d..efaffdc4 100644 --- a/sdb/commands/sum.py +++ b/sdb/commands/sum.py @@ -46,7 +46,7 @@ def _call(self, objs: Iterable[drgn.Object]) -> Iterable[drgn.Object]: result = 0 for obj in objs: type_ = sdb.type_canonicalize(obj.type_) - if type_.kind != drgn.TypeKind.INT and type_.kind != drgn.TypeKind.POINTER: + if type_.kind not in (drgn.TypeKind.INT, drgn.TypeKind.POINTER): raise sdb.CommandError( self.name, f"'{type_.type_name()}' is not an integer type") result += int(obj.value_()) diff --git a/sdb/commands/zfs/__init__.py b/sdb/commands/zfs/__init__.py index 9f511412..15c719d7 100644 --- a/sdb/commands/zfs/__init__.py +++ b/sdb/commands/zfs/__init__.py @@ -20,7 +20,7 @@ import importlib import os -for path in glob.glob("{}/*.py".format(os.path.dirname(__file__))): +for path in glob.glob(f"{os.path.dirname(__file__)}/*.py"): if path != __file__: module = os.path.splitext(os.path.basename(path))[0] - importlib.import_module("sdb.commands.zfs.{}".format(module)) + importlib.import_module(f"sdb.commands.zfs.{module}") diff --git a/sdb/commands/zfs/arc.py b/sdb/commands/zfs/arc.py index 1ba54cf5..e69e3995 100644 --- a/sdb/commands/zfs/arc.py +++ b/sdb/commands/zfs/arc.py @@ -32,7 +32,7 @@ def print_stats(obj: drgn.Object) -> None: names = [memb.name for memb in sdb.get_type('struct arc_stats').members] for name in names: - print("{:32} = {}".format(name, int(obj.member_(name).value.ui64))) + print(f"{name:32} = {int(obj.member_(name).value.ui64)}") def pretty_print(self, objs: Iterable[drgn.Object]) -> None: for obj in objs: diff --git a/sdb/commands/zfs/dbuf.py b/sdb/commands/zfs/dbuf.py index 898c3f62..186265ed 100644 --- a/sdb/commands/zfs/dbuf.py +++ b/sdb/commands/zfs/dbuf.py @@ -77,18 +77,22 @@ def DatasetName(ds: drgn.Object) -> str: @staticmethod def ObjsetName(os: drgn.Object) -> str: if not os.os_dsl_dataset: - return '{}/_MOS'.format( - os.os_spa.spa_name.string_().decode("utf-8")) + spa_name = os.os_spa.spa_name.string_().decode("utf-8") + return f'{spa_name}/_MOS' return Dbuf.DatasetName(os.os_dsl_dataset) def pretty_print(self, objs: drgn.Object) -> None: - print("{:>20} {:>8} {:>4} {:>8} {:>5} {}".format( - "addr", "object", "lvl", "blkid", "holds", "os")) + print( + f"{'addr':>20} {'object':>8} {'lvl':>4} {'blkid':>8} {'holds':>5} os" + ) for dbuf in filter(self.argfilter, objs): - print("{:>20} {:>8d} {:>4d} {:>8d} {:>5d} {}".format( - hex(dbuf), int(dbuf.db.db_object), int(dbuf.db_level), - int(dbuf.db_blkid), int(dbuf.db_holds.rc_count), - Dbuf.ObjsetName(dbuf.db_objset))) + entry = (f"{hex(dbuf):>20}" + f" {int(dbuf.db.db_object):>8d}" + f" {int(dbuf.db_level):>4d}" + f" {int(dbuf.db_blkid):>8d}" + f" {int(dbuf.db_holds.rc_count):>5d}" + f" {Dbuf.ObjsetName(dbuf.db_objset)}") + print(entry) def argfilter(self, db: drgn.Object) -> bool: # self.args.object (and friends) may be set to 0, indicating a search diff --git a/sdb/commands/zfs/internal/__init__.py b/sdb/commands/zfs/internal/__init__.py index 7909c29c..677c14cd 100644 --- a/sdb/commands/zfs/internal/__init__.py +++ b/sdb/commands/zfs/internal/__init__.py @@ -34,9 +34,9 @@ def enum_lookup(enum_type_name: str, value: int) -> str: def nicenum(num: int, suffix: str = "B") -> str: for unit in ["", "K", "M", "G", "T", "P", "E", "Z"]: if num < 1024: - return "{}{}{}".format(int(num), unit, suffix) + return f"{int(num)}{unit}{suffix}" num = int(num / 1024) - return "{}{}{}".format(int(num), "Y", suffix) + return "{int(num)}Y{suffix}" def P2PHASE(x: drgn.Object, align: int) -> int: diff --git a/sdb/commands/zfs/metaslab.py b/sdb/commands/zfs/metaslab.py index 7c7b0465..c50c4818 100644 --- a/sdb/commands/zfs/metaslab.py +++ b/sdb/commands/zfs/metaslab.py @@ -97,8 +97,8 @@ def metaslab_weight_print(msp: drgn.Object, print_header: bool, print((str(int(msp.ms_fragmentation)) + "%").rjust(5), end="") print( str(str(int(msp.ms_allocated_space) >> 20) + "M").rjust(7), - ("({0:.1f}%)".format( - int(msp.ms_allocated_space) * 100 / int(msp.ms_size)).rjust(7)), + f"({(int(msp.ms_allocated_space) * 100 / int(msp.ms_size)):.1f}%)". + rjust(7), nicenum(msp.ms_max_size).rjust(10), end="", ) @@ -187,10 +187,11 @@ def from_vdev(self, vdev: drgn.Object) -> Iterable[drgn.Object]: # yield the requested metaslabs for i in self.args.metaslab_ids: if i >= vdev.vdev_ms_count: + ms_count = int(vdev.vdev_ms_count) + vdev = int(vdev.vdev_id) raise sdb.CommandError( - self.name, "metaslab id {} not valid; " - "there are only {} metaslabs in vdev id {}".format( - i, int(vdev.vdev_ms_count), int(vdev.vdev_id))) + self.name, f"metaslab id {i} not valid; " + f"there are only {ms_count} metaslabs in vdev {vdev}") yield vdev.vdev_ms[i] else: for i in range(int(vdev.vdev_ms_count)): diff --git a/sdb/commands/zfs/range_tree.py b/sdb/commands/zfs/range_tree.py index 4cda8962..63aae5d8 100644 --- a/sdb/commands/zfs/range_tree.py +++ b/sdb/commands/zfs/range_tree.py @@ -71,7 +71,6 @@ class RangeSeg(sdb.Locator): """ names = ['range_seg'] - #pylint: disable=no-self-use @sdb.InputHandler('range_tree_t *') def from_range_tree(self, rt: drgn.Object) -> Iterable[drgn.Object]: enum_dict = dict(sdb.get_type('enum range_seg_type').enumerators) diff --git a/sdb/commands/zfs/spa.py b/sdb/commands/zfs/spa.py index 160e504d..3fc37400 100644 --- a/sdb/commands/zfs/spa.py +++ b/sdb/commands/zfs/spa.py @@ -66,11 +66,11 @@ def __init__(self, self.arg_list.append("-w") def pretty_print(self, objs: Iterable[drgn.Object]) -> None: - print("{:18} {}".format("ADDR", "NAME")) - print("%s" % ("-" * 60)) + print(f"{'ADDR':18} NAME") + print(f"{('-' * 60)}") for spa in objs: - print("{:18} {}".format(hex(spa), - spa.spa_name.string_().decode("utf-8"))) + spa_name = spa.spa_name.string_().decode("utf-8") + print(f"{hex(spa):18} {spa_name}") if self.args.histogram: ZFSHistogram.print_histogram(spa.spa_normal_class.mc_histogram, 0, 5) diff --git a/sdb/commands/zfs/vdev.py b/sdb/commands/zfs/vdev.py index 883e5abe..7d3a842f 100644 --- a/sdb/commands/zfs/vdev.py +++ b/sdb/commands/zfs/vdev.py @@ -138,11 +138,12 @@ def from_spa(self, spa: drgn.Object) -> Iterable[drgn.Object]: # yield the requested top-level vdevs for i in self.args.vdev_ids: if i >= spa.spa_root_vdev.vdev_children: + children = int(spa.spa_root_vdev.vdev_children) + spa_name = spa.spa_name.string_().decode("utf-8") raise sdb.CommandError( self.name, - "vdev id {} not valid; there are only {} vdevs in {}". - format(i, int(spa.spa_root_vdev.vdev_children), - spa.spa_name.string_().decode("utf-8"))) + f"vdev id {i} not valid; there are only {children} vdevs in {spa_name}" + ) yield spa.spa_root_vdev.vdev_child[i] else: yield from self.from_vdev(spa.spa_root_vdev) diff --git a/sdb/commands/zfs/zfs_dbgmsg.py b/sdb/commands/zfs/zfs_dbgmsg.py index 3fb534e0..6d28633f 100644 --- a/sdb/commands/zfs/zfs_dbgmsg.py +++ b/sdb/commands/zfs/zfs_dbgmsg.py @@ -42,11 +42,10 @@ def print_msg(obj: drgn.Object, print_timestamp: bool = False, print_address: bool = False) -> None: if print_address: - print("{} ".format(hex(obj)), end="") + print(f"{hex(obj)} ", end="") if print_timestamp: timestamp = datetime.datetime.fromtimestamp(int(obj.zdm_timestamp)) - print("{}: ".format(timestamp.strftime("%Y-%m-%dT%H:%M:%S")), - end="") + print(f"{timestamp.strftime('%Y-%m-%dT%H:%M:%S')}: ", end="") print(drgn.cast("char *", obj.zdm_msg).string_().decode("utf-8")) diff --git a/sdb/pipeline.py b/sdb/pipeline.py index f5a2dac3..4c6f7ab6 100644 --- a/sdb/pipeline.py +++ b/sdb/pipeline.py @@ -23,8 +23,8 @@ import drgn -import sdb.parser as parser -import sdb.target as target +from sdb import parser +from sdb import target from sdb.error import CommandArgumentsError, CommandNotFoundError from sdb.command import Address, Cast, Command, get_registered_commands diff --git a/sdb/target.py b/sdb/target.py index ed9c11d4..309b6959 100644 --- a/sdb/target.py +++ b/sdb/target.py @@ -51,42 +51,34 @@ def get_type(type_name: str) -> drgn.Type: - global prog return prog.type(type_name) def get_pointer_type(type_name: str) -> drgn.Type: - global prog return prog.pointer_type(type_name) def is_null(obj: drgn.Object) -> bool: - global prog return bool(obj == drgn.NULL(prog, obj.type_)) def create_object(type_: Union[str, drgn.Type], val: Any) -> drgn.Object: - global prog return drgn.Object(prog, type_, value=val) def get_target_flags() -> drgn.ProgramFlags: - global prog return prog.flags def get_object(obj_name: str) -> drgn.Object: - global prog return prog[obj_name] def get_symbol(sym: Union[str, int]) -> drgn.Symbol: - global prog return prog.symbol(sym) def get_prog() -> drgn.Program: - global prog return prog @@ -104,7 +96,6 @@ def type_canonicalize(t: drgn.Type) -> drgn.Type: Note: function type's arguments and return types are not canonicalized. """ - global prog if t.kind == drgn.TypeKind.TYPEDEF: return type_canonicalize(t.type) if t.kind == drgn.TypeKind.POINTER: @@ -125,7 +116,6 @@ def type_canonicalize_name(type_name: str) -> str: """ Return the "canonical name" of this type name. See type_canonicalize(). """ - global prog return type_canonical_name(prog.type(type_name)) diff --git a/tests/integration/data/regression_output/linux/echo 0xffffa089669edc00 | stack b/tests/integration/data/regression_output/linux/echo 0xffffa089669edc00 | stack index 0e713d5b..3e555fbc 100644 --- a/tests/integration/data/regression_output/linux/echo 0xffffa089669edc00 | stack +++ b/tests/integration/data/regression_output/linux/echo 0xffffa089669edc00 | stack @@ -1,6 +1,7 @@ TASK_STRUCT STATE COUNT ========================================== 0xffffa089669edc00 INTERRUPTIBLE 1 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c schedule_hrtimeout_range_clock+0x181 @@ -8,6 +9,8 @@ TASK_STRUCT STATE COUNT ep_poll+0x258 do_epoll_wait+0xb0 __x64_sys_epoll_wait+0x1e + __x64_sys_epoll_wait+0x1e + __x64_sys_epoll_wait+0x1e do_syscall_64+0x5a entry_SYSCALL_64+0x7c diff --git a/tests/integration/data/regression_output/linux/stacks b/tests/integration/data/regression_output/linux/stacks index 3b6f9a41..69409db3 100644 --- a/tests/integration/data/regression_output/linux/stacks +++ b/tests/integration/data/regression_output/linux/stacks @@ -1,6 +1,7 @@ TASK_STRUCT STATE COUNT ========================================== 0xffffa08957da8000 INTERRUPTIBLE 164 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c taskq_thread+0x354 @@ -8,16 +9,21 @@ TASK_STRUCT STATE COUNT ret_from_fork+0x1f 0xffffa0893a532e00 INTERRUPTIBLE 70 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c futex_wait_queue_me+0xc4 + futex_wait_queue_me+0xc4 futex_wait+0x10a do_futex+0x364 __x64_sys_futex+0x13f + __x64_sys_futex+0x13f + __x64_sys_futex+0x13f do_syscall_64+0x5a entry_SYSCALL_64+0x7c 0xffffa08958085c00 INTERRUPTIBLE 64 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c schedule_timeout+0x169 @@ -27,6 +33,7 @@ TASK_STRUCT STATE COUNT ret_from_fork+0x1f 0xffffa089669edc00 INTERRUPTIBLE 33 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c schedule_hrtimeout_range_clock+0x181 @@ -34,17 +41,22 @@ TASK_STRUCT STATE COUNT ep_poll+0x258 do_epoll_wait+0xb0 __x64_sys_epoll_wait+0x1e + __x64_sys_epoll_wait+0x1e + __x64_sys_epoll_wait+0x1e do_syscall_64+0x5a entry_SYSCALL_64+0x7c 0xffffa0895803c500 INTERRUPTIBLE 33 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c irq_thread+0x9a + irq_thread+0x9a kthread+0x121 ret_from_fork+0x1f 0xffffa089669eae00 IDLE 28 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c rescuer_thread+0x310 @@ -52,6 +64,7 @@ TASK_STRUCT STATE COUNT ret_from_fork+0x1f 0xffffa089669e9700 IDLE 23 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c worker_thread+0xbc @@ -59,6 +72,7 @@ TASK_STRUCT STATE COUNT ret_from_fork+0x1f 0xffffa08952ec4500 INTERRUPTIBLE 19 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c schedule_hrtimeout_range_clock+0xb9 @@ -66,44 +80,57 @@ TASK_STRUCT STATE COUNT ep_poll+0x258 do_epoll_wait+0xb0 __x64_sys_epoll_wait+0x1e + __x64_sys_epoll_wait+0x1e + __x64_sys_epoll_wait+0x1e do_syscall_64+0x5a entry_SYSCALL_64+0x7c 0xffffa0893691dc00 INTERRUPTIBLE 18 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c do_wait+0x1cb kernel_wait4+0x89 __do_sys_wait4+0x95 __x64_sys_wait4+0x1e + __x64_sys_wait4+0x1e do_syscall_64+0x5a entry_SYSCALL_64+0x7c 0xffffa08936918000 INTERRUPTIBLE 16 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c pipe_wait+0x70 pipe_read+0x21f new_sync_read+0x109 + new_sync_read+0x109 __vfs_read+0x29 vfs_read+0x8e ksys_read+0x5c __x64_sys_read+0x1a + __x64_sys_read+0x1a + __x64_sys_read+0x1a do_syscall_64+0x5a entry_SYSCALL_64+0x7c 0xffffa08958081700 INTERRUPTIBLE 14 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c schedule_hrtimeout_range_clock+0x181 schedule_hrtimeout_range+0x13 poll_schedule_timeout.constprop.11+0x46 do_sys_poll+0x3d6 + do_sys_poll+0x3d6 + __x64_sys_poll+0x3b + __x64_sys_poll+0x3b __x64_sys_poll+0x3b do_syscall_64+0x5a entry_SYSCALL_64+0x7c 0xffffa0895684c500 INTERRUPTIBLE 13 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c cv_wait_common+0x11f @@ -114,15 +141,20 @@ TASK_STRUCT STATE COUNT ret_from_fork+0x1f 0xffffa08931969700 INTERRUPTIBLE 9 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c do_nanosleep+0x89 + do_nanosleep+0x89 hrtimer_nanosleep+0xd8 __x64_sys_nanosleep+0x74 + __x64_sys_nanosleep+0x74 + __x64_sys_nanosleep+0x74 do_syscall_64+0x5a entry_SYSCALL_64+0x7c 0xffffa08966a00000 INTERRUPTIBLE 8 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c smpboot_thread_fn+0x169 @@ -130,6 +162,7 @@ TASK_STRUCT STATE COUNT ret_from_fork+0x1f 0xffffa08931968000 INTERRUPTIBLE 7 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c schedule_hrtimeout_range_clock+0x181 @@ -139,10 +172,13 @@ TASK_STRUCT STATE COUNT core_sys_select+0x1d3 kern_select+0xb7 __x64_sys_select+0x24 + __x64_sys_select+0x24 + __x64_sys_select+0x24 do_syscall_64+0x5a entry_SYSCALL_64+0x7c 0xffffa08940965c00 INTERRUPTIBLE 7 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c schedule_hrtimeout_range_clock+0xb9 @@ -152,18 +188,24 @@ TASK_STRUCT STATE COUNT core_sys_select+0x1d3 kern_select+0xb7 __x64_sys_select+0x24 + __x64_sys_select+0x24 + __x64_sys_select+0x24 do_syscall_64+0x5a entry_SYSCALL_64+0x7c 0xffffa0893649ae00 INTERRUPTIBLE 4 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c sigsuspend+0x4a __x64_sys_rt_sigsuspend+0x4a + __x64_sys_rt_sigsuspend+0x4a + __x64_sys_rt_sigsuspend+0x4a do_syscall_64+0x5a entry_SYSCALL_64+0x7c 0xffffa0895820dc00 INTERRUPTIBLE 3 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c scsi_error_handler+0x1dd @@ -171,6 +213,7 @@ TASK_STRUCT STATE COUNT ret_from_fork+0x1f 0xffffa08957e3c500 INTERRUPTIBLE 3 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c cv_wait_common+0x11f @@ -182,6 +225,7 @@ TASK_STRUCT STATE COUNT ret_from_fork+0x1f 0xffffa08957da9700 INTERRUPTIBLE 3 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c schedule_timeout+0x169 @@ -194,6 +238,7 @@ TASK_STRUCT STATE COUNT ret_from_fork+0x1f 0xffffa08952e5ae00 INTERRUPTIBLE 3 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c schedule_hrtimeout_range_clock+0xb9 @@ -207,6 +252,7 @@ TASK_STRUCT STATE COUNT ret_from_fork+0x1f 0xffffa089320c5c00 INTERRUPTIBLE 2 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c __x64_sys_pause+0x30 @@ -214,41 +260,53 @@ TASK_STRUCT STATE COUNT entry_SYSCALL_64+0x7c 0xffffa089304eae00 INTERRUPTIBLE 2 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c schedule_hrtimeout_range_clock+0x181 schedule_hrtimeout_range+0x13 do_sigtimedwait+0x18f + do_sigtimedwait+0x18f + __x64_sys_rt_sigtimedwait+0x72 + __x64_sys_rt_sigtimedwait+0x72 __x64_sys_rt_sigtimedwait+0x72 do_syscall_64+0x5a entry_SYSCALL_64+0x7c 0xffffa088ef2d1700 INTERRUPTIBLE 2 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c schedule_timeout+0x1db inet_csk_accept+0x246 + inet_csk_accept+0x246 inet_accept+0x45 __sys_accept4+0x104 __x64_sys_accept+0x1c + __x64_sys_accept+0x1c + __x64_sys_accept+0x1c do_syscall_64+0x5a entry_SYSCALL_64+0x7c 0xffffa089669ec500 INTERRUPTIBLE 1 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c kthreadd+0x2e8 ret_from_fork+0x1f 0xffffa08966a01700 RUNNING 1 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c schedule_timeout+0x169 rcu_gp_kthread+0x572 + rcu_gp_kthread+0x572 kthread+0x121 ret_from_fork+0x1f 0xffffa08966a6dc00 INTERRUPTIBLE 1 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c devtmpfsd+0x159 @@ -256,6 +314,7 @@ TASK_STRUCT STATE COUNT ret_from_fork+0x1f 0xffffa08966a6ae00 INTERRUPTIBLE 1 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c rcu_tasks_kthread+0x391 @@ -263,6 +322,7 @@ TASK_STRUCT STATE COUNT ret_from_fork+0x1f 0xffffa08966a68000 INTERRUPTIBLE 1 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c kauditd_thread+0x18e @@ -270,6 +330,7 @@ TASK_STRUCT STATE COUNT ret_from_fork+0x1f 0xffffa08966bcae00 INTERRUPTIBLE 1 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c schedule_timeout+0x169 @@ -279,6 +340,7 @@ TASK_STRUCT STATE COUNT ret_from_fork+0x1f 0xffffa08966bc8000 INTERRUPTIBLE 1 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c oom_reaper+0x13a @@ -286,6 +348,7 @@ TASK_STRUCT STATE COUNT ret_from_fork+0x1f 0xffffa08966bcdc00 INTERRUPTIBLE 1 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c kcompactd+0x166 @@ -293,6 +356,7 @@ TASK_STRUCT STATE COUNT ret_from_fork+0x1f 0xffffa08966bcc500 INTERRUPTIBLE 1 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c ksm_scan_thread+0x210 @@ -300,13 +364,16 @@ TASK_STRUCT STATE COUNT ret_from_fork+0x1f 0xffffa08966bd2e00 INTERRUPTIBLE 1 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c khugepaged+0x403 + khugepaged+0x403 kthread+0x121 ret_from_fork+0x1f 0xffffa089666d1700 INTERRUPTIBLE 1 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c kthread_worker_fn+0x1ae @@ -314,13 +381,16 @@ TASK_STRUCT STATE COUNT ret_from_fork+0x1f 0xffffa08966791700 INTERRUPTIBLE 1 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c kswapd+0x3f1 + kswapd+0x3f1 kthread+0x121 ret_from_fork+0x1f 0xffffa089587bc500 INTERRUPTIBLE 1 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c ecryptfs_threadfn+0x139 @@ -328,6 +398,7 @@ TASK_STRUCT STATE COUNT ret_from_fork+0x1f 0xffffa08956849700 INTERRUPTIBLE 1 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c schedule_hrtimeout_range_clock+0xb9 @@ -341,6 +412,7 @@ TASK_STRUCT STATE COUNT ret_from_fork+0x1f 0xffffa0895684dc00 INTERRUPTIBLE 1 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c schedule_hrtimeout_range_clock+0xb9 @@ -354,6 +426,7 @@ TASK_STRUCT STATE COUNT ret_from_fork+0x1f 0xffffa089580b1700 INTERRUPTIBLE 1 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c schedule_timeout+0x169 @@ -365,17 +438,22 @@ TASK_STRUCT STATE COUNT ret_from_fork+0x1f 0xffffa089320e4500 INTERRUPTIBLE 1 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c schedule_hrtimeout_range_clock+0xb9 schedule_hrtimeout_range+0x13 poll_schedule_timeout.constprop.11+0x46 do_sys_poll+0x3d6 + do_sys_poll+0x3d6 + __x64_sys_poll+0xa3 + __x64_sys_poll+0xa3 __x64_sys_poll+0xa3 do_syscall_64+0x5a entry_SYSCALL_64+0x7c 0xffffa089408fdc00 INTERRUPTIBLE 1 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c cv_wait_common+0x11f @@ -385,12 +463,16 @@ TASK_STRUCT STATE COUNT zfsdev_ioctl_common+0x529 zfsdev_ioctl+0x52 do_vfs_ioctl+0xa9 + do_vfs_ioctl+0xa9 ksys_ioctl+0x75 __x64_sys_ioctl+0x1a + __x64_sys_ioctl+0x1a + __x64_sys_ioctl+0x1a do_syscall_64+0x5a entry_SYSCALL_64+0x7c 0xffffa089408f4500 INTERRUPTIBLE 1 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c do_syslog.part.23+0x7ef @@ -401,10 +483,13 @@ TASK_STRUCT STATE COUNT vfs_read+0x8e ksys_read+0x5c __x64_sys_read+0x1a + __x64_sys_read+0x1a + __x64_sys_read+0x1a do_syscall_64+0x5a entry_SYSCALL_64+0x7c 0xffffa0895541ae00 INTERRUPTIBLE 1 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c schedule_timeout+0x1db @@ -413,17 +498,22 @@ TASK_STRUCT STATE COUNT skb_recv_datagram+0x3f netlink_recvmsg+0x57 sock_recvmsg+0x43 + sock_recvmsg+0x43 ___sys_recvmsg+0xf5 __sys_recvmsg+0x60 __x64_sys_recvmsg+0x1f + __x64_sys_recvmsg+0x1f + __x64_sys_recvmsg+0x1f do_syscall_64+0x5a entry_SYSCALL_64+0x7c 0xffffa08905909700 INTERRUPTIBLE 1 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c schedule_timeout+0x1db inet_csk_accept+0x246 + inet_csk_accept+0x246 inet_accept+0x45 kernel_accept+0x59 0xffffffffc0d66f63+0x0 @@ -432,6 +522,7 @@ TASK_STRUCT STATE COUNT ret_from_fork+0x1f 0xffffa0888cc64500 INTERRUPTIBLE 1 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c schedule_hrtimeout_range_clock+0x181 @@ -440,10 +531,14 @@ TASK_STRUCT STATE COUNT do_select+0x60d core_sys_select+0x1d3 __x64_sys_pselect6+0x126 + __x64_sys_pselect6+0x126 + __x64_sys_pselect6+0x126 + __x64_sys_pselect6+0x126 do_syscall_64+0x5a entry_SYSCALL_64+0x7c 0xffffa08941afae00 INTERRUPTIBLE 1 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c eventfd_read+0x189 @@ -451,14 +546,23 @@ TASK_STRUCT STATE COUNT vfs_read+0x8e ksys_read+0x5c __x64_sys_read+0x1a + __x64_sys_read+0x1a + __x64_sys_read+0x1a do_syscall_64+0x5a entry_SYSCALL_64+0x7c 0xffffa0888cc62e00 RUNNING 1 + new_slab+0x240 + new_slab+0x240 + new_slab+0x240 + new_slab+0x240 new_slab+0x240 ___slab_alloc+0x393 + ___slab_alloc+0x393 __slab_alloc+0x20 kmem_cache_alloc+0x182 + kmem_cache_alloc+0x182 + kmem_cache_alloc+0x182 spl_kmem_cache_alloc+0x46 zio_data_buf_alloc+0x55 zil_itx_create+0x29 @@ -468,14 +572,18 @@ TASK_STRUCT STATE COUNT zpl_iter_write_common+0x81 zpl_iter_write+0x4f new_sync_write+0x10c + new_sync_write+0x10c __vfs_write+0x29 vfs_write+0xb1 ksys_write+0x5c __x64_sys_write+0x1a + __x64_sys_write+0x1a + __x64_sys_write+0x1a do_syscall_64+0x5a entry_SYSCALL_64+0x7c 0xffffa08884831700 RUNNING 1 + __crash_kexec+0x9d __crash_kexec+0x9d panic+0x10e 0xffffffff8b849f25+0x0 @@ -486,6 +594,8 @@ TASK_STRUCT STATE COUNT vfs_write+0xb1 ksys_write+0x5c __x64_sys_write+0x1a + __x64_sys_write+0x1a + __x64_sys_write+0x1a do_syscall_64+0x5a entry_SYSCALL_64+0x7c diff --git a/tests/integration/data/regression_output/linux/stacks -a b/tests/integration/data/regression_output/linux/stacks -a index e4d19c08..3c4adefc 100644 --- a/tests/integration/data/regression_output/linux/stacks -a +++ b/tests/integration/data/regression_output/linux/stacks -a @@ -164,6 +164,7 @@ TASK_STRUCT STATE 0xffffa0888d2c8000 INTERRUPTIBLE 0xffffa0888d2fdc00 INTERRUPTIBLE 0xffffa087d20edc00 INTERRUPTIBLE + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c taskq_thread+0x354 @@ -240,12 +241,16 @@ TASK_STRUCT STATE 0xffffa08888c49700 INTERRUPTIBLE 0xffffa08888c48000 INTERRUPTIBLE 0xffffa088ca874500 INTERRUPTIBLE + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c futex_wait_queue_me+0xc4 + futex_wait_queue_me+0xc4 futex_wait+0x10a do_futex+0x364 __x64_sys_futex+0x13f + __x64_sys_futex+0x13f + __x64_sys_futex+0x13f do_syscall_64+0x5a entry_SYSCALL_64+0x7c @@ -313,6 +318,7 @@ TASK_STRUCT STATE 0xffffa08939f74500 INTERRUPTIBLE 0xffffa08939f72e00 INTERRUPTIBLE 0xffffa0893c08ae00 INTERRUPTIBLE + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c schedule_timeout+0x169 @@ -354,6 +360,7 @@ TASK_STRUCT STATE 0xffffa0893196c500 INTERRUPTIBLE 0xffffa088f7408000 INTERRUPTIBLE 0xffffa08931488000 INTERRUPTIBLE + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c schedule_hrtimeout_range_clock+0x181 @@ -361,6 +368,8 @@ TASK_STRUCT STATE ep_poll+0x258 do_epoll_wait+0xb0 __x64_sys_epoll_wait+0x1e + __x64_sys_epoll_wait+0x1e + __x64_sys_epoll_wait+0x1e do_syscall_64+0x5a entry_SYSCALL_64+0x7c @@ -397,9 +406,11 @@ TASK_STRUCT STATE 0xffffa0895820ae00 INTERRUPTIBLE 0xffffa08958208000 INTERRUPTIBLE 0xffffa089320e5c00 INTERRUPTIBLE + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c irq_thread+0x9a + irq_thread+0x9a kthread+0x121 ret_from_fork+0x1f @@ -431,6 +442,7 @@ TASK_STRUCT STATE 0xffffa08957e38000 IDLE 0xffffa0890590c500 IDLE 0xffffa0890590dc00 IDLE + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c rescuer_thread+0x310 @@ -460,6 +472,7 @@ TASK_STRUCT STATE 0xffffa08905908000 IDLE 0xffffa0893c2b2e00 IDLE 0xffffa0893c2b5c00 IDLE + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c worker_thread+0xbc @@ -485,6 +498,7 @@ TASK_STRUCT STATE 0xffffa088f677ae00 INTERRUPTIBLE 0xffffa088ca871700 INTERRUPTIBLE 0xffffa088ca875c00 INTERRUPTIBLE + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c schedule_hrtimeout_range_clock+0xb9 @@ -492,6 +506,8 @@ TASK_STRUCT STATE ep_poll+0x258 do_epoll_wait+0xb0 __x64_sys_epoll_wait+0x1e + __x64_sys_epoll_wait+0x1e + __x64_sys_epoll_wait+0x1e do_syscall_64+0x5a entry_SYSCALL_64+0x7c @@ -513,12 +529,14 @@ TASK_STRUCT STATE 0xffffa0888548ae00 INTERRUPTIBLE 0xffffa0893c08c500 INTERRUPTIBLE 0xffffa08884830000 INTERRUPTIBLE + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c do_wait+0x1cb kernel_wait4+0x89 __do_sys_wait4+0x95 __x64_sys_wait4+0x1e + __x64_sys_wait4+0x1e do_syscall_64+0x5a entry_SYSCALL_64+0x7c @@ -538,15 +556,19 @@ TASK_STRUCT STATE 0xffffa08894565c00 INTERRUPTIBLE 0xffffa08894458000 INTERRUPTIBLE 0xffffa0889445c500 INTERRUPTIBLE + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c pipe_wait+0x70 pipe_read+0x21f new_sync_read+0x109 + new_sync_read+0x109 __vfs_read+0x29 vfs_read+0x8e ksys_read+0x5c __x64_sys_read+0x1a + __x64_sys_read+0x1a + __x64_sys_read+0x1a do_syscall_64+0x5a entry_SYSCALL_64+0x7c @@ -564,12 +586,16 @@ TASK_STRUCT STATE 0xffffa0893196ae00 INTERRUPTIBLE 0xffffa08884834500 INTERRUPTIBLE 0xffffa08884832e00 INTERRUPTIBLE + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c schedule_hrtimeout_range_clock+0x181 schedule_hrtimeout_range+0x13 poll_schedule_timeout.constprop.11+0x46 do_sys_poll+0x3d6 + do_sys_poll+0x3d6 + __x64_sys_poll+0x3b + __x64_sys_poll+0x3b __x64_sys_poll+0x3b do_syscall_64+0x5a entry_SYSCALL_64+0x7c @@ -587,6 +613,7 @@ TASK_STRUCT STATE 0xffffa08883df5c00 INTERRUPTIBLE 0xffffa08883df1700 INTERRUPTIBLE 0xffffa08937f4dc00 INTERRUPTIBLE + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c cv_wait_common+0x11f @@ -605,11 +632,15 @@ TASK_STRUCT STATE 0xffffa0896510c500 INTERRUPTIBLE 0xffffa0894b284500 INTERRUPTIBLE 0xffffa088f1e95c00 INTERRUPTIBLE + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c do_nanosleep+0x89 + do_nanosleep+0x89 hrtimer_nanosleep+0xd8 __x64_sys_nanosleep+0x74 + __x64_sys_nanosleep+0x74 + __x64_sys_nanosleep+0x74 do_syscall_64+0x5a entry_SYSCALL_64+0x7c @@ -621,6 +652,7 @@ TASK_STRUCT STATE 0xffffa08966a51700 INTERRUPTIBLE 0xffffa08966a55c00 INTERRUPTIBLE 0xffffa08966a54500 INTERRUPTIBLE + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c smpboot_thread_fn+0x169 @@ -634,6 +666,7 @@ TASK_STRUCT STATE 0xffffa08952ec0000 INTERRUPTIBLE 0xffffa0893c2b1700 INTERRUPTIBLE 0xffffa088a150ae00 INTERRUPTIBLE + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c schedule_hrtimeout_range_clock+0x181 @@ -643,6 +676,8 @@ TASK_STRUCT STATE core_sys_select+0x1d3 kern_select+0xb7 __x64_sys_select+0x24 + __x64_sys_select+0x24 + __x64_sys_select+0x24 do_syscall_64+0x5a entry_SYSCALL_64+0x7c @@ -653,6 +688,7 @@ TASK_STRUCT STATE 0xffffa088f740c500 INTERRUPTIBLE 0xffffa08894564500 INTERRUPTIBLE 0xffffa0889445dc00 INTERRUPTIBLE + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c schedule_hrtimeout_range_clock+0xb9 @@ -662,6 +698,8 @@ TASK_STRUCT STATE core_sys_select+0x1d3 kern_select+0xb7 __x64_sys_select+0x24 + __x64_sys_select+0x24 + __x64_sys_select+0x24 do_syscall_64+0x5a entry_SYSCALL_64+0x7c @@ -669,16 +707,20 @@ TASK_STRUCT STATE 0xffffa08936498000 INTERRUPTIBLE 0xffffa089320c4500 INTERRUPTIBLE 0xffffa0893319dc00 INTERRUPTIBLE + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c sigsuspend+0x4a __x64_sys_rt_sigsuspend+0x4a + __x64_sys_rt_sigsuspend+0x4a + __x64_sys_rt_sigsuspend+0x4a do_syscall_64+0x5a entry_SYSCALL_64+0x7c 0xffffa0895820dc00 INTERRUPTIBLE 0xffffa08957d19700 INTERRUPTIBLE 0xffffa08957582e00 INTERRUPTIBLE + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c scsi_error_handler+0x1dd @@ -688,6 +730,7 @@ TASK_STRUCT STATE 0xffffa08957e3c500 INTERRUPTIBLE 0xffffa089553a8000 INTERRUPTIBLE 0xffffa0895a318000 INTERRUPTIBLE + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c cv_wait_common+0x11f @@ -701,6 +744,7 @@ TASK_STRUCT STATE 0xffffa08957da9700 INTERRUPTIBLE 0xffffa089553a9700 INTERRUPTIBLE 0xffffa0895a31dc00 INTERRUPTIBLE + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c schedule_timeout+0x169 @@ -715,6 +759,7 @@ TASK_STRUCT STATE 0xffffa08952e5ae00 INTERRUPTIBLE 0xffffa089553adc00 INTERRUPTIBLE 0xffffa0888d2cdc00 INTERRUPTIBLE + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c schedule_hrtimeout_range_clock+0xb9 @@ -729,6 +774,7 @@ TASK_STRUCT STATE 0xffffa089320c5c00 INTERRUPTIBLE 0xffffa0894b280000 INTERRUPTIBLE + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c __x64_sys_pause+0x30 @@ -737,42 +783,54 @@ TASK_STRUCT STATE 0xffffa089304eae00 INTERRUPTIBLE 0xffffa088c58aae00 INTERRUPTIBLE + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c schedule_hrtimeout_range_clock+0x181 schedule_hrtimeout_range+0x13 do_sigtimedwait+0x18f + do_sigtimedwait+0x18f + __x64_sys_rt_sigtimedwait+0x72 + __x64_sys_rt_sigtimedwait+0x72 __x64_sys_rt_sigtimedwait+0x72 do_syscall_64+0x5a entry_SYSCALL_64+0x7c 0xffffa088ef2d1700 INTERRUPTIBLE 0xffffa088ca872e00 INTERRUPTIBLE + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c schedule_timeout+0x1db inet_csk_accept+0x246 + inet_csk_accept+0x246 inet_accept+0x45 __sys_accept4+0x104 __x64_sys_accept+0x1c + __x64_sys_accept+0x1c + __x64_sys_accept+0x1c do_syscall_64+0x5a entry_SYSCALL_64+0x7c 0xffffa089669ec500 INTERRUPTIBLE + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c kthreadd+0x2e8 ret_from_fork+0x1f 0xffffa08966a01700 RUNNING + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c schedule_timeout+0x169 rcu_gp_kthread+0x572 + rcu_gp_kthread+0x572 kthread+0x121 ret_from_fork+0x1f 0xffffa08966a6dc00 INTERRUPTIBLE + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c devtmpfsd+0x159 @@ -780,6 +838,7 @@ TASK_STRUCT STATE ret_from_fork+0x1f 0xffffa08966a6ae00 INTERRUPTIBLE + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c rcu_tasks_kthread+0x391 @@ -787,6 +846,7 @@ TASK_STRUCT STATE ret_from_fork+0x1f 0xffffa08966a68000 INTERRUPTIBLE + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c kauditd_thread+0x18e @@ -794,6 +854,7 @@ TASK_STRUCT STATE ret_from_fork+0x1f 0xffffa08966bcae00 INTERRUPTIBLE + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c schedule_timeout+0x169 @@ -803,6 +864,7 @@ TASK_STRUCT STATE ret_from_fork+0x1f 0xffffa08966bc8000 INTERRUPTIBLE + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c oom_reaper+0x13a @@ -810,6 +872,7 @@ TASK_STRUCT STATE ret_from_fork+0x1f 0xffffa08966bcdc00 INTERRUPTIBLE + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c kcompactd+0x166 @@ -817,6 +880,7 @@ TASK_STRUCT STATE ret_from_fork+0x1f 0xffffa08966bcc500 INTERRUPTIBLE + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c ksm_scan_thread+0x210 @@ -824,13 +888,16 @@ TASK_STRUCT STATE ret_from_fork+0x1f 0xffffa08966bd2e00 INTERRUPTIBLE + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c khugepaged+0x403 + khugepaged+0x403 kthread+0x121 ret_from_fork+0x1f 0xffffa089666d1700 INTERRUPTIBLE + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c kthread_worker_fn+0x1ae @@ -838,13 +905,16 @@ TASK_STRUCT STATE ret_from_fork+0x1f 0xffffa08966791700 INTERRUPTIBLE + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c kswapd+0x3f1 + kswapd+0x3f1 kthread+0x121 ret_from_fork+0x1f 0xffffa089587bc500 INTERRUPTIBLE + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c ecryptfs_threadfn+0x139 @@ -852,6 +922,7 @@ TASK_STRUCT STATE ret_from_fork+0x1f 0xffffa08956849700 INTERRUPTIBLE + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c schedule_hrtimeout_range_clock+0xb9 @@ -865,6 +936,7 @@ TASK_STRUCT STATE ret_from_fork+0x1f 0xffffa0895684dc00 INTERRUPTIBLE + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c schedule_hrtimeout_range_clock+0xb9 @@ -878,6 +950,7 @@ TASK_STRUCT STATE ret_from_fork+0x1f 0xffffa089580b1700 INTERRUPTIBLE + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c schedule_timeout+0x169 @@ -889,17 +962,22 @@ TASK_STRUCT STATE ret_from_fork+0x1f 0xffffa089320e4500 INTERRUPTIBLE + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c schedule_hrtimeout_range_clock+0xb9 schedule_hrtimeout_range+0x13 poll_schedule_timeout.constprop.11+0x46 do_sys_poll+0x3d6 + do_sys_poll+0x3d6 + __x64_sys_poll+0xa3 + __x64_sys_poll+0xa3 __x64_sys_poll+0xa3 do_syscall_64+0x5a entry_SYSCALL_64+0x7c 0xffffa089408fdc00 INTERRUPTIBLE + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c cv_wait_common+0x11f @@ -909,12 +987,16 @@ TASK_STRUCT STATE zfsdev_ioctl_common+0x529 zfsdev_ioctl+0x52 do_vfs_ioctl+0xa9 + do_vfs_ioctl+0xa9 ksys_ioctl+0x75 __x64_sys_ioctl+0x1a + __x64_sys_ioctl+0x1a + __x64_sys_ioctl+0x1a do_syscall_64+0x5a entry_SYSCALL_64+0x7c 0xffffa089408f4500 INTERRUPTIBLE + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c do_syslog.part.23+0x7ef @@ -925,10 +1007,13 @@ TASK_STRUCT STATE vfs_read+0x8e ksys_read+0x5c __x64_sys_read+0x1a + __x64_sys_read+0x1a + __x64_sys_read+0x1a do_syscall_64+0x5a entry_SYSCALL_64+0x7c 0xffffa0895541ae00 INTERRUPTIBLE + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c schedule_timeout+0x1db @@ -937,17 +1022,22 @@ TASK_STRUCT STATE skb_recv_datagram+0x3f netlink_recvmsg+0x57 sock_recvmsg+0x43 + sock_recvmsg+0x43 ___sys_recvmsg+0xf5 __sys_recvmsg+0x60 __x64_sys_recvmsg+0x1f + __x64_sys_recvmsg+0x1f + __x64_sys_recvmsg+0x1f do_syscall_64+0x5a entry_SYSCALL_64+0x7c 0xffffa08905909700 INTERRUPTIBLE + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c schedule_timeout+0x1db inet_csk_accept+0x246 + inet_csk_accept+0x246 inet_accept+0x45 kernel_accept+0x59 0xffffffffc0d66f63+0x0 @@ -956,6 +1046,7 @@ TASK_STRUCT STATE ret_from_fork+0x1f 0xffffa0888cc64500 INTERRUPTIBLE + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c schedule_hrtimeout_range_clock+0x181 @@ -964,10 +1055,14 @@ TASK_STRUCT STATE do_select+0x60d core_sys_select+0x1d3 __x64_sys_pselect6+0x126 + __x64_sys_pselect6+0x126 + __x64_sys_pselect6+0x126 + __x64_sys_pselect6+0x126 do_syscall_64+0x5a entry_SYSCALL_64+0x7c 0xffffa08941afae00 INTERRUPTIBLE + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c eventfd_read+0x189 @@ -975,14 +1070,23 @@ TASK_STRUCT STATE vfs_read+0x8e ksys_read+0x5c __x64_sys_read+0x1a + __x64_sys_read+0x1a + __x64_sys_read+0x1a do_syscall_64+0x5a entry_SYSCALL_64+0x7c 0xffffa0888cc62e00 RUNNING + new_slab+0x240 + new_slab+0x240 + new_slab+0x240 + new_slab+0x240 new_slab+0x240 ___slab_alloc+0x393 + ___slab_alloc+0x393 __slab_alloc+0x20 kmem_cache_alloc+0x182 + kmem_cache_alloc+0x182 + kmem_cache_alloc+0x182 spl_kmem_cache_alloc+0x46 zio_data_buf_alloc+0x55 zil_itx_create+0x29 @@ -992,14 +1096,18 @@ TASK_STRUCT STATE zpl_iter_write_common+0x81 zpl_iter_write+0x4f new_sync_write+0x10c + new_sync_write+0x10c __vfs_write+0x29 vfs_write+0xb1 ksys_write+0x5c __x64_sys_write+0x1a + __x64_sys_write+0x1a + __x64_sys_write+0x1a do_syscall_64+0x5a entry_SYSCALL_64+0x7c 0xffffa08884831700 RUNNING + __crash_kexec+0x9d __crash_kexec+0x9d panic+0x10e 0xffffffff8b849f25+0x0 @@ -1010,6 +1118,8 @@ TASK_STRUCT STATE vfs_write+0xb1 ksys_write+0x5c __x64_sys_write+0x1a + __x64_sys_write+0x1a + __x64_sys_write+0x1a do_syscall_64+0x5a entry_SYSCALL_64+0x7c diff --git a/tests/integration/data/regression_output/linux/stacks -m zfs b/tests/integration/data/regression_output/linux/stacks -m zfs index 79b43022..fe9792a7 100644 --- a/tests/integration/data/regression_output/linux/stacks -m zfs +++ b/tests/integration/data/regression_output/linux/stacks -m zfs @@ -1,6 +1,7 @@ TASK_STRUCT STATE COUNT ========================================== 0xffffa0895684c500 INTERRUPTIBLE 13 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c cv_wait_common+0x11f @@ -11,6 +12,7 @@ TASK_STRUCT STATE COUNT ret_from_fork+0x1f 0xffffa08957e3c500 INTERRUPTIBLE 3 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c cv_wait_common+0x11f @@ -22,6 +24,7 @@ TASK_STRUCT STATE COUNT ret_from_fork+0x1f 0xffffa08957da9700 INTERRUPTIBLE 3 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c schedule_timeout+0x169 @@ -34,6 +37,7 @@ TASK_STRUCT STATE COUNT ret_from_fork+0x1f 0xffffa08952e5ae00 INTERRUPTIBLE 3 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c schedule_hrtimeout_range_clock+0xb9 @@ -47,6 +51,7 @@ TASK_STRUCT STATE COUNT ret_from_fork+0x1f 0xffffa08956849700 INTERRUPTIBLE 1 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c schedule_hrtimeout_range_clock+0xb9 @@ -60,6 +65,7 @@ TASK_STRUCT STATE COUNT ret_from_fork+0x1f 0xffffa0895684dc00 INTERRUPTIBLE 1 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c schedule_hrtimeout_range_clock+0xb9 @@ -73,6 +79,7 @@ TASK_STRUCT STATE COUNT ret_from_fork+0x1f 0xffffa089580b1700 INTERRUPTIBLE 1 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c schedule_timeout+0x169 @@ -84,6 +91,7 @@ TASK_STRUCT STATE COUNT ret_from_fork+0x1f 0xffffa089408fdc00 INTERRUPTIBLE 1 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c cv_wait_common+0x11f @@ -93,16 +101,26 @@ TASK_STRUCT STATE COUNT zfsdev_ioctl_common+0x529 zfsdev_ioctl+0x52 do_vfs_ioctl+0xa9 + do_vfs_ioctl+0xa9 ksys_ioctl+0x75 __x64_sys_ioctl+0x1a + __x64_sys_ioctl+0x1a + __x64_sys_ioctl+0x1a do_syscall_64+0x5a entry_SYSCALL_64+0x7c 0xffffa0888cc62e00 RUNNING 1 new_slab+0x240 + new_slab+0x240 + new_slab+0x240 + new_slab+0x240 + new_slab+0x240 + ___slab_alloc+0x393 ___slab_alloc+0x393 __slab_alloc+0x20 kmem_cache_alloc+0x182 + kmem_cache_alloc+0x182 + kmem_cache_alloc+0x182 spl_kmem_cache_alloc+0x46 zio_data_buf_alloc+0x55 zil_itx_create+0x29 @@ -112,10 +130,13 @@ TASK_STRUCT STATE COUNT zpl_iter_write_common+0x81 zpl_iter_write+0x4f new_sync_write+0x10c + new_sync_write+0x10c __vfs_write+0x29 vfs_write+0xb1 ksys_write+0x5c __x64_sys_write+0x1a + __x64_sys_write+0x1a + __x64_sys_write+0x1a do_syscall_64+0x5a entry_SYSCALL_64+0x7c diff --git a/tests/integration/data/regression_output/linux/stacks -m zfs -c zthr_procedure b/tests/integration/data/regression_output/linux/stacks -m zfs -c zthr_procedure index e03c0257..1584b540 100644 --- a/tests/integration/data/regression_output/linux/stacks -m zfs -c zthr_procedure +++ b/tests/integration/data/regression_output/linux/stacks -m zfs -c zthr_procedure @@ -1,6 +1,7 @@ TASK_STRUCT STATE COUNT ========================================== 0xffffa0895684c500 INTERRUPTIBLE 13 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c cv_wait_common+0x11f @@ -11,6 +12,7 @@ TASK_STRUCT STATE COUNT ret_from_fork+0x1f 0xffffa08956849700 INTERRUPTIBLE 1 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c schedule_hrtimeout_range_clock+0xb9 diff --git "a/tests/integration/data/regression_output/linux/threads | filter 'obj.comm == \"java\"' | stack" "b/tests/integration/data/regression_output/linux/threads | filter 'obj.comm == \"java\"' | stack" index f7f72d66..1036da1c 100644 --- "a/tests/integration/data/regression_output/linux/threads | filter 'obj.comm == \"java\"' | stack" +++ "b/tests/integration/data/regression_output/linux/threads | filter 'obj.comm == \"java\"' | stack" @@ -1,16 +1,21 @@ TASK_STRUCT STATE COUNT ========================================== 0xffffa08960a38000 INTERRUPTIBLE 57 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c futex_wait_queue_me+0xc4 + futex_wait_queue_me+0xc4 futex_wait+0x10a do_futex+0x364 __x64_sys_futex+0x13f + __x64_sys_futex+0x13f + __x64_sys_futex+0x13f do_syscall_64+0x5a entry_SYSCALL_64+0x7c 0xffffa08960a24500 INTERRUPTIBLE 12 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c schedule_hrtimeout_range_clock+0xb9 @@ -18,44 +23,57 @@ TASK_STRUCT STATE COUNT ep_poll+0x258 do_epoll_wait+0xb0 __x64_sys_epoll_wait+0x1e + __x64_sys_epoll_wait+0x1e + __x64_sys_epoll_wait+0x1e do_syscall_64+0x5a entry_SYSCALL_64+0x7c 0xffffa088f740dc00 INTERRUPTIBLE 6 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c pipe_wait+0x70 pipe_read+0x21f new_sync_read+0x109 + new_sync_read+0x109 __vfs_read+0x29 vfs_read+0x8e ksys_read+0x5c __x64_sys_read+0x1a + __x64_sys_read+0x1a + __x64_sys_read+0x1a do_syscall_64+0x5a entry_SYSCALL_64+0x7c 0xffffa088f740ae00 INTERRUPTIBLE 3 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c do_wait+0x1cb kernel_wait4+0x89 __do_sys_wait4+0x95 __x64_sys_wait4+0x1e + __x64_sys_wait4+0x1e do_syscall_64+0x5a entry_SYSCALL_64+0x7c 0xffffa088ef2d1700 INTERRUPTIBLE 2 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c schedule_timeout+0x1db inet_csk_accept+0x246 + inet_csk_accept+0x246 inet_accept+0x45 __sys_accept4+0x104 __x64_sys_accept+0x1c + __x64_sys_accept+0x1c + __x64_sys_accept+0x1c do_syscall_64+0x5a entry_SYSCALL_64+0x7c 0xffffa0889cd4dc00 INTERRUPTIBLE 2 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c schedule_hrtimeout_range_clock+0x181 @@ -63,16 +81,22 @@ TASK_STRUCT STATE COUNT ep_poll+0x258 do_epoll_wait+0xb0 __x64_sys_epoll_wait+0x1e + __x64_sys_epoll_wait+0x1e + __x64_sys_epoll_wait+0x1e do_syscall_64+0x5a entry_SYSCALL_64+0x7c 0xffffa088f0979700 INTERRUPTIBLE 1 + __schedule+0x2c0 __schedule+0x2c0 schedule+0x2c schedule_hrtimeout_range_clock+0x181 schedule_hrtimeout_range+0x13 poll_schedule_timeout.constprop.11+0x46 do_sys_poll+0x3d6 + do_sys_poll+0x3d6 + __x64_sys_poll+0x3b + __x64_sys_poll+0x3b __x64_sys_poll+0x3b do_syscall_64+0x5a entry_SYSCALL_64+0x7c diff --git a/tests/integration/infra.py b/tests/integration/infra.py index 5a8ab07d..f833e14c 100644 --- a/tests/integration/infra.py +++ b/tests/integration/infra.py @@ -96,6 +96,8 @@ def slurp_output_file(modname: str, cmd: str) -> str: Given a module name and a command, find the output file and return all of its contents as a string. """ + # The pylint below is a false positive + # pylint: disable=unspecified-encoding return Path(f"{TEST_OUTPUT_DIR}/{modname}/{cmd}").read_text() @@ -113,7 +115,7 @@ def generate_output_for_commands(cmds: List[str], dirpath: str) -> None: shutil.rmtree(dirpath) os.makedirs(dirpath) for cmd in cmds: - with open(f"{dirpath}/{cmd}", 'w') as f: + with open(f"{dirpath}/{cmd}", 'w', encoding="utf-8") as f: with redirect_stdout(f): repl_invoke(cmd) diff --git a/tests/integration/test_linux_generic.py b/tests/integration/test_linux_generic.py index 7504bb13..69c7e9df 100644 --- a/tests/integration/test_linux_generic.py +++ b/tests/integration/test_linux_generic.py @@ -186,6 +186,6 @@ def test_cmd_stripped_output_and_error_code_0(capsys: Any, cmd: str) -> None: assert repl_invoke(cmd) == 0 captured = capsys.readouterr() slurped = slurp_output_file("linux", cmd) - for i in range(len(captured.out)): - assert captured.out[i].strip() == slurped[i].strip() + for i, n in enumerate(captured.out): + assert n.strip() == slurped[i].strip() assert len(captured.out) == len(slurped)