Conversation

Lorenzo Stoakes

Learning the hard way why pfn_valid() matters :)
1
0
2
Edited 1 year ago
@ljs when does it matter? the only thing I know about it is that the kernel does not have struct page when pfn_valid() is false.
2
0
1
@hyeyoo it matters when your pfn is garbage because your struct page* is uninitialised data :>)
0
0
2
@ptesarik @ljs

When do usable PFNs (for which pfn_valid() is false) exist?
2
0
1
@hyeyoo @ptesarik it's going to be arch-dependent. For x86-64 it always implies the PFN is garbage because it'd be > max physical range.

Am curious as to what particular scenario Petr is referring to though, I see some arches have a PFN offset which maybe leaves out usable PFNs?
1
0
1
@ptesarik @hyeyoo ah yeah with MMIO I guess all bets are off :)
0
0
2
Edited 1 year ago
@ptesarik @ljs

I thought maybe freeing unnecessary vmemmap pages for HugeTLB pages might be the case, but it seems to remap to first vmemmap page. And if I am not mistaken pfn_valid() will return true for them.
1
0
0
@hyeyoo @ptesarik that'd be ram-backed though right?
1
0
1
Edited 1 year ago
@ljs @ptesarik Yes! "might be the case" was was not clear ;)
0
0
1