Conversation

@ljs btw, have you seen this hacky weekend hobby project thing I built a while ago yet?

https://mehlbrei.thejh.net/thread?msgid=20241108135708.48567-1-lorenzo.stoakes%40oracle.com#topic-0

You can put in some messageid of a patch series that exists on lore and it'll show you all the review comments from that series inline in the original patches.

1
1
3
@jann ohhh noice!

You are a talented ape, sir
1
0
2

@ljs
*tips hat*

All thanks to the ridiculously powerful python standard library. I was like "how do I compare two mails and figure out which lines in the reply map to which lines in the original mail" and the python standard library is like "here's an email parser and here's a thing that compares sequences of things and tells you how they match up", and at that point the hardest part was fixing all the off-by-one bugs in my code...

But as I said, hacky hobby project, it will fall over and refuse to show anything on some threads, and it does not understand the various ways in which people write "I removed some lines here" markers and it can't deal with partially quoted lines and stuff...

1
0
2

@ljs I was kind of trying to imitate "real" code review tools. If it had "show more context lines" buttons and a way to draft and send replies, I think it would be really nice...

2
0
2
@jann yeah I'm starting to be more sympathetic to the 'fuck email review' people nowadays tbh it can be a real pain...

Then again I think what it'd be like if it was super super easy for anybody to join reviews + the latest kernel drama would cause every review to be spammed or sth.

Ugh anyway that's a Pandora's box :P but yeah this is nice!

Speaking of hacks, I really want a tool that can show in real time _physical_ memory layout system-wide...

Have asked @sj about it via email to see if maybe DAMON can help, /proc/kpageflags can do it but it's too slow.

I can hack in something to the kernel for it ranging from really awful to just a bit terrible but it'd be cool just to see it visually at least.
2
0
1

@ljs (ah, and the security of it is also pretty trashy, unlike tools like b4 it makes no effort to actually verify the identities of mail senders)

1
0
1
@jann phoronix: Famous google security expert eschews security in shock move
0
0
2

@ljs @sj yeah, email review is a pain, this was created when I was wondering how close to something looking like a real code review tool you could get while using email as the backend... though that is probably making things harder than necessary.

re physical memory viewer: so you want to see something like, a graphical live view of physical memory at the 4K page level? and basically want a faster version of kpageflags? I guess an alternate approach would be to get initial state from kpageflags and then basically use ftrace to log alloc/free operations and try to keep up with that firehose from userspace, but that might be unrealistic under load...

(wanting to have a graphical memory viewer reminds me of something I once did for Chrome's userspace memory allocator, screenshots are at https://drive.google.com/drive/folders/1IqPKAmayTwqAHZkWuLa15OYNdPP-Awir?usp=sharing - that was only really usable on monitors with sufficiently high resolution ^^)

1
0
3
@jann @sj Nice!

Yeah you could use ftrace or bpf, or even the new alloc path tracing stuff perhapps? But I think this wouldn't necessarily catch everything.

My crazy idea was to add a hook into the page flag macros and somehow use this.

I also had a crazy idea of, on memmap init creating a parallel array for page flags... and just mapping it into userland...

This is for a custom kernel I'd run on my fish box :P
1
0
2

@ljs @sj ... you know, if you are doing this as root anyway, and you build your kernel without the annoying strict devmem config flag, you can just mmap() basically-arbitrary physical memory by calling mmap() on /dev/mem. including freed memory, slab memory, whatever, thanks to the magic of pfnmap.
So if you can somehow figure out where in physical memory the memmap is, you could just mmap the whole thing and look at every `struct page` directly from userspace...

2
0
2
@jann @sj lol yes you're right, christ alive, you devious maniac!

Could just do the insanity from userspace...

There are holes though but you could look at /proc/iomem for that...
0
0
1

@ljs @sj (the more insane version would be to change the x86 page table flags so that every kernel page table entry except in the top-level PGD has the USER bit set, and then add a privileged prctl that lets you set the USER bit for all PGD entries in the PGD of your process)

0
0
2
@ljs @jann re: real time physical memory layout, I replied to @ljs via mail, but TL; DR: No. But if no real page granularity is required, I think we can make a fun hack using DAMON's adaptive regions adjustment mechanism[1].

[1] https://docs.kernel.org/mm/damon/design.html#adaptive-regions-adjustment
1
1
1
@sj @jann thanks for your reply, been busy with stable backports so not been able to reply to the reply yet unless I did somehow and forgot (I am old) lol
0
0
1