Conversation

Thorsten Leemhuis (acct. 1/4)

Edited 1 year ago

Do you often need to check if a patch was merged to the and which version it showed up in?

Or check through which tree a particular patch was merged?

I have to do this and a few other things all the time, hence I wrote a script to make these tasks a little easier for me:

, the scrutiny tool – https://gitlab.com/knurd42/linuxscru

It's tailored for my needs and my setup; but that could change if other people show an interest in it.

README: https://gitlab.com/knurd42/linuxscru/-/blob/main/README.md?ref_type=heads

3
2
2
@kernellogger
why did I read it as linux SRCU (Sleepable RCU) ;)
it's nice tool though!
1
0
2

@hyeyoo

Haha, by brain hadn't made that connection yet (and had to to read "linux SRCU" two times before my brain saw the difference).

Side note: "linuxscru" didn't take much of a thought; if others show and interest in it it might be wise to consider a better name

0
0
1
@kernellogger Cool, here's a horrible hack of a "implement a database in a filesystem tree" that I use for the stable development work I do for this same problem (and others like it): https://git.sr.ht/~gregkh/linux-stable_commit_tree
1
0
3

@gregkh

ha, nice hack, guess that will be a whole lot faster. 😬

For my use case something like that wasn't needed, as the lookup was fast enough for my needs. But to be honest I recently thought about going a similar route for some other problem (one my head already forgot about… 🥴)

1
0
0
@kernellogger I need speed as I rely on that all the time to determine how far back to backport stable changes, and to determine if any of the pending fixes have fixes of their own that we have missed, or if fixes have ended up in Linus's tree for things we backported in the past. As an example:

$ time ~/linux/stable/commit_tree/id_found_in 27e348b221f6
6.3 6.3.2

real 0m0.336s
user 0m0.261s
sys 0m0.501s

And really, it would be great if I could make that go faster, I played with using ripgrep instead of git grep but it turned out git grep was faster for this use case, and so I gave up as it being "good enough" for now.
2
0
1
@kernellogger And the obligatory `perf stat` output:

$ perf stat ~/linux/stable/commit_tree/id_found_in 27e348b221f6
6.3 6.3.2

Performance counter stats for '/home/gregkh/linux/stable/commit_tree/id_found_in 27e348b221f6':

927.17 msec task-clock:u # 2.695 CPUs utilized
0 context-switches:u # 0.000 /sec
0 cpu-migrations:u # 0.000 /sec
102,368 page-faults:u # 110.409 K/sec
625,620,707 cycles:u # 0.675 GHz (86.75%)
17,593,408 stalled-cycles-frontend:u # 2.81% frontend cycles idle (74.93%)
244,430,441 stalled-cycles-backend:u # 39.07% backend cycles idle (77.20%)
1,688,567,927 instructions:u # 2.70 insn per cycle
# 0.14 stalled cycles per insn (79.87%)
281,869,777 branches:u # 304.009 M/sec (90.53%)
2,038,670 branch-misses:u # 0.72% of all branches (94.14%)

0.343984835 seconds time elapsed

0.198861000 seconds user
0.661305000 seconds sys
0
0
1
@kernellogger Let's debug by this horrible interface!

$ ./linuxscru history Makefile

Traceback (most recent call last):
File "/mnt/fast_t2/linux/gregkh/./linuxscru", line 526, in <module>
cmdargs.func(cmdargs)
File "/mnt/fast_t2/linux/gregkh/./linuxscru", line 376, in cmd_history
if not GITTREE.is_file(cmdargs.patterns):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/mnt/fast_t2/linux/gregkh/./linuxscru", line 251, in is_file
if GITTREE.gitpyrepo.git.rev_list('-1', GITTREE.remotes['mainline'][0], '--', pattern):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/git/cmd.py", line 739, in <lambda>
return lambda *args, **kwargs: self._call_process(name, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/git/cmd.py", line 1315, in _call_process
return self.execute(call, **exec_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/git/cmd.py", line 1110, in execute
raise GitCommandError(redacted_command, status, stderr_value, stdout_value)
git.exc.GitCommandError: Cmd('git') failed due to: exit code(128)
cmdline: git rev-list -1 mainline/master -- Makefile
stderr: 'fatal: bad revision 'mainline/master''
1
0
0

@gregkh

Guess your remotes have different names:

https://gitlab.com/knurd42/kernel-scripts/-/blob/master/linuxscru/linuxscru?ref_type=heads#L52

See the README as well.

https://gitlab.com/knurd42/kernel-scripts/-/blob/master/linuxscru/README.md?ref_type=heads

Side note: needs a tree that contains mainline, next and stable, not sure if that's the case for you.

Guess I should fix these things up and include a few checks, but I first wanted to see if anyone is interested in this…

1
0
0
@kernellogger oops, I should have read that in the script, my fault, thanks!
0
0
0

@gregkh @kernellogger This is from a tool I did, although the main goal was to attach all this info to individual commits through git notes and have it displayed on git.kernel.org.

1
0
0