svn commit: r242342 - in head/sys: contrib/octeon-sdk mips/cavium
Author: jmallett Date: Tue Oct 30 06:07:30 2012 New Revision: 242342 URL: http://svn.freebsd.org/changeset/base/242342 Log: Speed feature tests and initialize helper configuration that some CPUs require. Modified: head/sys/contrib/octeon-sdk/octeon-feature.c head/sys/contrib/octeon-sdk/octeon-feature.h head/sys/mips/cavium/files.octeon1 head/sys/mips/cavium/octeon_machdep.c Modified: head/sys/contrib/octeon-sdk/octeon-feature.c == --- head/sys/contrib/octeon-sdk/octeon-feature.cTue Oct 30 04:31:32 2012(r242341) +++ head/sys/contrib/octeon-sdk/octeon-feature.cTue Oct 30 06:07:30 2012(r242342) @@ -139,7 +139,7 @@ feature_check: cvmx_dprintf(unknown error %d.\n, val); break; } -#if !defined(CVMX_BUILD_FOR_LINUX_KERNEL) !defined(__U_BOOT__) !defined(CVMX_BUILD_FOR_TOOLCHAIN) +#if !defined(CVMX_BUILD_FOR_LINUX_KERNEL) !defined(__U_BOOT__) !defined(CVMX_BUILD_FOR_TOOLCHAIN) !defined(CVMX_BUILD_FOR_FREEBSD_KERNEL) exit (1); #endif } Modified: head/sys/contrib/octeon-sdk/octeon-feature.h == --- head/sys/contrib/octeon-sdk/octeon-feature.hTue Oct 30 04:31:32 2012(r242341) +++ head/sys/contrib/octeon-sdk/octeon-feature.hTue Oct 30 06:07:30 2012(r242342) @@ -281,7 +281,7 @@ extern uint8_t octeon_feature_map[FEATUR #if defined(__U_BOOT__) || defined(CVMX_BUILD_FOR_LINUX_HOST) || defined(CVMX_BUILD_FOR_TOOLCHAIN) #define octeon_has_feature old_octeon_has_feature #else -#if defined(USE_RUNTIME_MODEL_CHECKS) +#if defined(USE_RUNTIME_MODEL_CHECKS) || (defined(__FreeBSD__) defined(_KERNEL)) static inline int octeon_has_feature(octeon_feature_t feature) { int byte, bit; Modified: head/sys/mips/cavium/files.octeon1 == --- head/sys/mips/cavium/files.octeon1 Tue Oct 30 04:31:32 2012 (r242341) +++ head/sys/mips/cavium/files.octeon1 Tue Oct 30 06:07:30 2012 (r242342) @@ -61,6 +61,7 @@ contrib/octeon-sdk/cvmx-clock.c standa contrib/octeon-sdk/cvmx-ebt3000.c standard contrib/octeon-sdk/cvmx-fpa.c standard contrib/octeon-sdk/cvmx-helper.c standard +contrib/octeon-sdk/cvmx-helper-cfg.c standard contrib/octeon-sdk/cvmx-helper-board.c standard contrib/octeon-sdk/cvmx-helper-cfg.c standard contrib/octeon-sdk/cvmx-helper-errata.cstandard @@ -89,6 +90,7 @@ contrib/octeon-sdk/cvmx-sysinfo.c stand contrib/octeon-sdk/cvmx-thunder.c standard contrib/octeon-sdk/cvmx-twsi.c standard contrib/octeon-sdk/cvmx-warn.c standard +contrib/octeon-sdk/octeon-feature.cstandard contrib/octeon-sdk/octeon-model.c standard # HWPMC Modified: head/sys/mips/cavium/octeon_machdep.c == --- head/sys/mips/cavium/octeon_machdep.c Tue Oct 30 04:31:32 2012 (r242341) +++ head/sys/mips/cavium/octeon_machdep.c Tue Oct 30 06:07:30 2012 (r242342) @@ -76,6 +76,7 @@ __FBSDID($FreeBSD$); #include contrib/octeon-sdk/cvmx.h #include contrib/octeon-sdk/cvmx-bootmem.h #include contrib/octeon-sdk/cvmx-ebt3000.h +#include contrib/octeon-sdk/cvmx-helper-cfg.h #include contrib/octeon-sdk/cvmx-interrupt.h #include contrib/octeon-sdk/cvmx-version.h @@ -598,6 +599,10 @@ octeon_boot_params_init(register_t ptr) panic(Your boot loader did not supply a memory descriptor.); cvmx_bootmem_init(cvmx_sysinfo_get()-phy_mem_desc_addr); + octeon_feature_init(); + + __cvmx_helper_cfg_init(); + printf(Boot Descriptor Ver: %u - %u/%u, app_desc_ptr-desc_version, octeon_bootinfo-major_version, octeon_bootinfo-minor_version); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r242343 - head/sys/arm/lpc
Author: andrew Date: Tue Oct 30 06:11:09 2012 New Revision: 242343 URL: http://svn.freebsd.org/changeset/base/242343 Log: Move the call to platform_gpio_init() into initarm_gpio_init() to reduce the diff to the other FDT versions of initarm. Modified: head/sys/arm/lpc/lpc_machdep.c Modified: head/sys/arm/lpc/lpc_machdep.c == --- head/sys/arm/lpc/lpc_machdep.c Tue Oct 30 06:07:30 2012 (r242342) +++ head/sys/arm/lpc/lpc_machdep.c Tue Oct 30 06:11:09 2012 (r242343) @@ -542,11 +542,6 @@ initarm(struct arm_boot_params *abp) */ physmap_init(); - /* -* Set initial values of GPIO output ports -*/ - platform_gpio_init(); - /* Do basic tuning, hz etc */ init_param2(physmem); kdb_init(); @@ -569,6 +564,11 @@ initarm_lastaddr(void) void initarm_gpio_init(void) { + + /* +* Set initial values of GPIO output ports +*/ + platform_gpio_init(); } void ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r242344 - head/sys/mips/cavium
Author: jmallett Date: Tue Oct 30 06:19:46 2012 New Revision: 242344 URL: http://svn.freebsd.org/changeset/base/242344 Log: Remove stale declarations. Modified: head/sys/mips/cavium/octeon_machdep.c Modified: head/sys/mips/cavium/octeon_machdep.c == --- head/sys/mips/cavium/octeon_machdep.c Tue Oct 30 06:11:09 2012 (r242343) +++ head/sys/mips/cavium/octeon_machdep.c Tue Oct 30 06:19:46 2012 (r242344) @@ -130,9 +130,6 @@ static const struct octeon_feature_descr { 0,NULL } }; -uint64_t ciu_get_en_reg_addr_new(int corenum, int intx, int enx, int ciu_ip); -void ciu_dump_interrutps_enabled(int core_num, int intx, int enx, int ciu_ip); - static uint64_t octeon_get_ticks(void); static unsigned octeon_get_timecount(struct timecounter *tc); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r242345 - head/sys/mips/cavium
Author: jmallett Date: Tue Oct 30 06:29:17 2012 New Revision: 242345 URL: http://svn.freebsd.org/changeset/base/242345 Log: Remove oct_read64 and oct_write64 and use their equivalents from the Simple Executive, which are used everywhere else in the Octeon port. While here, remove other unused things from octeon_pcmap_regs.h. Modified: head/sys/mips/cavium/octeon_pcmap_regs.h head/sys/mips/cavium/uart_cpu_octeonusart.c Modified: head/sys/mips/cavium/octeon_pcmap_regs.h == --- head/sys/mips/cavium/octeon_pcmap_regs.hTue Oct 30 06:19:46 2012 (r242344) +++ head/sys/mips/cavium/octeon_pcmap_regs.hTue Oct 30 06:29:17 2012 (r242345) @@ -47,148 +47,14 @@ #define __OCTEON_PCMAP_REGS_H__ #ifndef LOCORE - -/* - * Utility inlines macros - */ - -#if defined(__mips_n64) -#defineoct_write64(a, v) (*(volatile uint64_t *)(a) = (uint64_t)(v)) - -#defineOCT_READ(n, t) \ -static inline t oct_read ## n(uintptr_t a) \ -{ \ - volatile t *p = (volatile t *)a;\ - return (*p);\ -} - -OCT_READ(64, uint64_t); - -#elif defined(__mips_n32) || defined(__mips_o32) -#if defined(__mips_n32) -static inline void oct_write64 (uint64_t csr_addr, uint64_t val64) -{ -__asm __volatile ( - .set push\n -.set mips64\n -sd %0, 0(%1)\n -.set pop\n -: - : r(val64), r(csr_addr)); -} - -#defineOCT_READ(n, t, insn) \ -static inline t oct_read ## n(uint64_t a) \ -{ \ -uint64_t tmp; \ - \ -__asm __volatile ( \ - .set push\n \ -.set mips64\n \ -insn \t%0, 0(%1)\n \ -.set pop\n \ -: =r(tmp)\ -: r(a)); \ -return ((t)tmp); \ -} - -OCT_READ(64, uint64_t, ld); -#else - -/* - * XXX - * Add o32 variants that load the address into a register and the result out - * of a register properly, and simply disable interrupts before and after and - * hope that we don't need to refill or modify the TLB to access the address. - * I'd be a lot happier if csr_addr were a physical address and we mapped it - * into XKPHYS here so that we could guarantee that interrupts were the only - * kind of exception we needed to worry about. - * - * Also, some of this inline assembly is needlessly verbose. Oh, well. - */ -static inline void oct_write64 (uint64_t csr_addr, uint64_t val64) -{ - uint32_t csr_addrh = csr_addr 32; - uint32_t csr_addrl = csr_addr; - uint32_t valh = val64 32; - uint32_t vall = val64; - uint32_t tmp1; - uint32_t tmp2; - uint32_t tmp3; - register_t sr; - - sr = intr_disable(); - - __asm __volatile ( - .set push\n -.set mips64\n - .set noreorder\n - .set noat\n - dsll %0, %3, 32\n - dsll %1, %5, 32\n - dsll %2, %4, 32\n - dsrl %2, %2, 32\n - or %0, %0, %2\n - dsll %2, %6, 32\n - dsrl %2, %2, 32\n - or %1, %1, %2\n - sd %0, 0(%1)\n -.set pop\n - : =r (tmp1), =r (tmp2), =r (tmp3) - : r (valh), r (vall), r (csr_addrh), r (csr_addrl)); - - intr_restore(sr); -} - -static inline uint64_t oct_read64 (uint64_t csr_addr) -{ - uint32_t csr_addrh = csr_addr 32; - uint32_t csr_addrl = csr_addr; - uint32_t valh; - uint32_t vall; - register_t sr; - - sr = intr_disable(); - - __asm __volatile ( - .set push\n -.set mips64\n - .set noreorder\n - .set noat\n - dsll %0, %2, 32\n - dsll %1, %3, 32\n - dsrl %1, %1, 32\n - or %0, %0, %1\n - ld %1, 0(%0)\n - dsrl %0, %1, 32\n - dsll %1, %1, 32\n - dsrl %1, %1, 32\n - .set pop\n - : =r (valh), =r (vall) - : r (csr_addrh), r (csr_addrl)); - - intr_restore(sr); - - return ((uint64_t)valh 32) | vall;
svn commit: r242346 - in head/sys/mips/cavium: . octe
Author: jmallett Date: Tue Oct 30 06:36:14 2012 New Revision: 242346 URL: http://svn.freebsd.org/changeset/base/242346 Log: Actually check board type rather than using a specialized octeon_is_simulation function. Modified: head/sys/mips/cavium/octe/ethernet-common.c head/sys/mips/cavium/octe/ethernet-rgmii.c head/sys/mips/cavium/octe/ethernet-sgmii.c head/sys/mips/cavium/octe/ethernet-xaui.c head/sys/mips/cavium/octe/ethernet.c head/sys/mips/cavium/octeon_ebt3000_cf.c head/sys/mips/cavium/octeon_machdep.c head/sys/mips/cavium/octeon_pcmap_regs.h Modified: head/sys/mips/cavium/octe/ethernet-common.c == --- head/sys/mips/cavium/octe/ethernet-common.c Tue Oct 30 06:29:17 2012 (r242345) +++ head/sys/mips/cavium/octe/ethernet-common.c Tue Oct 30 06:36:14 2012 (r242346) @@ -44,8 +44,6 @@ __FBSDID($FreeBSD$); #include wrapper-cvmx-includes.h #include ethernet-headers.h -extern int octeon_is_simulation(void); - static uint64_t cvm_oct_mac_addr = 0; static uint32_t cvm_oct_mac_addr_offset = 0; @@ -243,7 +241,7 @@ int cvm_oct_common_open(struct ifnet *if /* * Set the link state unless we are using MII. */ -if (!octeon_is_simulation() priv-miibus == NULL) { +if (cvmx_sysinfo_get()-board_type != CVMX_BOARD_TYPE_SIM priv-miibus == NULL) { link_info = cvmx_helper_link_get(priv-port); if (!link_info.s.link_up) if_link_state_change(ifp, LINK_STATE_DOWN); @@ -282,7 +280,7 @@ void cvm_oct_common_poll(struct ifnet *i /* * If this is a simulation, do nothing. */ - if (octeon_is_simulation()) + if (cvmx_sysinfo_get()-board_type == CVMX_BOARD_TYPE_SIM) return; /* Modified: head/sys/mips/cavium/octe/ethernet-rgmii.c == --- head/sys/mips/cavium/octe/ethernet-rgmii.c Tue Oct 30 06:29:17 2012 (r242345) +++ head/sys/mips/cavium/octe/ethernet-rgmii.c Tue Oct 30 06:36:14 2012 (r242346) @@ -49,7 +49,6 @@ __FBSDID($FreeBSD$); #include octebusvar.h -extern int octeon_is_simulation(void); extern struct ifnet *cvm_oct_device[]; static struct mtx global_register_lock; @@ -256,7 +255,7 @@ int cvm_oct_rgmii_init(struct ifnet *ifp if (((priv-imode == CVMX_HELPER_INTERFACE_MODE_GMII) (priv-port == 0)) || (priv-imode == CVMX_HELPER_INTERFACE_MODE_RGMII)) { - if (!octeon_is_simulation()) { + if (cvmx_sysinfo_get()-board_type != CVMX_BOARD_TYPE_SIM) { cvmx_gmxx_rxx_int_en_t gmx_rx_int_en; int interface = INTERFACE(priv-port); @@ -285,7 +284,7 @@ void cvm_oct_rgmii_uninit(struct ifnet * if (((priv-imode == CVMX_HELPER_INTERFACE_MODE_GMII) (priv-port == 0)) || (priv-imode == CVMX_HELPER_INTERFACE_MODE_RGMII)) { - if (!octeon_is_simulation()) { + if (cvmx_sysinfo_get()-board_type != CVMX_BOARD_TYPE_SIM) { cvmx_gmxx_rxx_int_en_t gmx_rx_int_en; int interface = INTERFACE(priv-port); Modified: head/sys/mips/cavium/octe/ethernet-sgmii.c == --- head/sys/mips/cavium/octe/ethernet-sgmii.c Tue Oct 30 06:29:17 2012 (r242345) +++ head/sys/mips/cavium/octe/ethernet-sgmii.c Tue Oct 30 06:36:14 2012 (r242346) @@ -44,8 +44,6 @@ __FBSDID($FreeBSD$); #include wrapper-cvmx-includes.h #include ethernet-headers.h -extern int octeon_is_simulation(void); - int cvm_oct_sgmii_init(struct ifnet *ifp) { cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp-if_softc; Modified: head/sys/mips/cavium/octe/ethernet-xaui.c == --- head/sys/mips/cavium/octe/ethernet-xaui.c Tue Oct 30 06:29:17 2012 (r242345) +++ head/sys/mips/cavium/octe/ethernet-xaui.c Tue Oct 30 06:36:14 2012 (r242346) @@ -44,8 +44,6 @@ __FBSDID($FreeBSD$); #include wrapper-cvmx-includes.h #include ethernet-headers.h -extern int octeon_is_simulation(void); - int cvm_oct_xaui_init(struct ifnet *ifp) { cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp-if_softc; Modified: head/sys/mips/cavium/octe/ethernet.c == --- head/sys/mips/cavium/octe/ethernet.cTue Oct 30 06:29:17 2012 (r242345) +++ head/sys/mips/cavium/octe/ethernet.cTue Oct 30 06:36:14 2012 (r242346) @@ -74,8 +74,6 @@ TUNABLE_INT(hw.octe.pow_receive_group, \t\tgroup. Also any other software can submit packets to this\n \t\tgroup for the kernel to process. */ -extern int octeon_is_simulation(void); - /** * Periodic timer to
svn commit: r242348 - head/sys/dev/age
Author: yongari Date: Tue Oct 30 07:55:03 2012 New Revision: 242348 URL: http://svn.freebsd.org/changeset/base/242348 Log: TSO engine of L1 requires a separate DMA descriptor for TCP payload. This means driver has to split a TX buffer into two pieces of TX buffers when the TX buffer contains both ethernet/IP/TCP header and partial TCP payload. The controller does not require all header should be in a TX buffer but driver forced it to compute IP/TCP header size/offset which is required parameter to configure DMA descriptor for TSO. While here, slightly reorder DMA descriptor setup to enhance readability and remove unnecessary code for TSO(upper stack never requests TSO when the frame length is less than or equal to MTU). Reported by: Yamagi Burmeister lists yamagi dot org Tested by:Yamagi Burmeister lists yamagi dot org MFC After:1 week Modified: head/sys/dev/age/if_age.c Modified: head/sys/dev/age/if_age.c == --- head/sys/dev/age/if_age.c Tue Oct 30 07:51:18 2012(r242347) +++ head/sys/dev/age/if_age.c Tue Oct 30 07:55:03 2012(r242348) @@ -1495,7 +1495,7 @@ age_encap(struct age_softc *sc, struct m struct tcphdr *tcp; bus_dma_segment_t txsegs[AGE_MAXTXSEGS]; bus_dmamap_t map; - uint32_t cflags, ip_off, poff, vtag; + uint32_t cflags, hdrlen, ip_off, poff, vtag; int error, i, nsegs, prod, si; AGE_LOCK_ASSERT(sc); @@ -1562,8 +1562,12 @@ age_encap(struct age_softc *sc, struct m *m_head = NULL; return (ENOBUFS); } - ip = (struct ip *)(mtod(m, char *) + ip_off); tcp = (struct tcphdr *)(mtod(m, char *) + poff); + m = m_pullup(m, poff + (tcp-th_off 2)); + if (m == NULL) { + *m_head = NULL; + return (ENOBUFS); + } /* * L1 requires IP/TCP header size and offset as * well as TCP pseudo checksum which complicates @@ -1578,14 +1582,11 @@ age_encap(struct age_softc *sc, struct m * Reset IP checksum and recompute TCP pseudo * checksum as NDIS specification said. */ + ip = (struct ip *)(mtod(m, char *) + ip_off); + tcp = (struct tcphdr *)(mtod(m, char *) + poff); ip-ip_sum = 0; - if (poff + (tcp-th_off 2) == m-m_pkthdr.len) - tcp-th_sum = in_pseudo(ip-ip_src.s_addr, - ip-ip_dst.s_addr, - htons((tcp-th_off 2) + IPPROTO_TCP)); - else - tcp-th_sum = in_pseudo(ip-ip_src.s_addr, - ip-ip_dst.s_addr, htons(IPPROTO_TCP)); + tcp-th_sum = in_pseudo(ip-ip_src.s_addr, + ip-ip_dst.s_addr, htons(IPPROTO_TCP)); } *m_head = m; } @@ -1627,23 +1628,48 @@ age_encap(struct age_softc *sc, struct m } m = *m_head; + /* Configure VLAN hardware tag insertion. */ + if ((m-m_flags M_VLANTAG) != 0) { + vtag = AGE_TX_VLAN_TAG(m-m_pkthdr.ether_vtag); + vtag = ((vtag AGE_TD_VLAN_SHIFT) AGE_TD_VLAN_MASK); + cflags |= AGE_TD_INSERT_VLAN_TAG; + } + + desc = NULL; + i = 0; if ((m-m_pkthdr.csum_flags CSUM_TSO) != 0) { - /* Configure TSO. */ - if (poff + (tcp-th_off 2) == m-m_pkthdr.len) { - /* Not TSO but IP/TCP checksum offload. */ - cflags |= AGE_TD_IPCSUM | AGE_TD_TCPCSUM; - /* Clear TSO in order not to set AGE_TD_TSO_HDR. */ - m-m_pkthdr.csum_flags = ~CSUM_TSO; - } else { - /* Request TSO and set MSS. */ - cflags |= AGE_TD_TSO_IPV4; - cflags |= AGE_TD_IPCSUM | AGE_TD_TCPCSUM; - cflags |= ((uint32_t)m-m_pkthdr.tso_segsz - AGE_TD_TSO_MSS_SHIFT); - } + /* Request TSO and set MSS. */ + cflags |= AGE_TD_TSO_IPV4; + cflags |= AGE_TD_IPCSUM | AGE_TD_TCPCSUM; + cflags |= ((uint32_t)m-m_pkthdr.tso_segsz + AGE_TD_TSO_MSS_SHIFT); /* Set IP/TCP header size. */ cflags |= ip-ip_hl AGE_TD_IPHDR_LEN_SHIFT; cflags |= tcp-th_off AGE_TD_TSO_TCPHDR_LEN_SHIFT; + /* +* L1 requires the first buffer should only hold
svn commit: r242349 - head/usr.sbin/pw
Author: bapt Date: Tue Oct 30 08:00:53 2012 New Revision: 242349 URL: http://svn.freebsd.org/changeset/base/242349 Log: Teach pw(8) about how to use pw/gr API to reduce code duplication MFC after:2 months Deleted: head/usr.sbin/pw/edgroup.c Modified: head/usr.sbin/pw/Makefile head/usr.sbin/pw/fileupd.c head/usr.sbin/pw/grupd.c head/usr.sbin/pw/pw.8 head/usr.sbin/pw/pw.c head/usr.sbin/pw/pw.h head/usr.sbin/pw/pw_group.c head/usr.sbin/pw/pw_log.c head/usr.sbin/pw/pw_nis.c head/usr.sbin/pw/pw_user.c head/usr.sbin/pw/pw_vpw.c head/usr.sbin/pw/pwupd.c head/usr.sbin/pw/pwupd.h Modified: head/usr.sbin/pw/Makefile == --- head/usr.sbin/pw/Makefile Tue Oct 30 07:55:03 2012(r242348) +++ head/usr.sbin/pw/Makefile Tue Oct 30 08:00:53 2012(r242349) @@ -3,10 +3,10 @@ PROG= pw MAN= pw.conf.5 pw.8 SRCS= pw.c pw_conf.c pw_user.c pw_group.c pw_log.c pw_nis.c pw_vpw.c \ - grupd.c pwupd.c fileupd.c edgroup.c psdate.c \ + grupd.c pwupd.c fileupd.c psdate.c \ bitmap.c cpdir.c rm_r.c -WARNS?=1 +WARNS?=2 DPADD= ${LIBCRYPT} ${LIBUTIL} LDADD= -lcrypt -lutil Modified: head/usr.sbin/pw/fileupd.c == --- head/usr.sbin/pw/fileupd.c Tue Oct 30 07:55:03 2012(r242348) +++ head/usr.sbin/pw/fileupd.c Tue Oct 30 08:00:53 2012(r242349) @@ -66,138 +66,3 @@ extendarray(char ***buf, int * buflen, i } return *buflen; } - - -int -fileupdate(char const * filename, mode_t fmode, char const * newline, char const * prefix, int pfxlen, int updmode) -{ - int rc = 0; - - if (pfxlen = 1) - rc = EINVAL; - else { - intinfd = open(filename, O_RDWR | O_CREAT | O_EXLOCK, fmode); - - if (infd == -1) - rc = errno; - else { - FILE *infp = fdopen(infd, r+); - - if (infp == NULL) { - rc = errno; /* Assumes fopen(3) sets errno from open(2) */ - close(infd); - } else { - int outfd; - char file[MAXPATHLEN]; - - strcpy(file, filename); - strcat(file, .new); - outfd = open(file, O_RDWR | O_CREAT | O_TRUNC, fmode); - if (outfd == -1) - rc = errno; - else { - FILE*outfp = fdopen(outfd, w+); - - if (outfp == NULL) { - rc = errno; - close(outfd); - } else { - int updated = UPD_CREATE; - int linesize = PWBUFSZ; - char *line = malloc(linesize); - - nextline: - while (fgets(line, linesize, infp) != NULL) { - char *p = strchr(line, '\n'); - - while ((p = strchr(line, '\n')) == NULL) { - int l; - if (extendline(line, linesize, linesize + PWBUFSZ) == -1) { - int ch; - fputs(line, outfp); - while ((ch = fgetc(infp)) != EOF) { - fputc(ch, outfp); - if (ch == '\n') - break; - } - goto nextline; - } - l = strlen(line); - if (fgets(line + l, linesize - l, infp) == NULL) - break; - } -
svn commit: r242350 - head/share/man/man9
Author: kevlo Date: Tue Oct 30 10:13:26 2012 New Revision: 242350 URL: http://svn.freebsd.org/changeset/base/242350 Log: The argument len of m_pullup(9) could be less than or equal to MHLEN. Reviewed by: glebius Modified: head/share/man/man9/mbuf.9 Modified: head/share/man/man9/mbuf.9 == --- head/share/man/man9/mbuf.9 Tue Oct 30 08:00:53 2012(r242349) +++ head/share/man/man9/mbuf.9 Tue Oct 30 10:13:26 2012(r242350) @@ -706,7 +706,7 @@ It does not allocate any .Vt mbuf clusters , so .Fa len -must be less than +must be less than or equal to .Dv MHLEN . .\ .It Fn m_pulldown mbuf offset len offsetp ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r242325 - head/sys/netinet
On Mon, Oct 29, 2012 at 08:42:48PM +, Michael Tuexen wrote: M Author: tuexen M Date: Mon Oct 29 20:42:48 2012 M New Revision: 242325 M URL: http://svn.freebsd.org/changeset/base/242325 M M Log: M Use ntohs() and htons() in correct order. However, this doesn't change M functionality. Oh, sorry for that. Thanks for fixing! M Modified: M head/sys/netinet/sctputil.c M M Modified: head/sys/netinet/sctputil.c M == M --- head/sys/netinet/sctputil.c Mon Oct 29 18:06:09 2012 (r242324) M +++ head/sys/netinet/sctputil.c Mon Oct 29 20:42:48 2012 (r242325) M @@ -6821,7 +6821,7 @@ sctp_recv_udp_tunneled_packet(struct mbu M switch (iph-ip_v) { M #ifdef INET M case IPVERSION: M -iph-ip_len = ntohs(htons(iph-ip_len) - sizeof(struct udphdr)); M +iph-ip_len = htons(ntohs(iph-ip_len) - sizeof(struct udphdr)); M sctp_input_with_port(m, off, port); M break; M #endif M ___ M svn-src-...@freebsd.org mailing list M http://lists.freebsd.org/mailman/listinfo/svn-src-all M To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org -- Totus tuus, Glebius. ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r242352 - head/sys/dev/sound/pci/hda
Author: mav Date: Tue Oct 30 10:59:42 2012 New Revision: 242352 URL: http://svn.freebsd.org/changeset/base/242352 Log: Print card and subsystem IDs in verbose logs to help to identify system. Hide some less iseful messages under debug. Modified: head/sys/dev/sound/pci/hda/hdaa.c head/sys/dev/sound/pci/hda/hdaa.h head/sys/dev/sound/pci/hda/hdaa_patches.c head/sys/dev/sound/pci/hda/hdac.c head/sys/dev/sound/pci/hda/hdac.h head/sys/dev/sound/pci/hda/hdacc.c Modified: head/sys/dev/sound/pci/hda/hdaa.c == --- head/sys/dev/sound/pci/hda/hdaa.c Tue Oct 30 10:52:35 2012 (r242351) +++ head/sys/dev/sound/pci/hda/hdaa.c Tue Oct 30 10:59:42 2012 (r242352) @@ -6243,6 +6243,10 @@ hdaa_attach(device_t dev) devinfo-endnode = devinfo-startnode + devinfo-nodecnt; HDA_BOOTVERBOSE( + device_printf(dev, Subsystem ID: 0x%08x\n, + hda_get_subsystem_id(dev)); + ); + HDA_BOOTHVERBOSE( device_printf(dev, Audio Function Group at nid=%d: %d subnodes %d-%d\n, nid, devinfo-nodecnt, Modified: head/sys/dev/sound/pci/hda/hdaa.h == --- head/sys/dev/sound/pci/hda/hdaa.h Tue Oct 30 10:52:35 2012 (r242351) +++ head/sys/dev/sound/pci/hda/hdaa.h Tue Oct 30 10:59:42 2012 (r242352) @@ -260,7 +260,7 @@ struct hdaa_chan { (((uint32_t)hda_get_vendor_id(devinfo-dev) 16) +\ hda_get_device_id(devinfo-dev)) -#define hdaa_subvendor_id(devinfo) \ +#define hdaa_card_id(devinfo) \ (((uint32_t)hda_get_subdevice_id(devinfo-dev) 16) + \ hda_get_subvendor_id(devinfo-dev)) Modified: head/sys/dev/sound/pci/hda/hdaa_patches.c == --- head/sys/dev/sound/pci/hda/hdaa_patches.c Tue Oct 30 10:52:35 2012 (r242351) +++ head/sys/dev/sound/pci/hda/hdaa_patches.c Tue Oct 30 10:59:42 2012 (r242352) @@ -139,7 +139,7 @@ hdac_pin_patch(struct hdaa_widget *w) config = orig = w-wclass.pin.config; id = hdaa_codec_id(w-devinfo); - subid = hdaa_subvendor_id(w-devinfo); + subid = hdaa_card_id(w-devinfo); /* XXX: Old patches require complete review. * Now they may create more problem then solve due to @@ -392,7 +392,7 @@ hdaa_patch(struct hdaa_devinfo *devinfo) int i; id = hdaa_codec_id(devinfo); - subid = hdaa_subvendor_id(devinfo); + subid = hdaa_card_id(devinfo); /* * Quirks @@ -594,7 +594,7 @@ hdaa_patch_direct(struct hdaa_devinfo *d uint32_t id, subid, val; id = hdaa_codec_id(devinfo); - subid = hdaa_subvendor_id(devinfo); + subid = hdaa_card_id(devinfo); switch (id) { case HDA_CODEC_VT1708S_0: Modified: head/sys/dev/sound/pci/hda/hdac.c == --- head/sys/dev/sound/pci/hda/hdac.c Tue Oct 30 10:52:35 2012 (r242351) +++ head/sys/dev/sound/pci/hda/hdac.c Tue Oct 30 10:59:42 2012 (r242352) @@ -1074,6 +1074,8 @@ hdac_attach(device_t dev) sc = device_get_softc(dev); HDA_BOOTVERBOSE( + device_printf(dev, PCI card vendor: 0x%04x, device: 0x%04x\n, + pci_get_subvendor(dev), pci_get_subdevice(dev)); device_printf(dev, HDA Driver Revision: %s\n, HDA_DRV_TEST_REV); ); Modified: head/sys/dev/sound/pci/hda/hdac.h == --- head/sys/dev/sound/pci/hda/hdac.h Tue Oct 30 10:52:35 2012 (r242351) +++ head/sys/dev/sound/pci/hda/hdac.h Tue Oct 30 10:59:42 2012 (r242352) @@ -666,6 +666,7 @@ HDA_ACCESSOR(revision_id, REVISION_ID,u HDA_ACCESSOR(stepping_id, STEPPING_ID,uint8_t); HDA_ACCESSOR(subvendor_id, SUBVENDOR_ID, uint16_t); HDA_ACCESSOR(subdevice_id, SUBDEVICE_ID, uint16_t); +HDA_ACCESSOR(subsystem_id, SUBSYSTEM_ID, uint32_t); HDA_ACCESSOR(node_type,NODE_TYPE, uint8_t); HDA_ACCESSOR(dma_nocache, DMA_NOCACHE,uint8_t); Modified: head/sys/dev/sound/pci/hda/hdacc.c == --- head/sys/dev/sound/pci/hda/hdacc.c Tue Oct 30 10:52:35 2012 (r242351) +++ head/sys/dev/sound/pci/hda/hdacc.c Tue Oct 30 10:59:42 2012 (r242352) @@ -422,7 +422,7 @@ hdacc_attach(device_t dev) startnode = HDA_PARAM_SUB_NODE_COUNT_START(subnode); endnode = startnode + codec-fgcnt; - HDA_BOOTVERBOSE( + HDA_BOOTHVERBOSE( device_printf(dev,
svn commit: r242356 - head/sys/kern
Author: attilio Date: Tue Oct 30 12:25:52 2012 New Revision: 242356 URL: http://svn.freebsd.org/changeset/base/242356 Log: tdq_lock_pair() already does spinlock_enter() so migration is not possible in sched_balance_pair(). Remove redundant sched_pin(). Reviewed by: marius, jeff Modified: head/sys/kern/sched_ule.c Modified: head/sys/kern/sched_ule.c == --- head/sys/kern/sched_ule.c Tue Oct 30 11:33:47 2012(r242355) +++ head/sys/kern/sched_ule.c Tue Oct 30 12:25:52 2012(r242356) @@ -910,10 +910,8 @@ sched_balance_pair(struct tdq *high, str * reschedule with the new workload. */ cpu = TDQ_ID(low); - sched_pin(); if (cpu != PCPU_GET(cpuid)) ipi_cpu(cpu, IPI_PREEMPT); - sched_unpin(); } tdq_unlock_pair(high, low); return (moved); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r242357 - head/sys/dev/sound/pci/hda
Author: mav Date: Tue Oct 30 12:44:30 2012 New Revision: 242357 URL: http://svn.freebsd.org/changeset/base/242357 Log: Set all pins initial connection status to unknown (2) and then update it with the real value in regular way if sensing is supported. This fixes minor inconsistency when playback redirection appeared in undefined state on boot if headphones were not connected. Modified: head/sys/dev/sound/pci/hda/hdaa.c Modified: head/sys/dev/sound/pci/hda/hdaa.c == --- head/sys/dev/sound/pci/hda/hdaa.c Tue Oct 30 12:25:52 2012 (r242356) +++ head/sys/dev/sound/pci/hda/hdaa.c Tue Oct 30 12:44:30 2012 (r242357) @@ -400,7 +400,7 @@ hdaa_presence_handler(struct hdaa_widget struct hdaa_devinfo *devinfo = w-devinfo; struct hdaa_audio_as *as; uint32_t res; - int connected; + int connected, old; if (w-enable == 0 || w-type != HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX) @@ -414,19 +414,22 @@ hdaa_presence_handler(struct hdaa_widget connected = (res HDA_CMD_GET_PIN_SENSE_PRESENCE_DETECT) != 0; if (devinfo-quirks HDAA_QUIRK_SENSEINV) connected = !connected; - if (connected == w-wclass.pin.connected) + old = w-wclass.pin.connected; + if (connected == old) return; w-wclass.pin.connected = connected; HDA_BOOTVERBOSE( - device_printf(devinfo-dev, - Pin sense: nid=%d sence=0x%08x (%sconnected)\n, - w-nid, res, !w-wclass.pin.connected ? dis : ); + if (connected || old != 2) { + device_printf(devinfo-dev, + Pin sense: nid=%d sence=0x%08x (%sconnected)\n, + w-nid, res, !connected ? dis : ); + } ); as = devinfo-as[w-bindas]; if (as-hpredir = 0 as-pins[15] == w-nid) hdaa_hpredir_handler(w); - if (as-dir == HDAA_CTL_IN) + if (as-dir == HDAA_CTL_IN old != 2) hdaa_autorecsrc_handler(as, w); } @@ -1151,6 +1154,7 @@ hdaa_widget_parse(struct hdaa_widget *w) HDA_CMD_GET_PARAMETER(0, w-nid, HDA_PARAM_PIN_CAP)); w-wclass.pin.ctrl = hda_command(dev, HDA_CMD_GET_PIN_WIDGET_CTRL(0, nid)); + w-wclass.pin.connected = 2; if (HDA_PARAM_PIN_CAP_EAPD_CAP(w-wclass.pin.cap)) { w-param.eapdbtl = hda_command(dev, HDA_CMD_GET_EAPD_BTL_ENABLE(0, nid)); @@ -1238,10 +1242,6 @@ hdaa_widget_postprocess(struct hdaa_widg } strlcat(w-name, HDA_CONNS[conn], sizeof(w-name)); strlcat(w-name, ), sizeof(w-name)); - - if (HDA_PARAM_PIN_CAP_PRESENCE_DETECT_CAP(w-wclass.pin.cap) == 0 || - (HDA_CONFIG_DEFAULTCONF_MISC(w-wclass.pin.config) 1) != 0) - w-wclass.pin.connected = 2; } } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r242358 - head/sys/cam/ctl
Author: trasz Date: Tue Oct 30 12:52:41 2012 New Revision: 242358 URL: http://svn.freebsd.org/changeset/base/242358 Log: Use M_ZERO instead of explicit memsets and bzeros. Modified: head/sys/cam/ctl/ctl.c head/sys/cam/ctl/ctl_backend_block.c Modified: head/sys/cam/ctl/ctl.c == --- head/sys/cam/ctl/ctl.c Tue Oct 30 12:44:30 2012(r242357) +++ head/sys/cam/ctl/ctl.c Tue Oct 30 12:52:41 2012(r242358) @@ -957,11 +957,10 @@ ctl_init(void) if (ctl_disable != 0) return; - control_softc = malloc(sizeof(*control_softc), M_DEVBUF, M_WAITOK); + control_softc = malloc(sizeof(*control_softc), M_DEVBUF, + M_WAITOK | M_ZERO); softc = control_softc; - memset(softc, 0, sizeof(*softc)); - softc-dev = make_dev(ctl_cdevsw, 0, UID_ROOT, GID_OPERATOR, 0600, cam/ctl); @@ -3271,14 +3270,13 @@ ctl_pool_create(struct ctl_softc *ctl_so retval = 0; - pool = (struct ctl_io_pool *)malloc(sizeof(*pool), M_CTL, M_NOWAIT); + pool = (struct ctl_io_pool *)malloc(sizeof(*pool), M_CTL, + M_NOWAIT | M_ZERO); if (pool == NULL) { retval = -ENOMEM; goto bailout; } - memset(pool, 0, sizeof(*pool)); - pool-type = pool_type; pool-ctl_softc = ctl_softc; @@ -6561,7 +6559,7 @@ ctl_mode_sense(struct ctl_scsiio *ctsio) header_len, page_len, total_len); #endif - ctsio-kern_data_ptr = malloc(total_len, M_CTL, M_WAITOK); + ctsio-kern_data_ptr = malloc(total_len, M_CTL, M_WAITOK | M_ZERO); ctsio-kern_sg_entries = 0; ctsio-kern_data_resid = 0; ctsio-kern_rel_offset = 0; @@ -6574,7 +6572,6 @@ ctl_mode_sense(struct ctl_scsiio *ctsio) ctsio-kern_data_len = alloc_len; ctsio-kern_total_len = alloc_len; } - memset(ctsio-kern_data_ptr, 0, total_len); switch (ctsio-cdb[0]) { case MODE_SENSE_6: { @@ -6742,7 +6739,7 @@ ctl_read_capacity(struct ctl_scsiio *cts lun = (struct ctl_lun *)ctsio-io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - ctsio-kern_data_ptr = malloc(sizeof(*data), M_CTL, M_WAITOK); + ctsio-kern_data_ptr = malloc(sizeof(*data), M_CTL, M_WAITOK | M_ZERO); data = (struct scsi_read_capacity_data *)ctsio-kern_data_ptr; ctsio-residual = 0; ctsio-kern_data_len = sizeof(*data); @@ -6751,8 +6748,6 @@ ctl_read_capacity(struct ctl_scsiio *cts ctsio-kern_rel_offset = 0; ctsio-kern_sg_entries = 0; - memset(data, 0, sizeof(*data)); - /* * If the maximum LBA is greater than 0xfffe, the user must * issue a SERVICE ACTION IN (16) command, with the read capacity @@ -6806,7 +6801,7 @@ ctl_read_capacity_16(struct ctl_scsiio * lun = (struct ctl_lun *)ctsio-io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - ctsio-kern_data_ptr = malloc(sizeof(*data), M_CTL, M_WAITOK); + ctsio-kern_data_ptr = malloc(sizeof(*data), M_CTL, M_WAITOK | M_ZERO); data = (struct scsi_read_capacity_data_long *)ctsio-kern_data_ptr; if (sizeof(*data) alloc_len) { @@ -6822,8 +6817,6 @@ ctl_read_capacity_16(struct ctl_scsiio * ctsio-kern_rel_offset = 0; ctsio-kern_sg_entries = 0; - memset(data, 0, sizeof(*data)); - scsi_u64to8b(lun-be_lun-maxlba, data-addr); /* XXX KDM this may not be 512 bytes... */ scsi_ulto4b(lun-be_lun-blocksize, data-length); @@ -6913,8 +6906,7 @@ ctl_maintenance_in(struct ctl_scsiio *ct alloc_len = scsi_4btoul(cdb-length); - ctsio-kern_data_ptr = malloc(total_len, M_CTL, M_WAITOK); - memset(ctsio-kern_data_ptr, 0, total_len); + ctsio-kern_data_ptr = malloc(total_len, M_CTL, M_WAITOK | M_ZERO); ctsio-kern_sg_entries = 0; @@ -7068,7 +7060,7 @@ retry: } mtx_unlock(softc-ctl_lock); - ctsio-kern_data_ptr = malloc(total_len, M_CTL, M_WAITOK); + ctsio-kern_data_ptr = malloc(total_len, M_CTL, M_WAITOK | M_ZERO); if (total_len alloc_len) { ctsio-residual = alloc_len - total_len; @@ -7084,8 +7076,6 @@ retry: ctsio-kern_rel_offset = 0; ctsio-kern_sg_entries = 0; - memset(ctsio-kern_data_ptr, 0, total_len); - mtx_lock(softc-ctl_lock); switch (cdb-action) { case SPRI_RK: { // read keys @@ -8611,7 +8601,7 @@ ctl_report_luns(struct ctl_scsiio *ctsio lun_datalen = sizeof(*lun_data) + (num_luns * sizeof(struct scsi_report_luns_lundata)); - ctsio-kern_data_ptr = malloc(lun_datalen, M_CTL, M_WAITOK); + ctsio-kern_data_ptr = malloc(lun_datalen, M_CTL, M_WAITOK | M_ZERO); lun_data = (struct scsi_report_luns_data *)ctsio-kern_data_ptr;
svn commit: r242359 - head/share/man/man9
Author: trasz Date: Tue Oct 30 13:05:50 2012 New Revision: 242359 URL: http://svn.freebsd.org/changeset/base/242359 Log: Document disk_resize(9). Modified: head/share/man/man9/Makefile head/share/man/man9/disk.9 Modified: head/share/man/man9/Makefile == --- head/share/man/man9/MakefileTue Oct 30 12:52:41 2012 (r242358) +++ head/share/man/man9/MakefileTue Oct 30 13:05:50 2012 (r242359) @@ -614,7 +614,8 @@ MLINKS+=devstat.9 devicestat.9 \ MLINKS+=disk.9 disk_alloc.9 \ disk.9 disk_create.9 \ disk.9 disk_destroy.9 \ - disk.9 disk_gone.9 + disk.9 disk_gone.9 \ + disk.9 disk_resize.9 MLINKS+=domain.9 DOMAIN_SET.9 \ domain.9 domain_add.9 \ domain.9 pfctlinput.9 \ Modified: head/share/man/man9/disk.9 == --- head/share/man/man9/disk.9 Tue Oct 30 12:52:41 2012(r242358) +++ head/share/man/man9/disk.9 Tue Oct 30 13:05:50 2012(r242359) @@ -27,7 +27,7 @@ .\ .\ $FreeBSD$ .\ -.Dd February 18, 2004 +.Dd October 30, 2012 .Dt DISK 9 .Os .Sh NAME @@ -43,6 +43,8 @@ .Fn disk_gone struct disk *disk .Ft void .Fn disk_destroy struct disk *disk +.Ft int +.Fn disk_resize struct disk *disk int flags .Sh DESCRIPTION The disk storage API permits kernel device drivers providing access to disk-like storage devices to advertise the device to other kernel @@ -67,6 +69,13 @@ function, fill in the fields and call .Fn disk_create when the device is ready to service requests. +.Fn disk_resize +can be called by the driver after modifying +.Va d_mediasize +to notify GEOM about the disk capacity change. +The +.Fa flags +field should be set to either M_WAITOK, or M_NOWAIT. .Fn disk_gone orphans all of the providers associated with the drive, setting an error condition of ENXIO in each one. ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r242360 - in head/sys: conf dev/bce
Author: zont Date: Tue Oct 30 13:22:39 2012 New Revision: 242360 URL: http://svn.freebsd.org/changeset/base/242360 Log: - Remove BCE_JUMBO_HDRSPLIT kernel option which was forgotten in r218423. Approved by: davidch Approved by: kib (mentor) Modified: head/sys/conf/NOTES head/sys/conf/options head/sys/dev/bce/if_bcereg.h Modified: head/sys/conf/NOTES == --- head/sys/conf/NOTES Tue Oct 30 13:05:50 2012(r242359) +++ head/sys/conf/NOTES Tue Oct 30 13:22:39 2012(r242360) @@ -2142,12 +2142,6 @@ device ral # Ralink Technology RT2500 # This option requires the TI_SF_BUF_JUMBO option above. #options TI_JUMBO_HDRSPLIT -# -# Use header splitting feature on bce(4) adapters. -# This may help to reduce the amount of jumbo-sized memory buffers used. -# -optionsBCE_JUMBO_HDRSPLIT - # These two options allow manipulating the mbuf cluster size and mbuf size, # respectively. Be very careful with NIC driver modules when changing # these from their default values, because that can potentially cause a Modified: head/sys/conf/options == --- head/sys/conf/options Tue Oct 30 13:05:50 2012(r242359) +++ head/sys/conf/options Tue Oct 30 13:22:39 2012(r242360) @@ -523,7 +523,6 @@ SOCKET_SEND_COW opt_zero.h SOCKET_RECV_PFLIP opt_zero.h TI_SF_BUF_JUMBOopt_ti.h TI_JUMBO_HDRSPLIT opt_ti.h -BCE_JUMBO_HDRSPLIT opt_bce.h # XXX Conflict: # of devices vs network protocol (Native ATM). # This makes atm.h unusable. Modified: head/sys/dev/bce/if_bcereg.h == --- head/sys/dev/bce/if_bcereg.hTue Oct 30 13:05:50 2012 (r242359) +++ head/sys/dev/bce/if_bcereg.hTue Oct 30 13:22:39 2012 (r242360) @@ -289,7 +289,6 @@ * * #define BCE_DEBUG * #define BCE_NVRAM_WRITE_SUPPORT - * #define BCE_JUMBO_HDRSPLIT */ // ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r242361 - in head/sys: dev/hwpmc kern
Author: attilio Date: Tue Oct 30 15:10:50 2012 New Revision: 242361 URL: http://svn.freebsd.org/changeset/base/242361 Log: Fixup r240246: hwpmc needs to retain the pinning until ASTs are not executed. This means past the point where userret() is generally executed. Skip the td_pinned check if a callchain tracing is currently happening and add a more robust check to pmc_capture_user_callchain() in order to catch td_pinned leak past ast() in hwpmc case. Reported and tested by: fabient MFC after:1 week X-MFC:r240246 Modified: head/sys/dev/hwpmc/hwpmc_mod.c head/sys/kern/subr_trap.c Modified: head/sys/dev/hwpmc/hwpmc_mod.c == --- head/sys/dev/hwpmc/hwpmc_mod.c Tue Oct 30 13:22:39 2012 (r242360) +++ head/sys/dev/hwpmc/hwpmc_mod.c Tue Oct 30 15:10:50 2012 (r242361) @@ -4248,7 +4248,7 @@ pmc_capture_user_callchain(int cpu, int ([pmc,%d] cpu %d didn't find a sample to collect, __LINE__, cpu)); - KASSERT(td-td_pinned 0, + KASSERT(td-td_pinned == 1, ([pmc,%d] invalid td_pinned value, __LINE__)); sched_unpin(); /* Can migrate safely now. */ Modified: head/sys/kern/subr_trap.c == --- head/sys/kern/subr_trap.c Tue Oct 30 13:22:39 2012(r242360) +++ head/sys/kern/subr_trap.c Tue Oct 30 15:10:50 2012(r242361) @@ -145,6 +145,11 @@ userret(struct thread *td, struct trapfr /* * Check for misbehavior. +* +* In case there is a callchain tracing ongoing because of +* hwpmc(4), skip the scheduler pinning check. +* hwpmc(4) subsystem, infact, will collect callchain informations +* at ast() checkpoint, which is past userret(). */ WITNESS_WARN(WARN_PANIC, NULL, userret: returning); KASSERT(td-td_critnest == 0, @@ -155,7 +160,7 @@ userret(struct thread *td, struct trapfr (userret: Returning with pagefaults disabled)); KASSERT((td-td_pflags TDP_NOSLEEPING) == 0, (userret: Returning with sleep disabled)); - KASSERT(td-td_pinned == 0, + KASSERT(td-td_pinned == 0 || (td-td_pflags TDP_CALLCHAIN) != 0, (userret: Returning with with pinned thread)); KASSERT(td-td_vp_reserv == 0, (userret: Returning while holding vnode reservation)); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r242362 - head/sys/arm/ti/omap4
Author: cognet Date: Tue Oct 30 15:25:01 2012 New Revision: 242362 URL: http://svn.freebsd.org/changeset/base/242362 Log: Fix SMP build for omap4 Submitted by: Giovanni Trematerra gianni at freebsd DOT org Modified: head/sys/arm/ti/omap4/omap4_mp.c Modified: head/sys/arm/ti/omap4/omap4_mp.c == --- head/sys/arm/ti/omap4/omap4_mp.cTue Oct 30 15:10:50 2012 (r242361) +++ head/sys/arm/ti/omap4/omap4_mp.cTue Oct 30 15:25:01 2012 (r242362) @@ -75,7 +75,7 @@ platform_mp_start_ap(void) cpu_idcache_wbinv_all(); cpu_l2cache_wbinv_all(); ti_smc0(0x200, 0xfdff, MODIFY_AUX_CORE_0); - ti_smc0(pmap_kextract(mpentry), 0, WRITE_AUX_CORE_1); + ti_smc0(pmap_kextract((vm_offset_t)mpentry), 0, WRITE_AUX_CORE_1); armv7_sev(); bus_space_unmap(fdtbus_bs_tag, scu_addr, 0x1000); } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r242372 - head/libexec/atrun
Author: mjg Date: Tue Oct 30 19:46:00 2012 New Revision: 242372 URL: http://svn.freebsd.org/changeset/base/242372 Log: atrun(8): scale default load average limit with the number of CPUs Previously atrun refused to run jobs if load average was not below fixed limit of 1.5. PR: 173175 Reviewed by: peterj Approved by: trasz (mentor) MFC after:2 weeks Modified: head/libexec/atrun/atrun.c head/libexec/atrun/atrun.man Modified: head/libexec/atrun/atrun.c == --- head/libexec/atrun/atrun.c Tue Oct 30 19:34:45 2012(r242371) +++ head/libexec/atrun/atrun.c Tue Oct 30 19:46:00 2012(r242372) @@ -33,6 +33,9 @@ static const char rcsid[] = #include sys/fcntl.h #include sys/types.h #include sys/stat.h +#ifdef __FreeBSD__ +#include sys/sysctl.h +#endif #include sys/wait.h #include sys/param.h #include ctype.h @@ -454,7 +457,12 @@ main(int argc, char *argv[]) gid_t batch_gid; int c; int run_batch; +#ifdef __FreeBSD__ +size_t ncpu, ncpusz; +double load_avg = -1; +#else double load_avg = LOADAVG_MX; +#endif /* We don't need root privileges all the time; running under uid and gid daemon * is fine. @@ -472,8 +480,10 @@ main(int argc, char *argv[]) case 'l': if (sscanf(optarg, %lf, load_avg) != 1) perr(garbled option -l); +#ifndef __FreeBSD__ if (load_avg = 0.) load_avg = LOADAVG_MX; +#endif break; case 'd': @@ -489,6 +499,15 @@ main(int argc, char *argv[]) if (chdir(ATJOB_DIR) != 0) perr(cannot change to %s, ATJOB_DIR); +#ifdef __FreeBSD__ +if (load_avg = 0.) { + ncpusz = sizeof(size_t); + if (sysctlbyname(hw.ncpu, ncpu, ncpusz, NULL, 0) 0) + ncpu = 1; + load_avg = LOADAVG_MX * ncpu; +} +#endif + /* Main loop. Open spool directory for reading and look over all the * files in there. If the filename indicates that the job should be run * and the x bit is set, fork off a child which sets its user and group Modified: head/libexec/atrun/atrun.man == --- head/libexec/atrun/atrun.manTue Oct 30 19:34:45 2012 (r242371) +++ head/libexec/atrun/atrun.manTue Oct 30 19:46:00 2012 (r242372) @@ -1,5 +1,5 @@ .\ $FreeBSD$ -.Dd June 17, 2007 +.Dd October 30, 2012 .Dt ATRUN 8 .Os .Sh NAME @@ -45,7 +45,7 @@ e.g., locked out or expired. .Bl -tag -width indent .It Fl l Ar load_avg Specify a limiting load factor, over which batch jobs should -not be run, instead of the compiled in default of 1.5. +not be run, instead of the default of 1.5 * number of active CPUs. .It Fl d Debug; print error messages to standard error instead of using .Xr syslog 3 . ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r242378 - head/usr.bin/ktrdump
Author: np Date: Tue Oct 30 21:10:06 2012 New Revision: 242378 URL: http://svn.freebsd.org/changeset/base/242378 Log: Catch up with r238925. ktr_entries may not be a power of 2. Modified: head/usr.bin/ktrdump/ktrdump.c Modified: head/usr.bin/ktrdump/ktrdump.c == --- head/usr.bin/ktrdump/ktrdump.c Tue Oct 30 21:05:06 2012 (r242377) +++ head/usr.bin/ktrdump/ktrdump.c Tue Oct 30 21:10:06 2012 (r242378) @@ -218,7 +218,7 @@ main(int ac, char **av) * Now tear through the trace buffer. */ if (!iflag) - i = (index - 1) (entries - 1); + i = (index - 1) % entries; tlast = -1; for (;;) { if (buf[i].ktr_desc == NULL) @@ -286,7 +286,7 @@ next: if ((c = *p++) == '\0') if (!iflag) { if (i == index) break; - i = (i - 1) (entries - 1); + i = (i - 1) % entries; } else { if (++i == entries) break; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r242380 - head/contrib/llvm/lib/Target/X86
Author: dim Date: Tue Oct 30 22:09:53 2012 New Revision: 242380 URL: http://svn.freebsd.org/changeset/base/242380 Log: Pull in r165377 from upstream llvm trunk: X86: fcmov doesn't handle all possible EFLAGS, fall back to a branch for the others. Otherwise it will try to use SSE patterns and fail horribly if sse is disabled. Fixes PR14035. This should fix the following assertion failure: Assertion failed: (Reg = X86::FP0 Reg = X86::FP6 Expected FP register!), function getFPReg, file contrib/llvm/lib/Target/X86/X86FloatingPoint.cpp, line 330. which can show up when compiling contrib/compiler-rt, using -march=i686 through -march=pentium3 (CPU's which do support fcmov, but don't support SSE2). MFC after:1 week Modified: head/contrib/llvm/lib/Target/X86/X86InstrCompiler.td Modified: head/contrib/llvm/lib/Target/X86/X86InstrCompiler.td == --- head/contrib/llvm/lib/Target/X86/X86InstrCompiler.tdTue Oct 30 21:32:10 2012(r242379) +++ head/contrib/llvm/lib/Target/X86/X86InstrCompiler.tdTue Oct 30 22:09:53 2012(r242380) @@ -453,6 +453,11 @@ def CMOV_GR16 : I0, Pseudo, #CMOV_GR16* PSEUDO!, [(set GR16:$dst, (X86cmov GR16:$src1, GR16:$src2, imm:$cond, EFLAGS))]; +} // Predicates = [NoCMov] + +// fcmov doesn't handle all possible EFLAGS, provide a fallback if there is no +// SSE1. +let Predicates = [FPStackf32] in def CMOV_RFP32 : I0, Pseudo, (outs RFP32:$dst), (ins RFP32:$src1, RFP32:$src2, i8imm:$cond), @@ -460,6 +465,9 @@ def CMOV_RFP32 : I0, Pseudo, [(set RFP32:$dst, (X86cmov RFP32:$src1, RFP32:$src2, imm:$cond, EFLAGS))]; +// fcmov doesn't handle all possible EFLAGS, provide a fallback if there is no +// SSE2. +let Predicates = [FPStackf64] in def CMOV_RFP64 : I0, Pseudo, (outs RFP64:$dst), (ins RFP64:$src1, RFP64:$src2, i8imm:$cond), @@ -474,7 +482,6 @@ def CMOV_RFP80 : I0, Pseudo, [(set RFP80:$dst, (X86cmov RFP80:$src1, RFP80:$src2, imm:$cond, EFLAGS))]; -} // Predicates = [NoCMov] } // UsesCustomInserter = 1, Uses = [EFLAGS] ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r242381 - head/lib/libutil
Author: bapt Date: Tue Oct 30 22:18:08 2012 New Revision: 242381 URL: http://svn.freebsd.org/changeset/base/242381 Log: Document the pw_util(3) functions Reviewed by: des, gjb Added: head/lib/libutil/pw_util.3 (contents, props changed) Modified: head/lib/libutil/Makefile Modified: head/lib/libutil/Makefile == --- head/lib/libutil/Makefile Tue Oct 30 22:09:53 2012(r242380) +++ head/lib/libutil/Makefile Tue Oct 30 22:18:08 2012(r242381) @@ -30,7 +30,7 @@ MAN+= expand_number.3 flopen.3 fparseln. kinfo_getproc.3 kinfo_getvmmap.3 kld.3 login_auth.3 login_cap.3 \ login_class.3 login_ok.3 login_times.3 login_tty.3 pidfile.3 \ property.3 pty.3 quotafile.3 realhostname.3 realhostname_sa.3 \ - _secure_path.3 trimdomain.3 uucplock.3 + _secure_path.3 trimdomain.3 uucplock.3 pw_util.3 MAN+= login.conf.5 MLINKS+= kld.3 kld_isloaded.3 kld.3 kld_load.3 MLINKS+=login_auth.3 auth_cat.3 login_auth.3 auth_checknologin.3 @@ -67,5 +67,18 @@ MLINKS+=quotafile.3 quota_close.3 \ quotafile.3 quota_write_usage.3 MLINKS+=uucplock.3 uu_lock.3 uucplock.3 uu_lock_txfr.3 \ uucplock.3 uu_lockerr.3 uucplock.3 uu_unlock.3 +MLINKS+=pw_util.3 pw_copy.3 \ + pw_util.3 pw_dup.3 \ + pw_util.3 pw_edit.3 \ + pw_util.3 pw_equal.3 \ + pw_util.3 pw_fini.3 \ + pw_util.3 pw_init.3 \ + pw_util.3 pw_make.3 \ + pw_util.3 pw_make_v7.3 \ + pw_util.3 pw_mkdb.3 \ + pw_util.3 pw_lock.3 \ + pw_util.3 pw_scan.3 \ + pw_util.3 pw_tempname.3 \ + pw_util.3 pw_tmp.3 .include bsd.lib.mk Added: head/lib/libutil/pw_util.3 == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libutil/pw_util.3 Tue Oct 30 22:18:08 2012(r242381) @@ -0,0 +1,285 @@ +.\ Copyright (c) 2012 Baptiste Daroussin b...@freebsd.org +.\ All rights reserved. +.\ +.\ This software was developed by Pawel Jakub Dawidek under sponsorship from +.\ the FreeBSD Foundation. +.\ +.\ 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. +.\ +.\ THIS SOFTWARE IS PROVIDED BY THE AUTHORS 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 AUTHORS 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. +.\ +.\ $FreeBSD$ +.\ +.Dd October 30, 2012 +.Dt PW_UTIL 3 +.Os +.Sh NAME +.Nm pw_copy , +.Nm pw_dup , +.Nm pw_edit , +.Nm pw_equal , +.Nm pw_fini , +.Nm pw_init , +.Nm pw_make , +.Nm pw_make_v7 , +.Nm pw_mkdb , +.Nm pw_lock , +.Nm pw_scan , +.Nm pw_tempname , +.Nm pw_tmp +.Nd functions for passwd file handling +.Sh LIBRARY +.Lb libutil +.Sh SYNOPSIS +.In pwd.h +.In libutil.h +.Ft int +.Fn pw_copy int ffd int tfd const struct passwd *pw const struct paddwd *oldpw +.Ft struct passwd * +.Fn pw_dup const struct passwd *pw +.Ft int +.Fn pw_edit int nosetuid +.Ft int +.Fn pw_equal const struct passwd *pw1 const struct passwd pw2 +.Ft void +.Fn pw_fini void +.Ft int +.Fn pw_init const char *dir const char *master +.Ft char * +.Fn pw_make const struct passwd *pw +.Ft char * +.Fn pw_make_v7 const struct passwd *pw +.Ft int +.Fn pw_mkdb const char *user +.Ft int +.Fn pw_lock void +.Ft struct passwd * +.Fn pw_scan const char *line int flags +.Ft const char * +.Fn pw_tempname void +.Ft int +.Fn pw_tmp int mfd +.Sh DESCRIPTION +.Pp +The +.Fn pw_copy +function reads a password file from +.Vt ffd +and writes it back out to +.Vt tfd +possibly with modifications: +.Bl -dash +.It +If +.Fa pw +is +.Dv NULL +and +.Fa oldpw +is not +.Dv NULL , +then the record represented by +.Fa oldpw +will not be copied (corresponding to user deletion). +.It +If +.Fa pw +and +.Fa oldpw +are not +.Dv NULL +then the record corresponding to +.Fa pw +will be replace by the record corresponding to +.Fa oldpw . +.It +If +.Vt pw +is set and
svn commit: r242382 - head/lib/libutil
Author: bapt Date: Tue Oct 30 22:26:19 2012 New Revision: 242382 URL: http://svn.freebsd.org/changeset/base/242382 Log: Removed unnecessary bits in the header that shows where I stole the template Modified: head/lib/libutil/pw_util.3 Modified: head/lib/libutil/pw_util.3 == --- head/lib/libutil/pw_util.3 Tue Oct 30 22:18:08 2012(r242381) +++ head/lib/libutil/pw_util.3 Tue Oct 30 22:26:19 2012(r242382) @@ -1,9 +1,6 @@ .\ Copyright (c) 2012 Baptiste Daroussin b...@freebsd.org .\ All rights reserved. .\ -.\ This software was developed by Pawel Jakub Dawidek under sponsorship from -.\ the FreeBSD Foundation. -.\ .\ Redistribution and use in source and binary forms, with or without .\ modification, are permitted provided that the following conditions .\ are met: ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r242383 - head/lib/libutil
Author: joel (doc committer) Date: Tue Oct 30 22:30:30 2012 New Revision: 242383 URL: http://svn.freebsd.org/changeset/base/242383 Log: Minor mdoc and language fixes. Modified: head/lib/libutil/pw_util.3 Modified: head/lib/libutil/pw_util.3 == --- head/lib/libutil/pw_util.3 Tue Oct 30 22:26:19 2012(r242382) +++ head/lib/libutil/pw_util.3 Tue Oct 30 22:30:30 2012(r242383) @@ -74,7 +74,6 @@ .Ft int .Fn pw_tmp int mfd .Sh DESCRIPTION -.Pp The .Fn pw_copy function reads a password file from @@ -104,7 +103,7 @@ are not .Dv NULL then the record corresponding to .Fa pw -will be replace by the record corresponding to +will be replaced by the record corresponding to .Fa oldpw . .It If @@ -171,7 +170,7 @@ function destroy the temporary file crea if any, kills any running instance of .Ev EDITOR -excuted by +executed by .Fn pw_edit if any, and closes the lock created by ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r242384 - head/sys/fs/smbfs
Author: davide Date: Wed Oct 31 02:54:44 2012 New Revision: 242384 URL: http://svn.freebsd.org/changeset/base/242384 Log: Change the code to use %jd as printf() placeholder for uio_offset and cast to intmax_t. Suggested by: pjd Sponsored by: iXsystems inc. Modified: head/sys/fs/smbfs/smbfs_io.c head/sys/fs/smbfs/smbfs_vnops.c Modified: head/sys/fs/smbfs/smbfs_io.c == --- head/sys/fs/smbfs/smbfs_io.cTue Oct 30 22:30:30 2012 (r242383) +++ head/sys/fs/smbfs/smbfs_io.cWed Oct 31 02:54:44 2012 (r242384) @@ -241,7 +241,8 @@ smbfs_writevnode(struct vnode *vp, struc SMBERROR(vn types other than VREG unsupported !\n); return EIO; } - SMBVDEBUG(ofs=%d,resid=%zd\n,(int)uiop-uio_offset, uiop-uio_resid); + SMBVDEBUG(ofs=%jd,resid=%zd\n, (intmax_t)uiop-uio_offset, + uiop-uio_resid); if (uiop-uio_offset 0) return EINVAL; /* if (uiop-uio_offset + uiop-uio_resid smp-nm_maxfilesize) @@ -274,7 +275,8 @@ smbfs_writevnode(struct vnode *vp, struc smb_makescred(scred, td, cred); error = smb_write(smp-sm_share, np-n_fid, uiop, scred); - SMBVDEBUG(after: ofs=%d,resid=%zd\n,(int)uiop-uio_offset, uiop-uio_resid); + SMBVDEBUG(after: ofs=%jd,resid=%zd\n, (intmax_t)uiop-uio_offset, + uiop-uio_resid); if (!error) { if (uiop-uio_offset np-n_size) { np-n_size = uiop-uio_offset; @@ -601,7 +603,8 @@ smbfs_putpages(ap) uio.uio_segflg = UIO_SYSSPACE; uio.uio_rw = UIO_WRITE; uio.uio_td = td; - SMBVDEBUG(ofs=%d,resid=%zd\n,(int)uio.uio_offset, uio.uio_resid); + SMBVDEBUG(ofs=%jd,resid=%zd\n, (intmax_t)uio.uio_offset, + uio.uio_resid); smb_makescred(scred, td, cred); error = smb_write(smp-sm_share, np-n_fid, uio, scred); Modified: head/sys/fs/smbfs/smbfs_vnops.c == --- head/sys/fs/smbfs/smbfs_vnops.c Tue Oct 30 22:30:30 2012 (r242383) +++ head/sys/fs/smbfs/smbfs_vnops.c Wed Oct 31 02:54:44 2012 (r242384) @@ -452,7 +452,7 @@ smbfs_write(ap) struct vnode *vp = ap-a_vp; struct uio *uio = ap-a_uio; - SMBVDEBUG(%d,ofs=%d,sz=%zd\n,vp-v_type, (int)uio-uio_offset, + SMBVDEBUG(%d,ofs=%jd,sz=%zd\n,vp-v_type, (intmax_t)uio-uio_offset, uio-uio_resid); if (vp-v_type != VREG) return (EPERM); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r242386 - in head/sys: fs/smbfs netsmb
Author: davide Date: Wed Oct 31 03:34:07 2012 New Revision: 242386 URL: http://svn.freebsd.org/changeset/base/242386 Log: Fix panic due to page faults while in kernel mode, under conditions of VM pressure. The reason is that in some codepaths pointers to stack variables were passed from one thread to another. In collaboration with:pho Reported by: pho's stress2 suite Sponsored by: iXsystems inc. Modified: head/sys/fs/smbfs/smbfs_io.c head/sys/fs/smbfs/smbfs_node.c head/sys/fs/smbfs/smbfs_smb.c head/sys/fs/smbfs/smbfs_subr.c head/sys/fs/smbfs/smbfs_subr.h head/sys/fs/smbfs/smbfs_vfsops.c head/sys/fs/smbfs/smbfs_vnops.c head/sys/netsmb/smb_conn.c head/sys/netsmb/smb_dev.c head/sys/netsmb/smb_trantcp.c head/sys/netsmb/smb_usr.c Modified: head/sys/fs/smbfs/smbfs_io.c == --- head/sys/fs/smbfs/smbfs_io.cWed Oct 31 03:29:52 2012 (r242385) +++ head/sys/fs/smbfs/smbfs_io.cWed Oct 31 03:34:07 2012 (r242386) @@ -75,7 +75,7 @@ smbfs_readvdir(struct vnode *vp, struct { struct dirent de; struct componentname cn; - struct smb_cred scred; + struct smb_cred *scred; struct smbfs_fctx *ctx; struct vnode *newvp; struct smbnode *np = VTOSMB(vp); @@ -84,11 +84,14 @@ smbfs_readvdir(struct vnode *vp, struct np = VTOSMB(vp); SMBVDEBUG(dirname='%s'\n, np-n_name); - smb_makescred(scred, uio-uio_td, cred); + scred = smbfs_malloc_scred(); + smb_makescred(scred, uio-uio_td, cred); offset = uio-uio_offset / DE_SIZE; /* offset in the directory */ limit = uio-uio_resid / DE_SIZE; - if (uio-uio_resid DE_SIZE || uio-uio_offset 0) - return EINVAL; + if (uio-uio_resid DE_SIZE || uio-uio_offset 0) { + error = EINVAL; + goto out; + } while (limit offset 2) { limit--; bzero((caddr_t)de, DE_SIZE); @@ -104,40 +107,43 @@ smbfs_readvdir(struct vnode *vp, struct de.d_type = DT_DIR; error = uiomove(de, DE_SIZE, uio); if (error) - return error; + goto out; offset++; uio-uio_offset += DE_SIZE; } - if (limit == 0) - return 0; + if (limit == 0) { + error = 0; + goto out; + } if (offset != np-n_dirofs || np-n_dirseq == NULL) { SMBVDEBUG(Reopening search %ld:%ld\n, offset, np-n_dirofs); if (np-n_dirseq) { - smbfs_findclose(np-n_dirseq, scred); + smbfs_findclose(np-n_dirseq, scred); np-n_dirseq = NULL; } np-n_dirofs = 2; error = smbfs_findopen(np, *, 1, SMB_FA_SYSTEM | SMB_FA_HIDDEN | SMB_FA_DIR, - scred, ctx); + scred, ctx); if (error) { SMBVDEBUG(can not open search, error = %d, error); - return error; + goto out; } np-n_dirseq = ctx; } else ctx = np-n_dirseq; while (np-n_dirofs offset) { - error = smbfs_findnext(ctx, offset - np-n_dirofs++, scred); + error = smbfs_findnext(ctx, offset - np-n_dirofs++, scred); if (error) { - smbfs_findclose(np-n_dirseq, scred); + smbfs_findclose(np-n_dirseq, scred); np-n_dirseq = NULL; - return error == ENOENT ? 0 : error; + error = ENOENT ? 0 : error; + goto out; } } error = 0; for (; limit; limit--, offset++) { - error = smbfs_findnext(ctx, limit, scred); + error = smbfs_findnext(ctx, limit, scred); if (error) break; np-n_dirofs++; @@ -165,6 +171,8 @@ smbfs_readvdir(struct vnode *vp, struct if (error == ENOENT) error = 0; uio-uio_offset = offset * DE_SIZE; +out: + smbfs_free_scred(scred); return error; } @@ -175,7 +183,7 @@ smbfs_readvnode(struct vnode *vp, struct struct smbnode *np = VTOSMB(vp); struct thread *td; struct vattr vattr; - struct smb_cred scred; + struct smb_cred *scred; int error, lks; /* @@ -223,8 +231,11 @@ smbfs_readvnode(struct vnode *vp, struct np-n_mtime.tv_sec = vattr.va_mtime.tv_sec; } } - smb_makescred(scred, td, cred); - return smb_read(smp-sm_share, np-n_fid, uiop, scred); + scred = smbfs_malloc_scred(); +
svn commit: r242387 - head/sys/fs/smbfs
Author: davide Date: Wed Oct 31 03:55:33 2012 New Revision: 242387 URL: http://svn.freebsd.org/changeset/base/242387 Log: - Do not put in the mntqueue half-constructed vnodes. - Change the code so that it relies on vfs_hash rather than on a home-made hashtable. - There's no need to inline fnv_32_buf(). Reviewed by: delphij Tested by:pho Sponsored by: iXsystems inc. Modified: head/sys/fs/smbfs/smbfs.h head/sys/fs/smbfs/smbfs_node.c head/sys/fs/smbfs/smbfs_node.h head/sys/fs/smbfs/smbfs_vfsops.c Modified: head/sys/fs/smbfs/smbfs.h == --- head/sys/fs/smbfs/smbfs.h Wed Oct 31 03:34:07 2012(r242386) +++ head/sys/fs/smbfs/smbfs.h Wed Oct 31 03:55:33 2012(r242387) @@ -82,9 +82,6 @@ struct smbmount { /* struct simplelock sm_npslock;*/ struct smbnode *sm_npstack[SMBFS_MAXPATHCOMP]; int sm_caseopt; - struct sx sm_hashlock; - LIST_HEAD(smbnode_hashhead, smbnode) *sm_hash; - u_long sm_hashlen; int sm_didrele; }; Modified: head/sys/fs/smbfs/smbfs_node.c == --- head/sys/fs/smbfs/smbfs_node.c Wed Oct 31 03:34:07 2012 (r242386) +++ head/sys/fs/smbfs/smbfs_node.c Wed Oct 31 03:55:33 2012 (r242387) @@ -27,6 +27,7 @@ */ #include sys/param.h #include sys/systm.h +#include sys/fnv_hash.h #include sys/kernel.h #include sys/lock.h #include sys/malloc.h @@ -52,54 +53,15 @@ #include fs/smbfs/smbfs_node.h #include fs/smbfs/smbfs_subr.h -#defineSMBFS_NOHASH(smp, hval) ((smp)-sm_hash[(hval) (smp)-sm_hashlen]) -#definesmbfs_hash_lock(smp)sx_xlock(smp-sm_hashlock) -#definesmbfs_hash_unlock(smp) sx_xunlock(smp-sm_hashlock) - extern struct vop_vector smbfs_vnodeops; /* XXX - .h file */ static MALLOC_DEFINE(M_SMBNODE, smbufs_node, SMBFS vnode private part); static MALLOC_DEFINE(M_SMBNODENAME, smbufs_nname, SMBFS node name); -int smbfs_hashprint(struct mount *mp); - -#if 0 -#ifdef SYSCTL_DECL -SYSCTL_DECL(_vfs_smbfs); -#endif -SYSCTL_PROC(_vfs_smbfs, OID_AUTO, vnprint, CTLFLAG_WR|CTLTYPE_OPAQUE, - NULL, 0, smbfs_hashprint, S,vnlist, vnode hash); -#endif - -#defineFNV_32_PRIME ((u_int32_t) 0x01000193UL) -#defineFNV1_32_INIT ((u_int32_t) 33554467UL) - -u_int32_t +u_int32_t __inline smbfs_hash(const u_char *name, int nmlen) { - u_int32_t v; - - for (v = FNV1_32_INIT; nmlen; name++, nmlen--) { - v *= FNV_32_PRIME; - v ^= (u_int32_t)*name; - } - return v; -} - -int -smbfs_hashprint(struct mount *mp) -{ - struct smbmount *smp = VFSTOSMBFS(mp); - struct smbnode_hashhead *nhpp; - struct smbnode *np; - int i; - - for(i = 0; i = smp-sm_hashlen; i++) { - nhpp = smp-sm_hash[i]; - LIST_FOREACH(np, nhpp, n_hash) - vprint(, SMBTOV(np)); - } - return 0; + return (fnv_32_buf(name, nmlen, FNV1_32_INIT)); } static char * @@ -149,6 +111,20 @@ smbfs_name_free(u_char *name) #endif } +static int __inline +smbfs_vnode_cmp(struct vnode *vp, void *_sc) +{ + struct smbnode *np; + struct smbcmp *sc; + + np = (struct smbnode *) vp; + sc = (struct smbcmp *) _sc; + if (np-n_parent != sc-n_parent || np-n_nmlen != sc-n_nmlen || + bcmp(sc-n_name, np-n_name, sc-n_nmlen) != 0) + return 1; + return 0; +} + static int smbfs_node_alloc(struct mount *mp, struct vnode *dvp, const char *name, int nmlen, struct smbfattr *fap, struct vnode **vpp) @@ -156,12 +132,14 @@ smbfs_node_alloc(struct mount *mp, struc struct vattr vattr; struct thread *td = curthread; /* XXX */ struct smbmount *smp = VFSTOSMBFS(mp); - struct smbnode_hashhead *nhpp; - struct smbnode *np, *np2, *dnp; - struct vnode *vp; - u_long hashval; + struct smbnode *np, *dnp; + struct vnode *vp, *vp2; + struct smbcmp sc; int error; + sc.n_parent = dvp; + sc.n_nmlen = nmlen; + sc.n_name = name; *vpp = NULL; if (smp-sm_root != NULL dvp == NULL) { SMBERROR(do not allocate root vnode twice!\n); @@ -184,38 +162,33 @@ smbfs_node_alloc(struct mount *mp, struc vprint(smbfs_node_alloc: dead parent vnode, dvp); return EINVAL; } - hashval = smbfs_hash(name, nmlen); -retry: - smbfs_hash_lock(smp); -loop: - nhpp = SMBFS_NOHASH(smp, hashval); - LIST_FOREACH(np, nhpp, n_hash) { - vp = SMBTOV(np); - if (np-n_parent != dvp || - np-n_nmlen != nmlen || bcmp(name, np-n_name, nmlen) != 0) - continue; -
Re: svn commit: r242387 - head/sys/fs/smbfs
On Wed, Oct 31, 2012 at 4:55 AM, Davide Italiano dav...@freebsd.org wrote: Author: davide Date: Wed Oct 31 03:55:33 2012 New Revision: 242387 URL: http://svn.freebsd.org/changeset/base/242387 Log: - Do not put in the mntqueue half-constructed vnodes. - Change the code so that it relies on vfs_hash rather than on a home-made hashtable. - There's no need to inline fnv_32_buf(). Reviewed by: delphij Tested by:pho Sponsored by: iXsystems inc. Modified: head/sys/fs/smbfs/smbfs.h head/sys/fs/smbfs/smbfs_node.c head/sys/fs/smbfs/smbfs_node.h head/sys/fs/smbfs/smbfs_vfsops.c Modified: head/sys/fs/smbfs/smbfs.h == --- head/sys/fs/smbfs/smbfs.h Wed Oct 31 03:34:07 2012(r242386) +++ head/sys/fs/smbfs/smbfs.h Wed Oct 31 03:55:33 2012(r242387) @@ -82,9 +82,6 @@ struct smbmount { /* struct simplelock sm_npslock;*/ struct smbnode *sm_npstack[SMBFS_MAXPATHCOMP]; int sm_caseopt; - struct sx sm_hashlock; - LIST_HEAD(smbnode_hashhead, smbnode) *sm_hash; - u_long sm_hashlen; int sm_didrele; }; Modified: head/sys/fs/smbfs/smbfs_node.c == --- head/sys/fs/smbfs/smbfs_node.c Wed Oct 31 03:34:07 2012 (r242386) +++ head/sys/fs/smbfs/smbfs_node.c Wed Oct 31 03:55:33 2012 (r242387) @@ -27,6 +27,7 @@ */ #include sys/param.h #include sys/systm.h +#include sys/fnv_hash.h #include sys/kernel.h #include sys/lock.h #include sys/malloc.h @@ -52,54 +53,15 @@ #include fs/smbfs/smbfs_node.h #include fs/smbfs/smbfs_subr.h -#defineSMBFS_NOHASH(smp, hval) ((smp)-sm_hash[(hval) (smp)-sm_hashlen]) -#definesmbfs_hash_lock(smp)sx_xlock(smp-sm_hashlock) -#definesmbfs_hash_unlock(smp) sx_xunlock(smp-sm_hashlock) - extern struct vop_vector smbfs_vnodeops; /* XXX - .h file */ static MALLOC_DEFINE(M_SMBNODE, smbufs_node, SMBFS vnode private part); static MALLOC_DEFINE(M_SMBNODENAME, smbufs_nname, SMBFS node name); -int smbfs_hashprint(struct mount *mp); - -#if 0 -#ifdef SYSCTL_DECL -SYSCTL_DECL(_vfs_smbfs); -#endif -SYSCTL_PROC(_vfs_smbfs, OID_AUTO, vnprint, CTLFLAG_WR|CTLTYPE_OPAQUE, - NULL, 0, smbfs_hashprint, S,vnlist, vnode hash); -#endif - -#defineFNV_32_PRIME ((u_int32_t) 0x01000193UL) -#defineFNV1_32_INIT ((u_int32_t) 33554467UL) - -u_int32_t +u_int32_t __inline smbfs_hash(const u_char *name, int nmlen) { - u_int32_t v; - - for (v = FNV1_32_INIT; nmlen; name++, nmlen--) { - v *= FNV_32_PRIME; - v ^= (u_int32_t)*name; - } - return v; -} - -int -smbfs_hashprint(struct mount *mp) -{ - struct smbmount *smp = VFSTOSMBFS(mp); - struct smbnode_hashhead *nhpp; - struct smbnode *np; - int i; - - for(i = 0; i = smp-sm_hashlen; i++) { - nhpp = smp-sm_hash[i]; - LIST_FOREACH(np, nhpp, n_hash) - vprint(, SMBTOV(np)); - } - return 0; + return (fnv_32_buf(name, nmlen, FNV1_32_INIT)); } static char * @@ -149,6 +111,20 @@ smbfs_name_free(u_char *name) #endif } +static int __inline +smbfs_vnode_cmp(struct vnode *vp, void *_sc) +{ + struct smbnode *np; + struct smbcmp *sc; + + np = (struct smbnode *) vp; + sc = (struct smbcmp *) _sc; + if (np-n_parent != sc-n_parent || np-n_nmlen != sc-n_nmlen || + bcmp(sc-n_name, np-n_name, sc-n_nmlen) != 0) + return 1; + return 0; +} + static int smbfs_node_alloc(struct mount *mp, struct vnode *dvp, const char *name, int nmlen, struct smbfattr *fap, struct vnode **vpp) @@ -156,12 +132,14 @@ smbfs_node_alloc(struct mount *mp, struc struct vattr vattr; struct thread *td = curthread; /* XXX */ struct smbmount *smp = VFSTOSMBFS(mp); - struct smbnode_hashhead *nhpp; - struct smbnode *np, *np2, *dnp; - struct vnode *vp; - u_long hashval; + struct smbnode *np, *dnp; + struct vnode *vp, *vp2; + struct smbcmp sc; int error; + sc.n_parent = dvp; + sc.n_nmlen = nmlen; + sc.n_name = name; *vpp = NULL; if (smp-sm_root != NULL dvp == NULL) { SMBERROR(do not allocate root vnode twice!\n); @@ -184,38 +162,33 @@ smbfs_node_alloc(struct mount *mp, struc vprint(smbfs_node_alloc: dead parent vnode, dvp); return EINVAL; } - hashval = smbfs_hash(name, nmlen); -retry: - smbfs_hash_lock(smp); -loop: - nhpp = SMBFS_NOHASH(smp, hashval); - LIST_FOREACH(np, nhpp,
Re: svn commit: r242387 - head/sys/fs/smbfs
On Wed, Oct 31, 2012 at 4:57 AM, Davide Italiano dav...@freebsd.org wrote: On Wed, Oct 31, 2012 at 4:55 AM, Davide Italiano dav...@freebsd.org wrote: Author: davide Date: Wed Oct 31 03:55:33 2012 New Revision: 242387 URL: http://svn.freebsd.org/changeset/base/242387 Log: - Do not put in the mntqueue half-constructed vnodes. - Change the code so that it relies on vfs_hash rather than on a home-made hashtable. - There's no need to inline fnv_32_buf(). Reviewed by: delphij Tested by:pho Sponsored by: iXsystems inc. Modified: head/sys/fs/smbfs/smbfs.h head/sys/fs/smbfs/smbfs_node.c head/sys/fs/smbfs/smbfs_node.h head/sys/fs/smbfs/smbfs_vfsops.c Modified: head/sys/fs/smbfs/smbfs.h == --- head/sys/fs/smbfs/smbfs.h Wed Oct 31 03:34:07 2012(r242386) +++ head/sys/fs/smbfs/smbfs.h Wed Oct 31 03:55:33 2012(r242387) @@ -82,9 +82,6 @@ struct smbmount { /* struct simplelock sm_npslock;*/ struct smbnode *sm_npstack[SMBFS_MAXPATHCOMP]; int sm_caseopt; - struct sx sm_hashlock; - LIST_HEAD(smbnode_hashhead, smbnode) *sm_hash; - u_long sm_hashlen; int sm_didrele; }; Modified: head/sys/fs/smbfs/smbfs_node.c == --- head/sys/fs/smbfs/smbfs_node.c Wed Oct 31 03:34:07 2012 (r242386) +++ head/sys/fs/smbfs/smbfs_node.c Wed Oct 31 03:55:33 2012 (r242387) @@ -27,6 +27,7 @@ */ #include sys/param.h #include sys/systm.h +#include sys/fnv_hash.h #include sys/kernel.h #include sys/lock.h #include sys/malloc.h @@ -52,54 +53,15 @@ #include fs/smbfs/smbfs_node.h #include fs/smbfs/smbfs_subr.h -#defineSMBFS_NOHASH(smp, hval) ((smp)-sm_hash[(hval) (smp)-sm_hashlen]) -#definesmbfs_hash_lock(smp)sx_xlock(smp-sm_hashlock) -#definesmbfs_hash_unlock(smp) sx_xunlock(smp-sm_hashlock) - extern struct vop_vector smbfs_vnodeops; /* XXX - .h file */ static MALLOC_DEFINE(M_SMBNODE, smbufs_node, SMBFS vnode private part); static MALLOC_DEFINE(M_SMBNODENAME, smbufs_nname, SMBFS node name); -int smbfs_hashprint(struct mount *mp); - -#if 0 -#ifdef SYSCTL_DECL -SYSCTL_DECL(_vfs_smbfs); -#endif -SYSCTL_PROC(_vfs_smbfs, OID_AUTO, vnprint, CTLFLAG_WR|CTLTYPE_OPAQUE, - NULL, 0, smbfs_hashprint, S,vnlist, vnode hash); -#endif - -#defineFNV_32_PRIME ((u_int32_t) 0x01000193UL) -#defineFNV1_32_INIT ((u_int32_t) 33554467UL) - -u_int32_t +u_int32_t __inline smbfs_hash(const u_char *name, int nmlen) { - u_int32_t v; - - for (v = FNV1_32_INIT; nmlen; name++, nmlen--) { - v *= FNV_32_PRIME; - v ^= (u_int32_t)*name; - } - return v; -} - -int -smbfs_hashprint(struct mount *mp) -{ - struct smbmount *smp = VFSTOSMBFS(mp); - struct smbnode_hashhead *nhpp; - struct smbnode *np; - int i; - - for(i = 0; i = smp-sm_hashlen; i++) { - nhpp = smp-sm_hash[i]; - LIST_FOREACH(np, nhpp, n_hash) - vprint(, SMBTOV(np)); - } - return 0; + return (fnv_32_buf(name, nmlen, FNV1_32_INIT)); } static char * @@ -149,6 +111,20 @@ smbfs_name_free(u_char *name) #endif } +static int __inline +smbfs_vnode_cmp(struct vnode *vp, void *_sc) +{ + struct smbnode *np; + struct smbcmp *sc; + + np = (struct smbnode *) vp; + sc = (struct smbcmp *) _sc; + if (np-n_parent != sc-n_parent || np-n_nmlen != sc-n_nmlen || + bcmp(sc-n_name, np-n_name, sc-n_nmlen) != 0) + return 1; + return 0; +} + static int smbfs_node_alloc(struct mount *mp, struct vnode *dvp, const char *name, int nmlen, struct smbfattr *fap, struct vnode **vpp) @@ -156,12 +132,14 @@ smbfs_node_alloc(struct mount *mp, struc struct vattr vattr; struct thread *td = curthread; /* XXX */ struct smbmount *smp = VFSTOSMBFS(mp); - struct smbnode_hashhead *nhpp; - struct smbnode *np, *np2, *dnp; - struct vnode *vp; - u_long hashval; + struct smbnode *np, *dnp; + struct vnode *vp, *vp2; + struct smbcmp sc; int error; + sc.n_parent = dvp; + sc.n_nmlen = nmlen; + sc.n_name = name; *vpp = NULL; if (smp-sm_root != NULL dvp == NULL) { SMBERROR(do not allocate root vnode twice!\n); @@ -184,38 +162,33 @@ smbfs_node_alloc(struct mount *mp, struc vprint(smbfs_node_alloc: dead parent vnode, dvp); return EINVAL; } - hashval = smbfs_hash(name, nmlen); -retry: - smbfs_hash_lock(smp); -loop: -
svn commit: r242389 - head/sys/mips/cavium
Author: jmallett Date: Wed Oct 31 04:23:36 2012 New Revision: 242389 URL: http://svn.freebsd.org/changeset/base/242389 Log: If the CF physical base is 0, attach no CF devices. This fixes a warning about a 0 passed to cvmx_phys_to_ptr on systems without a CF interface, such as the RSYS4GBE. Modified: head/sys/mips/cavium/octeon_ebt3000_cf.c Modified: head/sys/mips/cavium/octeon_ebt3000_cf.c == --- head/sys/mips/cavium/octeon_ebt3000_cf.cWed Oct 31 04:07:52 2012 (r242388) +++ head/sys/mips/cavium/octeon_ebt3000_cf.cWed Oct 31 04:23:36 2012 (r242389) @@ -622,6 +622,8 @@ static void cf_identify (driver_t *drv, return; phys_base = cvmx_sysinfo_get()-compact_flash_common_base_addr; + if (phys_base == 0) + return; base_addr = cvmx_phys_to_ptr(phys_base); for (bus_region = 0; bus_region 8; bus_region++) ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r242390 - head/sys/mips/cavium/octe
Author: jmallett Date: Wed Oct 31 04:44:32 2012 New Revision: 242390 URL: http://svn.freebsd.org/changeset/base/242390 Log: Fix longstanding misprint. Modified: head/sys/mips/cavium/octe/ethernet-rx.c Modified: head/sys/mips/cavium/octe/ethernet-rx.c == --- head/sys/mips/cavium/octe/ethernet-rx.c Wed Oct 31 04:23:36 2012 (r242389) +++ head/sys/mips/cavium/octe/ethernet-rx.c Wed Oct 31 04:44:32 2012 (r242390) @@ -317,7 +317,7 @@ void cvm_oct_tasklet_rx(void *context, i } else { /* Drop any packet received for a device that doesn't exist */ - DEBUGPRINT(Port %d not controlled by Linux, packet dropped\n, work-word1.cn38xx.ipprt); + DEBUGPRINT(Port %d not controlled by FreeBSD, packet dropped\n, work-word1.cn38xx.ipprt); m_freem(m); } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org