Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic pool_prime() the ncr53c9x_ecb pool with one eleme...



details:   https://anonhg.NetBSD.org/src/rev/03d093430695
branches:  trunk
changeset: 569876:03d093430695
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Fri Sep 10 23:44:29 2004 +0000

description:
pool_prime() the ncr53c9x_ecb pool with one element (this will cause one page
to be allocated anyway). scsipi can deal with resources shortage, but if this
pool goes down to 0 pages we can deadlock with the scsipi_xfer, vnode or
inode pools.
Also update a comment, despite resources accounting we can return
ATAPTER_RESOURCES_SHORTAGE here.

diffstat:

 sys/dev/ic/ncr53c9x.c |  11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diffs (39 lines):

diff -r f7a13f92d616 -r 03d093430695 sys/dev/ic/ncr53c9x.c
--- a/sys/dev/ic/ncr53c9x.c     Fri Sep 10 22:22:20 2004 +0000
+++ b/sys/dev/ic/ncr53c9x.c     Fri Sep 10 23:44:29 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ncr53c9x.c,v 1.111 2004/05/03 12:25:34 pk Exp $        */
+/*     $NetBSD: ncr53c9x.c,v 1.112 2004/09/10 23:44:29 bouyer Exp $    */
 
 /*-
  * Copyright (c) 1998, 2002 The NetBSD Foundation, Inc.
@@ -77,7 +77,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ncr53c9x.c,v 1.111 2004/05/03 12:25:34 pk Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ncr53c9x.c,v 1.112 2004/09/10 23:44:29 bouyer Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -444,6 +444,10 @@
                /* All instances share this pool */
                pool_init(&ecb_pool, sizeof(struct ncr53c9x_ecb), 0, 0, 0,
                    "ncr53c9x_ecb", NULL);
+               /* make sure to always have some items to play with */
+               if (pool_prime(&ecb_pool, 1) == ENOMEM) {
+                       printf("WARNING: not enough memory for ncr53c9x_ecb\n");
+               }
                ecb_pool_initialized = 1;
        }
 
@@ -858,7 +862,8 @@
                ecb = ncr53c9x_get_ecb(sc, xs->xs_control);
                /*
                 * This should never happen as we track resources
-                * in the mid-layer.
+                * in the mid-layer, but for now it can as pool_get()
+                * can fail.
                 */
                if (ecb == NULL) {
                        scsipi_printaddr(periph);



Home | Main Index | Thread Index | Old Index