free(sc, M_DEVBUF) [Was: amd64 panic snd_hda - hdac_get_capabilities: Invalid corb size (0)]

2010-07-28 Thread Andriy Gapon
on 27/07/2010 19:53 Gavin Atkinson said the following:
 
 Thanks.  Can you try
 http://people.freebsd.org/~gavin/mexas-hda-panic.diff
 
 and see if that solves things for you?
 
 (Credit goes to avg@ for looking into this before me :)

BTW, it seems that there is an epidemic of free(sc, M_DEVBUF) in sound 
drivers.
And not only them, but I haven't looked at the other cases - perhaps the code
there does something different and thus correct.


glimpse -w M_DEVBUF | fgrep -w free | fgrep '(sc,'
/usr/src/sys/dev/sound/pci/hda/hdac.c:  free(sc, M_DEVBUF);
/usr/src/sys/net/if_lagg.c: free(sc, M_DEVBUF);
/usr/src/sys/net/if_lagg.c: free(sc, M_DEVBUF);
/usr/src/sys/net/if_lagg.c: free(sc, M_DEVBUF);
/usr/src/sys/net/if_bridge.c:   free(sc, M_DEVBUF);
/usr/src/sys/net/if_bridge.c:   free(sc, M_DEVBUF);
/usr/src/sys/dev/sound/pci/ich.c:   free(sc, M_DEVBUF);
/usr/src/sys/dev/sound/pci/ich.c:   free(sc, M_DEVBUF);
/usr/src/sys/dev/sound/pci/maestro3.c:  free(sc, M_DEVBUF);
/usr/src/sys/dev/sound/pci/maestro3.c:  free(sc, M_DEVBUF);
/usr/src/sys/net/if_enc.c:  free(sc, M_DEVBUF);
/usr/src/sys/sun4v/sun4v/simdisk.c: free(sc, M_DEVBUF);
/usr/src/sys/dev/ofw/ofw_disk.c:free(sc, M_DEVBUF);
/usr/src/sys/dev/sound/isa/ess.c:   free(sc, M_DEVBUF);
/usr/src/sys/dev/sound/sbus/cs4231.c:   free(sc, M_DEVBUF);
/usr/src/sys/dev/sound/pci/atiixp.c:free(sc, M_DEVBUF);
/usr/src/sys/dev/sound/pci/emu10kx-pcm.c:   free(sc, M_DEVBUF);
/usr/src/sys/dev/sound/pci/emu10kx-pcm.c:   free(sc, M_DEVBUF);
/usr/src/sys/dev/sound/pci/emu10kx-pcm.c:   free(sc, M_DEVBUF);
/usr/src/sys/dev/sound/pci/ds1.c:   free(sc, M_DEVBUF);
/usr/src/sys/dev/sound/pci/ds1.c:   free(sc, M_DEVBUF);
/usr/src/sys/dev/sound/pci/cmi.c:   free(sc, M_DEVBUF);
/usr/src/sys/dev/sound/pci/cmi.c:   free(sc, M_DEVBUF);
/usr/src/sys/dev/sound/pci/neomagic.c:  free(sc, 
M_DEVBUF);
/usr/src/sys/dev/sound/pci/neomagic.c:  free(sc, M_DEVBUF);
/usr/src/sys/dev/sound/pci/neomagic.c:  free(sc, M_DEVBUF);
/usr/src/sys/dev/sound/pci/neomagic.c:  free(sc, M_DEVBUF);
/usr/src/sys/dev/sound/pci/solo.c:  free(sc, M_DEVBUF);
/usr/src/sys/dev/sound/pci/als4000.c:   free(sc, M_DEVBUF);
/usr/src/sys/dev/sound/pci/als4000.c:   free(sc, M_DEVBUF);
/usr/src/sys/dev/sound/pci/vibes.c: free(sc, M_DEVBUF);
/usr/src/sys/dev/sound/pci/emu10k1.c:   free(sc, M_DEVBUF);
/usr/src/sys/dev/sound/pci/emu10k1.c:   free(sc, M_DEVBUF);
/usr/src/sys/dev/sound/pci/cs4281.c: free(sc, M_DEVBUF);
/usr/src/sys/dev/sound/pci/cs4281.c: free(sc, M_DEVBUF);


Good example of how get examples get multiplied.

P.S.
Actually all non-sound case seem to be correct, explicitly malloc-ed memory gets
freed.

-- 
Andriy Gapon
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: free(sc, M_DEVBUF) [Was: amd64 panic snd_hda - hdac_get_capabilities: Invalid corb size (0)]

2010-07-28 Thread Kostik Belousov
On Wed, Jul 28, 2010 at 04:14:10PM +0300, Andriy Gapon wrote:
 on 27/07/2010 19:53 Gavin Atkinson said the following:
  
  Thanks.  Can you try
  http://people.freebsd.org/~gavin/mexas-hda-panic.diff
  
  and see if that solves things for you?
  
  (Credit goes to avg@ for looking into this before me :)
 
 BTW, it seems that there is an epidemic of free(sc, M_DEVBUF) in sound 
 drivers.
 And not only them, but I haven't looked at the other cases - perhaps the code
 there does something different and thus correct.
 
 
 glimpse -w M_DEVBUF | fgrep -w free | fgrep '(sc,'
 /usr/src/sys/dev/sound/pci/hda/hdac.c:  free(sc, M_DEVBUF);
 /usr/src/sys/net/if_lagg.c: free(sc, M_DEVBUF);
 /usr/src/sys/net/if_lagg.c: free(sc, M_DEVBUF);
 /usr/src/sys/net/if_lagg.c: free(sc, M_DEVBUF);
 /usr/src/sys/net/if_bridge.c:   free(sc, M_DEVBUF);
 /usr/src/sys/net/if_bridge.c:   free(sc, M_DEVBUF);
 /usr/src/sys/dev/sound/pci/ich.c:   free(sc, M_DEVBUF);
 /usr/src/sys/dev/sound/pci/ich.c:   free(sc, M_DEVBUF);
 /usr/src/sys/dev/sound/pci/maestro3.c:  free(sc, M_DEVBUF);
 /usr/src/sys/dev/sound/pci/maestro3.c:  free(sc, M_DEVBUF);
 /usr/src/sys/net/if_enc.c:  free(sc, M_DEVBUF);
 /usr/src/sys/sun4v/sun4v/simdisk.c: free(sc, M_DEVBUF);
 /usr/src/sys/dev/ofw/ofw_disk.c:free(sc, M_DEVBUF);
 /usr/src/sys/dev/sound/isa/ess.c:   free(sc, M_DEVBUF);
 /usr/src/sys/dev/sound/sbus/cs4231.c:   free(sc, M_DEVBUF);
 /usr/src/sys/dev/sound/pci/atiixp.c:free(sc, M_DEVBUF);
 /usr/src/sys/dev/sound/pci/emu10kx-pcm.c:   free(sc, M_DEVBUF);
 /usr/src/sys/dev/sound/pci/emu10kx-pcm.c:   free(sc, M_DEVBUF);
 /usr/src/sys/dev/sound/pci/emu10kx-pcm.c:   free(sc, M_DEVBUF);
 /usr/src/sys/dev/sound/pci/ds1.c:   free(sc, M_DEVBUF);
 /usr/src/sys/dev/sound/pci/ds1.c:   free(sc, M_DEVBUF);
 /usr/src/sys/dev/sound/pci/cmi.c:   free(sc, M_DEVBUF);
 /usr/src/sys/dev/sound/pci/cmi.c:   free(sc, M_DEVBUF);
 /usr/src/sys/dev/sound/pci/neomagic.c:  free(sc, 
 M_DEVBUF);
 /usr/src/sys/dev/sound/pci/neomagic.c:  free(sc, M_DEVBUF);
 /usr/src/sys/dev/sound/pci/neomagic.c:  free(sc, M_DEVBUF);
 /usr/src/sys/dev/sound/pci/neomagic.c:  free(sc, M_DEVBUF);
 /usr/src/sys/dev/sound/pci/solo.c:  free(sc, M_DEVBUF);
 /usr/src/sys/dev/sound/pci/als4000.c:   free(sc, M_DEVBUF);
 /usr/src/sys/dev/sound/pci/als4000.c:   free(sc, M_DEVBUF);
 /usr/src/sys/dev/sound/pci/vibes.c: free(sc, M_DEVBUF);
 /usr/src/sys/dev/sound/pci/emu10k1.c:   free(sc, M_DEVBUF);
 /usr/src/sys/dev/sound/pci/emu10k1.c:   free(sc, M_DEVBUF);
 /usr/src/sys/dev/sound/pci/cs4281.c: free(sc, M_DEVBUF);
 /usr/src/sys/dev/sound/pci/cs4281.c: free(sc, M_DEVBUF);
 
 
 Good example of how get examples get multiplied.
 
 P.S.
 Actually all non-sound case seem to be correct, explicitly malloc-ed memory 
 gets
 freed.

If anybody goes to make infrastructure work on the sound drivers,
it might be not that bad idea to replace clone.c with cdevpriv.


pgpBKC2T791a0.pgp
Description: PGP signature


Re: free(sc, M_DEVBUF) [Was: amd64 panic snd_hda - hdac_get_capabilities: Invalid corb size (0)]

2010-07-28 Thread Pyun YongHyeon
On Wed, Jul 28, 2010 at 04:14:10PM +0300, Andriy Gapon wrote:
 on 27/07/2010 19:53 Gavin Atkinson said the following:
  
  Thanks.  Can you try
  http://people.freebsd.org/~gavin/mexas-hda-panic.diff
  
  and see if that solves things for you?
  
  (Credit goes to avg@ for looking into this before me :)
 
 BTW, it seems that there is an epidemic of free(sc, M_DEVBUF) in sound 
 drivers.
 And not only them, but I haven't looked at the other cases - perhaps the code
 there does something different and thus correct.
 
 
 glimpse -w M_DEVBUF | fgrep -w free | fgrep '(sc,'
 /usr/src/sys/dev/sound/pci/hda/hdac.c:  free(sc, M_DEVBUF);
 /usr/src/sys/net/if_lagg.c: free(sc, M_DEVBUF);
 /usr/src/sys/net/if_lagg.c: free(sc, M_DEVBUF);
 /usr/src/sys/net/if_lagg.c: free(sc, M_DEVBUF);
 /usr/src/sys/net/if_bridge.c:   free(sc, M_DEVBUF);
 /usr/src/sys/net/if_bridge.c:   free(sc, M_DEVBUF);
 /usr/src/sys/dev/sound/pci/ich.c:   free(sc, M_DEVBUF);
 /usr/src/sys/dev/sound/pci/ich.c:   free(sc, M_DEVBUF);
 /usr/src/sys/dev/sound/pci/maestro3.c:  free(sc, M_DEVBUF);
 /usr/src/sys/dev/sound/pci/maestro3.c:  free(sc, M_DEVBUF);
 /usr/src/sys/net/if_enc.c:  free(sc, M_DEVBUF);
 /usr/src/sys/sun4v/sun4v/simdisk.c: free(sc, M_DEVBUF);
 /usr/src/sys/dev/ofw/ofw_disk.c:free(sc, M_DEVBUF);
 /usr/src/sys/dev/sound/isa/ess.c:   free(sc, M_DEVBUF);
 /usr/src/sys/dev/sound/sbus/cs4231.c:   free(sc, M_DEVBUF);
 /usr/src/sys/dev/sound/pci/atiixp.c:free(sc, M_DEVBUF);
 /usr/src/sys/dev/sound/pci/emu10kx-pcm.c:   free(sc, M_DEVBUF);
 /usr/src/sys/dev/sound/pci/emu10kx-pcm.c:   free(sc, M_DEVBUF);
 /usr/src/sys/dev/sound/pci/emu10kx-pcm.c:   free(sc, M_DEVBUF);
 /usr/src/sys/dev/sound/pci/ds1.c:   free(sc, M_DEVBUF);
 /usr/src/sys/dev/sound/pci/ds1.c:   free(sc, M_DEVBUF);
 /usr/src/sys/dev/sound/pci/cmi.c:   free(sc, M_DEVBUF);
 /usr/src/sys/dev/sound/pci/cmi.c:   free(sc, M_DEVBUF);
 /usr/src/sys/dev/sound/pci/neomagic.c:  free(sc, 
 M_DEVBUF);
 /usr/src/sys/dev/sound/pci/neomagic.c:  free(sc, M_DEVBUF);
 /usr/src/sys/dev/sound/pci/neomagic.c:  free(sc, M_DEVBUF);
 /usr/src/sys/dev/sound/pci/neomagic.c:  free(sc, M_DEVBUF);
 /usr/src/sys/dev/sound/pci/solo.c:  free(sc, M_DEVBUF);
 /usr/src/sys/dev/sound/pci/als4000.c:   free(sc, M_DEVBUF);
 /usr/src/sys/dev/sound/pci/als4000.c:   free(sc, M_DEVBUF);
 /usr/src/sys/dev/sound/pci/vibes.c: free(sc, M_DEVBUF);
 /usr/src/sys/dev/sound/pci/emu10k1.c:   free(sc, M_DEVBUF);
 /usr/src/sys/dev/sound/pci/emu10k1.c:   free(sc, M_DEVBUF);
 /usr/src/sys/dev/sound/pci/cs4281.c: free(sc, M_DEVBUF);
 /usr/src/sys/dev/sound/pci/cs4281.c: free(sc, M_DEVBUF);
 
 
 Good example of how get examples get multiplied.
 

When I started to write snd_audiocs(4) for sparc64 I also noticed
that. The practice of sound driver was to explicitly allocate softc
structure in device attach routine and release it after use. I
don't remember details but other parts of sound subsystem seemed to
rely on the structure and changing it to use standard
device_get_softc(9) was not easy task.

 P.S.
 Actually all non-sound case seem to be correct, explicitly malloc-ed memory 
 gets
 freed.
 
 -- 
 Andriy Gapon
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: free(sc, M_DEVBUF) [Was: amd64 panic snd_hda - hdac_get_capabilities: Invalid corb size (0)]

2010-07-28 Thread Andriy Gapon
on 28/07/2010 19:59 Pyun YongHyeon said the following:
 
 When I started to write snd_audiocs(4) for sparc64 I also noticed
 that. The practice of sound driver was to explicitly allocate softc
 structure in device attach routine and release it after use. I
 don't remember details but other parts of sound subsystem seemed to
 rely on the structure and changing it to use standard
 device_get_softc(9) was not easy task.

Oh, I see what you mean.
So those drivers do malloc their softc.
snd_hda was (is) the only one that got it via device_get_softc, but still used
free(9) on it in the case of attachment failure.

-- 
Andriy Gapon
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org