Date: Sun, 6 May 2007 20:54:13 GMT From: Paolo Pisati <piso@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 119369 for review Message-ID: <200705062054.l46KsD48008466@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=119369 Change 119369 by piso@piso_newluxor on 2007/05/06 20:53:14 IFC@119361 Affected files ... .. //depot/projects/soc2006/intr_filter/amd64/amd64/intr_machdep.c#29 integrate .. //depot/projects/soc2006/intr_filter/amd64/include/vmparam.h#3 integrate .. //depot/projects/soc2006/intr_filter/arm/include/vmparam.h#4 integrate .. //depot/projects/soc2006/intr_filter/boot/common/loader.8#6 integrate .. //depot/projects/soc2006/intr_filter/conf/files#19 integrate .. //depot/projects/soc2006/intr_filter/conf/options#17 integrate .. //depot/projects/soc2006/intr_filter/contrib/opensolaris/uts/common/fs/zfs/dbuf.c#2 integrate .. //depot/projects/soc2006/intr_filter/contrib/opensolaris/uts/common/fs/zfs/dnode.c#2 integrate .. //depot/projects/soc2006/intr_filter/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c#2 integrate .. //depot/projects/soc2006/intr_filter/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c#2 integrate .. //depot/projects/soc2006/intr_filter/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c#2 integrate .. //depot/projects/soc2006/intr_filter/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c#3 integrate .. //depot/projects/soc2006/intr_filter/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c#3 integrate .. //depot/projects/soc2006/intr_filter/contrib/opensolaris/uts/common/fs/zfs/zio.c#2 integrate .. //depot/projects/soc2006/intr_filter/dev/ata/ata-disk.c#7 integrate .. //depot/projects/soc2006/intr_filter/dev/isp/isp.c#16 integrate .. //depot/projects/soc2006/intr_filter/dev/isp/isp_freebsd.c#13 integrate .. //depot/projects/soc2006/intr_filter/dev/isp/isp_freebsd.h#11 integrate .. //depot/projects/soc2006/intr_filter/dev/isp/isp_pci.c#16 integrate .. //depot/projects/soc2006/intr_filter/dev/isp/isp_sbus.c#12 integrate .. //depot/projects/soc2006/intr_filter/dev/isp/isp_tpublic.h#6 integrate .. //depot/projects/soc2006/intr_filter/dev/mpt/mpt.c#8 integrate .. //depot/projects/soc2006/intr_filter/dev/mpt/mpt.h#10 integrate .. //depot/projects/soc2006/intr_filter/dev/mpt/mpt_cam.c#14 integrate .. //depot/projects/soc2006/intr_filter/dev/mpt/mpt_cam.h#3 integrate .. //depot/projects/soc2006/intr_filter/dev/mpt/mpt_pci.c#11 integrate .. //depot/projects/soc2006/intr_filter/dev/mpt/mpt_raid.c#5 integrate .. //depot/projects/soc2006/intr_filter/dev/sound/pcm/sound.h#7 integrate .. //depot/projects/soc2006/intr_filter/dev/usb/if_rum.c#1 branch .. //depot/projects/soc2006/intr_filter/dev/usb/if_rumreg.h#1 branch .. //depot/projects/soc2006/intr_filter/dev/usb/if_rumvar.h#1 branch .. //depot/projects/soc2006/intr_filter/dev/usb/rt2573_ucode.h#1 branch .. //depot/projects/soc2006/intr_filter/dev/usb/usbdevs#14 integrate .. //depot/projects/soc2006/intr_filter/geom/eli/g_eli_ctl.c#5 integrate .. //depot/projects/soc2006/intr_filter/geom/geom.h#5 integrate .. //depot/projects/soc2006/intr_filter/geom/geom_dev.c#6 integrate .. //depot/projects/soc2006/intr_filter/geom/geom_disk.c#4 integrate .. //depot/projects/soc2006/intr_filter/geom/geom_disk.h#3 integrate .. //depot/projects/soc2006/intr_filter/geom/geom_io.c#5 integrate .. //depot/projects/soc2006/intr_filter/geom/geom_slice.c#3 integrate .. //depot/projects/soc2006/intr_filter/geom/geom_subr.c#3 integrate .. //depot/projects/soc2006/intr_filter/i386/conf/GENERIC#13 integrate .. //depot/projects/soc2006/intr_filter/i386/i386/intr_machdep.c#36 integrate .. //depot/projects/soc2006/intr_filter/i386/include/vmparam.h#3 integrate .. //depot/projects/soc2006/intr_filter/ia64/ia64/machdep.c#7 integrate .. //depot/projects/soc2006/intr_filter/ia64/include/vmparam.h#4 integrate .. //depot/projects/soc2006/intr_filter/kern/kern_intr.c#41 integrate .. //depot/projects/soc2006/intr_filter/kern/uipc_usrreq.c#13 integrate .. //depot/projects/soc2006/intr_filter/modules/Makefile#15 integrate .. //depot/projects/soc2006/intr_filter/modules/rum/Makefile#1 branch .. //depot/projects/soc2006/intr_filter/net80211/ieee80211_amrr.c#2 integrate .. //depot/projects/soc2006/intr_filter/netinet/sctp_input.c#10 integrate .. //depot/projects/soc2006/intr_filter/netinet/sctputil.c#10 integrate .. //depot/projects/soc2006/intr_filter/netinet/tcp_input.c#14 integrate .. //depot/projects/soc2006/intr_filter/netinet/tcp_output.c#8 integrate .. //depot/projects/soc2006/intr_filter/netinet/tcp_subr.c#11 integrate .. //depot/projects/soc2006/intr_filter/netinet/tcp_syncache.c#10 integrate .. //depot/projects/soc2006/intr_filter/netinet/tcp_timer.c#7 integrate .. //depot/projects/soc2006/intr_filter/netinet/tcp_usrreq.c#11 integrate .. //depot/projects/soc2006/intr_filter/netinet/tcp_var.h#10 integrate .. //depot/projects/soc2006/intr_filter/powerpc/include/vmparam.h#3 integrate .. //depot/projects/soc2006/intr_filter/sparc64/include/vmparam.h#3 integrate .. //depot/projects/soc2006/intr_filter/sun4v/include/vmparam.h#3 integrate .. //depot/projects/soc2006/intr_filter/sys/disk.h#2 integrate .. //depot/projects/soc2006/intr_filter/sys/interrupt.h#21 integrate .. //depot/projects/soc2006/intr_filter/vm/vm_page.c#10 integrate .. //depot/projects/soc2006/intr_filter/vm/vm_page.h#6 integrate Differences ... ==== //depot/projects/soc2006/intr_filter/amd64/amd64/intr_machdep.c#29 (text+ko) ==== @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/amd64/amd64/intr_machdep.c,v 1.30 2007/03/06 17:16:46 jhb Exp $ + * $FreeBSD: src/sys/amd64/amd64/intr_machdep.c,v 1.31 2007/05/06 17:02:49 piso Exp $ */ /* ==== //depot/projects/soc2006/intr_filter/amd64/include/vmparam.h#3 (text+ko) ==== @@ -38,7 +38,7 @@ * SUCH DAMAGE. * * from: @(#)vmparam.h 5.9 (Berkeley) 5/12/91 - * $FreeBSD: src/sys/amd64/include/vmparam.h,v 1.46 2007/04/21 01:14:47 sepotvin Exp $ + * $FreeBSD: src/sys/amd64/include/vmparam.h,v 1.47 2007/05/05 19:50:26 alc Exp $ */ @@ -88,6 +88,11 @@ #define UMA_MD_SMALL_ALLOC /* + * The physical address space is densely populated. + */ +#define VM_PHYSSEG_DENSE + +/* * Virtual addresses of things. Derived from the page directory and * page table indexes from pmap.h for precision. * Because of the page that is both a PD and PT, it looks a little ==== //depot/projects/soc2006/intr_filter/arm/include/vmparam.h#4 (text+ko) ==== @@ -28,7 +28,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/arm/include/vmparam.h,v 1.7 2006/08/25 23:51:10 alc Exp $ + * $FreeBSD: src/sys/arm/include/vmparam.h,v 1.8 2007/05/05 19:50:26 alc Exp $ */ #ifndef _MACHINE_VMPARAM_H_ @@ -73,6 +73,11 @@ #define VM_PHYSSEG_NOADD /* + * The physical address space is densely populated. + */ +#define VM_PHYSSEG_DENSE + +/* * we support 2 free lists: * * - DEFAULT for all systems ==== //depot/projects/soc2006/intr_filter/boot/common/loader.8#6 (text+ko) ==== @@ -22,9 +22,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/sys/boot/common/loader.8,v 1.91 2007/02/04 06:35:10 imp Exp $ +.\" $FreeBSD: src/sys/boot/common/loader.8,v 1.92 2007/05/05 17:36:42 jmg Exp $ .\" -.Dd November 29, 2006 +.Dd May 5, 2007 .Dt LOADER 8 .Os .Sh NAME @@ -574,20 +574,19 @@ meta information, which directly governs the maximum amount of swap the system can support. This value is specified in bytes of KVA space -and defaults to around 70MBytes. +and defaults to 32MBytes on i386 and amd64. Care should be taken to not reduce this value such that the actual amount of configured swap exceeds 1/2 the kernel-supported swap. -The default 70MB allows -the kernel to support a maximum of (approximately) -14GB of configured swap. -Only mess around with +The default of 32MB allows +the kernel to support a maximum of ~7GB of swap. +Only change this parameter if you need to greatly extend the KVM reservation for other resources such as the buffer cache or .Va kern.ipc.nmbclusters . -Modifies +Modifies kernel option .Dv VM_SWZONE_SIZE_MAX . .It Va kern.maxbcache Limits the amount of KVM reserved for use by the ==== //depot/projects/soc2006/intr_filter/conf/files#19 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/sys/conf/files,v 1.1201 2007/05/04 13:29:45 rwatson Exp $ +# $FreeBSD: src/sys/conf/files,v 1.1202 2007/05/06 10:07:20 kevlo Exp $ # # The long compile-with and dependency lines are required because of # limitations in config: backslash-newline doesn't work in strings, and @@ -1071,6 +1071,7 @@ dev/usb/if_kue.c optional kue dev/usb/if_ural.c optional ural dev/usb/if_rue.c optional rue +dev/usb/if_rum.c optional rum dev/usb/if_udav.c optional udav dev/usb/ohci.c optional ohci dev/usb/ohci_pci.c optional ohci pci ==== //depot/projects/soc2006/intr_filter/conf/options#17 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/sys/conf/options,v 1.586 2007/04/14 20:16:03 kmacy Exp $ +# $FreeBSD: src/sys/conf/options,v 1.587 2007/05/06 17:04:34 piso Exp $ # # On the handling of kernel options # @@ -766,4 +766,4 @@ SND_EMU10KX_MULTICHANNEL opt_emu10kx.h # Interrupt filtering -INTR_FILTER opt_global.h +INTR_FILTER opt_global.h ==== //depot/projects/soc2006/intr_filter/contrib/opensolaris/uts/common/fs/zfs/dbuf.c#2 (text+ko) ==== @@ -1178,7 +1178,8 @@ } else { ASSERT(db->db_buf != NULL); ASSERT(list_head(&dr->dt.di.dr_children) == NULL); - /* XXX - mutex and list destroy? */ + list_destroy(&dr->dt.di.dr_children); + mutex_destroy(&dr->dt.di.dr_mtx); } kmem_free(dr, sizeof (dbuf_dirty_record_t)); @@ -1925,6 +1926,10 @@ drp = &(*drp)->dr_next; ASSERT((*drp)->dr_next == NULL); *drp = NULL; + if (dr->dr_dbuf->db_level != 0) { + list_destroy(&dr->dt.di.dr_children); + mutex_destroy(&dr->dt.di.dr_mtx); + } kmem_free(dr, sizeof (dbuf_dirty_record_t)); ASSERT(db->db_dirtycnt > 0); db->db_dirtycnt -= 1; @@ -2225,6 +2230,8 @@ >> (db->db_level * epbs), >=, db->db_blkid); arc_set_callback(db->db_buf, dbuf_do_evict, db); } + list_destroy(&dr->dt.di.dr_children); + mutex_destroy(&dr->dt.di.dr_mtx); } kmem_free(dr, sizeof (dbuf_dirty_record_t)); ==== //depot/projects/soc2006/intr_filter/contrib/opensolaris/uts/common/fs/zfs/dnode.c#2 (text+ko) ==== @@ -260,7 +260,6 @@ uint64_t object) { dnode_t *dn = kmem_cache_alloc(dnode_cache, KM_SLEEP); - (void) dnode_cons(dn, NULL, 0); /* XXX */ dn->dn_objset = os; dn->dn_object = object; ==== //depot/projects/soc2006/intr_filter/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c#2 (text+ko) ==== @@ -445,6 +445,8 @@ } else { mutex_exit(&db->db_mtx); dnode_undirty_dbufs(&dr->dt.di.dr_children); + list_destroy(&dr->dt.di.dr_children); + mutex_destroy(&dr->dt.di.dr_mtx); } kmem_free(dr, sizeof (dbuf_dirty_record_t)); dbuf_rele(db, (void *)(uintptr_t)txg); ==== //depot/projects/soc2006/intr_filter/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c#2 (text+ko) ==== @@ -129,6 +129,7 @@ txg_list_destroy(&dp->dp_dirty_datasets); txg_list_destroy(&dp->dp_dirty_dirs); + txg_list_destroy(&dp->dp_sync_tasks); list_destroy(&dp->dp_synced_objsets); arc_flush(); ==== //depot/projects/soc2006/intr_filter/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c#2 (text+ko) ==== @@ -27,11 +27,13 @@ #include <sys/param.h> #include <sys/kernel.h> #include <sys/bio.h> +#include <sys/disk.h> #include <sys/spa.h> #include <sys/vdev_impl.h> #include <sys/fs/zfs.h> #include <sys/zio.h> #include <geom/geom.h> +#include <geom/geom_int.h> /* * Virtual device vector for GEOM. @@ -83,7 +85,8 @@ error = cp->provider->error; ZFS_LOG(1, "Closing access to %s.", cp->provider->name); - g_access(cp, -cp->acr, -cp->acw, -cp->ace); + if (cp->acr + cp->acw + cp->ace > 0) + g_access(cp, -cp->acr, -cp->acw, -cp->ace); ZFS_LOG(1, "Destroyed consumer to %s.", cp->provider->name); g_detach(cp); g_destroy_consumer(cp); @@ -113,8 +116,11 @@ ZFS_LOG(1, "Attaching to %s.", pp->name); /* Do we have geom already? No? Create one. */ LIST_FOREACH(gp, &zfs_vdev_class.geom, geom) { - if (!(gp->flags & G_GEOM_WITHER)) - break; + if (gp->flags & G_GEOM_WITHER) + continue; + if (strcmp(gp->name, "zfs::vdev") != 0) + continue; + break; } if (gp == NULL) { gp = g_new_geomf(&zfs_vdev_class, "zfs::vdev"); @@ -227,12 +233,125 @@ } } +static char * +vdev_geom_get_id(struct g_consumer *cp) +{ + char *id; + int len; + + g_topology_assert_not(); + len = DISK_IDENT_SIZE; + id = kmem_zalloc(len, KM_SLEEP); + if (g_io_getattr("GEOM::ident", cp, &len, id) != 0) { + kmem_free(id, DISK_IDENT_SIZE); + return (NULL); + } + return (id); +} + +static void +vdev_geom_free_id(char *id) +{ + + if (id != NULL) + kmem_free(id, DISK_IDENT_SIZE); +} + +struct vdev_geom_find { + const char *id; + int write; + struct g_consumer *cp; +}; + +static void +vdev_geom_taste_orphan(struct g_consumer *cp) +{ + + KASSERT(1 == 0, ("%s called while tasting %s.", __func__, + cp->provider->name)); +} + +static void +vdev_geom_attach_by_id_event(void *arg, int flags __unused) +{ + struct vdev_geom_find *ap; + struct g_class *mp; + struct g_geom *gp, *zgp; + struct g_provider *pp; + struct g_consumer *zcp; + char *id; + + g_topology_assert(); + + ap = arg; + + zgp = g_new_geomf(&zfs_vdev_class, "zfs::vdev::taste"); + /* This orphan function should be never called. */ + zgp->orphan = vdev_geom_taste_orphan; + zcp = g_new_consumer(zgp); + + LIST_FOREACH(mp, &g_classes, class) { + if (mp == &zfs_vdev_class) + continue; + LIST_FOREACH(gp, &mp->geom, geom) { + if (gp->flags & G_GEOM_WITHER) + continue; + LIST_FOREACH(pp, &gp->provider, provider) { + if (pp->flags & G_PF_WITHER) + continue; + g_attach(zcp, pp); + if (g_access(zcp, 1, 0, 0) != 0) { + g_detach(zcp); + continue; + } + g_topology_unlock(); + id = vdev_geom_get_id(zcp); + g_topology_lock(); + g_access(zcp, -1, 0, 0); + g_detach(zcp); + if (id == NULL || strcmp(id, ap->id) != 0) { + vdev_geom_free_id(id); + continue; + } + vdev_geom_free_id(id); + ap->cp = vdev_geom_attach(pp, ap->write); + if (ap->cp == NULL) { + printf("ZFS WARNING: Cannot open %s " + "for writting.\n", pp->name); + continue; + } + goto end; + } + } + } + ap->cp = NULL; +end: + g_destroy_consumer(zcp); + g_destroy_geom(zgp); +} + +static struct g_consumer * +vdev_geom_attach_by_id(const char *id, int write) +{ + struct vdev_geom_find *ap; + struct g_consumer *cp; + + ap = kmem_zalloc(sizeof(*ap), KM_SLEEP); + ap->id = id; + ap->write = write; + g_waitfor_event(vdev_geom_attach_by_id_event, ap, M_WAITOK, NULL); + cp = ap->cp; + kmem_free(ap, sizeof(*ap)); + return (cp); +} + static int vdev_geom_open(vdev_t *vd, uint64_t *psize, uint64_t *ashift) { vdev_geom_ctx_t *ctx; struct g_provider *pp; struct g_consumer *cp; + char *id = NULL; int owned; /* @@ -245,23 +364,55 @@ if ((owned = mtx_owned(&Giant))) mtx_unlock(&Giant); + cp = NULL; g_topology_lock(); pp = g_provider_by_name(vd->vdev_path + sizeof("/dev/") - 1); - if (pp == NULL) { - g_topology_unlock(); - if (owned) - mtx_lock(&Giant); - vd->vdev_stat.vs_aux = VDEV_AUX_BAD_LABEL; - return (EINVAL); + if (pp != NULL) { + ZFS_LOG(1, "Found provider by name %s.", vd->vdev_path); + cp = vdev_geom_attach(pp, !!(spa_mode & FWRITE)); + if (cp != NULL && vd->vdev_devid != NULL) { + g_topology_unlock(); + id = vdev_geom_get_id(cp); + g_topology_lock(); + if (id == NULL || strcmp(id, vd->vdev_devid) != 0) { + vdev_geom_detach(cp, 0); + cp = NULL; + ZFS_LOG(1, "ID mismatch for provider %s: " + "[%s]!=[%s].", vd->vdev_path, + vd->vdev_devid, id); + goto next; + } + ZFS_LOG(1, "ID match for provider %s.", vd->vdev_path); + } } - cp = vdev_geom_attach(pp, !!(spa_mode & FWRITE)); +next: g_topology_unlock(); + vdev_geom_free_id(id); + if (cp == NULL && vd->vdev_devid != NULL) { + ZFS_LOG(0, "Searching by ID [%s].", vd->vdev_devid); + cp = vdev_geom_attach_by_id(vd->vdev_devid, + !!(spa_mode & FWRITE)); + if (cp != NULL) { + size_t len = strlen(cp->provider->name) + 6; /* 6 == strlen("/dev/") + 1 */ + char *buf = kmem_alloc(len, KM_SLEEP); + + snprintf(buf, len, "/dev/%s", cp->provider->name); + spa_strfree(vd->vdev_path); + vd->vdev_path = buf; + + ZFS_LOG(1, "Attach by ID [%s] succeeded, provider %s.", + vd->vdev_devid, vd->vdev_path); + } + } if (owned) mtx_lock(&Giant); if (cp == NULL) { + ZFS_LOG(1, "Provider %s (id=[%s]) not found.", vd->vdev_path, + vd->vdev_devid); vd->vdev_stat.vs_aux = VDEV_AUX_OPEN_FAILED; return (EACCES); } + pp = cp->provider; /* * Determine the actual size of the device. ==== //depot/projects/soc2006/intr_filter/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c#3 (text+ko) ==== @@ -770,11 +770,12 @@ * Perhaps we should use SPA_MAXBLOCKSIZE chunks? */ nbytes = MIN(n, max_blksz - P2PHASE(woff, max_blksz)); - rw_enter(&zp->z_map_lock, RW_READER); if (woff + nbytes > zp->z_phys->zp_size) vnode_pager_setsize(vp, woff + nbytes); + rw_enter(&zp->z_map_lock, RW_READER); + tx_bytes = uio->uio_resid; if (vn_has_cached_data(vp)) { rw_exit(&zp->z_map_lock); ==== //depot/projects/soc2006/intr_filter/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c#3 (text+ko) ==== @@ -695,9 +695,6 @@ ZFS_OBJ_HOLD_EXIT(zfsvfs, z_id); } -/* - * FreeBSD: Should be called from ->vop_reclaim(). - */ void zfs_znode_free(znode_t *zp) { @@ -991,6 +988,7 @@ error = zap_add(os, moid, ZFS_ROOT_OBJ, 8, 1, &roid, tx); ASSERT(error == 0); + mutex_destroy(&zfsvfs.z_znodes_lock); kmem_cache_free(znode_cache, rootzp); } #endif /* _KERNEL */ ==== //depot/projects/soc2006/intr_filter/contrib/opensolaris/uts/common/fs/zfs/zio.c#2 (text+ko) ==== @@ -977,6 +977,8 @@ cv_broadcast(&zio->io_cv); mutex_exit(&zio->io_lock); } else { + cv_destroy(&zio->io_cv); + mutex_destroy(&zio->io_lock); kmem_cache_free(zio_cache, zio); } } ==== //depot/projects/soc2006/intr_filter/dev/ata/ata-disk.c#7 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/ata/ata-disk.c,v 1.202 2007/04/26 12:59:20 roberto Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/ata/ata-disk.c,v 1.203 2007/05/06 01:20:06 pjd Exp $"); #include "opt_ata.h" #include <sys/param.h> @@ -161,6 +161,8 @@ adp->disk->d_unit = device_get_unit(dev); if (atadev->param.support.command2 & ATA_SUPPORT_FLUSHCACHE) adp->disk->d_flags = DISKFLAG_CANFLUSHCACHE; + snprintf(adp->disk->d_ident, sizeof(adp->disk->d_ident), "ad:%s", + atadev->param.serial); disk_create(adp->disk, DISK_VERSION); device_add_child(dev, "subdisk", device_get_unit(dev)); ad_firmware_geom_adjust(dev, adp->disk); ==== //depot/projects/soc2006/intr_filter/dev/isp/isp.c#16 (text+ko) ==== @@ -46,7 +46,7 @@ #endif #ifdef __FreeBSD__ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/isp/isp.c,v 1.145 2007/03/29 21:29:26 mjacob Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/isp/isp.c,v 1.146 2007/05/05 20:17:22 mjacob Exp $"); #include <dev/isp/isp_freebsd.h> #endif #ifdef __OpenBSD__ @@ -5121,20 +5121,11 @@ isp->isp_mboxtmp[0] = MBOX_HOST_INTERFACE_ERROR; MBOX_NOTIFY_COMPLETE(isp); } -#ifdef ISP_FW_CRASH_DUMP /* - * If we have crash dumps enabled, it's up to the handler - * for isp_async to reinit stuff and restart the firmware - * after performing the crash dump. The reason we do things - * this way is that we may need to activate a kernel thread - * to do all the crash dump goop. + * It's up to the handler for isp_async to reinit stuff and + * restart the firmware */ isp_async(isp, ISPASYNC_FW_CRASH, NULL); -#else - isp_async(isp, ISPASYNC_FW_CRASH, NULL); - isp_reinit(isp); - isp_async(isp, ISPASYNC_FW_RESTARTED, NULL); -#endif rval = -1; break; @@ -5401,13 +5392,7 @@ break; case ISP_CONN_FATAL: isp_prt(isp, ISP_LOGERR, "FATAL CONNECTION ERROR"); -#ifdef ISP_FW_CRASH_DUMP isp_async(isp, ISPASYNC_FW_CRASH, NULL); -#else - isp_async(isp, ISPASYNC_FW_CRASH, NULL); - isp_reinit(isp); - isp_async(isp, ISPASYNC_FW_RESTARTED, NULL); -#endif return (-1); case ISP_CONN_LOOPBACK: isp_prt(isp, ISP_LOGWARN, ==== //depot/projects/soc2006/intr_filter/dev/isp/isp_freebsd.c#13 (text+ko) ==== @@ -28,7 +28,7 @@ * Platform (FreeBSD) dependent common attachment code for Qlogic adapters. */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/isp/isp_freebsd.c,v 1.139 2007/04/18 04:58:53 scottl Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/isp/isp_freebsd.c,v 1.140 2007/05/05 20:17:23 mjacob Exp $"); #include <dev/isp/isp_freebsd.h> #include <sys/unistd.h> #include <sys/kthread.h> @@ -99,7 +99,9 @@ #else static struct cdevsw isp_cdevsw = { .d_version = D_VERSION, +#if __FreeBSD_version < 700037 .d_flags = D_NEEDGIANT, +#endif .d_ioctl = ispioctl, .d_name = "isp", }; @@ -135,22 +137,17 @@ /* * Construct our SIM entry. */ - ISPLOCK_2_CAMLOCK(isp); - sim = cam_sim_alloc(isp_action, isp_poll, "isp", isp, - device_get_unit(isp->isp_dev), &Giant, 1, isp->isp_maxcmds, devq); + sim = isp_sim_alloc(isp_action, isp_poll, "isp", isp, + device_get_unit(isp->isp_dev), 1, isp->isp_maxcmds, devq); if (sim == NULL) { cam_simq_free(devq); - CAMLOCK_2_ISPLOCK(isp); return; } - CAMLOCK_2_ISPLOCK(isp); isp->isp_osinfo.ehook.ich_func = isp_intr_enable; isp->isp_osinfo.ehook.ich_arg = isp; - ISPLOCK_2_CAMLOCK(isp); if (config_intrhook_establish(&isp->isp_osinfo.ehook) != 0) { cam_sim_free(sim, TRUE); - CAMLOCK_2_ISPLOCK(isp); isp_prt(isp, ISP_LOGERR, "could not establish interrupt enable hook"); return; @@ -158,7 +155,6 @@ if (xpt_bus_register(sim, primary) != CAM_SUCCESS) { cam_sim_free(sim, TRUE); - CAMLOCK_2_ISPLOCK(isp); return; } @@ -167,7 +163,6 @@ xpt_bus_deregister(cam_sim_path(sim)); cam_sim_free(sim, TRUE); config_intrhook_disestablish(&isp->isp_osinfo.ehook); - CAMLOCK_2_ISPLOCK(isp); return; } @@ -177,55 +172,15 @@ csa.callback = isp_cam_async; csa.callback_arg = sim; xpt_action((union ccb *)&csa); - CAMLOCK_2_ISPLOCK(isp); isp->isp_sim = sim; isp->isp_path = path; - /* - * Create a kernel thread for fibre channel instances. We - * don't have dual channel FC cards. - */ - if (IS_FC(isp)) { - ISPLOCK_2_CAMLOCK(isp); -#if __FreeBSD_version >= 500000 - cv_init(&isp->isp_osinfo.kthread_cv, "isp_kthread_cv"); - if (kthread_create(isp_kthread, isp, &isp->isp_osinfo.kproc, - RFHIGHPID, 0, "%s: fc_thrd", - device_get_nameunit(isp->isp_dev))) -#else - if (kthread_create(isp_kthread, isp, &isp->isp_osinfo.kproc, - "%s: fc_thrd", device_get_nameunit(isp->isp_dev))) -#endif - { - xpt_bus_deregister(cam_sim_path(sim)); - cam_sim_free(sim, TRUE); - config_intrhook_disestablish(&isp->isp_osinfo.ehook); - CAMLOCK_2_ISPLOCK(isp); - isp_prt(isp, ISP_LOGERR, "could not create kthread"); - return; - } - CAMLOCK_2_ISPLOCK(isp); - /* - * We start by being "loop down" if we have an initiator role - */ - if (isp->isp_role & ISP_ROLE_INITIATOR) { - isp_freeze_loopdown(isp, "isp_attach"); - isp->isp_osinfo.ldt = - timeout(isp_ldt, isp, isp_quickboot_time * hz); - isp->isp_osinfo.ldt_running = 1; - isp_prt(isp, ISP_LOGSANCFG|ISP_LOGDEBUG0, - "Starting Initial Loop Down Timer"); - } - } - /* * If we have a second channel, construct SIM entry for that. */ if (IS_DUALBUS(isp)) { - ISPLOCK_2_CAMLOCK(isp); - sim = cam_sim_alloc(isp_action, isp_poll, "isp", isp, - device_get_unit(isp->isp_dev), &Giant, 1, - isp->isp_maxcmds, devq); + sim = isp_sim_alloc(isp_action, isp_poll, "isp", isp, + device_get_unit(isp->isp_dev), 1, isp->isp_maxcmds, devq); if (sim == NULL) { xpt_bus_deregister(cam_sim_path(isp->isp_sim)); xpt_free_path(isp->isp_path); @@ -238,7 +193,6 @@ xpt_free_path(isp->isp_path); cam_sim_free(sim, TRUE); config_intrhook_disestablish(&isp->isp_osinfo.ehook); - CAMLOCK_2_ISPLOCK(isp); return; } @@ -249,7 +203,6 @@ xpt_bus_deregister(cam_sim_path(sim)); cam_sim_free(sim, TRUE); config_intrhook_disestablish(&isp->isp_osinfo.ehook); - CAMLOCK_2_ISPLOCK(isp); return; } @@ -259,7 +212,6 @@ csa.callback = isp_cam_async; csa.callback_arg = sim; xpt_action((union ccb *)&csa); - CAMLOCK_2_ISPLOCK(isp); isp->isp_sim2 = sim; isp->isp_path2 = path; } @@ -267,8 +219,11 @@ /* * Create device nodes */ + ISP_UNLOCK(isp); (void) make_dev(&isp_cdevsw, device_get_unit(isp->isp_dev), UID_ROOT, GID_OPERATOR, 0600, "%s", device_get_nameunit(isp->isp_dev)); + isp_sysctl_update(isp); + ISP_LOCK(isp); if (isp->isp_role != ISP_ROLE_NONE) { isp->isp_state = ISP_RUNSTATE; @@ -283,7 +238,43 @@ } tmp->isp_osinfo.next = isp; } - isp_sysctl_update(isp); + + /* + * Create a kernel thread for fibre channel instances. + */ + if (IS_FC(isp)) { + isp_callout_init(&isp->isp_osinfo.ldt); + isp_callout_init(&isp->isp_osinfo.gdt); + ISP_UNLOCK(isp); +#if __FreeBSD_version >= 500000 + if (kthread_create(isp_kthread, isp, &isp->isp_osinfo.kproc, + RFHIGHPID, 0, "%s: fc_thrd", + device_get_nameunit(isp->isp_dev))) +#else + if (kthread_create(isp_kthread, isp, &isp->isp_osinfo.kproc, + "%s: fc_thrd", device_get_nameunit(isp->isp_dev))) +#endif + { + ISP_LOCK(isp); + xpt_bus_deregister(cam_sim_path(sim)); + cam_sim_free(sim, TRUE); + config_intrhook_disestablish(&isp->isp_osinfo.ehook); + isp_prt(isp, ISP_LOGERR, "could not create kthread"); + return; + } + ISP_LOCK(isp); + /* + * We start by being "loop down" if we have an initiator role + */ + if (isp->isp_role & ISP_ROLE_INITIATOR) { + isp_freeze_loopdown(isp, "isp_attach"); + isp->isp_osinfo.ldt_running = 1; + callout_reset(&isp->isp_osinfo.ldt, + isp_quickboot_time * hz, isp_ldt, isp); + isp_prt(isp, ISP_LOGSANCFG|ISP_LOGDEBUG0, + "Starting Initial Loop Down Timer"); + } + } } static void @@ -292,9 +283,7 @@ if (isp->isp_osinfo.simqfrozen == 0) { isp_prt(isp, ISP_LOGDEBUG0, "%s: freeze simq (loopdown)", msg); isp->isp_osinfo.simqfrozen |= SIMQFRZ_LOOPDOWN; - ISPLOCK_2_CAMLOCK(isp); xpt_freeze_simq(isp->isp_sim, 1); - CAMLOCK_2_ISPLOCK(isp); } else { isp_prt(isp, ISP_LOGDEBUG0, "%s: mark frozen (loopdown)", msg); isp->isp_osinfo.simqfrozen |= SIMQFRZ_LOOPDOWN; @@ -315,6 +304,11 @@ { ispsoftc_t *isp; int nr, retval = ENOTTY; +#if __FreeBSD_version < 500000 + int s = splcam(); +#else + GIANT_REQUIRED; +#endif isp = isplist; while (isp) { @@ -323,8 +317,12 @@ } isp = isp->isp_osinfo.next; } - if (isp == NULL) + if (isp == NULL) { +#if __FreeBSD_version < 500000 + splx(s); +#endif return (ENXIO); + } switch (c) { #ifdef ISP_FW_CRASH_DUMP @@ -339,7 +337,6 @@ } else { sz = QLA2300_RISC_IMAGE_DUMP_SIZE; } - ISP_LOCK(isp); if (ptr && *ptr) { void *uaddr = *((void **) addr); if (copyout(ptr, uaddr, sz)) { @@ -350,17 +347,14 @@ } else { retval = ENXIO; } - ISP_UNLOCK(isp); } break; case ISP_FORCE_CRASH_DUMP: if (IS_FC(isp)) { - ISP_LOCK(isp); isp_freeze_loopdown(isp, "ispioctl(ISP_FORCE_CRASH_DUMP)"); isp_fw_dump(isp); isp_reinit(isp); - ISP_UNLOCK(isp); retval = 0; } break; @@ -395,31 +389,25 @@ isp->isp_role = nr; /* FALLTHROUGH */ case ISP_RESETHBA: - ISP_LOCK(isp); isp_reinit(isp); - ISP_UNLOCK(isp); retval = 0; break; case ISP_RESCAN: if (IS_FC(isp)) { - ISP_LOCK(isp); if (isp_fc_runstate(isp, 5 * 1000000)) { retval = EIO; } else { retval = 0; } - ISP_UNLOCK(isp); } break; case ISP_FC_LIP: if (IS_FC(isp)) { - ISP_LOCK(isp); if (isp_control(isp, ISPCTL_SEND_LIP, 0)) { retval = EIO; } else { retval = 0; } - ISP_UNLOCK(isp); } break; case ISP_FC_GETDINFO: @@ -434,7 +422,6 @@ retval = EINVAL; break; } - ISP_LOCK(isp); lp = &FCPARAM(isp)->portdb[ifc->loopid]; if (lp->state == FC_PORTDB_STATE_VALID) { ifc->role = lp->roles; @@ -446,7 +433,6 @@ } else { retval = ENODEV; } - ISP_UNLOCK(isp); break; } case ISP_GET_STATS: @@ -457,7 +443,6 @@ sp->isp_stat_version = ISP_STATS_VERSION; sp->isp_type = isp->isp_type; sp->isp_revision = isp->isp_revision; - ISP_LOCK(isp); sp->isp_stats[ISP_INTCNT] = isp->isp_intcnt; sp->isp_stats[ISP_INTBOGUS] = isp->isp_intbogus; sp->isp_stats[ISP_INTMBOXC] = isp->isp_intmboxc; @@ -466,12 +451,10 @@ sp->isp_stats[ISP_FPHCCMCPLT] = isp->isp_fphccmplt; sp->isp_stats[ISP_RSCCHIWAT] = isp->isp_rscchiwater; sp->isp_stats[ISP_FPCCHIWAT] = isp->isp_fpcchiwater; - ISP_UNLOCK(isp); retval = 0; break; } case ISP_CLR_STATS: - ISP_LOCK(isp); isp->isp_intcnt = 0; isp->isp_intbogus = 0; isp->isp_intmboxc = 0; @@ -480,7 +463,6 @@ isp->isp_fphccmplt = 0; isp->isp_rscchiwater = 0; isp->isp_fpcchiwater = 0; - ISP_UNLOCK(isp); retval = 0; break; case ISP_FC_GETHINFO: @@ -641,12 +623,10 @@ break; } if (retval == 0) { - ISP_LOCK(isp); if (needmarker) { isp->isp_sendmarker |= 1; } retval = isp_control(isp, ISPCTL_RUN_MBOXCMD, &mbs); - ISP_UNLOCK(isp); if (retval) retval = EIO; } @@ -655,6 +635,9 @@ default: break; } +#if __FreeBSD_version < 500000 + splx(s); +#endif return (retval); } @@ -702,9 +685,11 @@ isp_intr_enable(void *arg) { ispsoftc_t *isp = arg; + ISP_LOCK(isp); if (isp->isp_role != ISP_ROLE_NONE) { ISP_ENABLE_INTS(isp); } + ISP_UNLOCK(isp); /* Release our hook so that the boot can continue. */ config_intrhook_disestablish(&isp->isp_osinfo.ehook); >>> TRUNCATED FOR MAIL (1000 lines) <<<
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200705062054.l46KsD48008466>