linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: Recent kernels sound crash  solution found?
  2001-09-07 19:26 Recent kernels sound crash solution found? Samium Gromoff
@ 2001-09-07 15:16 ` Alan Cox
  2001-09-07 20:09   ` Samium Gromoff
  0 siblings, 1 reply; 5+ messages in thread
From: Alan Cox @ 2001-09-07 15:16 UTC (permalink / raw)
  To: Samium Gromoff; +Cc: alan, linux-kernel

>       * comment to point 2: very rare circumcistances includes
>    that some time should pass to fragment memory

The alloc_dmap code returns -ENOMEM when the allocation fails. That causes
the open_dmap call to return -ENOMEM which in turn causes DMAbuf_open
to return -ENOMEM which causes audio_openb to return -ENOMEM, which gets
back to userspace. 

I don't see a problem.

[sound btw also supports a module option to keep the dmabuffers allocated
 once and hang onto them]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Recent kernels sound crash  solution found?
  2001-09-07 20:09   ` Samium Gromoff
@ 2001-09-07 15:54     ` Alan Cox
  2001-09-07 20:16       ` Samium Gromoff
  0 siblings, 1 reply; 5+ messages in thread
From: Alan Cox @ 2001-09-07 15:54 UTC (permalink / raw)
  To: Samium Gromoff; +Cc: Alan Cox, linux-kernel

>          * Now loop until we get a free buffer. Try to get smaller buffer if
>          * it fails. Don't accept smaller than 8k buffer for performance
>          * reasons.
>          */
>     ===>  _here_ is a dead-loop  <===
>         while (start_addr == NULL && dmap->buffsize > PAGE_SIZE) {

It terminates when dmap->bufsise hits  page size
>                 start_addr = (char *) __get_free_pages(GFP_ATOMIC|GFP_DMA, sz);
>                 if (start_addr == NULL)
>                         dmap->buffsize /= 2;

I see no bug

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Recent kernels sound crash  solution found?
@ 2001-09-07 19:26 Samium Gromoff
  2001-09-07 15:16 ` Alan Cox
  0 siblings, 1 reply; 5+ messages in thread
From: Samium Gromoff @ 2001-09-07 19:26 UTC (permalink / raw)
  To: alan; +Cc: linux-kernel

         Hello folks, seems that i found the potential bug which
    led to the infinite trace i`ve described before.

   Facts:
       1. My host have 24M of RAM and on kernels 2.4.x;x>7 it  started
   to have n-order alloc failures.
       2. In very rare circumsistances under 2.4.8-ac12 i have
   1-order alloc failures.
       3. sound_alloc_dmap::dmabuf.c comments states it will loop
   until the buffer is alloced
       4. sound_alloc_dmap::dmabuf.c comments states it wont accept buffer
   lesser than 8k in size.

   Logic:
      3 + 4 => it loops forever when 1-order alloc fails
      1 + 2 + 3 + 4 => my host crashes

      * comment to point 2: very rare circumcistances includes
   that some time should pass to fragment memory

cheers, Sam 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Recent kernels sound crash  solution found?
  2001-09-07 15:16 ` Alan Cox
@ 2001-09-07 20:09   ` Samium Gromoff
  2001-09-07 15:54     ` Alan Cox
  0 siblings, 1 reply; 5+ messages in thread
From: Samium Gromoff @ 2001-09-07 20:09 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-kernel

"  Alan Cox wrote:"
> 
> >       * comment to point 2: very rare circumcistances includes
> >    that some time should pass to fragment memory
> 
> The alloc_dmap code returns -ENOMEM when the allocation fails. That causes
> the open_dmap call to return -ENOMEM which in turn causes DMAbuf_open
> to return -ENOMEM which causes audio_openb to return -ENOMEM, which gets
> back to userspace. 
> 
> I don't see a problem.
> 
> [sound btw also supports a module option to keep the dmabuffers allocated
>  once and hang onto them]
> 
   Alan, actually i wanted to tell you about other place:
from dmabuf.c:
        /*
         * Now loop until we get a free buffer. Try to get smaller buffer if
         * it fails. Don't accept smaller than 8k buffer for performance
         * reasons.
         */
    ===>  _here_ is a dead-loop  <===
        while (start_addr == NULL && dmap->buffsize > PAGE_SIZE) {
                for (sz = 0, size = PAGE_SIZE; size < dmap->buffsize; sz++, size                dmap->buffsize = PAGE_SIZE * (1 << sz);
                start_addr = (char *) __get_free_pages(GFP_ATOMIC|GFP_DMA, sz);
                if (start_addr == NULL)
                        dmap->buffsize /= 2;
        }

      Solutions:
        1. make it accept 0-order allocations
        2. make CONFIG_SOUND_DMAP not a config, but the only option   


cheers, Sam


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Recent kernels sound crash  solution found?
  2001-09-07 15:54     ` Alan Cox
@ 2001-09-07 20:16       ` Samium Gromoff
  0 siblings, 0 replies; 5+ messages in thread
From: Samium Gromoff @ 2001-09-07 20:16 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-kernel

"  Alan Cox wrote:"
> 
> >          * Now loop until we get a free buffer. Try to get smaller buffer if
> >          * it fails. Don't accept smaller than 8k buffer for performance
> >          * reasons.
> >          */
> >     ===>  _here_ is a dead-loop  <===
> >         while (start_addr == NULL && dmap->buffsize > PAGE_SIZE) {
> 
> It terminates when dmap->bufsise hits  page size
> >                 start_addr = (char *) __get_free_pages(GFP_ATOMIC|GFP_DMA, sz);
> >                 if (start_addr == NULL)
> >                         dmap->buffsize /= 2;
> 
> I see no bug
> 
     Ahh.. yes. Sorry for this one. Comment was so obvious.

regards, Sam

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2001-09-07 15:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-09-07 19:26 Recent kernels sound crash solution found? Samium Gromoff
2001-09-07 15:16 ` Alan Cox
2001-09-07 20:09   ` Samium Gromoff
2001-09-07 15:54     ` Alan Cox
2001-09-07 20:16       ` Samium Gromoff

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).