NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: kern/57833: kernel panic on xorg exit
The following reply was made to PR kern/57833; it has been noted by GNATS.
From: Taylor R Campbell <riastradh%NetBSD.org@localhost>
To: Ramiro Aceves <ea1abz%gmail.com@localhost>,
"David H. Gutteridge" <david%gutteridge.ca@localhost>
Cc: gnats-bugs%NetBSD.org@localhost, netbsd-bugs%NetBSD.org@localhost
Subject: Re: kern/57833: kernel panic on xorg exit
Date: Thu, 11 Jan 2024 04:37:03 +0000
This is a multi-part message in MIME format.
--=_rcF9s9y1wcdKoxr8Pe72O3MsTry8XuO4
Can you also try the attached patch, instead of the other one, to see
what happens?
(This might break things more spectacularly -- I haven't thought about
whether it makes a lot of sense -- but it should at least prevent the
particular crash you observed, if we ever get that far with it.)
--=_rcF9s9y1wcdKoxr8Pe72O3MsTry8XuO4
Content-Type: text/plain; charset="ISO-8859-1"; name="pr57833-i915gempages"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename="pr57833-i915gempages.patch"
diff --git a/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_mman.c b/sys/=
external/bsd/drm2/dist/drm/i915/gem/i915_gem_mman.c
index 8e592f008ef7..276ebbdbc234 100644
--- a/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_mman.c
+++ b/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_mman.c
@@ -677,6 +677,8 @@ void i915_gem_object_release_mmap_offset(struct drm_i91=
5_gem_object *obj)
return;
for (i =3D 0; i < obj->base.size >> PAGE_SHIFT; i++) {
page =3D obj->mm.pages->sgl->sg_pgs[i];
+ if (page =3D=3D NULL)
+ continue;
vm_page =3D &page->p_vmp;
pmap_page_protect(vm_page, VM_PROT_NONE);
}
diff --git a/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_phys.c b/sys/=
external/bsd/drm2/dist/drm/i915/gem/i915_gem_phys.c
index 3f68276eea5f..29772bdbd8d9 100644
--- a/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_phys.c
+++ b/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_phys.c
@@ -83,8 +83,14 @@ static int i915_gem_object_get_pages_phys(struct drm_i91=
5_gem_object *obj)
if (!st)
goto err_pci;
=20
+#ifdef __NetBSD__
+ if (sg_alloc_table_from_bus_dmamem(st, dmat, &obj->mm.u.phys.seg, 1,
+ GFP_KERNEL))
+ goto err_st;
+#else
if (sg_alloc_table(st, 1, GFP_KERNEL))
goto err_st;
+#endif
=20
sg =3D st->sgl;
#ifdef __NetBSD__
diff --git a/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_region.c b/sy=
s/external/bsd/drm2/dist/drm/i915/gem/i915_gem_region.c
index 1a928988bd5f..5e8232b9634f 100644
--- a/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_region.c
+++ b/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_region.c
@@ -85,7 +85,15 @@ i915_gem_object_get_pages_buddy(struct drm_i915_gem_obje=
ct *obj)
=20
segs[i].ds_addr =3D mem->region.start + offset;
segs[i].ds_len =3D block_size;
+ i++;
}
+ KASSERT(i =3D=3D nsegs);
+
+ /* XXX errno NetBSD->Linux */
+ ret =3D -bus_dmamem_export_pages(dmat, segs, nsegs, sg->sg_pgs,
+ sg->sg_npgs);
+ if (ret)
+ goto err;
=20
/* XXX errno NetBSD->Linux */
ret =3D -bus_dmamap_create(dmat, size, nsegs, size, 0, BUS_DMA_WAITOK,
diff --git a/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_stolen.c b/sy=
s/external/bsd/drm2/dist/drm/i915/gem/i915_gem_stolen.c
index b53d543fa894..08cf7f0001bf 100644
--- a/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_stolen.c
+++ b/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_stolen.c
@@ -506,14 +506,13 @@ i915_pages_create_for_stolen(struct drm_device *dev,
{
struct drm_i915_private *i915 =3D to_i915(dev);
struct sg_table *st;
+ struct scatterlist *sg;
#ifdef __NetBSD__
bus_dma_tag_t dmat =3D i915->drm.dmat;
bus_dma_segment_t *seg =3D NULL;
int nseg =3D 0, i;
bool loaded =3D false;
int ret;
-#else
- struct scatterlist *sg;
#endif
=20
GEM_BUG_ON(range_overflows(offset, size, resource_size(&i915->dsm)));
@@ -532,6 +531,7 @@ i915_pages_create_for_stolen(struct drm_device *dev,
return ERR_PTR(-ENOMEM);
}
=20
+ sg =3D st->sgl;
#ifdef __NetBSD__
KASSERT((size % PAGE_SIZE) =3D=3D 0);
nseg =3D size / PAGE_SIZE;
@@ -548,19 +548,25 @@ i915_pages_create_for_stolen(struct drm_device *dev,
seg[i].ds_len =3D PAGE_SIZE;
}
=20
+ /* XXX errno NetBSD->Linux */
+ ret =3D -bus_dmamem_export_pages(dmat, seg, nseg, sg->sg_pgs,
+ sg->sg_npgs);
+ if (ret)
+ goto err;
+
/* XXX errno NetBSD->Linux */
ret =3D -bus_dmamap_create(dmat, size, nseg, PAGE_SIZE, 0,
- BUS_DMA_WAITOK, &st->sgl->sg_dmamap);
+ BUS_DMA_WAITOK, &sg->sg_dmamap);
if (ret) {
DRM_ERROR("failed to create DMA map for stolen object: %d\n",
ret);
- st->sgl->sg_dmamap =3D NULL;
+ sg->sg_dmamap =3D NULL;
goto out;
}
- st->sgl->sg_dmat =3D dmat;
+ sg->sg_dmat =3D dmat;
=20
/* XXX errno NetBSD->Liux */
- ret =3D -bus_dmamap_load_raw(dmat, st->sgl->sg_dmamap, seg, nseg, size,
+ ret =3D -bus_dmamap_load_raw(dmat, sg->sg_dmamap, seg, nseg, size,
BUS_DMA_WAITOK);
if (ret) {
DRM_ERROR("failed to load DMA map for stolen object: %d\n",
@@ -571,13 +577,12 @@ i915_pages_create_for_stolen(struct drm_device *dev,
=20
out: if (ret) {
if (loaded)
- bus_dmamap_unload(dmat, st->sgl->sg_dmamap);
+ bus_dmamap_unload(dmat, sg->sg_dmamap);
sg_free_table(st);
kfree(st);
return ERR_PTR(ret);
}
#else
- sg =3D st->sgl;
sg->offset =3D 0;
sg->length =3D size;
=20
--=_rcF9s9y1wcdKoxr8Pe72O3MsTry8XuO4--
Home |
Main Index |
Thread Index |
Old Index