Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 03 Sep 2008 22:00:27 -0400
From:      Robert Noland <rnoland@FreeBSD.org>
To:        Steve Kargl <sgk@troutmask.apl.washington.edu>
Cc:        freebsd-current@FreeBSD.org
Subject:   Re: drm causes kernel panic
Message-ID:  <1220493627.2467.6.camel@wombat.2hip.net>
In-Reply-To: <20080903195845.GA1370@troutmask.apl.washington.edu>
References:  <20080903011612.GA1242@troutmask.apl.washington.edu> <1220416793.1848.1.camel@wombat.2hip.net> <20080903051228.GA2475@troutmask.apl.washington.edu> <1220471512.11763.9.camel@squirrel.corp.cox.com> <20080903195845.GA1370@troutmask.apl.washington.edu>

next in thread | previous in thread | raw e-mail | index | archive | help

--=-flyrfkESakkE2tiRx7wv
Content-Type: multipart/mixed; boundary="=-82ZGda6AVxPnsww7BYI+"


--=-82ZGda6AVxPnsww7BYI+
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

On Wed, 2008-09-03 at 12:58 -0700, Steve Kargl wrote:
> On Wed, Sep 03, 2008 at 03:51:52PM -0400, Robert Noland wrote:
> > On Tue, 2008-09-02 at 22:12 -0700, Steve Kargl wrote:
> >>=20
> >> From dmesg:
> >>=20
> >> vgapci0: <VGA display> port 0xb000-0xb0ff mem 0xfd000000-0xfdffffff,0
> >> xfeaff000-0xfeafffff irq 18 at device 6.0 on pci3
> >> drm0: <Rage XL> on vgapci0
> >> info: [drm] Initialized mach64 2.0.0 20060718
> >=20
> > Ok, I've found the problem... It is easy enough to fix your specific
> > situation, but doing so will cause problems for other drivers...  Which
> > is the reason that I made that change to begin with.  The big problem i=
s
> > that drm_pci_alloc gets called from a variety of places, some of which
> > already hold locks while others don't.  We aren't allowed to hold locks
> > over some of the bus_dma functions, so I have to go through all of thes=
e
> > paths and figure out if it is generally safe to always drop the locks,
> > or if I need to restructure the code somehow...  If you want a patch to
> > just get you going temporarily, just let me know...
> >=20
>=20
> I can disable Xorg's dri module.  When you have a patch you're happy
> with, feel free to ping me for testing.

Ok, please try the attached patch.  I talked it over with another drm
developer and it should be safe to drop all the locks while calling
drm_pci_alloc().  I think I have fixed this for all drivers / paths that
call it.  It will log an error now if it is called with either of the
two locks that I found being held.  I have tested this on my intel 965gm
so far and all is well.  I also had to touch mach64 and radeon, so I
need someone to validate those.  (This is a different path from the
panic you received previously)

robert.


--=-82ZGda6AVxPnsww7BYI+
Content-Disposition: attachment; filename=drm_pci_alloc-lock_fix.patch
Content-Transfer-Encoding: base64
Content-Type: text/x-patch; name=drm_pci_alloc-lock_fix.patch; charset=utf-8

SW5kZXg6IGRldi9kcm0vZHJtX2J1ZnMuYw0KPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQ0KLS0tIGRldi9kcm0vZHJtX2J1
ZnMuYwkocmV2aXNpb24gMTgyNDY2KQ0KKysrIGRldi9kcm0vZHJtX2J1ZnMuYwkod29ya2luZyBj
b3B5KQ0KQEAgLTU5OCw4ICs1OTgsMTAgQEANCiAJcGFnZV9jb3VudCA9IDA7DQogDQogCXdoaWxl
ICggZW50cnktPmJ1Zl9jb3VudCA8IGNvdW50ICkgew0KKwkJRFJNX1NQSU5VTkxPQ0soJmRldi0+
ZG1hX2xvY2spOw0KIAkJZHJtX2RtYV9oYW5kbGVfdCAqZG1haCA9IGRybV9wY2lfYWxsb2MoZGV2
LCBzaXplLCBhbGlnbm1lbnQsDQogCQkgICAgMHhmZmZmZmZmZnVsKTsNCisJCURSTV9TUElOTE9D
SygmZGV2LT5kbWFfbG9jayk7DQogCQlpZiAoZG1haCA9PSBOVUxMKSB7DQogCQkJLyogU2V0IGNv
dW50IGNvcnJlY3RseSBzbyB3ZSBmcmVlIHRoZSBwcm9wZXIgYW1vdW50LiAqLw0KIAkJCWVudHJ5
LT5idWZfY291bnQgPSBjb3VudDsNCkluZGV4OiBkZXYvZHJtL21hY2g2NF9kbWEuYw0KPT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT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JRFJNX1VOTE9DSygp
Ow0KKwlkbWFoID0gZHJtX3BjaV9hbGxvYyhkZXYsIGdhcnRfaW5mby0+dGFibGVfc2l6ZSwgUEFH
RV9TSVpFLA0KKwkgICAgZ2FydF9pbmZvLT50YWJsZV9tYXNrKTsNCisJRFJNX0xPQ0soKTsNCisJ
aWYgKGRtYWggPT0gTlVMTCkNCiAJCXJldHVybiBFTk9NRU07DQogDQorCWRldi0+c2ctPmRtYWgg
PSBkbWFoOw0KKw0KIAlyZXR1cm4gMDsNCiB9DQogDQo=


--=-82ZGda6AVxPnsww7BYI+--

--=-flyrfkESakkE2tiRx7wv
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (FreeBSD)

iEYEABECAAYFAki/QTsACgkQM4TrQ4qfRONxfwCeKHi5wj3c141tdhEn4Lo4mDsc
aoAAnjM62HTABU5YAe2p3pTwr+nXzED1
=MTVm
-----END PGP SIGNATURE-----

--=-flyrfkESakkE2tiRx7wv--




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1220493627.2467.6.camel>