From: Jerome Glisse Subject: Re: [PATCH] drm/radeon/kms: consolidate GART code, fix memory fault after GPU lockup Date: Fri, 14 Oct 2011 12:37:54 -0400 Message-ID: <20111014163754.GA7116@homer.localdomain> References: <1318538338-26857-1-git-send-email-j.glisse@gmail.com> <1318580094.6614.28.camel@thor.local> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Received: from mail-ww0-f43.google.com (mail-ww0-f43.google.com [74.125.82.43]) by gabe.freedesktop.org (Postfix) with ESMTP id 841329E77C for ; Fri, 14 Oct 2011 09:33:58 -0700 (PDT) Received: by wwf27 with SMTP id 27so2996394wwf.12 for ; Fri, 14 Oct 2011 09:33:57 -0700 (PDT) Content-Disposition: inline In-Reply-To: <1318580094.6614.28.camel@thor.local> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org Errors-To: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org To: Michel =?iso-8859-1?Q?D=E4nzer?= Cc: dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org On Fri, Oct 14, 2011 at 10:14:54AM +0200, Michel D=E4nzer wrote: > [ Dropping stable@kernel.org from CC, it'll get picked up for stable > once it hits mainline ] > = > On Don, 2011-10-13 at 16:38 -0400, j.glisse@gmail.com wrote: = > > From: Jerome Glisse > > = > > After GPU lockup VRAM gart table is unpinned and thus its pointer > > becomes unvalid. This patch move the unpin code to a common helper > > function and set pointer to NULL so that page update code can check > > if it should update GPU page table or not. That way bo still bound > > to GART can be unbound (pci_unmap_page for all there page) properly > > while there is no need to update the GPU page table. > > = > > Signed-off-by: Jerome Glisse > = > [...] > = > > rdev->gart.pages_addr[p] =3D rdev->dummy_page.addr; > > page_base =3D rdev->gart.pages_addr[p]; > > for (j =3D 0; j < (PAGE_SIZE / RADEON_GPU_PAGE_SIZE); j++, t++) { > > - radeon_gart_set_page(rdev, t, page_base); > > + if (rdev->gart.ptr) { > > + radeon_gart_set_page(rdev, t, page_base); > > + } > > page_base +=3D RADEON_GPU_PAGE_SIZE; > > } > > } > > @@ -201,7 +211,9 @@ int radeon_gart_bind(struct radeon_device *rdev, un= signed offset, > > rdev->gart.pages[p] =3D pagelist[i]; > > page_base =3D rdev->gart.pages_addr[p]; > > for (j =3D 0; j < (PAGE_SIZE / RADEON_GPU_PAGE_SIZE); j++, t++) { > > - radeon_gart_set_page(rdev, t, page_base); > > + if (rdev->gart.ptr) { > > + radeon_gart_set_page(rdev, t, page_base); > > + } > > page_base +=3D RADEON_GPU_PAGE_SIZE; > > } > > } > = > Looks like these two loops could be completely guarded by if (rdev->gart.= ptr). Will respin with that = > = > > @@ -218,7 +230,9 @@ void radeon_gart_restore(struct radeon_device *rdev) > > for (i =3D 0, t =3D 0; i < rdev->gart.num_cpu_pages; i++) { > > page_base =3D rdev->gart.pages_addr[i]; > > for (j =3D 0; j < (PAGE_SIZE / RADEON_GPU_PAGE_SIZE); j++, t++) { > > - radeon_gart_set_page(rdev, t, page_base); > > + if (rdev->gart.ptr) { > > + radeon_gart_set_page(rdev, t, page_base); > > + } > > page_base +=3D RADEON_GPU_PAGE_SIZE; > > } > > } > = > I think this should rather BUG_ON(!rdev->gart.ptr). This should only happen after GPU lockup and GPU lockup would already print loud message so i don't think it's usefull to add another message that would confuse user more. Cheers, Jerome