Date: Wed, 27 Apr 2011 02:12:01 +0000 (UTC) From: Marcel Moolenaar <marcel@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r221106 - in projects/altix/sys: amd64/amd64 amd64/conf arm/conf cam cam/ata conf dev/usb/controller dev/usb/net fs/nfsclient geom geom/concat geom/journal geom/mirror geom/raid3 geom/s... Message-ID: <201104270212.p3R2C1O2048965@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: marcel Date: Wed Apr 27 02:12:01 2011 New Revision: 221106 URL: http://svn.freebsd.org/changeset/base/221106 Log: Merge svn+ssh://svn.freebsd.org/base/head@221105 Added: projects/altix/sys/sys/_callout.h - copied unchanged from r221105, head/sys/sys/_callout.h Modified: projects/altix/sys/amd64/amd64/minidump_machdep.c projects/altix/sys/amd64/conf/GENERIC projects/altix/sys/arm/conf/CRB projects/altix/sys/arm/conf/EP80219 projects/altix/sys/arm/conf/IQ31244 projects/altix/sys/cam/ata/ata_da.c projects/altix/sys/cam/cam_xpt.c projects/altix/sys/cam/cam_xpt.h projects/altix/sys/conf/NOTES projects/altix/sys/dev/usb/controller/ehci.c projects/altix/sys/dev/usb/net/if_cdcereg.h projects/altix/sys/fs/nfsclient/nfs_clvfsops.c projects/altix/sys/geom/concat/g_concat.c projects/altix/sys/geom/geom.h projects/altix/sys/geom/geom_dev.c projects/altix/sys/geom/geom_subr.c projects/altix/sys/geom/journal/g_journal.c projects/altix/sys/geom/mirror/g_mirror.c projects/altix/sys/geom/raid3/g_raid3.c projects/altix/sys/geom/shsec/g_shsec.c projects/altix/sys/geom/stripe/g_stripe.c projects/altix/sys/geom/virstor/g_virstor.c projects/altix/sys/i386/conf/GENERIC projects/altix/sys/i386/conf/XBOX projects/altix/sys/kern/kern_intr.c projects/altix/sys/kern/sched_4bsd.c projects/altix/sys/kern/subr_taskqueue.c projects/altix/sys/mips/conf/OCTEON1 projects/altix/sys/mips/conf/std.SWARM projects/altix/sys/modules/cam/Makefile projects/altix/sys/nfsclient/nfs_vfsops.c projects/altix/sys/ofed/include/linux/file.h projects/altix/sys/ofed/include/linux/workqueue.h projects/altix/sys/pc98/conf/GENERIC projects/altix/sys/sys/callout.h projects/altix/sys/sys/taskqueue.h projects/altix/sys/vm/swap_pager.c projects/altix/sys/x86/cpufreq/powernow.c Directory Properties: projects/altix/lib/libstand/ (props changed) projects/altix/sys/ (props changed) projects/altix/sys/amd64/include/xen/ (props changed) projects/altix/sys/boot/i386/efi/ (props changed) projects/altix/sys/boot/ia64/efi/ (props changed) projects/altix/sys/boot/ia64/ski/ (props changed) projects/altix/sys/boot/powerpc/boot1.chrp/ (props changed) projects/altix/sys/boot/powerpc/ofw/ (props changed) projects/altix/sys/cddl/contrib/opensolaris/ (props changed) projects/altix/sys/conf/ (props changed) projects/altix/sys/contrib/dev/acpica/ (props changed) projects/altix/sys/contrib/octeon-sdk/ (props changed) projects/altix/sys/contrib/pf/ (props changed) projects/altix/sys/contrib/x86emu/ (props changed) projects/altix/sys/kern/subr_busdma.c (props changed) Modified: projects/altix/sys/amd64/amd64/minidump_machdep.c ============================================================================== --- projects/altix/sys/amd64/amd64/minidump_machdep.c Wed Apr 27 01:45:05 2011 (r221105) +++ projects/altix/sys/amd64/amd64/minidump_machdep.c Wed Apr 27 02:12:01 2011 (r221106) @@ -62,7 +62,7 @@ static off_t dumplo; /* Handle chunked writes. */ static size_t fragsz; static void *dump_va; -static size_t counter, progress; +static size_t counter, progress, dumpsize; CTASSERT(sizeof(*vm_page_dump) == 8); @@ -94,6 +94,40 @@ blk_flush(struct dumperinfo *di) return (error); } +static struct { + int min_per; + int max_per; + int visited; +} progress_track[10] = { + { 0, 10, 0}, + { 10, 20, 0}, + { 20, 30, 0}, + { 30, 40, 0}, + { 40, 50, 0}, + { 50, 60, 0}, + { 60, 70, 0}, + { 70, 80, 0}, + { 80, 90, 0}, + { 90, 100, 0} +}; + +static void +report_progress(size_t progress, size_t dumpsize) +{ + int sofar, i; + + sofar = 100 - ((progress * 100) / dumpsize); + for (i = 0; i < 10; i++) { + if (sofar < progress_track[i].min_per || sofar > progress_track[i].max_per) + continue; + if (progress_track[i].visited) + return; + progress_track[i].visited = 1; + printf("..%d%%", sofar); + return; + } +} + static int blk_write(struct dumperinfo *di, char *ptr, vm_paddr_t pa, size_t sz) { @@ -130,7 +164,7 @@ blk_write(struct dumperinfo *di, char *p counter += len; progress -= len; if (counter >> 24) { - printf(" %ld", PG2MB(progress >> PAGE_SHIFT)); + report_progress(progress, dumpsize); counter &= (1<<24) - 1; } if (ptr) { @@ -170,7 +204,6 @@ static pd_entry_t fakepd[NPDEPG]; void minidumpsys(struct dumperinfo *di) { - uint64_t dumpsize; uint32_t pmapsize; vm_offset_t va; int error; @@ -290,8 +323,8 @@ minidumpsys(struct dumperinfo *di) mkdumpheader(&kdh, KERNELDUMPMAGIC, KERNELDUMP_AMD64_VERSION, dumpsize, di->blocksize); - printf("Physical memory: %ju MB\n", ptoa((uintmax_t)physmem) / 1048576); - printf("Dumping %llu MB:", (long long)dumpsize >> 20); + printf("Dumping %llu out of %ju MB:", (long long)dumpsize >> 20, + ptoa((uintmax_t)physmem) / 1048576); /* Dump leader */ error = dump_write(di, &kdh, 0, dumplo, sizeof(kdh)); Modified: projects/altix/sys/amd64/conf/GENERIC ============================================================================== --- projects/altix/sys/amd64/conf/GENERIC Wed Apr 27 01:45:05 2011 (r221105) +++ projects/altix/sys/amd64/conf/GENERIC Wed Apr 27 02:12:01 2011 (r221106) @@ -93,6 +93,7 @@ device fdc device ahci # AHCI-compatible SATA controllers device ata # Legacy ATA/SATA controllers options ATA_CAM # Handle legacy controllers with CAM +options ATA_STATIC_ID # Static device numbering device mvs # Marvell 88SX50XX/88SX60XX/88SX70XX/SoC SATA device siis # SiliconImage SiI3124/SiI3132/SiI3531 SATA Modified: projects/altix/sys/arm/conf/CRB ============================================================================== --- projects/altix/sys/arm/conf/CRB Wed Apr 27 01:45:05 2011 (r221105) +++ projects/altix/sys/arm/conf/CRB Wed Apr 27 02:12:01 2011 (r221106) @@ -74,6 +74,7 @@ device pci device ata options ATA_CAM +options ATA_STATIC_ID # Static device numbering device scbus # SCSI bus (required for ATA/SCSI) device cd # CD Modified: projects/altix/sys/arm/conf/EP80219 ============================================================================== --- projects/altix/sys/arm/conf/EP80219 Wed Apr 27 01:45:05 2011 (r221105) +++ projects/altix/sys/arm/conf/EP80219 Wed Apr 27 02:12:01 2011 (r221106) @@ -74,6 +74,7 @@ device pci device ata options ATA_CAM +options ATA_STATIC_ID # Static device numbering device scbus # SCSI bus (required for ATA/SCSI) device cd # CD Modified: projects/altix/sys/arm/conf/IQ31244 ============================================================================== --- projects/altix/sys/arm/conf/IQ31244 Wed Apr 27 01:45:05 2011 (r221105) +++ projects/altix/sys/arm/conf/IQ31244 Wed Apr 27 02:12:01 2011 (r221106) @@ -73,6 +73,7 @@ device pci device ata options ATA_CAM +options ATA_STATIC_ID # Static device numbering device scbus # SCSI bus (required for ATA/SCSI) device cd # CD Modified: projects/altix/sys/cam/ata/ata_da.c ============================================================================== --- projects/altix/sys/cam/ata/ata_da.c Wed Apr 27 01:45:05 2011 (r221105) +++ projects/altix/sys/cam/ata/ata_da.c Wed Apr 27 02:12:01 2011 (r221106) @@ -28,6 +28,7 @@ __FBSDID("$FreeBSD$"); #include "opt_ada.h" +#include "opt_ata.h" #include <sys/param.h> @@ -183,6 +184,14 @@ static void adashutdown(void *arg, int static void adasuspend(void *arg); static void adaresume(void *arg); +#ifndef ADA_DEFAULT_LEGACY_ALIASES +#ifdef ATA_CAM +#define ADA_DEFAULT_LEGACY_ALIASES 1 +#else +#define ADA_DEFAULT_LEGACY_ALIASES 0 +#endif +#endif + #ifndef ADA_DEFAULT_TIMEOUT #define ADA_DEFAULT_TIMEOUT 30 /* Timeout in seconds */ #endif @@ -215,6 +224,7 @@ static void adaresume(void *arg); #define ata_disk_firmware_geom_adjust(disk) #endif +static int ada_legacy_aliases = ADA_DEFAULT_LEGACY_ALIASES; static int ada_retry_count = ADA_DEFAULT_RETRY; static int ada_default_timeout = ADA_DEFAULT_TIMEOUT; static int ada_send_ordered = ADA_DEFAULT_SEND_ORDERED; @@ -224,6 +234,9 @@ static int ada_write_cache = ADA_DEFAULT SYSCTL_NODE(_kern_cam, OID_AUTO, ada, CTLFLAG_RD, 0, "CAM Direct Access Disk driver"); +SYSCTL_INT(_kern_cam_ada, OID_AUTO, legacy_aliases, CTLFLAG_RW, + &ada_legacy_aliases, 0, "Create legacy-like device aliases"); +TUNABLE_INT("kern.cam.ada.legacy_aliases", &ada_legacy_aliases); SYSCTL_INT(_kern_cam_ada, OID_AUTO, retry_count, CTLFLAG_RW, &ada_retry_count, 0, "Normal I/O retry count"); TUNABLE_INT("kern.cam.ada.retry_count", &ada_retry_count); @@ -723,10 +736,11 @@ adaregister(struct cam_periph *periph, v struct ada_softc *softc; struct ccb_pathinq cpi; struct ccb_getdev *cgd; - char announce_buf[80]; + char announce_buf[80], buf1[32]; struct disk_params *dp; caddr_t match; u_int maxio; + int legacy_id; cgd = (struct ccb_getdev *)arg; if (periph == NULL) { @@ -861,6 +875,22 @@ adaregister(struct cam_periph *periph, v softc->disk->d_fwheads = softc->params.heads; ata_disk_firmware_geom_adjust(softc->disk); + if (ada_legacy_aliases) { +#ifdef ATA_STATIC_ID + legacy_id = xpt_path_legacy_ata_id(periph->path); +#else + legacy_id = softc->disk->d_unit; +#endif + if (legacy_id >= 0) { + snprintf(announce_buf, sizeof(announce_buf), + "kern.devalias.%s%d", + softc->disk->d_name, softc->disk->d_unit); + snprintf(buf1, sizeof(buf1), + "ad%d", legacy_id); + setenv(announce_buf, buf1); + } + } else + legacy_id = -1; disk_create(softc->disk, DISK_VERSION); mtx_lock(periph->sim->mtx); cam_periph_unhold(periph); @@ -874,6 +904,9 @@ adaregister(struct cam_periph *periph, v dp->secsize, dp->heads, dp->secs_per_track, dp->cylinders); xpt_announce_periph(periph, announce_buf); + if (legacy_id >= 0) + printf("%s%d: Previously was known as ad%d\n", + periph->periph_name, periph->unit_number, legacy_id); /* * Create our sysctl variables, now that we know Modified: projects/altix/sys/cam/cam_xpt.c ============================================================================== --- projects/altix/sys/cam/cam_xpt.c Wed Apr 27 01:45:05 2011 (r221105) +++ projects/altix/sys/cam/cam_xpt.c Wed Apr 27 02:12:01 2011 (r221106) @@ -3569,6 +3569,42 @@ xpt_path_periph(struct cam_path *path) return (path->periph); } +int +xpt_path_legacy_ata_id(struct cam_path *path) +{ + struct cam_eb *bus; + int bus_id; + + if ((strcmp(path->bus->sim->sim_name, "ata") != 0) && + strcmp(path->bus->sim->sim_name, "ahcich") != 0 && + strcmp(path->bus->sim->sim_name, "mvsch") != 0 && + strcmp(path->bus->sim->sim_name, "siisch") != 0) + return (-1); + + if (strcmp(path->bus->sim->sim_name, "ata") == 0 && + path->bus->sim->unit_number < 2) { + bus_id = path->bus->sim->unit_number; + } else { + bus_id = 2; + xpt_lock_buses(); + TAILQ_FOREACH(bus, &xsoftc.xpt_busses, links) { + if (bus == path->bus) + break; + if ((strcmp(bus->sim->sim_name, "ata") == 0 && + bus->sim->unit_number >= 2) || + strcmp(bus->sim->sim_name, "ahcich") == 0 || + strcmp(bus->sim->sim_name, "mvsch") == 0 || + strcmp(bus->sim->sim_name, "siisch") == 0) + bus_id++; + } + xpt_unlock_buses(); + } + if (path->target != NULL) + return (bus_id * 2 + path->target->target_id); + else + return (bus_id * 2); +} + /* * Release a CAM control block for the caller. Remit the cost of the structure * to the device referenced by the path. If the this device had no 'credits' Modified: projects/altix/sys/cam/cam_xpt.h ============================================================================== --- projects/altix/sys/cam/cam_xpt.h Wed Apr 27 01:45:05 2011 (r221105) +++ projects/altix/sys/cam/cam_xpt.h Wed Apr 27 02:12:01 2011 (r221106) @@ -113,6 +113,7 @@ int xpt_path_string(struct cam_path *p path_id_t xpt_path_path_id(struct cam_path *path); target_id_t xpt_path_target_id(struct cam_path *path); lun_id_t xpt_path_lun_id(struct cam_path *path); +int xpt_path_legacy_ata_id(struct cam_path *path); struct cam_sim *xpt_path_sim(struct cam_path *path); struct cam_periph *xpt_path_periph(struct cam_path *path); void xpt_async(u_int32_t async_code, struct cam_path *path, Modified: projects/altix/sys/conf/NOTES ============================================================================== --- projects/altix/sys/conf/NOTES Wed Apr 27 01:45:05 2011 (r221105) +++ projects/altix/sys/conf/NOTES Wed Apr 27 02:12:01 2011 (r221106) @@ -1754,7 +1754,7 @@ hint.ata.1.irq="15" # atapifd, atapist, atapicam) and all user-level APIs. # cam(4) drivers and APIs will be connected instead. -#options ATA_STATIC_ID +options ATA_STATIC_ID #options ATA_REQUEST_TIMEOUT=10 options ATA_CAM Modified: projects/altix/sys/dev/usb/controller/ehci.c ============================================================================== --- projects/altix/sys/dev/usb/controller/ehci.c Wed Apr 27 01:45:05 2011 (r221105) +++ projects/altix/sys/dev/usb/controller/ehci.c Wed Apr 27 02:12:01 2011 (r221106) @@ -1196,6 +1196,8 @@ ehci_data_toggle_update(struct usb_xfer dt ^= 1; /* short packet at the end */ else if (actlen != xlen) dt ^= 1; /* zero length packet at the end */ + else if (xlen == 0) + dt ^= 1; /* zero length transfer */ xfer->endpoint->toggle_next ^= dt; } Modified: projects/altix/sys/dev/usb/net/if_cdcereg.h ============================================================================== --- projects/altix/sys/dev/usb/net/if_cdcereg.h Wed Apr 27 01:45:05 2011 (r221105) +++ projects/altix/sys/dev/usb/net/if_cdcereg.h Wed Apr 27 02:12:01 2011 (r221106) @@ -39,7 +39,7 @@ #define CDCE_IND_SIZE_MAX 32 /* bytes */ #define CDCE_NCM_TX_MINLEN 512 /* bytes, must be power of two */ -#define CDCE_NCM_TX_MAXLEN (1UL << 14) /* bytes */ +#define CDCE_NCM_TX_MAXLEN (16384 + 4) /* bytes, must be short terminated */ #define CDCE_NCM_TX_FRAMES_MAX 8 /* units */ #define CDCE_NCM_RX_MAXLEN (1UL << 14) /* bytes */ Modified: projects/altix/sys/fs/nfsclient/nfs_clvfsops.c ============================================================================== --- projects/altix/sys/fs/nfsclient/nfs_clvfsops.c Wed Apr 27 01:45:05 2011 (r221105) +++ projects/altix/sys/fs/nfsclient/nfs_clvfsops.c Wed Apr 27 02:12:01 2011 (r221106) @@ -137,10 +137,17 @@ VFS_SET(nfs_vfsops, newnfs, VFCF_NETWORK MODULE_VERSION(newnfs, 1); /* - * This structure must be filled in by a primary bootstrap or bootstrap - * server for a diskless/dataless machine. It is initialized below just - * to ensure that it is allocated to initialized data (.data not .bss). + * This structure is now defined in sys/nfs/nfs_diskless.c so that it + * can be shared by both NFS clients. It is declared here so that it + * will be defined for kernels built without NFS_ROOT, although it + * isn't used in that case. */ +#if !defined(NFS_ROOT) && !defined(NFSCLIENT) +struct nfs_diskless nfs_diskless = { { { 0 } } }; +struct nfsv3_diskless nfsv3_diskless = { { { 0 } } }; +int nfs_diskless_valid = 0; +#endif + SYSCTL_INT(_vfs_newnfs, OID_AUTO, diskless_valid, CTLFLAG_RD, &nfs_diskless_valid, 0, "Has the diskless struct been filled correctly"); Modified: projects/altix/sys/geom/concat/g_concat.c ============================================================================== --- projects/altix/sys/geom/concat/g_concat.c Wed Apr 27 01:45:05 2011 (r221105) +++ projects/altix/sys/geom/concat/g_concat.c Wed Apr 27 02:12:01 2011 (r221106) @@ -678,7 +678,8 @@ g_concat_taste(struct g_class *mp, struc if (md.md_version < 4) md.md_provsize = pp->mediasize; - if (md.md_provider[0] != '\0' && strcmp(md.md_provider, pp->name) != 0) + if (md.md_provider[0] != '\0' && + !g_compare_names(md.md_provider, pp->name)) return (NULL); if (md.md_provsize != pp->mediasize) return (NULL); Modified: projects/altix/sys/geom/geom.h ============================================================================== --- projects/altix/sys/geom/geom.h Wed Apr 27 01:45:05 2011 (r221105) +++ projects/altix/sys/geom/geom.h Wed Apr 27 02:12:01 2011 (r221106) @@ -238,6 +238,7 @@ void g_waitidlelock(void); /* geom_subr.c */ int g_access(struct g_consumer *cp, int nread, int nwrite, int nexcl); int g_attach(struct g_consumer *cp, struct g_provider *pp); +int g_compare_names(const char *namea, const char *nameb); void g_destroy_consumer(struct g_consumer *cp); void g_destroy_geom(struct g_geom *pp); void g_destroy_provider(struct g_provider *pp); Modified: projects/altix/sys/geom/geom_dev.c ============================================================================== --- projects/altix/sys/geom/geom_dev.c Wed Apr 27 01:45:05 2011 (r221105) +++ projects/altix/sys/geom/geom_dev.c Wed Apr 27 02:12:01 2011 (r221106) @@ -113,8 +113,9 @@ g_dev_taste(struct g_class *mp, struct g { struct g_geom *gp; struct g_consumer *cp; - int error; - struct cdev *dev; + int error, len; + struct cdev *dev, *adev; + char buf[64], *val; g_trace(G_T_TOPOLOGY, "dev_taste(%s,%s)", mp->name, pp->name); g_topology_assert(); @@ -136,12 +137,35 @@ g_dev_taste(struct g_class *mp, struct g g_destroy_geom(gp); return (NULL); } + + /* Search for device alias name and create it if found. */ + adev = NULL; + for (len = MIN(strlen(gp->name), sizeof(buf) - 15); len > 0; len--) { + snprintf(buf, sizeof(buf), "kern.devalias.%s", gp->name); + buf[14 + len] = 0; + val = getenv(buf); + if (val != NULL) { + snprintf(buf, sizeof(buf), "%s%s", + val, gp->name + len); + freeenv(val); + adev = make_dev_alias(dev, buf); + break; + } + } + if (pp->flags & G_PF_CANDELETE) dev->si_flags |= SI_CANDELETE; dev->si_iosize_max = MAXPHYS; gp->softc = dev; dev->si_drv1 = gp; dev->si_drv2 = cp; + if (adev != NULL) { + if (pp->flags & G_PF_CANDELETE) + adev->si_flags |= SI_CANDELETE; + adev->si_iosize_max = MAXPHYS; + adev->si_drv1 = gp; + adev->si_drv2 = cp; + } return (gp); } Modified: projects/altix/sys/geom/geom_subr.c ============================================================================== --- projects/altix/sys/geom/geom_subr.c Wed Apr 27 01:45:05 2011 (r221105) +++ projects/altix/sys/geom/geom_subr.c Wed Apr 27 02:12:01 2011 (r221106) @@ -1017,6 +1017,43 @@ g_getattr__(const char *attr, struct g_c return (0); } +static int +g_get_device_prefix_len(const char *name) +{ + int len; + + if (strncmp(name, "ada", 3) == 0) + len = 3; + else if (strncmp(name, "ad", 2) == 0) + len = 2; + else + return (0); + if (name[len] < '0' || name[len] > '9') + return (0); + do { + len++; + } while (name[len] >= '0' && name[len] <= '9'); + return (len); +} + +int +g_compare_names(const char *namea, const char *nameb) +{ + int deva, devb; + + if (strcmp(namea, nameb) == 0) + return (1); + deva = g_get_device_prefix_len(namea); + if (deva == 0) + return (0); + devb = g_get_device_prefix_len(nameb); + if (devb == 0) + return (0); + if (strcmp(namea + deva, nameb + devb) == 0) + return (1); + return (0); +} + #if defined(DIAGNOSTIC) || defined(DDB) /* * This function walks the mesh and returns a non-zero integer if it Modified: projects/altix/sys/geom/journal/g_journal.c ============================================================================== --- projects/altix/sys/geom/journal/g_journal.c Wed Apr 27 01:45:05 2011 (r221105) +++ projects/altix/sys/geom/journal/g_journal.c Wed Apr 27 02:12:01 2011 (r221106) @@ -2527,7 +2527,8 @@ g_journal_taste(struct g_class *mp, stru return (NULL); gp = NULL; - if (md.md_provider[0] != '\0' && strcmp(md.md_provider, pp->name) != 0) + if (md.md_provider[0] != '\0' && + !g_compare_names(md.md_provider, pp->name)) return (NULL); if (md.md_provsize != 0 && md.md_provsize != pp->mediasize) return (NULL); Modified: projects/altix/sys/geom/mirror/g_mirror.c ============================================================================== --- projects/altix/sys/geom/mirror/g_mirror.c Wed Apr 27 01:45:05 2011 (r221105) +++ projects/altix/sys/geom/mirror/g_mirror.c Wed Apr 27 02:12:01 2011 (r221106) @@ -3007,7 +3007,8 @@ g_mirror_taste(struct g_class *mp, struc return (NULL); gp = NULL; - if (md.md_provider[0] != '\0' && strcmp(md.md_provider, pp->name) != 0) + if (md.md_provider[0] != '\0' && + !g_compare_names(md.md_provider, pp->name)) return (NULL); if (md.md_provsize != 0 && md.md_provsize != pp->mediasize) return (NULL); Modified: projects/altix/sys/geom/raid3/g_raid3.c ============================================================================== --- projects/altix/sys/geom/raid3/g_raid3.c Wed Apr 27 01:45:05 2011 (r221105) +++ projects/altix/sys/geom/raid3/g_raid3.c Wed Apr 27 02:12:01 2011 (r221106) @@ -3329,7 +3329,8 @@ g_raid3_taste(struct g_class *mp, struct return (NULL); gp = NULL; - if (md.md_provider[0] != '\0' && strcmp(md.md_provider, pp->name) != 0) + if (md.md_provider[0] != '\0' && + !g_compare_names(md.md_provider, pp->name)) return (NULL); if (md.md_provsize != 0 && md.md_provsize != pp->mediasize) return (NULL); Modified: projects/altix/sys/geom/shsec/g_shsec.c ============================================================================== --- projects/altix/sys/geom/shsec/g_shsec.c Wed Apr 27 01:45:05 2011 (r221105) +++ projects/altix/sys/geom/shsec/g_shsec.c Wed Apr 27 02:12:01 2011 (r221106) @@ -673,7 +673,8 @@ g_shsec_taste(struct g_class *mp, struct if (md.md_version < 1) md.md_provsize = pp->mediasize; - if (md.md_provider[0] != '\0' && strcmp(md.md_provider, pp->name) != 0) + if (md.md_provider[0] != '\0' && + !g_compare_names(md.md_provider, pp->name)) return (NULL); if (md.md_provsize != pp->mediasize) return (NULL); Modified: projects/altix/sys/geom/stripe/g_stripe.c ============================================================================== --- projects/altix/sys/geom/stripe/g_stripe.c Wed Apr 27 01:45:05 2011 (r221105) +++ projects/altix/sys/geom/stripe/g_stripe.c Wed Apr 27 02:12:01 2011 (r221106) @@ -952,7 +952,8 @@ g_stripe_taste(struct g_class *mp, struc if (md.md_version < 3) md.md_provsize = pp->mediasize; - if (md.md_provider[0] != '\0' && strcmp(md.md_provider, pp->name) != 0) + if (md.md_provider[0] != '\0' && + !g_compare_names(md.md_provider, pp->name)) return (NULL); if (md.md_provsize != pp->mediasize) return (NULL); Modified: projects/altix/sys/geom/virstor/g_virstor.c ============================================================================== --- projects/altix/sys/geom/virstor/g_virstor.c Wed Apr 27 01:45:05 2011 (r221105) +++ projects/altix/sys/geom/virstor/g_virstor.c Wed Apr 27 02:12:01 2011 (r221106) @@ -809,10 +809,9 @@ g_virstor_taste(struct g_class *mp, stru /* If the provider name is hardcoded, use the offered provider only * if it's been offered with its proper name (the one used in * the label command). */ - if (md.provider[0] != '\0') { - if (strcmp(md.provider, pp->name) != 0) - return (NULL); - } + if (md.provider[0] != '\0' && + !g_compare_names(md.provider, pp->name)) + return (NULL); /* Iterate all geoms this class already knows about to see if a new * geom instance of this class needs to be created (in case the provider Modified: projects/altix/sys/i386/conf/GENERIC ============================================================================== --- projects/altix/sys/i386/conf/GENERIC Wed Apr 27 01:45:05 2011 (r221105) +++ projects/altix/sys/i386/conf/GENERIC Wed Apr 27 02:12:01 2011 (r221106) @@ -95,6 +95,7 @@ device fdc device ahci # AHCI-compatible SATA controllers device ata # Legacy ATA/SATA controllers options ATA_CAM # Handle legacy controllers with CAM +options ATA_STATIC_ID # Static device numbering device mvs # Marvell 88SX50XX/88SX60XX/88SX70XX/SoC SATA device siis # SiliconImage SiI3124/SiI3132/SiI3531 SATA Modified: projects/altix/sys/i386/conf/XBOX ============================================================================== --- projects/altix/sys/i386/conf/XBOX Wed Apr 27 01:45:05 2011 (r221105) +++ projects/altix/sys/i386/conf/XBOX Wed Apr 27 02:12:01 2011 (r221106) @@ -52,6 +52,7 @@ device pci # ATA and ATAPI devices device ata options ATA_CAM +options ATA_STATIC_ID # Static device numbering # ATA/SCSI peripherals device scbus # SCSI bus (required for ATA/SCSI) Modified: projects/altix/sys/kern/kern_intr.c ============================================================================== --- projects/altix/sys/kern/kern_intr.c Wed Apr 27 01:45:05 2011 (r221105) +++ projects/altix/sys/kern/kern_intr.c Wed Apr 27 02:12:01 2011 (r221106) @@ -746,7 +746,6 @@ intr_handler_source(void *cookie) void _intr_drain(int irq) { - struct mtx *mtx; struct intr_event *ie; struct intr_thread *ithd; struct thread *td; @@ -758,13 +757,21 @@ _intr_drain(int irq) return; ithd = ie->ie_thread; td = ithd->it_thread; + /* + * We set the flag and wait for it to be cleared to avoid + * long delays with potentially busy interrupt handlers + * were we to only sample TD_AWAITING_INTR() every tick. + */ thread_lock(td); - mtx = td->td_lock; if (!TD_AWAITING_INTR(td)) { ithd->it_flags |= IT_WAIT; - msleep_spin(ithd, mtx, "isync", 0); + while (ithd->it_flags & IT_WAIT) { + thread_unlock(td); + pause("idrain", 1); + thread_lock(td); + } } - mtx_unlock_spin(mtx); + thread_unlock(td); return; } Modified: projects/altix/sys/kern/sched_4bsd.c ============================================================================== --- projects/altix/sys/kern/sched_4bsd.c Wed Apr 27 01:45:05 2011 (r221105) +++ projects/altix/sys/kern/sched_4bsd.c Wed Apr 27 02:12:01 2011 (r221106) @@ -1246,25 +1246,27 @@ sched_add(struct thread *td, int flags) } TD_SET_RUNQ(td); - if (td->td_pinned != 0) { - cpu = td->td_lastcpu; - ts->ts_runq = &runq_pcpu[cpu]; - single_cpu = 1; - CTR3(KTR_RUNQ, - "sched_add: Put td_sched:%p(td:%p) on cpu%d runq", ts, td, - cpu); - } else if (td->td_flags & TDF_BOUND) { - /* Find CPU from bound runq. */ - KASSERT(SKE_RUNQ_PCPU(ts), - ("sched_add: bound td_sched not on cpu runq")); - cpu = ts->ts_runq - &runq_pcpu[0]; - single_cpu = 1; - CTR3(KTR_RUNQ, - "sched_add: Put td_sched:%p(td:%p) on cpu%d runq", ts, td, - cpu); - } else if (ts->ts_flags & TSF_AFFINITY) { - /* Find a valid CPU for our cpuset */ - cpu = sched_pickcpu(td); + /* + * If SMP is started and the thread is pinned or otherwise limited to + * a specific set of CPUs, queue the thread to a per-CPU run queue. + * Otherwise, queue the thread to the global run queue. + * + * If SMP has not yet been started we must use the global run queue + * as per-CPU state may not be initialized yet and we may crash if we + * try to access the per-CPU run queues. + */ + if (smp_started && (td->td_pinned != 0 || td->td_flags & TDF_BOUND || + ts->ts_flags & TSF_AFFINITY)) { + if (td->td_pinned != 0) + cpu = td->td_lastcpu; + else if (td->td_flags & TDF_BOUND) { + /* Find CPU from bound runq. */ + KASSERT(SKE_RUNQ_PCPU(ts), + ("sched_add: bound td_sched not on cpu runq")); + cpu = ts->ts_runq - &runq_pcpu[0]; + } else + /* Find a valid CPU for our cpuset */ + cpu = sched_pickcpu(td); ts->ts_runq = &runq_pcpu[cpu]; single_cpu = 1; CTR3(KTR_RUNQ, Modified: projects/altix/sys/kern/subr_taskqueue.c ============================================================================== --- projects/altix/sys/kern/subr_taskqueue.c Wed Apr 27 01:45:05 2011 (r221105) +++ projects/altix/sys/kern/subr_taskqueue.c Wed Apr 27 02:12:01 2011 (r221106) @@ -61,12 +61,15 @@ struct taskqueue { int tq_tcount; int tq_spin; int tq_flags; + int tq_callouts; }; #define TQ_FLAGS_ACTIVE (1 << 0) #define TQ_FLAGS_BLOCKED (1 << 1) #define TQ_FLAGS_PENDING (1 << 2) +#define DT_CALLOUT_ARMED (1 << 0) + #define TQ_LOCK(tq) \ do { \ if ((tq)->tq_spin) \ @@ -83,6 +86,17 @@ struct taskqueue { mtx_unlock(&(tq)->tq_mutex); \ } while (0) +void +_timeout_task_init(struct taskqueue *queue, struct timeout_task *timeout_task, + int priority, task_fn_t func, void *context) +{ + + TASK_INIT(&timeout_task->t, priority, func, context); + callout_init_mtx(&timeout_task->c, &queue->tq_mutex, 0); + timeout_task->q = queue; + timeout_task->f = 0; +} + static __inline int TQ_SLEEP(struct taskqueue *tq, void *p, struct mtx *m, int pri, const char *wm, int t) @@ -129,7 +143,7 @@ static void taskqueue_terminate(struct thread **pp, struct taskqueue *tq) { - while (tq->tq_tcount > 0) { + while (tq->tq_tcount > 0 || tq->tq_callouts > 0) { wakeup(tq); TQ_SLEEP(tq, pp, &tq->tq_mutex, PWAIT, "taskqueue_destroy", 0); } @@ -143,26 +157,24 @@ taskqueue_free(struct taskqueue *queue) queue->tq_flags &= ~TQ_FLAGS_ACTIVE; taskqueue_terminate(queue->tq_threads, queue); KASSERT(TAILQ_EMPTY(&queue->tq_active), ("Tasks still running?")); + KASSERT(queue->tq_callouts == 0, ("Armed timeout tasks")); mtx_destroy(&queue->tq_mutex); free(queue->tq_threads, M_TASKQUEUE); free(queue, M_TASKQUEUE); } -int -taskqueue_enqueue(struct taskqueue *queue, struct task *task) +static int +taskqueue_enqueue_locked(struct taskqueue *queue, struct task *task) { struct task *ins; struct task *prev; - TQ_LOCK(queue); - /* * Count multiple enqueues. */ if (task->ta_pending) { task->ta_pending++; - TQ_UNLOCK(queue); - return 0; + return (0); } /* @@ -190,9 +202,60 @@ taskqueue_enqueue(struct taskqueue *queu else queue->tq_flags |= TQ_FLAGS_PENDING; + return (0); +} +int +taskqueue_enqueue(struct taskqueue *queue, struct task *task) +{ + int res; + + TQ_LOCK(queue); + res = taskqueue_enqueue_locked(queue, task); TQ_UNLOCK(queue); - return 0; + return (res); +} + +static void +taskqueue_timeout_func(void *arg) +{ + struct taskqueue *queue; + struct timeout_task *timeout_task; + + timeout_task = arg; + queue = timeout_task->q; + KASSERT((timeout_task->f & DT_CALLOUT_ARMED) != 0, ("Stray timeout")); + timeout_task->f &= ~DT_CALLOUT_ARMED; + queue->tq_callouts--; + taskqueue_enqueue_locked(timeout_task->q, &timeout_task->t); +} + +int +taskqueue_enqueue_timeout(struct taskqueue *queue, + struct timeout_task *timeout_task, int ticks) +{ + int res; + + TQ_LOCK(queue); + KASSERT(timeout_task->q == NULL || timeout_task->q == queue, + ("Migrated queue")); + KASSERT(!queue->tq_spin, ("Timeout for spin-queue")); + timeout_task->q = queue; + res = timeout_task->t.ta_pending; + if (ticks == 0) { + taskqueue_enqueue_locked(queue, &timeout_task->t); + } else { + if ((timeout_task->f & DT_CALLOUT_ARMED) != 0) { + res++; + } else { + queue->tq_callouts++; + timeout_task->f |= DT_CALLOUT_ARMED; + } + callout_reset(&timeout_task->c, ticks, taskqueue_timeout_func, + timeout_task); + } + TQ_UNLOCK(queue); + return (res); } void @@ -271,6 +334,19 @@ task_is_running(struct taskqueue *queue, return (0); } +static int +taskqueue_cancel_locked(struct taskqueue *queue, struct task *task, + u_int *pendp) +{ + + if (task->ta_pending > 0) + STAILQ_REMOVE(&queue->tq_queue, task, task, ta_link); + if (pendp != NULL) + *pendp = task->ta_pending; + task->ta_pending = 0; + return (task_is_running(queue, task) ? EBUSY : 0); +} + int taskqueue_cancel(struct taskqueue *queue, struct task *task, u_int *pendp) { @@ -278,14 +354,31 @@ taskqueue_cancel(struct taskqueue *queue int error; TQ_LOCK(queue); - if ((pending = task->ta_pending) > 0) - STAILQ_REMOVE(&queue->tq_queue, task, task, ta_link); - task->ta_pending = 0; - error = task_is_running(queue, task) ? EBUSY : 0; + pending = task->ta_pending; + error = taskqueue_cancel_locked(queue, task, pendp); + TQ_UNLOCK(queue); + + return (error); +} + +int +taskqueue_cancel_timeout(struct taskqueue *queue, + struct timeout_task *timeout_task, u_int *pendp) +{ + u_int pending, pending1; + int error; + + TQ_LOCK(queue); + pending = !!callout_stop(&timeout_task->c); + error = taskqueue_cancel_locked(queue, &timeout_task->t, &pending1); + if ((timeout_task->f & DT_CALLOUT_ARMED) != 0) { + timeout_task->f &= ~DT_CALLOUT_ARMED; + queue->tq_callouts--; + } TQ_UNLOCK(queue); if (pendp != NULL) - *pendp = pending; + *pendp = pending + pending1; return (error); } @@ -302,6 +395,15 @@ taskqueue_drain(struct taskqueue *queue, TQ_UNLOCK(queue); } +void +taskqueue_drain_timeout(struct taskqueue *queue, + struct timeout_task *timeout_task) +{ + + callout_drain(&timeout_task->c); + taskqueue_drain(queue, &timeout_task->t); +} + static void taskqueue_swi_enqueue(void *context) { Modified: projects/altix/sys/mips/conf/OCTEON1 ============================================================================== --- projects/altix/sys/mips/conf/OCTEON1 Wed Apr 27 01:45:05 2011 (r221105) +++ projects/altix/sys/mips/conf/OCTEON1 Wed Apr 27 02:12:01 2011 (r221106) @@ -99,6 +99,7 @@ device pci device ahci # AHCI-compatible SATA controllers device ata # Legacy ATA/SATA controllers options ATA_CAM # Handle legacy controllers with CAM +options ATA_STATIC_ID # Static device numbering device mvs # Marvell 88SX50XX/88SX60XX/88SX70XX/SoC SATA device siis # SiliconImage SiI3124/SiI3132/SiI3531 SATA Modified: projects/altix/sys/mips/conf/std.SWARM ============================================================================== --- projects/altix/sys/mips/conf/std.SWARM Wed Apr 27 01:45:05 2011 (r221105) +++ projects/altix/sys/mips/conf/std.SWARM Wed Apr 27 02:12:01 2011 (r221106) @@ -58,3 +58,4 @@ device pass device ata options ATA_CAM +options ATA_STATIC_ID # Static device numbering Modified: projects/altix/sys/modules/cam/Makefile ============================================================================== --- projects/altix/sys/modules/cam/Makefile Wed Apr 27 01:45:05 2011 (r221105) +++ projects/altix/sys/modules/cam/Makefile Wed Apr 27 02:12:01 2011 (r221106) @@ -9,6 +9,7 @@ KMOD= cam # See sys/conf/options for the flags that go into the different opt_*.h files. SRCS= opt_cam.h SRCS+= opt_ada.h +SRCS+= opt_ata.h SRCS+= opt_scsi.h SRCS+= opt_cd.h SRCS+= opt_pt.h Modified: projects/altix/sys/nfsclient/nfs_vfsops.c ============================================================================== --- projects/altix/sys/nfsclient/nfs_vfsops.c Wed Apr 27 01:45:05 2011 (r221105) +++ projects/altix/sys/nfsclient/nfs_vfsops.c Wed Apr 27 02:12:01 2011 (r221106) @@ -164,6 +164,18 @@ static struct nfs_rpcops nfs_rpcops = { nfs_commit, }; +/* + * This structure is now defined in sys/nfs/nfs_diskless.c so that it + * can be shared by both NFS clients. It is declared here so that it + * will be defined for kernels built without NFS_ROOT, although it + * isn't used in that case. + */ +#ifndef NFS_ROOT +struct nfs_diskless nfs_diskless = { { { 0 } } }; +struct nfsv3_diskless nfsv3_diskless = { { { 0 } } }; +int nfs_diskless_valid = 0; +#endif + SYSCTL_INT(_vfs_nfs, OID_AUTO, diskless_valid, CTLFLAG_RD, &nfs_diskless_valid, 0, "Has the diskless struct been filled correctly"); Modified: projects/altix/sys/ofed/include/linux/file.h ============================================================================== --- projects/altix/sys/ofed/include/linux/file.h Wed Apr 27 01:45:05 2011 (r221105) +++ projects/altix/sys/ofed/include/linux/file.h Wed Apr 27 02:12:01 2011 (r221106) @@ -92,7 +92,7 @@ get_unused_fd(void) int error; int fd; - error = falloc(curthread, &file, &fd); + error = falloc(curthread, &file, &fd, 0); if (error) return -error; return fd; Modified: projects/altix/sys/ofed/include/linux/workqueue.h ============================================================================== --- projects/altix/sys/ofed/include/linux/workqueue.h Wed Apr 27 01:45:05 2011 (r221105) +++ projects/altix/sys/ofed/include/linux/workqueue.h Wed Apr 27 02:12:01 2011 (r221106) @@ -160,9 +160,11 @@ flush_taskqueue(struct taskqueue *tq) { struct task flushtask; + PHOLD(curproc); TASK_INIT(&flushtask, 0, _flush_fn, NULL); taskqueue_enqueue(tq, &flushtask); taskqueue_drain(tq, &flushtask); + PRELE(curproc); } static inline int Modified: projects/altix/sys/pc98/conf/GENERIC ============================================================================== --- projects/altix/sys/pc98/conf/GENERIC Wed Apr 27 01:45:05 2011 (r221105) +++ projects/altix/sys/pc98/conf/GENERIC Wed Apr 27 02:12:01 2011 (r221106) @@ -91,6 +91,7 @@ device fdc device ahci # AHCI-compatible SATA controllers device ata # Legacy ATA/SATA controllers options ATA_CAM # Handle legacy controllers with CAM +options ATA_STATIC_ID # Static device numbering device mvs # Marvell 88SX50XX/88SX60XX/88SX70XX/SoC SATA device siis # SiliconImage SiI3124/SiI3132/SiI3531 SATA Copied: projects/altix/sys/sys/_callout.h (from r221105, head/sys/sys/_callout.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/altix/sys/sys/_callout.h Wed Apr 27 02:12:01 2011 (r221106, copy of r221105, head/sys/sys/_callout.h) @@ -0,0 +1,61 @@ +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)callout.h 8.2 (Berkeley) 1/21/94 + * $FreeBSD$ + */ + +#ifndef _SYS__CALLOUT_H +#define _SYS__CALLOUT_H + +#include <sys/queue.h> + +struct lock_object; + +SLIST_HEAD(callout_list, callout); +TAILQ_HEAD(callout_tailq, callout); + +struct callout { + union { + SLIST_ENTRY(callout) sle; + TAILQ_ENTRY(callout) tqe; + } c_links; + int c_time; /* ticks to the event */ + void *c_arg; /* function argument */ + void (*c_func)(void *); /* function to call */ + struct lock_object *c_lock; /* lock to handle */ + int c_flags; /* state of this entry */ + volatile int c_cpu; /* CPU we're scheduled on */ +}; + +#endif Modified: projects/altix/sys/sys/callout.h ============================================================================== --- projects/altix/sys/sys/callout.h Wed Apr 27 01:45:05 2011 (r221105) +++ projects/altix/sys/sys/callout.h Wed Apr 27 02:12:01 2011 (r221106) @@ -38,25 +38,7 @@ #ifndef _SYS_CALLOUT_H_ #define _SYS_CALLOUT_H_ -#include <sys/queue.h> - -struct lock_object; - -SLIST_HEAD(callout_list, callout); -TAILQ_HEAD(callout_tailq, callout); - -struct callout { - union { - SLIST_ENTRY(callout) sle; - TAILQ_ENTRY(callout) tqe; - } c_links; - int c_time; /* ticks to the event */ - void *c_arg; /* function argument */ - void (*c_func)(void *); /* function to call */ - struct lock_object *c_lock; /* lock to handle */ - int c_flags; /* state of this entry */ - volatile int c_cpu; /* CPU we're scheduled on */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201104270212.p3R2C1O2048965>