On 7/13/26 16:19, Dave Hansen wrote: > On 7/13/26 06:55, Yeoreum Yun wrote: >> We want to change how pXdp_get() works with generic compile-time folded >> page tables. To prepare for that, rework effective_prot() to ignore any >> folded page tables entries, as it will unconditionally get called by >> ptdump core with pXd_val(pXdp_get()), and we really should be ignoring >> that value for folded entries. >> >> For this, identify the first real page-table level and >> update effective_prot only when the current entry is not folded. >
I'll let Yeoreum comment on most of it, just one thought below. > Nit: could you please clean up the "we's" and move over to imperative > voice for the series? We're picky about it on the x86 side, but I do > think it's generally a good preferred practice across the kernel. > > Also I really do think this made the code worse. effective_prot() is a > pretty tidy function. This change more than doubles the size and is also > basically the same block copied and pasted twice. > > Further, this does seem like it will stop filling out some of the > st->prot_levels[] entries. That seems like it might break things. It > definitely needs to be covered in the changelog. > > So, in the end, I'm not 100% sure what this is doing. Is it "optimizing" > the ptdump code? Or is it preemptively fixing code that will soon be > throwing a compile error? It's a preparation for getting called with folded entries that no longer duplicate the information. Otherwise, with later changes in this series would break it. Essentially, we have to teach x86 code to ignore levels that are folded (e.g., pgd, p4d) and start collecting effective prots from the actual first non-folded level. I was thinking about handling the "don't call effective_prot() with folded entries" in ptdump code, which would likely be cleaner. We'd still have to teach x86's effective_prot() about "this is your actual first non-folded level, everything below is not initialized (or we decide to just initialize it)" -- Cheers, David
