No functional change intended.
Sponsored by: Dell EMC
Differential D27508
linux_dma: Ensure proper flags pass to allocators. bdrewery on Dec 8 2020, 5:44 AM. Authored by Tags None Referenced Files
Details
No functional change intended. Sponsored by: Dell EMC
Diff Detail
Event TimelineComment Actions Hi, Can you explain this change a bit more? gfp_t may contain bits which are not supported by the M_XXX flags and should be filtered away? If you need to pass additional flags you need to update GFP_NATIVE_MASK . --HPS Comment Actions % git grep GFP_NATIVE_MASK sys sys/compat/linuxkpi/common/include/linux/gfp.h:#define GFP_NATIVE_MASK (M_NOWAIT | M_WAITOK | M_USE_RESERVE | M_ZERO) sys/compat/linuxkpi/common/include/linux/gfp.h:CTASSERT((__GFP_DMA32 & GFP_NATIVE_MASK) == 0); sys/compat/linuxkpi/common/include/linux/gfp.h:CTASSERT((__GFP_BITS_MASK & GFP_NATIVE_MASK) == GFP_NATIVE_MASK); sys/compat/linuxkpi/common/include/linux/slab.h: return (flags & GFP_NATIVE_MASK); sys/compat/linuxkpi/common/src/linux_page.c: addr = kmem_malloc(size, flags & GFP_NATIVE_MASK); sys/compat/linuxkpi/common/src/linux_page.c: addr = kmem_alloc_contig(size, flags & GFP_NATIVE_MASK, 0, While reviewing the code here, I noticed the kmem_malloc and kmem_alloc_contig in linux_page.c were masking but not the calls in linux_pci.c. Yes this masks to only pass the acceptable M_ flags. if (priv->dma_mask) high = priv->dma_mask; else if (flag & GFP_DMA32) //////////////////////////// here high = BUS_SPACE_MAXADDR_32BIT; else high = BUS_SPACE_MAXADDR; align = PAGE_SIZE << get_order(size); mem = (void *)kmem_alloc_contig(size, flag, 0, high, align, 0, VM_MEMATTR_DEFAULT); It looks like GFP_DMA32 may be set in flag, 1 << 24 which isn't a normal flag kmem_alloc_contig should be seeing. It appears harmless currently. |