lkml.org 
[lkml]   [2021]   [Sep]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH v3 19/20] PCI/P2PDMA: introduce pci_mmap_p2pmem()
    On Thu, Sep 16, 2021 at 05:40:59PM -0600, Logan Gunthorpe wrote:
    > +int pci_mmap_p2pmem(struct pci_dev *pdev, struct vm_area_struct *vma)
    > +{
    > + struct pci_p2pdma_map *pmap;
    > + struct pci_p2pdma *p2pdma;
    > + int ret;
    > +
    > + /* prevent private mappings from being established */
    > + if ((vma->vm_flags & VM_MAYSHARE) != VM_MAYSHARE) {
    > + pci_info_ratelimited(pdev,
    > + "%s: fail, attempted private mapping\n",
    > + current->comm);
    > + return -EINVAL;
    > + }
    > +
    > + pmap = pci_p2pdma_map_alloc(pdev, vma->vm_end - vma->vm_start);
    > + if (!pmap)
    > + return -ENOMEM;
    > +
    > + rcu_read_lock();
    > + p2pdma = rcu_dereference(pdev->p2pdma);
    > + if (!p2pdma) {
    > + ret = -ENODEV;
    > + goto out;
    > + }
    > +
    > + ret = simple_pin_fs(&pci_p2pdma_fs_type, &pci_p2pdma_fs_mnt,
    > + &pci_p2pdma_fs_cnt);
    > + if (ret)
    > + goto out;
    > +
    > + ihold(p2pdma->inode);
    > + pmap->inode = p2pdma->inode;
    > + rcu_read_unlock();
    > +
    > + vma->vm_flags |= VM_MIXEDMAP;

    Why is this a VM_MIXEDMAP? Everything fault sticks in here has a
    struct page, right?

    Jason

    \
     
     \ /
      Last update: 2021-09-28 21:56    [W:7.345 / U:0.108 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site