From owner-p4-projects@FreeBSD.ORG Wed Aug 1 17:07:33 2007 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id C00FB16A420; Wed, 1 Aug 2007 17:07:33 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9594216A41A for ; Wed, 1 Aug 2007 17:07:33 +0000 (UTC) (envelope-from zec@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 86E6F13C442 for ; Wed, 1 Aug 2007 17:07:33 +0000 (UTC) (envelope-from zec@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id l71H7XdV052848 for ; Wed, 1 Aug 2007 17:07:33 GMT (envelope-from zec@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id l71H7XMg052845 for perforce@freebsd.org; Wed, 1 Aug 2007 17:07:33 GMT (envelope-from zec@FreeBSD.org) Date: Wed, 1 Aug 2007 17:07:33 GMT Message-Id: <200708011707.l71H7XMg052845@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to zec@FreeBSD.org using -f From: Marko Zec To: Perforce Change Reviews Cc: Subject: PERFORCE change 124478 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Aug 2007 17:07:34 -0000 http://perforce.freebsd.org/chv.cgi?CH=124478 Change 124478 by zec@zec_tpx32 on 2007/08/01 17:07:22 Introduce a few printf()s for tracking ordering of vnet module instatiation and cleanup. Enabled / disabled at compile time via DEBUG_ORDERING. A few indentation cleanups here and there. Affected files ... .. //depot/projects/vimage/src/sys/kern/kern_vimage.c#30 edit Differences ... ==== //depot/projects/vimage/src/sys/kern/kern_vimage.c#30 (text+ko) ==== @@ -72,6 +72,8 @@ static int vnet_mod_constructor(struct vnet_modlink *); static int vnet_mod_destructor(struct vnet_modlink *); +#define DEBUG_ORDERING + #ifdef VI_PREALLOC_SIZE /* * A private memory allocator can be enabled by setting VI_PREALLOC_SIZE @@ -598,7 +600,19 @@ { const struct vnet_modinfo *vmi = vml->vml_modinfo; - if (vml->vml_modinfo->vmi_struct_size) { +#ifdef DEBUG_ORDERING + printf("instatiating vnet_%s", vmi->vmi_name); + if (vml->vml_iarg) + printf("/%s", vml->vml_iname); + printf(": "); + if (vmi->vmi_struct_size) + printf("malloc(%d); ", vmi->vmi_struct_size); + if (vmi->vmi_iattach != NULL) + printf("iattach()"); + printf("\n"); +#endif + + if (vmi->vmi_struct_size) { void *mem = vi_malloc(vmi->vmi_struct_size, M_VNET, M_NOWAIT | M_ZERO); if (mem == NULL) /* XXX should return error, not panic */ @@ -606,8 +620,8 @@ curvnet->mod_data[vmi->vmi_id] = mem; } - if (vml->vml_modinfo->vmi_iattach != NULL) - vml->vml_modinfo->vmi_iattach(vml->vml_iarg); + if (vmi->vmi_iattach != NULL) + vmi->vmi_iattach(vml->vml_iarg); return 0; } @@ -615,16 +629,29 @@ static int vnet_mod_destructor(vml) struct vnet_modlink *vml; { - if (vml->vml_modinfo->vmi_idetach) - vml->vml_modinfo->vmi_idetach(vml->vml_iarg); - if (vml->vml_modinfo->vmi_struct_size) { - if (curvnet->mod_data[vml->vml_modinfo->vmi_id] == NULL) - panic("vi_destroy: %s\n", - vml->vml_modinfo->vmi_name); - vi_free(curvnet->mod_data[vml->vml_modinfo->vmi_id], - M_VNET); - curvnet->mod_data[vml->vml_modinfo->vmi_id] = NULL; - } + const struct vnet_modinfo *vmi = vml->vml_modinfo; + +#ifdef DEBUG_ORDERING + printf("destroying vnet_%s", vmi->vmi_name); + if (vml->vml_iarg) + printf("/%s", vml->vml_iname); + printf(": "); + if (vmi->vmi_idetach != NULL) + printf("idetach(); "); + if (vmi->vmi_struct_size) + printf("free()"); + printf("\n"); +#endif + + if (vmi->vmi_idetach) + vmi->vmi_idetach(vml->vml_iarg); + + if (vmi->vmi_struct_size) { + if (curvnet->mod_data[vmi->vmi_id] == NULL) + panic("vi_destroy: %s\n", vmi->vmi_name); + vi_free(curvnet->mod_data[vmi->vmi_id], M_VNET); + curvnet->mod_data[vmi->vmi_id] = NULL; + } return 0; }