On Monday, 6 June 2022 10:27:20 PM AEST Bharat Kumar Gogada wrote: > Hi All, > > In 5.4 kernel hmm_range structure has pfn_shift parameter. > This parameter is removed in the latest kernel. > > Can any one help me understand usage of this parameter ? I think originally it was intended to help hmm_range_fault() format PFNs into some kind of HW specific value, but it turned out not to be very useful - see 2733ea144dcc ("2733ea144dcce789de20988c1056e228a07b1bff") for more background. I think just setting it to PAGE_SHIFT would be fine. > In 5.4 kernel, if this parameter set to PAGE_SHIFT, does it mean HMM framework > expects user buffers to be 4K aligned, i.e which are allocated via mmap/ aligned_alloc ? It doesn't matter what the pfn_shift parameter is set to as HMM just copies (and reformats) CPU page tables so minimum alignment would be PAGE_SIZE (ie. generally 4K). HMM doesn't add any extra alignment constraints. > Does HMM have any alignment requirements in 5.4 or current kernel ? Will it work > with buffers allocated via malloc ? Yes. It should work with any normal page with present PTEs although I haven't personally tested it with v5.4 in a long time. There's been a number of changes in this area so I'd recommend trying to use a more recent kernel if possible. - Alistair > Regards, > bharat > > > > >