On 23/01/2024 15:01, Matthew Wilcox wrote: > On Tue, Jan 23, 2024 at 10:34:21AM +0000, Ryan Roberts wrote: >>> +#define PFN_PTE_SHIFT PAGE_SHIFT >> >> I think this is buggy. And so is the arm64 implementation of set_ptes(). It >> works fine for 48-bit output address, but for 52-bit OAs, the high bits are not >> kept contigously, so if you happen to be setting a mapping for which the >> physical memory block straddles bit 48, this won't work. > > I'd like to see the folio allocation that can straddle bit 48 ... > > agreed, it's not workable _in general_, but specifically for a memory > allocation from a power-of-two allocator, you'd have to do a 49-bit > allocation (half a petabyte) to care. Hmm good point. So its a hypothetical bug, not an actual bug. Personally I'm still inclined to "fix" it. Although its going to cost a few more instructions. Shout if you disagree.