From: Steven Price <steven.price@arm.com> To: Boris Brezillon <boris.brezillon@collabora.com>, Rob Herring <robh+dt@kernel.org>, Tomeu Vizoso <tomeu@tomeuvizoso.net>, Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>, Robin Murphy <robin.murphy@arm.com> Cc: dri-devel@lists.freedesktop.org, stable@vger.kernel.org Subject: Re: [PATCH 2/3] drm/panfrost: Don't try to map pages that are already mapped Date: Mon, 1 Feb 2021 12:13:42 +0000 [thread overview] Message-ID: <b65e630d-1913-ccfd-56cb-10b96f9052cc@arm.com> (raw) In-Reply-To: <20210201082116.267208-3-boris.brezillon@collabora.com> On 01/02/2021 08:21, Boris Brezillon wrote: > We allocate 2MB chunks at a time, so it might appear that a page fault > has already been handled by a previous page fault when we reach > panfrost_mmu_map_fault_addr(). Bail out in that case to avoid mapping the > same area twice. > > Cc: <stable@vger.kernel.org> > Fixes: 187d2929206e ("drm/panfrost: Add support for GPU heap allocations") > Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com> Reviewed-by: Steven Price <steven.price@arm.com> > --- > drivers/gpu/drm/panfrost/panfrost_mmu.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/panfrost/panfrost_mmu.c b/drivers/gpu/drm/panfrost/panfrost_mmu.c > index 904d63450862..21e552d1ac71 100644 > --- a/drivers/gpu/drm/panfrost/panfrost_mmu.c > +++ b/drivers/gpu/drm/panfrost/panfrost_mmu.c > @@ -488,8 +488,14 @@ static int panfrost_mmu_map_fault_addr(struct panfrost_device *pfdev, int as, > } > bo->base.pages = pages; > bo->base.pages_use_count = 1; > - } else > + } else { > pages = bo->base.pages; > + if (pages[page_offset]) { > + /* Pages are already mapped, bail out. */ > + mutex_unlock(&bo->base.pages_lock); > + goto out; > + } > + } > > mapping = bo->base.base.filp->f_mapping; > mapping_set_unevictable(mapping); > @@ -522,6 +528,7 @@ static int panfrost_mmu_map_fault_addr(struct panfrost_device *pfdev, int as, > > dev_dbg(pfdev->dev, "mapped page fault @ AS%d %llx", as, addr); > > +out: > panfrost_gem_mapping_put(bomapping); > > return 0; >
WARNING: multiple messages have this Message-ID (diff)
From: Steven Price <steven.price@arm.com> To: Boris Brezillon <boris.brezillon@collabora.com>, Rob Herring <robh+dt@kernel.org>, Tomeu Vizoso <tomeu@tomeuvizoso.net>, Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>, Robin Murphy <robin.murphy@arm.com> Cc: stable@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: Re: [PATCH 2/3] drm/panfrost: Don't try to map pages that are already mapped Date: Mon, 1 Feb 2021 12:13:42 +0000 [thread overview] Message-ID: <b65e630d-1913-ccfd-56cb-10b96f9052cc@arm.com> (raw) In-Reply-To: <20210201082116.267208-3-boris.brezillon@collabora.com> On 01/02/2021 08:21, Boris Brezillon wrote: > We allocate 2MB chunks at a time, so it might appear that a page fault > has already been handled by a previous page fault when we reach > panfrost_mmu_map_fault_addr(). Bail out in that case to avoid mapping the > same area twice. > > Cc: <stable@vger.kernel.org> > Fixes: 187d2929206e ("drm/panfrost: Add support for GPU heap allocations") > Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com> Reviewed-by: Steven Price <steven.price@arm.com> > --- > drivers/gpu/drm/panfrost/panfrost_mmu.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/panfrost/panfrost_mmu.c b/drivers/gpu/drm/panfrost/panfrost_mmu.c > index 904d63450862..21e552d1ac71 100644 > --- a/drivers/gpu/drm/panfrost/panfrost_mmu.c > +++ b/drivers/gpu/drm/panfrost/panfrost_mmu.c > @@ -488,8 +488,14 @@ static int panfrost_mmu_map_fault_addr(struct panfrost_device *pfdev, int as, > } > bo->base.pages = pages; > bo->base.pages_use_count = 1; > - } else > + } else { > pages = bo->base.pages; > + if (pages[page_offset]) { > + /* Pages are already mapped, bail out. */ > + mutex_unlock(&bo->base.pages_lock); > + goto out; > + } > + } > > mapping = bo->base.base.filp->f_mapping; > mapping_set_unevictable(mapping); > @@ -522,6 +528,7 @@ static int panfrost_mmu_map_fault_addr(struct panfrost_device *pfdev, int as, > > dev_dbg(pfdev->dev, "mapped page fault @ AS%d %llx", as, addr); > > +out: > panfrost_gem_mapping_put(bomapping); > > return 0; > _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2021-02-01 12:14 UTC|newest] Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-02-01 8:21 [PATCH 0/3] drm/panfrost: MMU fixes Boris Brezillon 2021-02-01 8:21 ` [PATCH 1/3] drm/panfrost: Clear MMU irqs before handling the fault Boris Brezillon 2021-02-01 8:21 ` Boris Brezillon 2021-02-01 12:13 ` Steven Price 2021-02-01 12:13 ` Steven Price 2021-02-01 8:21 ` [PATCH 2/3] drm/panfrost: Don't try to map pages that are already mapped Boris Brezillon 2021-02-01 8:21 ` Boris Brezillon 2021-02-01 12:13 ` Steven Price [this message] 2021-02-01 12:13 ` Steven Price 2021-02-01 8:21 ` [PATCH 3/3] drm/panfrost: Stay in the threaded MMU IRQ handler until we've handled all IRQs Boris Brezillon 2021-02-01 12:13 ` Steven Price 2021-02-01 12:59 ` Boris Brezillon 2021-02-01 13:24 ` Steven Price 2021-02-01 13:47 ` Boris Brezillon 2021-02-03 14:45 ` Rob Herring 2021-02-03 15:43 ` Steven Price
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=b65e630d-1913-ccfd-56cb-10b96f9052cc@arm.com \ --to=steven.price@arm.com \ --cc=alyssa.rosenzweig@collabora.com \ --cc=boris.brezillon@collabora.com \ --cc=dri-devel@lists.freedesktop.org \ --cc=robh+dt@kernel.org \ --cc=robin.murphy@arm.com \ --cc=stable@vger.kernel.org \ --cc=tomeu@tomeuvizoso.net \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.