profile
viewpoint
If you are wondering where the data of this site comes from, please visit https://api.github.com/users/osandov/events. GitMemory does not store any data, but only uses NGINX to cache data for a period of time. The idea behind GitMemory is simply to give users a better reading experience.
Omar Sandoval osandov @facebook Seattle, WA

osandov/drgn 454

Scriptable debugger library

osandov/blktests 71

Linux kernel block layer testing framework

osandov/osandov-linux 29

My ~/linux infrastructure

osandov/asmase 28

An assembly REPL.

osandov/dotfiles 10

My convoluted configuration files

osandov/btrfs-progs 2

Development branches of btrfs userspace tools.

osandov/osh 2

A quick, simple Unix shell

osandov/ctypesgen 1

Automatically generate ctypes bindings using libclang

osandov/linux-build 1

Script for automation of downloading, compiling, and installing the Linux kernel

osandov/osos 1

A simple, interpreted, stack-based language

push eventosandov/drgn

Omar Sandoval

commit sha c64d87e41ae1d57460c99de538bc586e792510c6

setup.py: add 5.15 to vmtest kernels Signed-off-by: Omar Sandoval <osandov@osandov.com>

view details

push time in 3 days

issue closedbtrfs/linux

[PATCH v6 00/11] fs: interface for directly reading/writing compressed data

Link to patches

https://lore.kernel.org/linux-btrfs/cover.1605723568.git.osandov@fb.com/

b4 am cover.1605723568.git.osandov@fb.com

closed time in 8 days

osandov

issue commentbtrfs/linux

[PATCH v6 00/11] fs: interface for directly reading/writing compressed data

Superseded by the latest version of #76.

osandov

comment created time in 8 days

push eventosandov/dotfiles

Omar Sandoval

commit sha d78aeb8afc59e1adb9d30fc58e4d4487ade4e174

zsh: fix tj command We need the mark target, not the mark file itself.

view details

push time in 14 days

push eventosandov/drgn

Omar Sandoval

commit sha 801f9d645cfefc62a83597576760ef0ec05c13b8

tests: improve cgroup helper tests These haven't been running in vmtest since they were added. Enable cgroup2 in vmtest and rework the cgroup tests to create cgroups that we can test with. Signed-off-by: Omar Sandoval <osandov@osandov.com>

view details

push time in 14 days

delete branch osandov/drgn

delete branch : cgroup-tests

delete time in 14 days

create barnchosandov/drgn

branch : cgroup-tests

created branch time in 14 days

push eventosandov/drgn

Peilin Ye

commit sha a01131483d2b19d0ba150bd3e15251cb26d9612e

helpers: Add netdev_for_each_tx_queue() Add a helper, netdev_for_each_tx_queue(), to iterate over all TX queues of a network device. As an example: >>> eth0 = netdev_get_by_name(prog, "eth0") >>> for txq in netdev_for_each_tx_queue(eth0): ... print(txq.qdisc.ops.id.string_().decode()) ... sfq tbf prio pfifo_fast Set up `net` in setUpClass(), since now several tests use it. Also use it in test_netdev_get_by_{index,name}(), instead of assuming `init_net`. Signed-off-by: Peilin Ye <peilin.ye@bytedance.com>

view details

Peilin Ye

commit sha f82273749dc1adb07844c0f5ab911c3034312787

helpers: Add qdisc_lookup() Add a helper, qdisc_lookup(), to get a Qdisc (struct Qdisc *) from a network device and a major handle number. As an example: >>> eth0 = netdev_get_by_name(prog, "eth0") >>> tbf = qdisc_lookup(eth0, 0x20) >>> tbf.ops.id.string_().decode() tbf >>> ingress = qdisc_lookup(eth0, 0xffff) >>> ingress.ops.id.string_().decode() ingress Testing depends on pyroute2. `TestTc` is skipped if pyroute2 is not found; test_qdisc_lookup() is skipped if the kernel is not built with the following options: CONFIG_DUMMY CONFIG_NET_SCH_PRIO CONFIG_NET_SCH_SFQ CONFIG_NET_SCH_TBF CONFIG_NET_SCH_INGRESS Suggested-by: Cong Wang <cong.wang@bytedance.com> Signed-off-by: Peilin Ye <peilin.ye@bytedance.com>

view details

push time in 14 days

PR merged osandov/drgn

Add netdev_for_each_tx_queue() and qdisc_lookup()

Hi Omar,

Two more helpers:

  1. netdev_for_each_tx_queue(), this one is simple.
  2. qdisc_lookup(), this one is for debugging Traffic Control (TC) issues. I created new files for it (and its test) since TC setup is more complicated (I'm already depending on 5 kernel configs for testing a semi-realistic scenario, see commit message below), and we are planning to add more TC helpers :-)

I'm using pyroute2 for TC testing, some questions:

  1. Is it okay to use a try block around pyroute2 imports and skip the entire TestTc upon ImportError?
  2. I've tested it locally with several kernel configs on and off. What should I do to let GitHub CI use pyroute2 (and enable those kernel configs), or could you make that happen?
  3. Should I, and/or where should I document that drgn testing now depends on pyroute2?

thanks, ypl


[1/2] helpers: Add netdev_for_each_tx_queue()

Add a helper, netdev_for_each_tx_queue(), to iterate over all TX queues of a network device. As an example:

>>> eth0 = netdev_get_by_name(prog, "eth0")
>>> for txq in netdev_for_each_tx_queue(eth0):
...     print(txq.qdisc.ops.id.string_().decode())
...
sfq
tbf
prio
pfifo_fast

[2/2] helpers: Add qdisc_lookup()

Add a helper, qdisc_lookup(), to get a Qdisc (struct Qdisc *) from a network device and a major handle number. As an example:

>>> eth0 = netdev_get_by_name(prog, "eth0")
>>> tbf = qdisc_lookup(eth0, 0x20)
>>> tbf.ops.id.string_().decode()
tbf
>>> ingress = qdisc_lookup(eth0, 0xffff)
>>> ingress.ops.id.string_().decode()
ingress

Testing depends on pyroute2. TestTc is skipped if pyroute2 is not found; test_qdisc_lookup() is skipped if the kernel is not build with the following options:

CONFIG_DUMMY
CONFIG_NET_SCH_PRIO
CONFIG_NET_SCH_SFQ
CONFIG_NET_SCH_TBF
CONFIG_NET_SCH_INGRESS
+210 -13

11 comments

4 changed files

ypl-coffee

pr closed time in 14 days

PullRequestReviewEvent

delete branch osandov/drgn

delete branch : test

delete time in 14 days

PullRequestReviewEvent
PullRequestReviewEvent

Pull request review commentosandov/drgn

Add netdev_for_each_tx_queue() and qdisc_lookup()

+# Copyright (c) ByteDance, Inc. and its affiliates.+# SPDX-License-Identifier: GPL-3.0-or-later++"""+Traffic Control (TC)+--------------------++The ``drgn.helpers.linux.tc`` module provides helpers for working with the+Linux kernel Traffic Control (TC) subsystem.+"""++import operator++from drgn import NULL, IntegerLike, Object+from drgn.helpers.linux.list import hlist_for_each_entry, list_for_each_entry++__all__ = ("qdisc_lookup",)+++def qdisc_lookup(dev: Object, major: IntegerLike) -> Object:+    """+    Get a Qdisc from a device and a major handle number.  It is worth noting+    that conventionally handles are hexadecimal, e.g. ``10:`` in a ``tc``+    command means major handle 0x10.++    :param dev: ``struct net_device *``+    :param major: Qdisc major handle number.+    :return: ``struct Qdisc *`` (``NULL`` if not found)+    """+    major = operator.index(major) << 16++    roots = [dev.qdisc]+    if dev.ingress_queue:+        roots.append(dev.ingress_queue.qdisc_sleeping)++    # Since Linux kernel commit 59cc1f61f09c ("net: sched: convert qdisc linked+    # list to hashtable") (in v4.7), a device's child Qdiscs are maintained in+    # a hashtable in its struct net_device. Before that, they are maintained in+    # a linked list in their root Qdisc.+    try:+        dev.prog_.type("struct net_device").member("qdisc_hash")+        use_hashtable = True+    except LookupError:+        use_hashtable = False

You can use Type.has_member() instead of catching an exception from Type.member().

    use_hashtable = dev.prog_.type("struct net_device").has_member("qdisc_hash")
ypl-coffee

comment created time in 14 days

PullRequestReviewEvent

push eventosandov/drgn

Omar Sandoval

commit sha 62efd2aab3c8091831cdb46bf632b4a21ef3c4b5

vmtest: use virtio-rng Now that the kernel module is enabled, let's enable the device and load the module. Signed-off-by: Omar Sandoval <osandov@osandov.com>

view details

push time in 14 days

push eventosandov/drgn

Omar Sandoval

commit sha ce845ad340bc0a3aa2283fb64d564a9fa1b91f1e

vmtest: add virtio-rng and cgroup Kconfig options We're seeing some hangs waiting for entropy when running tests, so let's enable the virtio-rng module. While we're doing a rebuild, we might as well enable cgroups so that we can finally run those tests. Signed-off-by: Omar Sandoval <osandov@osandov.com>

view details

push time in 14 days

push eventosandov/drgn

Omar Sandoval

commit sha efe927b422bd48c4f77da545a0f924adb92806d1

Testing

view details

push time in 15 days

push eventosandov/drgn

Omar Sandoval

commit sha e249fcc36e6a7ba08916ff4f741d1e3fbbf07985

Testing

view details

push time in 15 days

push eventosandov/drgn

Omar Sandoval

commit sha 3c60d49b7d3ab0a86cbb6636e81cb6a37eeb7b63

Testing

view details

push time in 15 days

pull request commentosandov/drgn

Add netdev_for_each_tx_queue() and qdisc_lookup()

This looks good and passes locally, thanks! I need to figure out what's going on with the CI, but other than that this is ready to go.

ypl-coffee

comment created time in 15 days

create barnchosandov/drgn

branch : test

created branch time in 15 days

pull request commentosandov/drgn

Add netdev_for_each_tx_queue() and qdisc_lookup()

Something seems to have gotten stuck in the CI. I'll try rerunning them, but in the meantime, it looks like this fails on 4.4:

======================================================================
ERROR: test_qdisc_lookup (tests.helpers.linux.test_tc.TestTc)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/osandov/repos/drgn/tests/helpers/linux/test_tc.py", line 109, in test_qdisc_lookup
    self.assertEqual(qdisc_lookup(netdev, 0x10).ops.id.string_(), b"sfq")
  File "/home/osandov/repos/drgn/drgn/helpers/linux/tc.py", line 39, in qdisc_lookup
    for head in root.dev_queue.dev.qdisc_hash:
AttributeError: 'struct net_device' has no member 'qdisc_hash'

----------------------------------------------------------------------
ypl-coffee

comment created time in 15 days

pull request commentosandov/drgn

Add netdev_for_each_tx_queue() and qdisc_lookup()

Okay that's done, you can rebase on top of 3c68b2521527c300d8429af50607b9b9cfb2b75d and the new test should run.

ypl-coffee

comment created time in 15 days

push eventosandov/drgn

Omar Sandoval

commit sha 3c68b2521527c300d8429af50607b9b9cfb2b75d

CI: install pyroute2 This is needed to test #117. Signed-off-by: Omar Sandoval <osandov@osandov.com>

view details

push time in 15 days

delete branch osandov/drgn

delete branch : pyroute2

delete time in 15 days

create barnchosandov/drgn

branch : pyroute2

created branch time in 15 days

pull request commentosandov/drgn

Add netdev_for_each_tx_queue() and qdisc_lookup()

I just kicked off a rebuild with the new config options here: https://github.com/osandov/drgn/actions/runs/1191854660. Once that's done, we can rerun the checks so that your new test runs.

ypl-coffee

comment created time in 15 days

PullRequestReviewEvent