NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/39526: adh driver crashes system if it runs out of memory



On Fri, Sep 26, 2008 at 11:50:04AM +0000, Wolfgang Stukenbrock wrote:
> The following reply was made to PR kern/39526; it has been noted by GNATS.
> 
> From: Wolfgang Stukenbrock <Wolfgang.Stukenbrock%nagler-company.com@localhost>
> To: gnats-bugs%NetBSD.org@localhost
> Cc: 
> Subject: Re: kern/39526: adh driver crashes system if it runs out of memory
> Date: Fri, 26 Sep 2008 13:48:36 +0200
> 
>  Hi again,
>  
>  now I've a workaround that avoids crashing the system by the ahd driver.
>  
>  The workaround will allocate all SCB structures during startup if 64-bit 
>  bus is detected. By dooing this it avoids any call to GROW the number of 
>  SCB's later.
>  That is the place where no memory was found and after some failed 
>  allocations a kernel crash with "fatal page fault in supervisour mode" 
>  happens.
>  
>  Wit this fix I've go no longer the kernel panic.
>  So this workaround leads to a stable running driver, but it does not fix 
>  the main cause of the problem!
>  There seems to be something wrong in either this driver or the uvm stuff!
>  
>  I assume that the problem is in the uvm stuff, because I've a similar 
>  problem with the ahc driver. It will crash too after more than 4G is 
>  used by the system and the ahc driver will also try to allocate more SCB's.

No, it's a bug in both ahc and ahd, which don't handle properly errors
from bus_dma().

>  in /usr/src/sys/dev/ic:
>  
>  
>  --- aic79xx.c   2008/09/26 11:19:07     1.1
>  +++ aic79xx.c   2008/09/26 11:26:57
>  @@ -5441,6 +5441,24 @@
>                         ahd_name(ahd));
>                  goto error_exit;
>          }
>  +/*
>  + * Workaround for the "more than 4GB main memory" crash.
>  + * We allocate all SCB's now - no additional request taht may fail
>  + * later.
>  + * This will work around a bug in either this driver or the uvm part.
>  + * Without this, the system will crash after some failed GROW requests with
>  + * a "fatal page fault in supoervisor mode".
>  + *
>  + * This fix requires setting the 64-Bit Flag in ahd_pci.c too.
>  + * Perhaps the amount of main memory should be checked here too ..
>  + *
>  +  W. Stukenbrock (09.2008)
>  + */
>  +       if ((ahd->flags & AHD_64BIT_ADDRESSING) != 0) {
>  +               printf("%s: allocating all SCB entries - 64 bit workaround 
> for 4G memory bug\n",
>  +                       ahd_name(ahd));
>  +               while (ahd_alloc_scbs(ahd) != 0);
>  +       }

Doing this based on AHD_64BIT_ADDRESSING is wrong. It will orrur as
well, if not more, if the adapter can't handle 64bits addresses.

-- 
Manuel Bouyer <bouyer%antioche.eu.org@localhost>
     NetBSD: 26 ans d'experience feront toujours la difference
--


Home | Main Index | Thread Index | Old Index