From owner-svn-src-head@FreeBSD.ORG Sun Oct 24 01:05:10 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AC43A1065674; Sun, 24 Oct 2010 01:05:10 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9AF3D8FC17; Sun, 24 Oct 2010 01:05:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9O15A18007323; Sun, 24 Oct 2010 01:05:10 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9O15Am1007321; Sun, 24 Oct 2010 01:05:10 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201010240105.o9O15Am1007321@svn.freebsd.org> From: Ed Maste Date: Sun, 24 Oct 2010 01:05:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214256 - head/lib/libfetch X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Oct 2010 01:05:10 -0000 Author: emaste Date: Sun Oct 24 01:05:10 2010 New Revision: 214256 URL: http://svn.freebsd.org/changeset/base/214256 Log: Move variable declarations into the conditional block where they are used, to fix warning if WITH_SSL is not set. Submitted by: Sean Bruno MFC after: 1 week Modified: head/lib/libfetch/common.c Modified: head/lib/libfetch/common.c ============================================================================== --- head/lib/libfetch/common.c Sat Oct 23 22:28:29 2010 (r214255) +++ head/lib/libfetch/common.c Sun Oct 24 01:05:10 2010 (r214256) @@ -321,9 +321,9 @@ fetch_connect(const char *host, int port int fetch_ssl(conn_t *conn, int verbose) { +#ifdef WITH_SSL int ret, ssl_err; -#ifdef WITH_SSL /* Init the SSL library and context */ if (!SSL_library_init()){ fprintf(stderr, "SSL library init failed\n"); From owner-svn-src-head@FreeBSD.ORG Sun Oct 24 02:59:03 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2A3A2106564A; Sun, 24 Oct 2010 02:59:03 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 184FE8FC0A; Sun, 24 Oct 2010 02:59:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9O2x2HG011920; Sun, 24 Oct 2010 02:59:02 GMT (envelope-from nyan@svn.freebsd.org) Received: (from nyan@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9O2x2CE011918; Sun, 24 Oct 2010 02:59:02 GMT (envelope-from nyan@svn.freebsd.org) Message-Id: <201010240259.o9O2x2CE011918@svn.freebsd.org> From: Takahashi Yoshihiro Date: Sun, 24 Oct 2010 02:59:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214257 - head/sys/boot/pc98/boot2 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Oct 2010 02:59:03 -0000 Author: nyan Date: Sun Oct 24 02:59:02 2010 New Revision: 214257 URL: http://svn.freebsd.org/changeset/base/214257 Log: MFi386: revision 214210 Avoid using memcpy() for copying 32bit chunks. This shrinks the resulting code a little. Modified: head/sys/boot/pc98/boot2/boot2.c Modified: head/sys/boot/pc98/boot2/boot2.c ============================================================================== --- head/sys/boot/pc98/boot2/boot2.c Sun Oct 24 01:05:10 2010 (r214256) +++ head/sys/boot/pc98/boot2/boot2.c Sun Oct 24 02:59:02 2010 (r214257) @@ -485,7 +485,7 @@ load(void) return; p += hdr.ex.a_data + roundup2(hdr.ex.a_bss, PAGE_SIZE); bootinfo.bi_symtab = VTOP(p); - memcpy(p, &hdr.ex.a_syms, sizeof(hdr.ex.a_syms)); + *(uint32_t*)p = hdr.ex.a_syms; p += sizeof(hdr.ex.a_syms); if (hdr.ex.a_syms) { if (xfsread(ino, p, hdr.ex.a_syms)) @@ -522,7 +522,7 @@ load(void) if (xfsread(ino, &es, sizeof(es))) return; for (i = 0; i < 2; i++) { - memcpy(p, &es[i].sh_size, sizeof(es[i].sh_size)); + *(Elf32_Word *)p = es[i].sh_size; p += sizeof(es[i].sh_size); fs_off = es[i].sh_offset; if (xfsread(ino, p, es[i].sh_size)) From owner-svn-src-head@FreeBSD.ORG Sun Oct 24 03:20:55 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 59A76106564A; Sun, 24 Oct 2010 03:20:55 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3C6D08FC1A; Sun, 24 Oct 2010 03:20:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9O3KtQ5014106; Sun, 24 Oct 2010 03:20:55 GMT (envelope-from nyan@svn.freebsd.org) Received: (from nyan@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9O3KtCM014104; Sun, 24 Oct 2010 03:20:55 GMT (envelope-from nyan@svn.freebsd.org) Message-Id: <201010240320.o9O3KtCM014104@svn.freebsd.org> From: Takahashi Yoshihiro Date: Sun, 24 Oct 2010 03:20:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214258 - head/sys/pc98/pc98 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Oct 2010 03:20:55 -0000 Author: nyan Date: Sun Oct 24 03:20:54 2010 New Revision: 214258 URL: http://svn.freebsd.org/changeset/base/214258 Log: MFi386: the part of revision 213226. Rewrite the i386 memory probe: - Move the base memory setup into a new basemem_setup() routine. MFC after: 1 week Modified: head/sys/pc98/pc98/machdep.c Modified: head/sys/pc98/pc98/machdep.c ============================================================================== --- head/sys/pc98/pc98/machdep.c Sun Oct 24 02:59:02 2010 (r214257) +++ head/sys/pc98/pc98/machdep.c Sun Oct 24 03:20:54 2010 (r214258) @@ -1776,52 +1776,13 @@ sdtossd(sd, ssd) ssd->ssd_gran = sd->sd_gran; } -/* - * Populate the (physmap) array with base/bound pairs describing the - * available physical memory in the system, then test this memory and - * build the phys_avail array describing the actually-available memory. - * - * If we cannot accurately determine the physical memory map, then use - * value from the 0xE801 call, and failing that, the RTC. - * - * Total memory size may be set by the kernel environment variable - * hw.physmem or the compile-time define MAXMEM. - * - * XXX first should be vm_paddr_t. - */ static void -getmemsize(int first) +basemem_setup(void) { - int i, off, physmap_idx, pa_indx, da_indx; - int pg_n; - u_long physmem_tunable; - u_int extmem; - u_int under16; - vm_paddr_t pa, physmap[PHYSMAP_SIZE]; + vm_paddr_t pa; pt_entry_t *pte; - quad_t dcons_addr, dcons_size; - - bzero(physmap, sizeof(physmap)); - - /* XXX - some of EPSON machines can't use PG_N */ - pg_n = PG_N; - if (pc98_machine_type & M_EPSON_PC98) { - switch (epson_machine_id) { -#ifdef WB_CACHE - default: -#endif - case EPSON_PC486_HX: - case EPSON_PC486_HG: - case EPSON_PC486_HA: - pg_n = 0; - break; - } - } + int i; - /* - * Perform "base memory" related probes & setup - */ - under16 = pc98_getmemsize(&basemem, &extmem); if (basemem > 640) { printf("Preposterous BIOS basemem of %uK, truncating to 640K\n", basemem); @@ -1853,12 +1814,62 @@ getmemsize(int first) pmap_kenter(KERNBASE + pa, pa); /* - * if basemem != 640, map pages r/w into vm86 page table so - * that the bios can scribble on it. + * Map pages between basemem and ISA_HOLE_START, if any, r/w into + * the vm86 page table so that vm86 can scribble on them using + * the vm86 map too. XXX: why 2 ways for this and only 1 way for + * page 0, at least as initialized here? */ pte = (pt_entry_t *)vm86paddr; for (i = basemem / 4; i < 160; i++) pte[i] = (i << PAGE_SHIFT) | PG_V | PG_RW | PG_U; +} + +/* + * Populate the (physmap) array with base/bound pairs describing the + * available physical memory in the system, then test this memory and + * build the phys_avail array describing the actually-available memory. + * + * If we cannot accurately determine the physical memory map, then use + * value from the 0xE801 call, and failing that, the RTC. + * + * Total memory size may be set by the kernel environment variable + * hw.physmem or the compile-time define MAXMEM. + * + * XXX first should be vm_paddr_t. + */ +static void +getmemsize(int first) +{ + int off, physmap_idx, pa_indx, da_indx; + u_long physmem_tunable; + vm_paddr_t physmap[PHYSMAP_SIZE]; + pt_entry_t *pte; + quad_t dcons_addr, dcons_size; + int i; + int pg_n; + u_int extmem; + u_int under16; + vm_paddr_t pa; + + bzero(physmap, sizeof(physmap)); + + /* XXX - some of EPSON machines can't use PG_N */ + pg_n = PG_N; + if (pc98_machine_type & M_EPSON_PC98) { + switch (epson_machine_id) { +#ifdef WB_CACHE + default: +#endif + case EPSON_PC486_HX: + case EPSON_PC486_HG: + case EPSON_PC486_HA: + pg_n = 0; + break; + } + } + + under16 = pc98_getmemsize(&basemem, &extmem); + basemem_setup(); physmap[0] = 0; physmap[1] = basemem * 1024; From owner-svn-src-head@FreeBSD.ORG Sun Oct 24 05:22:08 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 02629106566B; Sun, 24 Oct 2010 05:22:08 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E4F448FC1E; Sun, 24 Oct 2010 05:22:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9O5M7ZQ018470; Sun, 24 Oct 2010 05:22:07 GMT (envelope-from jchandra@svn.freebsd.org) Received: (from jchandra@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9O5M780018468; Sun, 24 Oct 2010 05:22:07 GMT (envelope-from jchandra@svn.freebsd.org) Message-Id: <201010240522.o9O5M780018468@svn.freebsd.org> From: "Jayachandran C." Date: Sun, 24 Oct 2010 05:22:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214260 - head/lib/libc/mips X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Oct 2010 05:22:08 -0000 Author: jchandra Date: Sun Oct 24 05:22:07 2010 New Revision: 214260 URL: http://svn.freebsd.org/changeset/base/214260 Log: Fix PIC_RETURN when abicalls are not defined. Submitted by: Artem Belevich (artemb at gmail dot com) Modified: head/lib/libc/mips/SYS.h Modified: head/lib/libc/mips/SYS.h ============================================================================== --- head/lib/libc/mips/SYS.h Sun Oct 24 04:38:56 2010 (r214259) +++ head/lib/libc/mips/SYS.h Sun Oct 24 05:22:07 2010 (r214260) @@ -91,7 +91,7 @@ #else # define PIC_PROLOGUE(x) # define PIC_TAILCALL(l) j _C_LABEL(l) -# define PIC_RETURN() +# define PIC_RETURN() j ra #endif /* __ABICALLS__ */ # define SYSTRAP(x) li v0,SYS_ ## x; syscall; From owner-svn-src-head@FreeBSD.ORG Sun Oct 24 06:17:42 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3A8BC1065670 for ; Sun, 24 Oct 2010 06:17:42 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from c00l3r.networx.ch (c00l3r.networx.ch [62.48.2.2]) by mx1.freebsd.org (Postfix) with ESMTP id B4D8B8FC0C for ; Sun, 24 Oct 2010 06:17:41 +0000 (UTC) Received: (qmail 67844 invoked from network); 24 Oct 2010 06:05:13 -0000 Received: from localhost (HELO [127.0.0.1]) ([127.0.0.1]) (envelope-sender ) by c00l3r.networx.ch (qmail-ldap-1.03) with SMTP for ; 24 Oct 2010 06:05:13 -0000 Message-ID: <4CC3CF84.2050606@freebsd.org> Date: Sun, 24 Oct 2010 08:17:40 +0200 From: Andre Oppermann User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.9) Gecko/20100915 Thunderbird/3.1.4 MIME-Version: 1.0 To: "Bjoern A. Zeeb" References: <201009172205.o8HM5RPG043265@svn.freebsd.org> <20101023131021.C66242@maildrop.int.zabbadoz.net> In-Reply-To: <20101023131021.C66242@maildrop.int.zabbadoz.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212803 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Oct 2010 06:17:42 -0000 On 23.10.2010 15:10, Bjoern A. Zeeb wrote: > On Fri, 17 Sep 2010, Andre Oppermann wrote: > >> Author: andre >> Date: Fri Sep 17 22:05:27 2010 >> New Revision: 212803 >> URL: http://svn.freebsd.org/changeset/base/212803 >> >> Log: >> Rearrange the TSO code to make it more readable and to clearly >> separate the decision logic, of whether we can do TSO, and the >> calculation of the burst length into two distinct parts. >> >> Change the way the TSO burst length calculation is done. While >> TSO could do bursts of 65535 bytes that can't be represented in >> ip_len together with the IP and TCP header. Account for that and >> use IP_MAXPACKET instead of TCP_MAXWIN as base constant (both >> have the same value of 64K). When more data is available prevent >> less than MSS sized segments from being sent during the current >> TSO burst. >> >> Add two more KASSERTs to ensure the integrity of the packets. >> >> Tested by: Ben Wilber >> MFC after: 10 days > > As this hasn't happned yet, please do not do. It breaks things. I'll > follow-up later as soon as I have more details. I was busied out after the EuroBSDCon DevSummit and didn't have have time to MFC. Incidentially I was planning on doing it today, but will hold off based on your request. The version currently in 8 certainly has a bug. For the one in head you are the first report. Others reported their all their issues to be fixed with this patch. Can you give an high level description of the problem you are seeing? A detailed description is not required to take a first look on whatever issue you may have. -- Andre > >> Modified: >> head/sys/netinet/tcp_output.c >> >> Modified: head/sys/netinet/tcp_output.c >> ============================================================================== >> --- head/sys/netinet/tcp_output.c Fri Sep 17 21:53:56 2010 (r212802) >> +++ head/sys/netinet/tcp_output.c Fri Sep 17 22:05:27 2010 (r212803) >> @@ -465,9 +465,8 @@ after_sack_rexmit: >> } >> >> /* >> - * Truncate to the maximum segment length or enable TCP Segmentation >> - * Offloading (if supported by hardware) and ensure that FIN is removed >> - * if the length no longer contains the last data byte. >> + * Decide if we can use TCP Segmentation Offloading (if supported by >> + * hardware). >> * >> * TSO may only be used if we are in a pure bulk sending state. The >> * presence of TCP-MD5, SACK retransmits, SACK advertizements and >> @@ -475,10 +474,6 @@ after_sack_rexmit: >> * (except for the sequence number) for all generated packets. This >> * makes it impossible to transmit any options which vary per generated >> * segment or packet. >> - * >> - * The length of TSO bursts is limited to TCP_MAXWIN. That limit and >> - * removal of FIN (if not already catched here) are handled later after >> - * the exact length of the TCP options are known. >> */ >> #ifdef IPSEC >> /* >> @@ -487,22 +482,15 @@ after_sack_rexmit: >> */ >> ipsec_optlen = ipsec_hdrsiz_tcp(tp); >> #endif >> - if (len > tp->t_maxseg) { >> - if ((tp->t_flags & TF_TSO) && V_tcp_do_tso && >> - ((tp->t_flags & TF_SIGNATURE) == 0) && >> - tp->rcv_numsacks == 0 && sack_rxmit == 0 && >> - tp->t_inpcb->inp_options == NULL && >> - tp->t_inpcb->in6p_options == NULL >> + if ((tp->t_flags & TF_TSO) && V_tcp_do_tso && len > tp->t_maxseg && >> + ((tp->t_flags & TF_SIGNATURE) == 0) && >> + tp->rcv_numsacks == 0 && sack_rxmit == 0 && >> #ifdef IPSEC >> - && ipsec_optlen == 0 >> + ipsec_optlen == 0 && >> #endif >> - ) { >> - tso = 1; >> - } else { >> - len = tp->t_maxseg; >> - sendalot = 1; >> - } >> - } >> + tp->t_inpcb->inp_options == NULL && >> + tp->t_inpcb->in6p_options == NULL) >> + tso = 1; >> >> if (sack_rxmit) { >> if (SEQ_LT(p->rxmit + len, tp->snd_una + so->so_snd.sb_cc)) >> @@ -732,28 +720,53 @@ send: >> * bump the packet length beyond the t_maxopd length. >> * Clear the FIN bit because we cut off the tail of >> * the segment. >> - * >> - * When doing TSO limit a burst to TCP_MAXWIN minus the >> - * IP, TCP and Options length to keep ip->ip_len from >> - * overflowing. Prevent the last segment from being >> - * fractional thus making them all equal sized and set >> - * the flag to continue sending. TSO is disabled when >> - * IP options or IPSEC are present. >> */ >> if (len + optlen + ipoptlen > tp->t_maxopd) { >> flags &= ~TH_FIN; >> + >> if (tso) { >> - if (len > TCP_MAXWIN - hdrlen - optlen) { >> - len = TCP_MAXWIN - hdrlen - optlen; >> - len = len - (len % (tp->t_maxopd - optlen)); >> + KASSERT(ipoptlen == 0, >> + ("%s: TSO can't do IP options", __func__)); >> + >> + /* >> + * Limit a burst to IP_MAXPACKET minus IP, >> + * TCP and options length to keep ip->ip_len >> + * from overflowing. >> + */ >> + if (len > IP_MAXPACKET - hdrlen) { >> + len = IP_MAXPACKET - hdrlen; >> + sendalot = 1; >> + } >> + >> + /* >> + * Prevent the last segment from being >> + * fractional unless the send sockbuf can >> + * be emptied. >> + */ >> + if (sendalot && off + len < so->so_snd.sb_cc) { >> + len -= len % (tp->t_maxopd - optlen); >> sendalot = 1; >> - } else if (tp->t_flags & TF_NEEDFIN) >> + } >> + >> + /* >> + * Send the FIN in a separate segment >> + * after the bulk sending is done. >> + * We don't trust the TSO implementations >> + * to clear the FIN flag on all but the >> + * last segment. >> + */ >> + if (tp->t_flags & TF_NEEDFIN) >> sendalot = 1; >> + >> } else { >> len = tp->t_maxopd - optlen - ipoptlen; >> sendalot = 1; >> } >> - } >> + } else >> + tso = 0; >> + >> + KASSERT(len + hdrlen + ipoptlen <= IP_MAXPACKET, >> + ("%s: len > IP_MAXPACKET", __func__)); >> >> /*#ifdef DIAGNOSTIC*/ >> #ifdef INET6 >> @@ -1068,6 +1081,9 @@ send: >> m->m_pkthdr.tso_segsz = tp->t_maxopd - optlen; >> } >> >> + KASSERT(len + hdrlen + ipoptlen == m_length(m, NULL), >> + ("%s: mbuf chain shorter than expected", __func__)); >> + >> /* >> * In transmit state, time the transmission and arrange for >> * the retransmit. In persist state, just set snd_max. >> > From owner-svn-src-head@FreeBSD.ORG Sun Oct 24 09:14:22 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1C9BB106564A; Sun, 24 Oct 2010 09:14:22 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E499D8FC1A; Sun, 24 Oct 2010 09:14:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9O9ELB9022929; Sun, 24 Oct 2010 09:14:21 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9O9ELh3022927; Sun, 24 Oct 2010 09:14:21 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201010240914.o9O9ELh3022927@svn.freebsd.org> From: Robert Watson Date: Sun, 24 Oct 2010 09:14:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214261 - head/tools/tools/syscall_timing X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Oct 2010 09:14:22 -0000 Author: rwatson Date: Sun Oct 24 09:14:21 2010 New Revision: 214261 URL: http://svn.freebsd.org/changeset/base/214261 Log: Add microbenchmark for create/unlink of a zero-byte file. Sponsored by: Google, Inc. MFC after: 2 weeks Modified: head/tools/tools/syscall_timing/syscall_timing.c Modified: head/tools/tools/syscall_timing/syscall_timing.c ============================================================================== --- head/tools/tools/syscall_timing/syscall_timing.c Sun Oct 24 05:22:07 2010 (r214260) +++ head/tools/tools/syscall_timing/syscall_timing.c Sun Oct 24 09:14:21 2010 (r214261) @@ -260,6 +260,34 @@ test_socketpair_dgram(uintmax_t num, uin } uintmax_t +test_create_unlink(uintmax_t num, uintmax_t int_arg, const char *path) +{ + uintmax_t i; + int fd; + + (void)unlink(path); + fd = open(path, O_RDWR | O_CREAT, 0600); + if (fd < 0) + err(-1, "test_create_unlink: create: %s", path); + close(fd); + if (unlink(path) < 0) + err(-1, "test_create_unlink: unlink: %s", path); + benchmark_start(); + for (i = 0; i < num; i++) { + if (alarm_fired) + break; + fd = open(path, O_RDWR | O_CREAT, 0600); + if (fd < 0) + err(-1, "test_create_unlink: create: %s", path); + close(fd); + if (unlink(path) < 0) + err(-1, "test_create_unlink: unlink: %s", path); + } + benchmark_stop(); + return (i); +} + +uintmax_t test_open_close(uintmax_t num, uintmax_t int_arg, const char *path) { uintmax_t i; @@ -292,7 +320,7 @@ test_read(uintmax_t num, uintmax_t int_a fd = open(path, O_RDONLY); if (fd < 0) - err(-1, "test_open_close: %s", path); + err(-1, "test_open_read: %s", path); (void)pread(fd, buf, int_arg, 0); benchmark_start(); @@ -315,7 +343,7 @@ test_open_read_close(uintmax_t num, uint fd = open(path, O_RDONLY); if (fd < 0) - err(-1, "test_open_close: %s", path); + err(-1, "test_open_read_close: %s", path); (void)read(fd, buf, int_arg); close(fd); @@ -325,7 +353,7 @@ test_open_read_close(uintmax_t num, uint break; fd = open(path, O_RDONLY); if (fd < 0) - err(-1, "test_open_close: %s", path); + err(-1, "test_open_read_close: %s", path); (void)read(fd, buf, int_arg); close(fd); } @@ -587,6 +615,7 @@ static const struct test tests[] = { { "socketpair_dgram", test_socketpair_dgram }, { "socket_tcp", test_socket_stream, .t_int = PF_INET }, { "socket_udp", test_socket_dgram, .t_int = PF_INET }, + { "create_unlink", test_create_unlink, .t_flags = FLAG_PATH }, { "open_close", test_open_close, .t_flags = FLAG_PATH }, { "open_read_close_1", test_open_read_close, .t_flags = FLAG_PATH, .t_int = 1 }, From owner-svn-src-head@FreeBSD.ORG Sun Oct 24 11:37:01 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D5945106564A; Sun, 24 Oct 2010 11:37:01 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C41B18FC0C; Sun, 24 Oct 2010 11:37:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9OBb1ZZ026780; Sun, 24 Oct 2010 11:37:01 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9OBb12X026778; Sun, 24 Oct 2010 11:37:01 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201010241137.o9OBb12X026778@svn.freebsd.org> From: Marius Strobl Date: Sun, 24 Oct 2010 11:37:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214262 - head/sys/dev/mii X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Oct 2010 11:37:01 -0000 Author: marius Date: Sun Oct 24 11:37:01 2010 New Revision: 214262 URL: http://svn.freebsd.org/changeset/base/214262 Log: - Take advantage of mii_phy_dev_probe(). - Use mii_phy_add_media() instead of mii_add_media(). I'm not sure how this driver actually managed to work before as mii_add_media() is intended to be used to gether with mii_anar() while mii_phy_add_media() is intended to be used with mii_phy_setmedia(), however this driver mii_add_media() along with mii_phy_setmedia(). Modified: head/sys/dev/mii/smcphy.c Modified: head/sys/dev/mii/smcphy.c ============================================================================== --- head/sys/dev/mii/smcphy.c Sun Oct 24 09:14:21 2010 (r214261) +++ head/sys/dev/mii/smcphy.c Sun Oct 24 11:37:01 2010 (r214262) @@ -76,20 +76,16 @@ static driver_t smcphy_driver = { DRIVER_MODULE(smcphy, miibus, smcphy_driver, smcphy_devclass, 0, 0); +static const struct mii_phydesc smcphys[] = { + MII_PHY_DESC(SMSC, LAN83C183), + MII_PHY_END +}; + static int smcphy_probe(device_t dev) { - struct mii_attach_args *ma; - - ma = device_get_ivars(dev); - if (MII_OUI(ma->mii_id1, ma->mii_id2) != MII_OUI_SMSC || - MII_MODEL(ma->mii_id2) != MII_MODEL_SMSC_LAN83C183) - return (ENXIO); - - device_set_desc(dev, MII_STR_SMSC_LAN83C183); - - return (0); + return (mii_phy_dev_probe(dev, smcphys, BUS_PROBE_DEFAULT)); } static int @@ -111,7 +107,7 @@ smcphy_attach(device_t dev) sc->mii_service = smcphy_service; sc->mii_pdata = mii; - sc->mii_flags |= MIIF_NOISOLATE; + sc->mii_flags |= MIIF_NOISOLATE | MIIF_NOLOOP; if (smcphy_reset(sc) != 0) { device_printf(dev, "reset failed\n"); @@ -122,7 +118,7 @@ smcphy_attach(device_t dev) sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; device_printf(dev, " "); - mii_add_media(sc); + mii_phy_add_media(sc); printf("\n"); MIIBUS_MEDIAINIT(sc->mii_dev); From owner-svn-src-head@FreeBSD.ORG Sun Oct 24 11:38:26 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2B98B106566B; Sun, 24 Oct 2010 11:38:26 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F3DE68FC08; Sun, 24 Oct 2010 11:38:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9OBcPH3026841; Sun, 24 Oct 2010 11:38:25 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9OBcPi7026839; Sun, 24 Oct 2010 11:38:25 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201010241138.o9OBcPi7026839@svn.freebsd.org> From: Marius Strobl Date: Sun, 24 Oct 2010 11:38:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214263 - head/sys/dev/mii X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Oct 2010 11:38:26 -0000 Author: marius Date: Sun Oct 24 11:38:25 2010 New Revision: 214263 URL: http://svn.freebsd.org/changeset/base/214263 Log: Take advantage of mii_phy_add_media()/mii_phy_setmedia(). Modified: head/sys/dev/mii/pnaphy.c Modified: head/sys/dev/mii/pnaphy.c ============================================================================== --- head/sys/dev/mii/pnaphy.c Sun Oct 24 11:37:01 2010 (r214262) +++ head/sys/dev/mii/pnaphy.c Sun Oct 24 11:38:25 2010 (r214263) @@ -102,7 +102,6 @@ pnaphy_attach(device_t dev) struct mii_softc *sc; struct mii_attach_args *ma; struct mii_data *mii; - const char *sep = ""; sc = device_get_softc(dev); ma = device_get_ivars(dev); @@ -116,29 +115,16 @@ pnaphy_attach(device_t dev) sc->mii_service = pnaphy_service; sc->mii_pdata = mii; - sc->mii_flags |= MIIF_NOISOLATE; - -#define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL) -#define PRINT(s) printf("%s%s", sep, s); sep = ", " + sc->mii_flags |= MIIF_NOISOLATE | MIIF_NOLOOP | MIIF_IS_HPNA; mii_phy_reset(sc); sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; device_printf(dev, " "); - if ((sc->mii_capabilities & BMSR_MEDIAMASK) == 0) - printf("no media present"); - else { - ADD(IFM_MAKEWORD(IFM_ETHER, IFM_HPNA_1, 0, sc->mii_inst), 0); - PRINT("HomePNA"); - } - + mii_phy_add_media(sc); printf("\n"); -#undef ADD -#undef PRINT - MIIBUS_MEDIAINIT(sc->mii_dev); - return (0); } @@ -159,17 +145,11 @@ pnaphy_service(struct mii_softc *sc, str break; switch (IFM_SUBTYPE(ife->ifm_media)) { - case IFM_AUTO: - case IFM_10_T: - case IFM_100_TX: - case IFM_100_T4: - return (EINVAL); + case IFM_HPNA_1: + mii_phy_setmedia(sc); + break; default: - /* - * BMCR data is stored in the ifmedia entry. - */ - PHY_WRITE(sc, MII_ANAR, mii_anar(ife->ifm_media)); - PHY_WRITE(sc, MII_BMCR, ife->ifm_data); + return (EINVAL); } break; @@ -182,7 +162,7 @@ pnaphy_service(struct mii_softc *sc, str /* Update the media status. */ ukphy_status(sc); if (IFM_SUBTYPE(mii->mii_media_active) == IFM_10_T) - mii->mii_media_active = IFM_ETHER|IFM_HPNA_1; + mii->mii_media_active = IFM_ETHER | IFM_HPNA_1; /* Callback if something changed. */ mii_phy_update(sc, cmd); From owner-svn-src-head@FreeBSD.ORG Sun Oct 24 12:51:03 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 530501065672; Sun, 24 Oct 2010 12:51:03 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3FCA38FC19; Sun, 24 Oct 2010 12:51:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9OCp3sv028393; Sun, 24 Oct 2010 12:51:03 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9OCp3wx028388; Sun, 24 Oct 2010 12:51:03 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201010241251.o9OCp3wx028388@svn.freebsd.org> From: Marius Strobl Date: Sun, 24 Oct 2010 12:51:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214264 - in head/sys/dev: mii tl X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Oct 2010 12:51:03 -0000 Author: marius Date: Sun Oct 24 12:51:02 2010 New Revision: 214264 URL: http://svn.freebsd.org/changeset/base/214264 Log: - Add IFM_10_2 and IFM_10_5 media via tlphy(4) only in case the respective interface also has such connectors. - In tl_attach() unify three different ways of obtaining the device and vendor IDs and remove the now obsolete tl_dinfo from tl_softc. - Given that tlphy(4) only handles the integrated PHYs of NICs driven by tl(4) make it only probe on the latter. - Switch mlphy(4) and tlphy(4) to use mii_phy_add_media()/mii_phy_setmedia(). - Simplify looking for the respective companion PHY in mlphy(4) and tlphy(4) by ignoring the native one by just comparing the device_t's directly rather than the device name. Modified: head/sys/dev/mii/mlphy.c head/sys/dev/mii/tlphy.c head/sys/dev/tl/if_tl.c head/sys/dev/tl/if_tlreg.h Modified: head/sys/dev/mii/mlphy.c ============================================================================== --- head/sys/dev/mii/mlphy.c Sun Oct 24 11:38:25 2010 (r214263) +++ head/sys/dev/mii/mlphy.c Sun Oct 24 12:51:02 2010 (r214264) @@ -70,6 +70,7 @@ __FBSDID("$FreeBSD$"); struct mlphy_softc { struct mii_softc ml_mii; + device_t ml_dev; int ml_state; int ml_linked; }; @@ -96,6 +97,7 @@ static driver_t mlphy_driver = { DRIVER_MODULE(mlphy, miibus, mlphy_driver, mlphy_devclass, 0, 0); +static struct mii_softc *mlphy_find_other(struct mlphy_softc *); static int mlphy_service(struct mii_softc *, struct mii_data *, int); static void mlphy_reset(struct mii_softc *); static void mlphy_status(struct mii_softc *); @@ -105,10 +107,8 @@ mlphy_probe(dev) device_t dev; { struct mii_attach_args *ma; - device_t parent; ma = device_get_ivars(dev); - parent = device_get_parent(device_get_parent(dev)); /* * Micro Linear PHY reports oui == 0 model == 0 @@ -122,7 +122,8 @@ mlphy_probe(dev) * encountered the 6692 on an Olicom card with a ThunderLAN * controller chip. */ - if (strcmp(device_get_name(parent), "tl") != 0) + if (strcmp(device_get_name(device_get_parent(device_get_parent(dev))), + "tl") != 0) return (ENXIO); device_set_desc(dev, "Micro Linear 6692 media interface"); @@ -141,6 +142,7 @@ mlphy_attach(dev) msc = device_get_softc(dev); sc = &msc->ml_mii; + msc->ml_dev = dev; ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); mii = ma->mii_data; @@ -155,14 +157,15 @@ mlphy_attach(dev) #define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL) ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, IFM_LOOP, sc->mii_inst), - BMCR_LOOP|BMCR_S100); + MII_MEDIA_100_TX); mii_phy_reset(sc); sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; + /* Let the companion PHY (if any) only handle the media we don't. */ ma->mii_capmask = ~sc->mii_capabilities; device_printf(dev, " "); - mii_add_media(sc); + mii_phy_add_media(sc); printf("\n"); #undef ADD MIIBUS_MEDIAINIT(sc->mii_dev); @@ -170,20 +173,21 @@ mlphy_attach(dev) } static struct mii_softc * -mlphy_find_other(device_t mii) +mlphy_find_other(struct mlphy_softc *msc) { device_t *devlist; struct mii_softc *retval; int i, devs; retval = NULL; - if (device_get_children(mii, &devlist, &devs)) + if (device_get_children(msc->ml_mii.mii_dev, &devlist, &devs) != 0) return (NULL); - for (i = 0; i < devs; i++) - if (strcmp(device_get_name(devlist[i]), "mlphy")) { + for (i = 0; i < devs; i++) { + if (devlist[i] != msc->ml_dev) { retval = device_get_softc(devlist[i]); break; } + } free(devlist, M_TEMP); return (retval); } @@ -204,7 +208,7 @@ mlphy_service(xsc, mii, cmd) * See if there's another PHY on this bus with us. * If so, we may need it for 10Mbps modes. */ - other = mlphy_find_other(msc->ml_mii.mii_dev); + other = mlphy_find_other(msc); switch (cmd) { case MII_POLLSTAT: @@ -229,7 +233,7 @@ mlphy_service(xsc, mii, cmd) mii_phy_reset(other); PHY_WRITE(other, MII_BMCR, BMCR_ISO); } - (void) mii_phy_auto(sc); + (void)mii_phy_auto(sc); msc->ml_linked = 0; return (0); case IFM_10_T: @@ -246,8 +250,7 @@ mlphy_service(xsc, mii, cmd) mii_phy_reset(other); PHY_WRITE(other, MII_BMCR, ife->ifm_data); } - PHY_WRITE(sc, MII_ANAR, mii_anar(ife->ifm_media)); - PHY_WRITE(sc, MII_BMCR, ife->ifm_data); + mii_phy_setmedia(sc); msc->ml_state = 0; break; case IFM_100_TX: @@ -262,17 +265,11 @@ mlphy_service(xsc, mii, cmd) mii_phy_reset(other); PHY_WRITE(other, MII_BMCR, BMCR_ISO); } - PHY_WRITE(sc, MII_ANAR, mii_anar(ife->ifm_media)); - PHY_WRITE(sc, MII_BMCR, ife->ifm_data); + mii_phy_setmedia(sc); msc->ml_state = 0; break; - case IFM_100_T4: - /* - * XXX Not supported as a manual setting right now. - */ - return (EINVAL); default: - break; + return (EINVAL); } break; @@ -381,7 +378,7 @@ mlphy_status(sc) struct mii_softc *other = NULL; /* See if there's another PHY on the bus with us. */ - other = mlphy_find_other(msc->ml_mii.mii_dev); + other = mlphy_find_other(msc); if (other == NULL) return; Modified: head/sys/dev/mii/tlphy.c ============================================================================== --- head/sys/dev/mii/tlphy.c Sun Oct 24 11:38:25 2010 (r214263) +++ head/sys/dev/mii/tlphy.c Sun Oct 24 12:51:02 2010 (r214264) @@ -124,6 +124,9 @@ static int tlphy_probe(device_t dev) { + if (strcmp(device_get_name(device_get_parent(device_get_parent(dev))), + "tl") != 0) + return (ENXIO); return (mii_phy_dev_probe(dev, tlphys, BUS_PROBE_DEFAULT)); } @@ -150,11 +153,17 @@ tlphy_attach(device_t dev) sc->sc_mii.mii_service = tlphy_service; sc->sc_mii.mii_pdata = mii; + /* + * Note that if we're on a device that also supports 100baseTX, + * we are not going to want to use the built-in 10baseT port, + * since there will be another PHY on the MII wired up to the + * UTP connector. + */ capmask = BMSR_DEFCAPMASK; if (mii->mii_instance && device_get_children(sc->sc_mii.mii_dev, &devlist, &devs) == 0) { for (i = 0; i < devs; i++) { - if (strcmp(device_get_name(devlist[i]), "tlphy")) { + if (devlist[i] != dev) { other = device_get_softc(devlist[i]); capmask &= ~other->mii_capabilities; break; @@ -167,38 +176,36 @@ tlphy_attach(device_t dev) mii_phy_reset(&sc->sc_mii); - /* - * Note that if we're on a device that also supports 100baseTX, - * we are not going to want to use the built-in 10baseT port, - * since there will be another PHY on the MII wired up to the - * UTP connector. The parent indicates this to us by specifying - * the TLPHY_MEDIA_NO_10_T bit. - */ sc->sc_mii.mii_capabilities = PHY_READ(&sc->sc_mii, MII_BMSR) & capmask; #define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL) - ADD(IFM_MAKEWORD(IFM_ETHER, IFM_NONE, 0, sc->sc_mii.mii_inst), - BMCR_ISO); - - ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_T, IFM_LOOP, - sc->sc_mii.mii_inst), BMCR_LOOP); + ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_T, IFM_LOOP, sc->sc_mii.mii_inst), + MII_MEDIA_100_TX); #define PRINT(s) printf("%s%s", sep, s); sep = ", " - device_printf(dev, " "); - ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_2, 0, sc->sc_mii.mii_inst), 0); - PRINT("10base2/BNC"); - ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_5, 0, sc->sc_mii.mii_inst), 0); - PRINT("10base5/AUI"); - - if (sc->sc_mii.mii_capabilities & BMSR_MEDIAMASK) { + if ((sc->sc_mii.mii_flags & (MIIF_MACPRIV0 | MIIF_MACPRIV1)) != 0 && + (sc->sc_mii.mii_capabilities & BMSR_MEDIAMASK) != 0) + device_printf(dev, " "); + if ((sc->sc_mii.mii_flags & MIIF_MACPRIV0) != 0) { + ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_2, 0, sc->sc_mii.mii_inst), + 0); + PRINT("10base2/BNC"); + } + if ((sc->sc_mii.mii_flags & MIIF_MACPRIV1) != 0) { + ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_5, 0, sc->sc_mii.mii_inst), + 0); + PRINT("10base5/AUI"); + } + if ((sc->sc_mii.mii_capabilities & BMSR_MEDIAMASK) != 0) { printf("%s", sep); - mii_add_media(&sc->sc_mii); + mii_phy_add_media(&sc->sc_mii); } - - printf("\n"); + if ((sc->sc_mii.mii_flags & (MIIF_MACPRIV0 | MIIF_MACPRIV1)) != 0 && + (sc->sc_mii.mii_capabilities & BMSR_MEDIAMASK) != 0) + printf("\n"); #undef ADD #undef PRINT MIIBUS_MEDIAINIT(sc->sc_mii.mii_dev); @@ -233,7 +240,7 @@ tlphy_service(struct mii_softc *self, st * an autonegotiation cycle, so there's no such * thing as "already in auto mode". */ - (void) tlphy_auto(sc); + (void)tlphy_auto(sc); break; case IFM_10_2: case IFM_10_5: @@ -244,9 +251,7 @@ tlphy_service(struct mii_softc *self, st default: PHY_WRITE(&sc->sc_mii, MII_TLPHY_CTRL, 0); DELAY(100000); - PHY_WRITE(&sc->sc_mii, MII_ANAR, - mii_anar(ife->ifm_media)); - PHY_WRITE(&sc->sc_mii, MII_BMCR, ife->ifm_data); + mii_phy_setmedia(&sc->sc_mii); } break; @@ -283,7 +288,7 @@ tlphy_service(struct mii_softc *self, st sc->sc_mii.mii_ticks = 0; mii_phy_reset(&sc->sc_mii); - tlphy_auto(sc); + (void)tlphy_auto(sc); return (0); } Modified: head/sys/dev/tl/if_tl.c ============================================================================== --- head/sys/dev/tl/if_tl.c Sun Oct 24 11:38:25 2010 (r214263) +++ head/sys/dev/tl/if_tl.c Sun Oct 24 12:51:02 2010 (r214264) @@ -1104,12 +1104,11 @@ static int tl_attach(dev) device_t dev; { - int i; u_int16_t did, vid; struct tl_type *t; struct ifnet *ifp; struct tl_softc *sc; - int unit, error = 0, rid; + int error, flags, i, rid, unit; u_char eaddr[6]; vid = pci_get_vendor(dev); @@ -1207,10 +1206,9 @@ tl_attach(dev) bzero(sc->tl_ldata, sizeof(struct tl_list_data)); - sc->tl_dinfo = t; - if (t->tl_vid == COMPAQ_VENDORID || t->tl_vid == TI_VENDORID) + if (vid == COMPAQ_VENDORID || vid == TI_VENDORID) sc->tl_eeaddr = TL_EEPROM_EADDR; - if (t->tl_vid == OLICOM_VENDORID) + if (vid == OLICOM_VENDORID) sc->tl_eeaddr = TL_EEPROM_EADDR_OC; /* Reset the adapter. */ @@ -1241,7 +1239,7 @@ tl_attach(dev) * word. To make things even more confusing, neither 00:00:28 * nor 00:00:24 appear in the IEEE OUI database. */ - if (sc->tl_dinfo->tl_vid == OLICOM_VENDORID) { + if (vid == OLICOM_VENDORID) { for (i = 0; i < ETHER_ADDR_LEN; i += 2) { u_int16_t *p; p = (u_int16_t *)&eaddr[i]; @@ -1279,6 +1277,20 @@ tl_attach(dev) * XXX mii_attach() can fail for reason different than * no PHYs found! */ + flags = 0; + if (vid == COMPAQ_VENDORID) { + if (did == COMPAQ_DEVICEID_NETEL_10_100_PROLIANT || + did == COMPAQ_DEVICEID_NETFLEX_3P_INTEGRATED || + did == COMPAQ_DEVICEID_NETFLEX_3P_BNC || + did == COMPAQ_DEVICEID_NETEL_10_T2_UTP_COAX) + flags |= MIIF_MACPRIV0; + if (did == COMPAQ_DEVICEID_NETEL_10 || + did == COMPAQ_DEVICEID_NETEL_10_100_DUAL || + did == COMPAQ_DEVICEID_NETFLEX_3P || + did == COMPAQ_DEVICEID_NETEL_10_100_EMBEDDED) + flags |= MIIF_MACPRIV1; + } else if (vid == OLICOM_VENDORID && did == OLICOM_DEVICEID_OC2183) + flags |= MIIF_MACPRIV0 | MIIF_MACPRIV1; if (mii_attach(dev, &sc->tl_miibus, ifp, tl_ifmedia_upd, tl_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0)) { struct ifmedia *ifm; Modified: head/sys/dev/tl/if_tlreg.h ============================================================================== --- head/sys/dev/tl/if_tlreg.h Sun Oct 24 11:38:25 2010 (r214263) +++ head/sys/dev/tl/if_tlreg.h Sun Oct 24 12:51:02 2010 (r214264) @@ -116,7 +116,6 @@ struct tl_softc { struct resource *tl_irq; struct resource *tl_res; device_t tl_miibus; - struct tl_type *tl_dinfo; /* ThunderLAN adapter info */ u_int8_t tl_eeaddr; struct tl_list_data *tl_ldata; /* TX/RX lists and mbufs */ struct tl_chain_data tl_cdata; From owner-svn-src-head@FreeBSD.ORG Sun Oct 24 12:59:44 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 281D11065670; Sun, 24 Oct 2010 12:59:44 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 161078FC0C; Sun, 24 Oct 2010 12:59:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9OCxhFn028602; Sun, 24 Oct 2010 12:59:43 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9OCxhqu028599; Sun, 24 Oct 2010 12:59:43 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201010241259.o9OCxhqu028599@svn.freebsd.org> From: Marius Strobl Date: Sun, 24 Oct 2010 12:59:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214265 - head/sys/dev/mii X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Oct 2010 12:59:44 -0000 Author: marius Date: Sun Oct 24 12:59:43 2010 New Revision: 214265 URL: http://svn.freebsd.org/changeset/base/214265 Log: - Given that as of r214264 all PHY drivers using mii(4) finally have been converted to use the mii_phy_add_media()/mii_phy_setmedia() pair instead of mii_add_media()/mii_anar() remove the latter. - Declare mii_media mii_media_table static as it shouldn't be used outside of mii_physubr.c. MFC after: never Modified: head/sys/dev/mii/mii_physubr.c head/sys/dev/mii/miivar.h Modified: head/sys/dev/mii/mii_physubr.c ============================================================================== --- head/sys/dev/mii/mii_physubr.c Sun Oct 24 12:51:02 2010 (r214264) +++ head/sys/dev/mii/mii_physubr.c Sun Oct 24 12:59:43 2010 (r214265) @@ -56,7 +56,7 @@ __FBSDID("$FreeBSD$"); /* * Media to register setting conversion table. Order matters. */ -const struct mii_media mii_media_table[MII_NMEDIA] = { +static const struct mii_media mii_media_table[MII_NMEDIA] = { /* None */ { BMCR_ISO, ANAR_CSMA, 0, }, @@ -287,99 +287,6 @@ mii_phy_update(struct mii_softc *sc, int } /* - * Given an ifmedia word, return the corresponding ANAR value. - */ -int -mii_anar(int media) -{ - int rv; - - switch (media & (IFM_TMASK|IFM_NMASK|IFM_FDX)) { - case IFM_ETHER|IFM_10_T: - rv = ANAR_10|ANAR_CSMA; - break; - case IFM_ETHER|IFM_10_T|IFM_FDX: - rv = ANAR_10_FD|ANAR_CSMA; - break; - case IFM_ETHER|IFM_100_TX: - rv = ANAR_TX|ANAR_CSMA; - break; - case IFM_ETHER|IFM_100_TX|IFM_FDX: - rv = ANAR_TX_FD|ANAR_CSMA; - break; - case IFM_ETHER|IFM_100_T4: - rv = ANAR_T4|ANAR_CSMA; - break; - default: - rv = 0; - break; - } - - return (rv); -} - -/* - * Initialize generic PHY media based on BMSR, called when a PHY is - * attached. We expect to be set up to print a comma-separated list - * of media names. Does not print a newline. - */ -void -mii_add_media(struct mii_softc *sc) -{ - struct mii_data *mii = sc->mii_pdata; - const char *sep = ""; - - if ((sc->mii_capabilities & BMSR_MEDIAMASK) == 0) { - printf("no media present"); - return; - } - -#define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL) -#define PRINT(s) printf("%s%s", sep, s); sep = ", " - - if (sc->mii_capabilities & BMSR_10THDX) { - ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_T, 0, sc->mii_inst), 0); - PRINT("10baseT"); - } - if (sc->mii_capabilities & BMSR_10TFDX) { - ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_T, IFM_FDX, sc->mii_inst), - BMCR_FDX); - PRINT("10baseT-FDX"); - } - if (sc->mii_capabilities & BMSR_100TXHDX) { - ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, 0, sc->mii_inst), - BMCR_S100); - PRINT("100baseTX"); - } - if (sc->mii_capabilities & BMSR_100TXFDX) { - ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, IFM_FDX, sc->mii_inst), - BMCR_S100|BMCR_FDX); - PRINT("100baseTX-FDX"); - } - if (sc->mii_capabilities & BMSR_100T4) { - /* - * XXX How do you enable 100baseT4? I assume we set - * XXX BMCR_S100 and then assume the PHYs will take - * XXX watever action is necessary to switch themselves - * XXX into T4 mode. - */ - ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_T4, 0, sc->mii_inst), - BMCR_S100); - PRINT("100baseT4"); - } - if (sc->mii_capabilities & BMSR_ANEG) { - ADD(IFM_MAKEWORD(IFM_ETHER, IFM_AUTO, 0, sc->mii_inst), - BMCR_AUTOEN); - PRINT("auto"); - } - - - -#undef ADD -#undef PRINT -} - -/* * Initialize generic PHY media based on BMSR, called when a PHY is * attached. We expect to be set up to print a comma-separated list * of media names. Does not print a newline. Modified: head/sys/dev/mii/miivar.h ============================================================================== --- head/sys/dev/mii/miivar.h Sun Oct 24 12:51:02 2010 (r214264) +++ head/sys/dev/mii/miivar.h Sun Oct 24 12:59:43 2010 (r214265) @@ -227,12 +227,10 @@ int miibus_detach(device_t); int mii_attach(device_t, device_t *, struct ifnet *, ifm_change_cb_t, ifm_stat_cb_t, int, int, int, int); -int mii_anar(int); void mii_down(struct mii_data *); int mii_mediachg(struct mii_data *); void mii_tick(struct mii_data *); void mii_pollstat(struct mii_data *); -void mii_add_media(struct mii_softc *); void mii_phy_add_media(struct mii_softc *); int mii_phy_auto(struct mii_softc *); From owner-svn-src-head@FreeBSD.ORG Sun Oct 24 13:20:17 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1233) id BAD3F106566B; Sun, 24 Oct 2010 13:20:17 +0000 (UTC) Date: Sun, 24 Oct 2010 13:20:17 +0000 From: Alexander Best To: Robert Watson Message-ID: <20101024132017.GA77378@freebsd.org> References: <201010240914.o9O9ELh3022927@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201010240914.o9O9ELh3022927@svn.freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r214261 - head/tools/tools/syscall_timing X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Oct 2010 13:20:17 -0000 On Sun Oct 24 10, Robert Watson wrote: > Author: rwatson > Date: Sun Oct 24 09:14:21 2010 > New Revision: 214261 > URL: http://svn.freebsd.org/changeset/base/214261 > > Log: > Add microbenchmark for create/unlink of a zero-byte file. clang still complaining: syscall_timing.c:766:24: warning: conversion specifies type 'int' but the argument has type 'uintmax_t' (aka 'unsigned long') [-Wformat] printf("%ju.%09ju\t%d\t", (uintmax_t)ts_end.tv_sec, ~^ %lu 1 warning generated. cheers. alex > > Sponsored by: Google, Inc. > MFC after: 2 weeks > > Modified: > head/tools/tools/syscall_timing/syscall_timing.c > > Modified: head/tools/tools/syscall_timing/syscall_timing.c > ============================================================================== > --- head/tools/tools/syscall_timing/syscall_timing.c Sun Oct 24 05:22:07 2010 (r214260) > +++ head/tools/tools/syscall_timing/syscall_timing.c Sun Oct 24 09:14:21 2010 (r214261) > @@ -260,6 +260,34 @@ test_socketpair_dgram(uintmax_t num, uin > } > > uintmax_t > +test_create_unlink(uintmax_t num, uintmax_t int_arg, const char *path) > +{ > + uintmax_t i; > + int fd; > + > + (void)unlink(path); > + fd = open(path, O_RDWR | O_CREAT, 0600); > + if (fd < 0) > + err(-1, "test_create_unlink: create: %s", path); > + close(fd); > + if (unlink(path) < 0) > + err(-1, "test_create_unlink: unlink: %s", path); > + benchmark_start(); > + for (i = 0; i < num; i++) { > + if (alarm_fired) > + break; > + fd = open(path, O_RDWR | O_CREAT, 0600); > + if (fd < 0) > + err(-1, "test_create_unlink: create: %s", path); > + close(fd); > + if (unlink(path) < 0) > + err(-1, "test_create_unlink: unlink: %s", path); > + } > + benchmark_stop(); > + return (i); > +} > + > +uintmax_t > test_open_close(uintmax_t num, uintmax_t int_arg, const char *path) > { > uintmax_t i; > @@ -292,7 +320,7 @@ test_read(uintmax_t num, uintmax_t int_a > > fd = open(path, O_RDONLY); > if (fd < 0) > - err(-1, "test_open_close: %s", path); > + err(-1, "test_open_read: %s", path); > (void)pread(fd, buf, int_arg, 0); > > benchmark_start(); > @@ -315,7 +343,7 @@ test_open_read_close(uintmax_t num, uint > > fd = open(path, O_RDONLY); > if (fd < 0) > - err(-1, "test_open_close: %s", path); > + err(-1, "test_open_read_close: %s", path); > (void)read(fd, buf, int_arg); > close(fd); > > @@ -325,7 +353,7 @@ test_open_read_close(uintmax_t num, uint > break; > fd = open(path, O_RDONLY); > if (fd < 0) > - err(-1, "test_open_close: %s", path); > + err(-1, "test_open_read_close: %s", path); > (void)read(fd, buf, int_arg); > close(fd); > } > @@ -587,6 +615,7 @@ static const struct test tests[] = { > { "socketpair_dgram", test_socketpair_dgram }, > { "socket_tcp", test_socket_stream, .t_int = PF_INET }, > { "socket_udp", test_socket_dgram, .t_int = PF_INET }, > + { "create_unlink", test_create_unlink, .t_flags = FLAG_PATH }, > { "open_close", test_open_close, .t_flags = FLAG_PATH }, > { "open_read_close_1", test_open_read_close, .t_flags = FLAG_PATH, > .t_int = 1 }, -- a13x From owner-svn-src-head@FreeBSD.ORG Sun Oct 24 13:48:11 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6837C1065782; Sun, 24 Oct 2010 13:48:11 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5642F8FC17; Sun, 24 Oct 2010 13:48:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9ODmBq5030060; Sun, 24 Oct 2010 13:48:11 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9ODmB7w030058; Sun, 24 Oct 2010 13:48:11 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201010241348.o9ODmB7w030058@svn.freebsd.org> From: Hans Petter Selasky Date: Sun, 24 Oct 2010 13:48:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214271 - head/usr.sbin/usbconfig X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Oct 2010 13:48:11 -0000 Author: hselasky Date: Sun Oct 24 13:48:11 2010 New Revision: 214271 URL: http://svn.freebsd.org/changeset/base/214271 Log: Remove stray semicolon. Submitted by: arundel Modified: head/usr.sbin/usbconfig/usbconfig.c Modified: head/usr.sbin/usbconfig/usbconfig.c ============================================================================== --- head/usr.sbin/usbconfig/usbconfig.c Sun Oct 24 13:43:45 2010 (r214270) +++ head/usr.sbin/usbconfig/usbconfig.c Sun Oct 24 13:48:11 2010 (r214271) @@ -640,7 +640,7 @@ main(int argc, char **argv) opt->bus = unit; opt->addr = addr; opt->got_bus = 1; -; opt->got_addr = 1; + opt->got_addr = 1; n++; break; From owner-svn-src-head@FreeBSD.ORG Sun Oct 24 14:04:52 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 59BB31065675; Sun, 24 Oct 2010 14:04:52 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 2DCC18FC17; Sun, 24 Oct 2010 14:04:52 +0000 (UTC) Received: from [10.57.169.185] (unknown [212.183.140.34]) by cyrus.watson.org (Postfix) with ESMTPSA id 41AD846B09; Sun, 24 Oct 2010 10:04:51 -0400 (EDT) References: <201010240914.o9O9ELh3022927@svn.freebsd.org> <20101024132017.GA77378@freebsd.org> Message-Id: From: "Robert N. M. Watson" To: Alexander Best In-Reply-To: <20101024132017.GA77378@freebsd.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Mailer: iPad Mail (7B500) Mime-Version: 1.0 (iPad Mail 7B500) Date: Sun, 24 Oct 2010 15:05:36 +0100 Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , Robert Watson Subject: Re: svn commit: r214261 - head/tools/tools/syscall_timing X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Oct 2010 14:04:52 -0000 On 24 Oct 2010, at 14:20, Alexander Best wrote: > On Sun Oct 24 10, Robert Watson wrote: >> Author: rwatson >> Date: Sun Oct 24 09:14:21 2010 >> New Revision: 214261 >> URL: http://svn.freebsd.org/changeset/base/214261 >>=20 >> Log: >> Add microbenchmark for create/unlink of a zero-byte file. >=20 > clang still complaining: >=20 > syscall_timing.c:766:24: warning: conversion specifies type 'int' but = the argument has type 'uintmax_t' (aka 'unsigned long') [-Wformat] > printf("%ju.%09ju\t%d\t", = (uintmax_t)ts_end.tv_sec, > ~^ > %lu > 1 warning generated. Hi Alexander: I also have detail feedback pending from Bruce on the uses of types in = this tool, which I hope to get to later this week! Since doing so is = sure to change the warnings, I'll revisit them then. In the mean time, = however, I'll keep updating to tool to finish up this chapter... :-) Thanks, Robert=20= From owner-svn-src-head@FreeBSD.ORG Sun Oct 24 15:31:42 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DD558106566C; Sun, 24 Oct 2010 15:31:41 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B15F58FC15; Sun, 24 Oct 2010 15:31:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9OFVffd032195; Sun, 24 Oct 2010 15:31:41 GMT (envelope-from uqs@svn.freebsd.org) Received: (from uqs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9OFVfCL032193; Sun, 24 Oct 2010 15:31:41 GMT (envelope-from uqs@svn.freebsd.org) Message-Id: <201010241531.o9OFVfCL032193@svn.freebsd.org> From: Ulrich Spoerlein Date: Sun, 24 Oct 2010 15:31:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214272 - head/usr.bin/lex X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Oct 2010 15:31:42 -0000 Author: uqs Date: Sun Oct 24 15:31:41 2010 New Revision: 214272 URL: http://svn.freebsd.org/changeset/base/214272 Log: flex: add missing ifdef magic to create/hide prototypes This unbreaks build for some software with higher WARNS flags. Reviewed by: rpaulo PR: bin/139319 (parts already committed in previous revision) Modified: head/usr.bin/lex/flex.skl Modified: head/usr.bin/lex/flex.skl ============================================================================== --- head/usr.bin/lex/flex.skl Sun Oct 24 13:48:11 2010 (r214271) +++ head/usr.bin/lex/flex.skl Sun Oct 24 15:31:41 2010 (r214272) @@ -747,7 +747,11 @@ void yyFlexLexer::LexerOutput( const cha */ %- +#ifdef YY_USE_PROTOS static int yy_get_next_buffer(void) +#else +static int yy_get_next_buffer() +#endif %+ int yyFlexLexer::yy_get_next_buffer() %* @@ -883,7 +887,11 @@ int yyFlexLexer::yy_get_next_buffer() /* yy_get_previous_state - get the state just before the EOB char was reached */ %- +#ifdef YY_USE_PROTOS static yy_state_type yy_get_previous_state(void) +#else +static yy_state_type yy_get_previous_state() +#endif %+ yy_state_type yyFlexLexer::yy_get_previous_state() %* @@ -983,7 +991,11 @@ void yyFlexLexer::yyunput( int c, char* #ifdef __cplusplus static int yyinput() #else +#ifdef YY_USE_PROTOS static int input(void) +#else +static int input() +#endif #endif %+ int yyFlexLexer::yyinput() @@ -1055,7 +1067,9 @@ int yyFlexLexer::yyinput() return c; } -#endif /* ifndef YY_NO_INPUT */ +%- +#endif /* ifndef YY_NO_INPUT */ +%* %- @@ -1404,7 +1418,11 @@ void yyFlexLexer::yy_push_state( int new #ifndef YY_NO_POP_STATE %- +#ifdef YY_USE_PROTOS +static void yy_pop_state(void) +#else static void yy_pop_state() +#endif %+ void yyFlexLexer::yy_pop_state() %* @@ -1419,7 +1437,11 @@ void yyFlexLexer::yy_pop_state() #ifndef YY_NO_TOP_STATE %- +#ifdef YY_USE_PROTOS +static int yy_top_state(void) +#else static int yy_top_state() +#endif %+ int yyFlexLexer::yy_top_state() %* From owner-svn-src-head@FreeBSD.ORG Sun Oct 24 15:38:58 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 752AF106566B; Sun, 24 Oct 2010 15:38:58 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 63B4C8FC1A; Sun, 24 Oct 2010 15:38:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9OFcwfa032460; Sun, 24 Oct 2010 15:38:58 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9OFcwUQ032458; Sun, 24 Oct 2010 15:38:58 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201010241538.o9OFcwUQ032458@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 24 Oct 2010 15:38:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214273 - head/sbin/hastd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Oct 2010 15:38:58 -0000 Author: pjd Date: Sun Oct 24 15:38:58 2010 New Revision: 214273 URL: http://svn.freebsd.org/changeset/base/214273 Log: Load geom_gate.ko module after parsing arguments. MFC after: 3 days Modified: head/sbin/hastd/hastd.c Modified: head/sbin/hastd/hastd.c ============================================================================== --- head/sbin/hastd/hastd.c Sun Oct 24 15:31:41 2010 (r214272) +++ head/sbin/hastd/hastd.c Sun Oct 24 15:38:58 2010 (r214273) @@ -701,8 +701,6 @@ main(int argc, char *argv[]) int debuglevel; sigset_t mask; - g_gate_load(); - foreground = false; debuglevel = 0; pidfile = HASTD_PIDFILE; @@ -736,6 +734,8 @@ main(int argc, char *argv[]) pjdlog_debug_set(debuglevel); + g_gate_load(); + pfh = pidfile_open(pidfile, 0600, &otherpid); if (pfh == NULL) { if (errno == EEXIST) { From owner-svn-src-head@FreeBSD.ORG Sun Oct 24 15:41:24 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 09208106566B; Sun, 24 Oct 2010 15:41:24 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EB47B8FC0A; Sun, 24 Oct 2010 15:41:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9OFfNrL032571; Sun, 24 Oct 2010 15:41:23 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9OFfN0N032567; Sun, 24 Oct 2010 15:41:23 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201010241541.o9OFfN0N032567@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 24 Oct 2010 15:41:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214274 - head/sbin/hastd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Oct 2010 15:41:24 -0000 Author: pjd Date: Sun Oct 24 15:41:23 2010 New Revision: 214274 URL: http://svn.freebsd.org/changeset/base/214274 Log: Plug memory leaks. Found with: valgrind MFC after: 3 days Modified: head/sbin/hastd/parse.y head/sbin/hastd/primary.c head/sbin/hastd/synch.h Modified: head/sbin/hastd/parse.y ============================================================================== --- head/sbin/hastd/parse.y Sun Oct 24 15:38:58 2010 (r214273) +++ head/sbin/hastd/parse.y Sun Oct 24 15:41:23 2010 (r214274) @@ -264,6 +264,7 @@ control_statement: CONTROL STR sizeof(depth0_control)) >= sizeof(depth0_control)) { pjdlog_error("control argument is too long."); + free($2); return (1); } break; @@ -274,12 +275,14 @@ control_statement: CONTROL STR sizeof(lconfig->hc_controladdr)) >= sizeof(lconfig->hc_controladdr)) { pjdlog_error("control argument is too long."); + free($2); return (1); } break; default: assert(!"control at wrong depth level"); } + free($2); } ; @@ -291,6 +294,7 @@ listen_statement: LISTEN STR sizeof(depth0_listen)) >= sizeof(depth0_listen)) { pjdlog_error("listen argument is too long."); + free($2); return (1); } break; @@ -301,12 +305,14 @@ listen_statement: LISTEN STR sizeof(lconfig->hc_listenaddr)) >= sizeof(lconfig->hc_listenaddr)) { pjdlog_error("listen argument is too long."); + free($2); return (1); } break; default: assert(!"listen at wrong depth level"); } + free($2); } ; @@ -357,6 +363,7 @@ exec_statement: EXEC STR if (strlcpy(depth0_exec, $2, sizeof(depth0_exec)) >= sizeof(depth0_exec)) { pjdlog_error("Exec path is too long."); + free($2); return (1); } break; @@ -367,12 +374,14 @@ exec_statement: EXEC STR sizeof(curres->hr_exec)) >= sizeof(curres->hr_exec)) { pjdlog_error("Exec path is too long."); + free($2); return (1); } break; default: assert(!"exec at wrong depth level"); } + free($2); } ; @@ -386,6 +395,7 @@ node_start: STR { switch (isitme($1)) { case -1: + free($1); return (1); case 0: break; @@ -395,6 +405,7 @@ node_start: STR default: assert(!"invalid isitme() return value"); } + free($1); } ; @@ -482,14 +493,17 @@ resource_start: STR curres = calloc(1, sizeof(*curres)); if (curres == NULL) { pjdlog_error("Unable to allocate memory for resource."); + free($1); return (1); } if (strlcpy(curres->hr_name, $1, sizeof(curres->hr_name)) >= sizeof(curres->hr_name)) { pjdlog_error("Resource name is too long."); + free($1); return (1); } + free($1); curres->hr_role = HAST_ROLE_INIT; curres->hr_previous_role = HAST_ROLE_INIT; curres->hr_replication = -1; @@ -530,6 +544,7 @@ name_statement: NAME STR sizeof(depth1_provname)) >= sizeof(depth1_provname)) { pjdlog_error("name argument is too long."); + free($2); return (1); } break; @@ -541,12 +556,14 @@ name_statement: NAME STR sizeof(curres->hr_provname)) >= sizeof(curres->hr_provname)) { pjdlog_error("name argument is too long."); + free($2); return (1); } break; default: assert(!"name at wrong depth level"); } + free($2); } ; @@ -558,6 +575,7 @@ local_statement: LOCAL STR sizeof(depth1_localpath)) >= sizeof(depth1_localpath)) { pjdlog_error("local argument is too long."); + free($2); return (1); } break; @@ -569,12 +587,14 @@ local_statement: LOCAL STR sizeof(curres->hr_localpath)) >= sizeof(curres->hr_localpath)) { pjdlog_error("local argument is too long."); + free($2); return (1); } break; default: assert(!"local at wrong depth level"); } + free($2); } ; @@ -589,6 +609,7 @@ resource_node_start: STR if (curres != NULL) { switch (isitme($1)) { case -1: + free($1); return (1); case 0: break; @@ -599,6 +620,7 @@ resource_node_start: STR assert(!"invalid isitme() return value"); } } + free($1); } ; @@ -624,8 +646,10 @@ remote_statement: REMOTE STR sizeof(curres->hr_remoteaddr)) >= sizeof(curres->hr_remoteaddr)) { pjdlog_error("remote argument is too long."); + free($2); return (1); } } + free($2); } ; Modified: head/sbin/hastd/primary.c ============================================================================== --- head/sbin/hastd/primary.c Sun Oct 24 15:38:58 2010 (r214273) +++ head/sbin/hastd/primary.c Sun Oct 24 15:41:23 2010 (r214274) @@ -646,6 +646,7 @@ init_remote(struct hast_resource *res, s */ (void)hast_activemap_flush(res); } + nv_free(nvin); pjdlog_info("Connected to %s.", res->hr_remoteaddr); if (inp != NULL && outp != NULL) { *inp = in; Modified: head/sbin/hastd/synch.h ============================================================================== --- head/sbin/hastd/synch.h Sun Oct 24 15:38:58 2010 (r214273) +++ head/sbin/hastd/synch.h Sun Oct 24 15:41:23 2010 (r214274) @@ -140,6 +140,8 @@ cv_init(pthread_cond_t *cv) assert(error == 0); error = pthread_cond_init(cv, &attr); assert(error == 0); + error = pthread_condattr_destroy(&attr); + assert(error == 0); } static __inline void cv_wait(pthread_cond_t *cv, pthread_mutex_t *lock) From owner-svn-src-head@FreeBSD.ORG Sun Oct 24 15:42:16 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C5CBD106564A; Sun, 24 Oct 2010 15:42:16 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B48428FC16; Sun, 24 Oct 2010 15:42:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9OFgG9W032630; Sun, 24 Oct 2010 15:42:16 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9OFgGCl032628; Sun, 24 Oct 2010 15:42:16 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201010241542.o9OFgGCl032628@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 24 Oct 2010 15:42:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214275 - head/sbin/hastd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Oct 2010 15:42:16 -0000 Author: pjd Date: Sun Oct 24 15:42:16 2010 New Revision: 214275 URL: http://svn.freebsd.org/changeset/base/214275 Log: Plug memory leak. MFC after: 3 days Modified: head/sbin/hastd/secondary.c Modified: head/sbin/hastd/secondary.c ============================================================================== --- head/sbin/hastd/secondary.c Sun Oct 24 15:41:23 2010 (r214274) +++ head/sbin/hastd/secondary.c Sun Oct 24 15:42:16 2010 (r214275) @@ -323,6 +323,8 @@ init_remote(struct hast_resource *res, s nv_free(nvout); exit(EX_TEMPFAIL); } + if (map != NULL) + free(map); nv_free(nvout); if (res->hr_secondary_localcnt > res->hr_primary_remotecnt && res->hr_primary_localcnt > res->hr_secondary_remotecnt) { From owner-svn-src-head@FreeBSD.ORG Sun Oct 24 15:44:23 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 55016106564A; Sun, 24 Oct 2010 15:44:23 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 439158FC13; Sun, 24 Oct 2010 15:44:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9OFiNq4032718; Sun, 24 Oct 2010 15:44:23 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9OFiNXZ032716; Sun, 24 Oct 2010 15:44:23 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201010241544.o9OFiNXZ032716@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 24 Oct 2010 15:44:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214276 - head/sbin/hastd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Oct 2010 15:44:23 -0000 Author: pjd Date: Sun Oct 24 15:44:23 2010 New Revision: 214276 URL: http://svn.freebsd.org/changeset/base/214276 Log: Simplify code a bit. MFC after: 3 days Modified: head/sbin/hastd/secondary.c Modified: head/sbin/hastd/secondary.c ============================================================================== --- head/sbin/hastd/secondary.c Sun Oct 24 15:42:16 2010 (r214275) +++ head/sbin/hastd/secondary.c Sun Oct 24 15:44:23 2010 (r214276) @@ -318,10 +318,8 @@ init_remote(struct hast_resource *res, s (uintmax_t)res->hr_secondary_remotecnt); } if (hast_proto_send(res, res->hr_remotein, nvout, map, mapsize) < 0) { - pjdlog_errno(LOG_WARNING, "Unable to send activemap to %s", + pjdlog_exit(EX_TEMPFAIL, "Unable to send activemap to %s", res->hr_remoteaddr); - nv_free(nvout); - exit(EX_TEMPFAIL); } if (map != NULL) free(map); From owner-svn-src-head@FreeBSD.ORG Sun Oct 24 15:56:21 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A02FB1065698; Sun, 24 Oct 2010 15:56:21 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8E6298FC1E; Sun, 24 Oct 2010 15:56:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9OFuL61032993; Sun, 24 Oct 2010 15:56:21 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9OFuLkE032990; Sun, 24 Oct 2010 15:56:21 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201010241556.o9OFuLkE032990@svn.freebsd.org> From: Jaakko Heinonen Date: Sun, 24 Oct 2010 15:56:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214277 - head/share/man/man9 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Oct 2010 15:56:21 -0000 Author: jh Date: Sun Oct 24 15:56:21 2010 New Revision: 214277 URL: http://svn.freebsd.org/changeset/base/214277 Log: Document make_dev_p(9). Reviewed by: brueffer, kib Modified: head/share/man/man9/Makefile head/share/man/man9/make_dev.9 Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Sun Oct 24 15:44:23 2010 (r214276) +++ head/share/man/man9/Makefile Sun Oct 24 15:56:21 2010 (r214277) @@ -775,7 +775,8 @@ MLINKS+=make_dev.9 destroy_dev.9 \ make_dev.9 dev_depends.9 \ make_dev.9 make_dev_alias.9 \ make_dev.9 make_dev_cred.9 \ - make_dev.9 make_dev_credf.9 + make_dev.9 make_dev_credf.9 \ + make_dev.9 make_dev_p.9 MLINKS+=malloc.9 free.9 \ malloc.9 MALLOC_DECLARE.9 \ malloc.9 MALLOC_DEFINE.9 \ Modified: head/share/man/man9/make_dev.9 ============================================================================== --- head/share/man/man9/make_dev.9 Sun Oct 24 15:44:23 2010 (r214276) +++ head/share/man/man9/make_dev.9 Sun Oct 24 15:56:21 2010 (r214277) @@ -24,13 +24,14 @@ .\" .\" $FreeBSD$ .\" -.Dd October 7, 2010 +.Dd October 24, 2010 .Dt MAKE_DEV 9 .Os .Sh NAME .Nm make_dev , .Nm make_dev_cred , .Nm make_dev_credf , +.Nm make_dev_p , .Nm make_dev_alias , .Nm destroy_dev , .Nm destroy_dev_sched , @@ -49,6 +50,8 @@ and DEVFS registration for devices .Fn make_dev_cred "struct cdevsw *cdevsw" "int unit" "struct ucred *cr" "uid_t uid" "gid_t gid" "int perms" "const char *fmt" ... .Ft struct cdev * .Fn make_dev_credf "int flags" "struct cdevsw *cdevsw" "int unit" "struct ucred *cr" "uid_t uid" "gid_t gid" "int perms" "const char *fmt" ... +.Ft int +.Fn make_dev_p "int flags" "struct cdev **cdev" "struct cdevsw *devsw" "struct ucred *cr" "uid_t uid" "gid_t gid" "int mode" "const char *fmt" ... .Ft struct cdev * .Fn make_dev_alias "struct cdev *pdev" "const char *fmt" ... .Ft void @@ -128,20 +131,22 @@ member of the initialized The .Va flags argument alters the operation of -.Fn make_dev_credf . +.Fn make_dev_credf +or +.Fn make_dev_p . The following values are currently accepted: .Pp .Bl -tag -width "MAKEDEV_CHECKNAME" -compact -offset indent .It MAKEDEV_REF reference the created device .It MAKEDEV_NOWAIT -do not sleep, may return NULL +do not sleep, the call may fail .It MAKEDEV_WAITOK allow the function to sleep to satisfy malloc .It MAKEDEV_ETERNAL created device will be never destroyed .It MAKEDEV_CHECKNAME -return NULL if the device name is invalid or already exists +return an error if the device name is invalid or already exists .El .Pp The @@ -190,6 +195,14 @@ make_dev_credf(0, cdevsw, unit, NULL, ui .Ed .Pp The +.Fn make_dev_p +function is similar to +.Fn make_dev_credf +but it may return an error number and takes a pointer to the resulting +.Ft *cdev +as an argument. +.Pp +The .Fn make_dev_alias function takes the returned .Ft cdev @@ -293,6 +306,44 @@ is called for all instantiated devices, unload until .Fn destroy_dev is actually finished for all of them. +.Sh RETURN VALUES +If successful, +.Fn make_dev_p +will return 0, otherwise it will return an error. +If successful, +.Fn make_dev_credf +will return a valid +.Fa cdev +pointer, otherwise it will return +.Dv NULL . +.Sh ERRORS +The +.Fn make_dev_p +call will fail and the device will be not registered if: +.Bl -tag -width Er +.It Bq Er ENOMEM +The +.Dv MAKEDEV_NOWAIT +flags was specified and a memory allocation request could not be satisfied. +.It Bq Er ENAMETOOLONG +The +.Dv MAKEDEV_CHECKNAME +flags was specified and the provided device name is longer than +.Dv SPECNAMELEN . +.It Bq Er EINVAL +The +.Dv MAKEDEV_CHECKNAME +flags was specified and the provided device name is empty, contains a +.Qq \&. +or +.Qq .. +path component or ends with +.Ql / . +.It Bq Er EEXIST +The +.Dv MAKEDEV_CHECKNAME +flags was specified and the provided device name already exists. +.El .Pp .Sh SEE ALSO .Xr devctl 4 , @@ -320,3 +371,7 @@ The functions .Fn destroy_dev_sched_cb first appeared in .Fx 7.0 . +The function +.Fn make_dev_p +first appeared in +.Fx 8.2 . From owner-svn-src-head@FreeBSD.ORG Sun Oct 24 16:10:33 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 54F2D1065670; Sun, 24 Oct 2010 16:10:33 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2943C8FC08; Sun, 24 Oct 2010 16:10:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9OGAXat033299; Sun, 24 Oct 2010 16:10:33 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9OGAX6a033297; Sun, 24 Oct 2010 16:10:33 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201010241610.o9OGAX6a033297@svn.freebsd.org> From: Jaakko Heinonen Date: Sun, 24 Oct 2010 16:10:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214278 - head/share/man/man9 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Oct 2010 16:10:33 -0000 Author: jh Date: Sun Oct 24 16:10:32 2010 New Revision: 214278 URL: http://svn.freebsd.org/changeset/base/214278 Log: Use .Dv with NULL. Modified: head/share/man/man9/make_dev.9 Modified: head/share/man/man9/make_dev.9 ============================================================================== --- head/share/man/man9/make_dev.9 Sun Oct 24 15:56:21 2010 (r214277) +++ head/share/man/man9/make_dev.9 Sun Oct 24 16:10:32 2010 (r214278) @@ -271,7 +271,9 @@ After .Fn destroy_dev is finished, and if the supplied .Fa cb -is not NULL, the callback +is not +.Dv NULL , +the callback .Fa cb is called, with argument .Fa arg . From owner-svn-src-head@FreeBSD.ORG Sun Oct 24 16:31:58 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 446131065672; Sun, 24 Oct 2010 16:31:58 +0000 (UTC) (envelope-from brucec@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 30EA68FC17; Sun, 24 Oct 2010 16:31:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9OGVw6B033822; Sun, 24 Oct 2010 16:31:58 GMT (envelope-from brucec@svn.freebsd.org) Received: (from brucec@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9OGVw1C033817; Sun, 24 Oct 2010 16:31:58 GMT (envelope-from brucec@svn.freebsd.org) Message-Id: <201010241631.o9OGVw1C033817@svn.freebsd.org> From: Bruce Cran Date: Sun, 24 Oct 2010 16:31:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214279 - in head: share/man/man4 sys/cam sys/cam/ata sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Oct 2010 16:31:58 -0000 Author: brucec Date: Sun Oct 24 16:31:57 2010 New Revision: 214279 URL: http://svn.freebsd.org/changeset/base/214279 Log: Mostly revert r203420, and add similar functionality into ada(4) since the existing code caused problems with some SCSI controllers. A new sysctl kern.cam.ada.spindown_shutdown has been added that controls whether or not to spin-down disks when shutting down. Spinning down the disks unloads/parks the heads - this is much better than removing power when the disk is still spinning because otherwise an Emergency Unload occurs which may cause damage to the actuator. PR: kern/140752 Submitted by: olli Reviewed by: arundel Discussed with: mav MFC after: 2 weeks Modified: head/share/man/man4/ada.4 head/sys/cam/ata/ata_da.c head/sys/cam/cam_xpt.c head/sys/kern/kern_shutdown.c Modified: head/share/man/man4/ada.4 ============================================================================== --- head/share/man/man4/ada.4 Sun Oct 24 16:10:32 2010 (r214278) +++ head/share/man/man4/ada.4 Sun Oct 24 16:31:57 2010 (r214279) @@ -118,6 +118,9 @@ This variable determines how long the driver will wait before timing out an outstanding command. The units for this value are seconds, and the default is currently 30 seconds. +.It kern.cam.ada.spindown_shutdown +.Pp +This variable determines whether to spin-down disks when shutting down. .El .Sh FILES .Bl -tag -width ".Pa /dev/ada*" -compact Modified: head/sys/cam/ata/ata_da.c ============================================================================== --- head/sys/cam/ata/ata_da.c Sun Oct 24 16:10:32 2010 (r214278) +++ head/sys/cam/ata/ata_da.c Sun Oct 24 16:31:57 2010 (r214279) @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #endif /* _KERNEL */ @@ -79,7 +80,8 @@ typedef enum { ADA_FLAG_CAN_TRIM = 0x080, ADA_FLAG_OPEN = 0x100, ADA_FLAG_SCTX_INIT = 0x200, - ADA_FLAG_CAN_CFA = 0x400 + ADA_FLAG_CAN_CFA = 0x400, + ADA_FLAG_CAN_POWERMGT = 0x800 } ada_flags; typedef enum { @@ -180,6 +182,10 @@ static void adashutdown(void *arg, int #define ADA_DEFAULT_SEND_ORDERED 1 #endif +#ifndef ADA_DEFAULT_SPINDOWN_SHUTDOWN +#define ADA_DEFAULT_SPINDOWN_SHUTDOWN 1 +#endif + /* * Most platforms map firmware geometry to actual, but some don't. If * not overridden, default to nothing. @@ -191,6 +197,7 @@ static void adashutdown(void *arg, int 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; +static int ada_spindown_shutdown = ADA_DEFAULT_SPINDOWN_SHUTDOWN; SYSCTL_NODE(_kern_cam, OID_AUTO, ada, CTLFLAG_RD, 0, "CAM Direct Access Disk driver"); @@ -203,6 +210,9 @@ TUNABLE_INT("kern.cam.ada.default_timeou SYSCTL_INT(_kern_cam_ada, OID_AUTO, ada_send_ordered, CTLFLAG_RW, &ada_send_ordered, 0, "Send Ordered Tags"); TUNABLE_INT("kern.cam.ada.ada_send_ordered", &ada_send_ordered); +SYSCTL_INT(_kern_cam_ada, OID_AUTO, spindown_shutdown, CTLFLAG_RW, + &ada_spindown_shutdown, 0, "Spin down upon shutdown"); +TUNABLE_INT("kern.cam.ada.spindown_shutdown", &ada_spindown_shutdown); /* * ADA_ORDEREDTAG_INTERVAL determines how often, relative @@ -665,6 +675,8 @@ adaregister(struct cam_periph *periph, v softc->flags |= ADA_FLAG_CAN_48BIT; if (cgd->ident_data.support.command2 & ATA_SUPPORT_FLUSHCACHE) softc->flags |= ADA_FLAG_CAN_FLUSHCACHE; + if (cgd->ident_data.support.command1 & ATA_SUPPORT_POWERMGT) + softc->flags |= ADA_FLAG_CAN_POWERMGT; if (cgd->ident_data.satacapabilities & ATA_SUPPORT_NCQ && cgd->inq_flags & SID_CmdQue) softc->flags |= ADA_FLAG_CAN_NCQ; @@ -1227,6 +1239,56 @@ adashutdown(void * arg, int howto) /*getcount_only*/0); cam_periph_unlock(periph); } + + if (ada_spindown_shutdown == 0 || + (howto & (RB_HALT | RB_POWEROFF)) == 0) + return; + + TAILQ_FOREACH(periph, &adadriver.units, unit_links) { + union ccb ccb; + + /* If we paniced with lock held - not recurse here. */ + if (cam_periph_owned(periph)) + continue; + cam_periph_lock(periph); + softc = (struct ada_softc *)periph->softc; + /* + * We only spin-down the drive if it is capable of it.. + */ + if ((softc->flags & ADA_FLAG_CAN_POWERMGT) == 0) { + cam_periph_unlock(periph); + continue; + } + + if (bootverbose) + xpt_print(periph->path, "spin-down\n"); + + xpt_setup_ccb(&ccb.ccb_h, periph->path, CAM_PRIORITY_NORMAL); + + ccb.ccb_h.ccb_state = ADA_CCB_DUMP; + cam_fill_ataio(&ccb.ataio, + 1, + adadone, + CAM_DIR_NONE, + 0, + NULL, + 0, + ada_default_timeout*1000); + + ata_28bit_cmd(&ccb.ataio, ATA_STANDBY_IMMEDIATE, 0, 0, 0); + xpt_polled_action(&ccb); + + if ((ccb.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) + xpt_print(periph->path, "Spin-down disk failed\n"); + + if ((ccb.ccb_h.status & CAM_DEV_QFRZN) != 0) + cam_release_devq(ccb.ccb_h.path, + /*relsim_flags*/0, + /*reduction*/0, + /*timeout*/0, + /*getcount_only*/0); + cam_periph_unlock(periph); + } } #endif /* _KERNEL */ Modified: head/sys/cam/cam_xpt.c ============================================================================== --- head/sys/cam/cam_xpt.c Sun Oct 24 16:10:32 2010 (r214278) +++ head/sys/cam/cam_xpt.c Sun Oct 24 16:31:57 2010 (r214279) @@ -39,7 +39,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -153,10 +152,6 @@ static struct xpt_softc xsoftc; TUNABLE_INT("kern.cam.boot_delay", &xsoftc.boot_delay); SYSCTL_INT(_kern_cam, OID_AUTO, boot_delay, CTLFLAG_RDTUN, &xsoftc.boot_delay, 0, "Bus registration wait time"); -static int xpt_power_down = 0; -TUNABLE_INT("kern.cam.power_down", &xpt_power_down); -SYSCTL_INT(_kern_cam, OID_AUTO, power_down, CTLFLAG_RW, - &xpt_power_down, 0, "Power down devices on shutdown"); /* Queues for our software interrupt handler */ typedef TAILQ_HEAD(cam_isrq, ccb_hdr) cam_isrq_t; @@ -250,7 +245,6 @@ static struct cam_ed* xpt_find_device(struct cam_et *target, lun_id_t lun_id); static void xpt_config(void *arg); static xpt_devicefunc_t xptpassannouncefunc; -static void xpt_shutdown(void *arg, int howto); static void xptaction(struct cam_sim *sim, union ccb *work_ccb); static void xptpoll(struct cam_sim *sim); static void camisr(void *); @@ -4538,12 +4532,6 @@ xpt_config(void *arg) #endif /* CAM_DEBUG_BUS */ #endif /* CAMDEBUG */ - /* Register our shutdown event handler */ - if ((EVENTHANDLER_REGISTER(shutdown_final, xpt_shutdown, - NULL, SHUTDOWN_PRI_FIRST)) == NULL) { - printf("xpt_config: failed to register shutdown event.\n"); - } - periphdriver_init(1); xpt_hold_boot(); callout_init(&xsoftc.boot_callout, 1); @@ -4625,87 +4613,6 @@ xpt_finishconfig_task(void *context, int free(context, M_CAMXPT); } -/* - * Power down all devices when we are going to power down the system. - */ -static void -xpt_shutdown_dev_done(struct cam_periph *periph, union ccb *done_ccb) -{ - - /* No-op. We're polling. */ - return; -} - -static int -xpt_shutdown_dev(struct cam_ed *device, void *arg) -{ - union ccb ccb; - struct cam_path path; - - if (device->flags & CAM_DEV_UNCONFIGURED) - return (1); - - if (device->protocol == PROTO_ATA) { - /* Only power down device if it supports power management. */ - if ((device->ident_data.support.command1 & - ATA_SUPPORT_POWERMGT) == 0) - return (1); - } else if (device->protocol != PROTO_SCSI) - return (1); - - xpt_compile_path(&path, - NULL, - device->target->bus->path_id, - device->target->target_id, - device->lun_id); - xpt_setup_ccb(&ccb.ccb_h, &path, CAM_PRIORITY_NORMAL); - if (device->protocol == PROTO_ATA) { - cam_fill_ataio(&ccb.ataio, - 1, - xpt_shutdown_dev_done, - CAM_DIR_NONE, - 0, - NULL, - 0, - 30*1000); - ata_28bit_cmd(&ccb.ataio, ATA_SLEEP, 0, 0, 0); - } else { - scsi_start_stop(&ccb.csio, - /*retries*/1, - xpt_shutdown_dev_done, - MSG_SIMPLE_Q_TAG, - /*start*/FALSE, - /*load/eject*/FALSE, - /*immediate*/TRUE, - SSD_FULL_SIZE, - /*timeout*/50*1000); - } - xpt_polled_action(&ccb); - - if ((ccb.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) - xpt_print(&path, "Device power down failed\n"); - if ((ccb.ccb_h.status & CAM_DEV_QFRZN) != 0) - cam_release_devq(ccb.ccb_h.path, - /*relsim_flags*/0, - /*reduction*/0, - /*timeout*/0, - /*getcount_only*/0); - xpt_release_path(&path); - return (1); -} - -static void -xpt_shutdown(void * arg, int howto) -{ - - if (!xpt_power_down) - return; - if ((howto & RB_POWEROFF) == 0) - return; - - xpt_for_all_devices(xpt_shutdown_dev, NULL); -} - cam_status xpt_register_async(int event, ac_callback_t *cbfunc, void *cbarg, struct cam_path *path) Modified: head/sys/kern/kern_shutdown.c ============================================================================== --- head/sys/kern/kern_shutdown.c Sun Oct 24 16:10:32 2010 (r214278) +++ head/sys/kern/kern_shutdown.c Sun Oct 24 16:31:57 2010 (r214279) @@ -144,7 +144,7 @@ shutdown_conf(void *unused) { EVENTHANDLER_REGISTER(shutdown_final, poweroff_wait, NULL, - SHUTDOWN_PRI_FIRST + 100); + SHUTDOWN_PRI_FIRST); EVENTHANDLER_REGISTER(shutdown_final, shutdown_halt, NULL, SHUTDOWN_PRI_LAST + 100); EVENTHANDLER_REGISTER(shutdown_final, shutdown_panic, NULL, From owner-svn-src-head@FreeBSD.ORG Sun Oct 24 16:35:36 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 43CA9106566C; Sun, 24 Oct 2010 16:35:36 +0000 (UTC) (envelope-from bruce@cran.org.uk) Received: from muon.cran.org.uk (muon.cran.org.uk [IPv6:2a01:348:0:15:5d59:5c40:0:1]) by mx1.freebsd.org (Postfix) with ESMTP id D06038FC0C; Sun, 24 Oct 2010 16:35:35 +0000 (UTC) Received: from muon.cran.org.uk (localhost [127.0.0.1]) by muon.cran.org.uk (Postfix) with ESMTP id 11E6AE7F6E; Sun, 24 Oct 2010 17:35:35 +0100 (BST) Received: from core.nessbank (client-81-107-142-135.midd.adsl.virginmedia.com [81.107.142.135]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by muon.cran.org.uk (Postfix) with ESMTPSA; Sun, 24 Oct 2010 17:35:34 +0100 (BST) From: Bruce Cran To: src-committers@freebsd.org Date: Sun, 24 Oct 2010 17:35:32 +0100 User-Agent: KMail/1.13.5 (FreeBSD/9.0-CURRENT; KDE/4.5.1; amd64; ; ) References: <201010241631.o9OGVw1C033817@svn.freebsd.org> In-Reply-To: <201010241631.o9OGVw1C033817@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201010241735.32876.bruce@cran.org.uk> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r214279 - in head: share/man/man4 sys/cam sys/cam/ata sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Oct 2010 16:35:36 -0000 On Sunday 24 October 2010 17:31:58 Bruce Cran wrote: > Log: > Mostly revert r203420, and add similar functionality into ada(4) since > the existing code caused problems with some SCSI controllers. > > A new sysctl kern.cam.ada.spindown_shutdown has been added that controls > whether or not to spin-down disks when shutting down. > Spinning down the disks unloads/parks the heads - this is > much better than removing power when the disk is still > spinning because otherwise an Emergency Unload occurs which may cause > damage to the actuator. The FLUSH CACHE + STANDBY IMMEDIATE commands are issued (instead of just SLEEP) following the procedure documented in Fujitsu's MHW series product documentation under section 1.10.1, "Recommended power-off sequence". -- Bruce Cran From owner-svn-src-head@FreeBSD.ORG Sun Oct 24 16:55:17 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CEEAE1065670; Sun, 24 Oct 2010 16:55:17 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BD1288FC08; Sun, 24 Oct 2010 16:55:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9OGtHb3034337; Sun, 24 Oct 2010 16:55:17 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9OGtHYE034334; Sun, 24 Oct 2010 16:55:17 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201010241655.o9OGtHYE034334@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 24 Oct 2010 16:55:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214280 - head/tools/regression/bin/sh/parser X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Oct 2010 16:55:17 -0000 Author: jilles Date: Sun Oct 24 16:55:17 2010 New Revision: 214280 URL: http://svn.freebsd.org/changeset/base/214280 Log: sh: Add some testcases for alias expansion. Added: head/tools/regression/bin/sh/parser/alias1.0 (contents, props changed) head/tools/regression/bin/sh/parser/alias2.0 (contents, props changed) Added: head/tools/regression/bin/sh/parser/alias1.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/parser/alias1.0 Sun Oct 24 16:55:17 2010 (r214280) @@ -0,0 +1,5 @@ +# $FreeBSD$ + +alias alias0=exit +eval 'alias0 0' +exit 1 Added: head/tools/regression/bin/sh/parser/alias2.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/parser/alias2.0 Sun Oct 24 16:55:17 2010 (r214280) @@ -0,0 +1,6 @@ +# $FreeBSD$ + +alias alias0=exit +x=alias0 +eval 'case $x in alias0) exit 0;; esac' +exit 1 From owner-svn-src-head@FreeBSD.ORG Sun Oct 24 17:03:23 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3F6E8106566C; Sun, 24 Oct 2010 17:03:23 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-fx0-f54.google.com (mail-fx0-f54.google.com [209.85.161.54]) by mx1.freebsd.org (Postfix) with ESMTP id 676188FC13; Sun, 24 Oct 2010 17:03:21 +0000 (UTC) Received: by fxm17 with SMTP id 17so2179951fxm.13 for ; Sun, 24 Oct 2010 10:03:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :x-enigmail-version:content-type:content-transfer-encoding; bh=mCIztr/xowHskuQsaz9rG/AXkbudb6MEwChNz7qITpI=; b=jDvkYfB56w5X0z2HcTIjWJOK+FX/3WWC5rwbLh6khhUwufk30YHKTsnoYOvbxYW8Sm aMbx3JvFVlgPgUi6DEd4JUMMtvAob6v4u4oPAx+cX68clTm9LsWcyO8GBEPa1i1GbA9H CwQDolM9ar6i3k62hXuwiTH2ryjHRZaMOkc8I= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; b=Y8lkaTw/cRjULrnssFzNmCzsIqVM1mc4uYYuRgc/4egyrGl9EY9UG01T7Aqr0j9P3i SfUFrzwql57n69hKTXrT5UnWpdGq3Kx891Zai+2+4F51lkiPDbqLhg7FP2Jd9vCuXDWJ 8/7Ymvk275ALiKASQWNYhGxp0A5laJy6E/9vY= Received: by 10.103.192.8 with SMTP id u8mr6771297mup.20.1287939801167; Sun, 24 Oct 2010 10:03:21 -0700 (PDT) Received: from mavbook2.mavhome.dp.ua (pc.mavhome.dp.ua [212.86.226.226]) by mx.google.com with ESMTPS id n8sm2443619faa.7.2010.10.24.10.03.18 (version=SSLv3 cipher=RC4-MD5); Sun, 24 Oct 2010 10:03:19 -0700 (PDT) Sender: Alexander Motin Message-ID: <4CC466D5.6080306@FreeBSD.org> Date: Sun, 24 Oct 2010 20:03:17 +0300 From: Alexander Motin User-Agent: Thunderbird 2.0.0.23 (X11/20091212) MIME-Version: 1.0 To: Bruce Cran References: <201010241631.o9OGVw1C033817@svn.freebsd.org> <201010241735.32876.bruce@cran.org.uk> In-Reply-To: <201010241735.32876.bruce@cran.org.uk> X-Enigmail-Version: 0.96.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r214279 - in head: share/man/man4 sys/cam sys/cam/ata sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Oct 2010 17:03:23 -0000 Bruce Cran wrote: > On Sunday 24 October 2010 17:31:58 Bruce Cran wrote: > >> Log: >> Mostly revert r203420, and add similar functionality into ada(4) since >> the existing code caused problems with some SCSI controllers. Proper way would be IMHO to fix polling in aac driver. >> A new sysctl kern.cam.ada.spindown_shutdown has been added that controls >> whether or not to spin-down disks when shutting down. >> Spinning down the disks unloads/parks the heads - this is >> much better than removing power when the disk is still >> spinning because otherwise an Emergency Unload occurs which may cause >> damage to the actuator. > > The FLUSH CACHE + STANDBY IMMEDIATE commands are issued (instead of just > SLEEP) following the procedure documented in Fujitsu's MHW series product > documentation under section 1.10.1, "Recommended power-off sequence". Not instead of "just SLEEP", but instead of FLUSH CACHE (by respective peripheral driver) + SLEEP (by xpt). It should probably be the same. Just for the note, SCSI specification states that STOP automatically implies FLUSH CACHE. ATA - doesn't. -- Alexander Motin From owner-svn-src-head@FreeBSD.ORG Sun Oct 24 17:06:50 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 697A8106566B; Sun, 24 Oct 2010 17:06:50 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3CFA58FC1F; Sun, 24 Oct 2010 17:06:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9OH6o59034600; Sun, 24 Oct 2010 17:06:50 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9OH6oOV034597; Sun, 24 Oct 2010 17:06:50 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201010241706.o9OH6oOV034597@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 24 Oct 2010 17:06:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214281 - in head: bin/sh tools/regression/bin/sh/parser X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Oct 2010 17:06:50 -0000 Author: jilles Date: Sun Oct 24 17:06:49 2010 New Revision: 214281 URL: http://svn.freebsd.org/changeset/base/214281 Log: sh: Change ! within a pipeline to start a new pipeline instead. This is how ksh93 treats ! within a pipeline and makes the ! in a | ! b | c negate the exit status of the pipeline, as if it were a | { ! b | c; } Side effect: something like f() ! a is now a syntax error, because a function definition takes a command, not a pipeline. Exp-run done by: pav (with some other sh(1) changes) Added: head/tools/regression/bin/sh/parser/pipe-not1.0 (contents, props changed) Modified: head/bin/sh/parser.c Modified: head/bin/sh/parser.c ============================================================================== --- head/bin/sh/parser.c Sun Oct 24 16:55:17 2010 (r214280) +++ head/bin/sh/parser.c Sun Oct 24 17:06:49 2010 (r214281) @@ -328,7 +328,7 @@ pipeline(void) { union node *n1, *n2, *pipenode; struct nodelist *lp, *prev; - int negate; + int negate, t; negate = 0; checkkwd = 2; @@ -347,7 +347,13 @@ pipeline(void) do { prev = lp; lp = (struct nodelist *)stalloc(sizeof (struct nodelist)); - lp->n = command(); + checkkwd = 2; + t = readtoken(); + tokpushback++; + if (t == TNOT) + lp->n = pipeline(); + else + lp->n = command(); prev->next = lp; } while (readtoken() == TPIPE); lp->next = NULL; @@ -372,7 +378,7 @@ command(void) union node *ap, **app; union node *cp, **cpp; union node *redir, **rpp; - int t, negate = 0; + int t; checkkwd = 2; redir = NULL; @@ -387,12 +393,6 @@ command(void) } tokpushback++; - while (readtoken() == TNOT) { - TRACE(("command: TNOT recognized\n")); - negate = !negate; - } - tokpushback++; - switch (readtoken()) { case TIF: n1 = (union node *)stalloc(sizeof (struct nif)); @@ -573,7 +573,7 @@ TRACE(("expecting DO got %s %s\n", tokna case TRP: tokpushback++; n1 = simplecmd(rpp, redir); - goto checkneg; + return n1; default: synexpect(-1); } @@ -596,15 +596,7 @@ TRACE(("expecting DO got %s %s\n", tokna n1->nredir.redirect = redir; } -checkneg: - if (negate) { - n2 = (union node *)stalloc(sizeof (struct nnot)); - n2->type = NNOT; - n2->nnot.com = n1; - return n2; - } - else - return n1; + return n1; } Added: head/tools/regression/bin/sh/parser/pipe-not1.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/parser/pipe-not1.0 Sun Oct 24 17:06:49 2010 (r214281) @@ -0,0 +1,3 @@ +# $FreeBSD$ + +: | ! : | false From owner-svn-src-head@FreeBSD.ORG Sun Oct 24 17:22:35 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F22391065675; Sun, 24 Oct 2010 17:22:34 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C6B038FC0A; Sun, 24 Oct 2010 17:22:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9OHMYMW034966; Sun, 24 Oct 2010 17:22:34 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9OHMYXS034963; Sun, 24 Oct 2010 17:22:34 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201010241722.o9OHMYXS034963@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 24 Oct 2010 17:22:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214282 - head/sbin/hastd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Oct 2010 17:22:35 -0000 Author: pjd Date: Sun Oct 24 17:22:34 2010 New Revision: 214282 URL: http://svn.freebsd.org/changeset/base/214282 Log: Move all NV defines into nv.c, they are not used externally thus there is no need to make then visible from outside. MFC after: 3 days Modified: head/sbin/hastd/nv.c head/sbin/hastd/nv.h Modified: head/sbin/hastd/nv.c ============================================================================== --- head/sbin/hastd/nv.c Sun Oct 24 17:06:49 2010 (r214281) +++ head/sbin/hastd/nv.c Sun Oct 24 17:22:34 2010 (r214282) @@ -46,6 +46,33 @@ __FBSDID("$FreeBSD$"); #include #include +#define NV_TYPE_INT8 1 +#define NV_TYPE_UINT8 2 +#define NV_TYPE_INT16 3 +#define NV_TYPE_UINT16 4 +#define NV_TYPE_INT32 5 +#define NV_TYPE_UINT32 6 +#define NV_TYPE_INT64 7 +#define NV_TYPE_UINT64 8 +#define NV_TYPE_INT8_ARRAY 9 +#define NV_TYPE_UINT8_ARRAY 10 +#define NV_TYPE_INT16_ARRAY 11 +#define NV_TYPE_UINT16_ARRAY 12 +#define NV_TYPE_INT32_ARRAY 13 +#define NV_TYPE_UINT32_ARRAY 14 +#define NV_TYPE_INT64_ARRAY 15 +#define NV_TYPE_UINT64_ARRAY 16 +#define NV_TYPE_STRING 17 + +#define NV_TYPE_MASK 0x7f +#define NV_TYPE_FIRST NV_TYPE_INT8 +#define NV_TYPE_LAST NV_TYPE_STRING + +#define NV_ORDER_NETWORK 0x00 +#define NV_ORDER_HOST 0x80 + +#define NV_ORDER_MASK 0x80 + #define NV_MAGIC 0xaea1e struct nv { int nv_magic; Modified: head/sbin/hastd/nv.h ============================================================================== --- head/sbin/hastd/nv.h Sun Oct 24 17:06:49 2010 (r214281) +++ head/sbin/hastd/nv.h Sun Oct 24 17:22:34 2010 (r214282) @@ -41,33 +41,6 @@ #include -#define NV_TYPE_INT8 1 -#define NV_TYPE_UINT8 2 -#define NV_TYPE_INT16 3 -#define NV_TYPE_UINT16 4 -#define NV_TYPE_INT32 5 -#define NV_TYPE_UINT32 6 -#define NV_TYPE_INT64 7 -#define NV_TYPE_UINT64 8 -#define NV_TYPE_INT8_ARRAY 9 -#define NV_TYPE_UINT8_ARRAY 10 -#define NV_TYPE_INT16_ARRAY 11 -#define NV_TYPE_UINT16_ARRAY 12 -#define NV_TYPE_INT32_ARRAY 13 -#define NV_TYPE_UINT32_ARRAY 14 -#define NV_TYPE_INT64_ARRAY 15 -#define NV_TYPE_UINT64_ARRAY 16 -#define NV_TYPE_STRING 17 - -#define NV_TYPE_MASK 0x7f -#define NV_TYPE_FIRST NV_TYPE_INT8 -#define NV_TYPE_LAST NV_TYPE_STRING - -#define NV_ORDER_NETWORK 0x00 -#define NV_ORDER_HOST 0x80 - -#define NV_ORDER_MASK 0x80 - struct nv; struct nv *nv_alloc(void); From owner-svn-src-head@FreeBSD.ORG Sun Oct 24 17:24:08 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CA360106566B; Sun, 24 Oct 2010 17:24:08 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9E4948FC08; Sun, 24 Oct 2010 17:24:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9OHO8Hs035034; Sun, 24 Oct 2010 17:24:08 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9OHO8FU035031; Sun, 24 Oct 2010 17:24:08 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201010241724.o9OHO8FU035031@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 24 Oct 2010 17:24:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214283 - head/sbin/hastd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Oct 2010 17:24:08 -0000 Author: pjd Date: Sun Oct 24 17:24:08 2010 New Revision: 214283 URL: http://svn.freebsd.org/changeset/base/214283 Log: Implement nv_exists() function that returns true if argument of the given name exists. MFC after: 3 days Modified: head/sbin/hastd/nv.c head/sbin/hastd/nv.h Modified: head/sbin/hastd/nv.c ============================================================================== --- head/sbin/hastd/nv.c Sun Oct 24 17:22:34 2010 (r214282) +++ head/sbin/hastd/nv.c Sun Oct 24 17:24:08 2010 (r214283) @@ -46,6 +46,8 @@ __FBSDID("$FreeBSD$"); #include #include +#define NV_TYPE_NONE 0 + #define NV_TYPE_INT8 1 #define NV_TYPE_UINT8 2 #define NV_TYPE_INT16 3 @@ -561,6 +563,29 @@ nv_get_string(struct nv *nv, const char return (str); } +bool +nv_exists(struct nv *nv, const char *namefmt, ...) +{ + struct nvhdr *nvh; + va_list nameap; + int snverror, serrno; + + if (nv == NULL) + return (false); + + serrno = errno; + snverror = nv->nv_error; + + va_start(nameap, namefmt); + nvh = nv_find(nv, NV_TYPE_NONE, namefmt, nameap); + va_end(nameap); + + errno = serrno; + nv->nv_error = snverror; + + return (nvh != NULL); +} + /* * Dump content of the nv structure. */ @@ -797,7 +822,8 @@ nv_find(struct nv *nv, int type, const c assert(size >= NVH_SIZE(nvh)); nv_swap(nvh, true); if (strcmp(nvh->nvh_name, name) == 0) { - if ((nvh->nvh_type & NV_TYPE_MASK) != type) { + if (type != NV_TYPE_NONE && + (nvh->nvh_type & NV_TYPE_MASK) != type) { errno = EINVAL; if (nv->nv_error == 0) nv->nv_error = EINVAL; Modified: head/sbin/hastd/nv.h ============================================================================== --- head/sbin/hastd/nv.h Sun Oct 24 17:22:34 2010 (r214282) +++ head/sbin/hastd/nv.h Sun Oct 24 17:24:08 2010 (r214283) @@ -126,6 +126,7 @@ const uint64_t *nv_get_uint64_array(stru const char *nv_get_string(struct nv *nv, const char *namefmt, ...) __printflike(2, 3); +bool nv_exists(struct nv *nv, const char *namefmt, ...) __printflike(2, 3); void nv_dump(struct nv *nv); #endif /* !_NV_H_ */ From owner-svn-src-head@FreeBSD.ORG Sun Oct 24 17:28:25 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C1CCD106564A; Sun, 24 Oct 2010 17:28:25 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B01468FC1A; Sun, 24 Oct 2010 17:28:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9OHSP6H035154; Sun, 24 Oct 2010 17:28:25 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9OHSPQV035151; Sun, 24 Oct 2010 17:28:25 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201010241728.o9OHSPQV035151@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 24 Oct 2010 17:28:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214284 - head/sbin/hastd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Oct 2010 17:28:25 -0000 Author: pjd Date: Sun Oct 24 17:28:25 2010 New Revision: 214284 URL: http://svn.freebsd.org/changeset/base/214284 Log: Before this change on first connect between primary and secondary we initialize all the data. This is huge waste of time and resources if there were no writes yet, as there is no real data to synchronize. Optimize this by sending "virgin" argument to secondary, which gives it a hint that synchronization is not needed. In the common case (where noth nodes are configured at the same time) instead of synchronizing everything, we don't synchronize at all. MFC after: 1 week Modified: head/sbin/hastd/primary.c head/sbin/hastd/secondary.c Modified: head/sbin/hastd/primary.c ============================================================================== --- head/sbin/hastd/primary.c Sun Oct 24 17:24:08 2010 (r214283) +++ head/sbin/hastd/primary.c Sun Oct 24 17:28:25 2010 (r214284) @@ -417,6 +417,24 @@ init_environment(struct hast_resource *r } } +static bool +init_resuid(struct hast_resource *res) +{ + + mtx_lock(&metadata_lock); + if (res->hr_resuid != 0) { + mtx_unlock(&metadata_lock); + return (false); + } else { + /* Initialize unique resource identifier. */ + arc4random_buf(&res->hr_resuid, sizeof(res->hr_resuid)); + mtx_unlock(&metadata_lock); + if (metadata_write(res) < 0) + exit(EX_NOINPUT); + return (true); + } +} + static void init_local(struct hast_resource *res) { @@ -452,10 +470,12 @@ init_local(struct hast_resource *res) if (res->hr_resuid != 0) return; /* - * We're using provider for the first time, so we have to generate - * resource unique identifier and initialize local and remote counts. + * We're using provider for the first time. Initialize local and remote + * counters. We don't initialize resuid here, as we want to do it just + * in time. The reason for this is that we want to inform secondary + * that there were no writes yet, so there is no need to synchronize + * anything. */ - arc4random_buf(&res->hr_resuid, sizeof(res->hr_resuid)); res->hr_primary_localcnt = 1; res->hr_primary_remotecnt = 0; if (metadata_write(res) < 0) @@ -566,6 +586,19 @@ init_remote(struct hast_resource *res, s nv_add_string(nvout, res->hr_name, "resource"); nv_add_uint8_array(nvout, res->hr_token, sizeof(res->hr_token), "token"); + if (res->hr_resuid == 0) { + /* + * The resuid field was not yet initialized. + * Because we do synchronization inside init_resuid(), it is + * possible that someone already initialized it, the function + * will return false then, but if we successfully initialized + * it, we will get true. True means that there were no writes + * to this resource yet and we want to inform secondary that + * synchronization is not needed by sending "virgin" argument. + */ + if (init_resuid(res)) + nv_add_int8(nvout, 1, "virgin"); + } nv_add_uint64(nvout, res->hr_resuid, "resuid"); nv_add_uint64(nvout, res->hr_primary_localcnt, "localcnt"); nv_add_uint64(nvout, res->hr_primary_remotecnt, "remotecnt"); @@ -1006,6 +1039,10 @@ ggate_recv_thread(void *arg) QUEUE_INSERT1(hio, send, ncomp); break; case BIO_WRITE: + if (res->hr_resuid == 0) { + /* This is first write, initialize resuid. */ + (void)init_resuid(res); + } for (;;) { mtx_lock(&range_lock); if (rangelock_islocked(range_sync, Modified: head/sbin/hastd/secondary.c ============================================================================== --- head/sbin/hastd/secondary.c Sun Oct 24 17:24:08 2010 (r214283) +++ head/sbin/hastd/secondary.c Sun Oct 24 17:28:25 2010 (r214284) @@ -243,13 +243,22 @@ init_remote(struct hast_resource *res, s */ if (res->hr_resuid == 0) { /* - * Provider is used for the first time. Initialize everything. + * Provider is used for the first time. If primary node done no + * writes yet as well (we will find "virgin" argument) then + * there is no need to synchronize anything. If primary node + * done any writes already we have to synchronize everything. */ assert(res->hr_secondary_localcnt == 0); res->hr_resuid = resuid; if (metadata_write(res) < 0) exit(EX_NOINPUT); - memset(map, 0xff, mapsize); + if (nv_exists(nvin, "virgin")) { + free(map); + map = NULL; + mapsize = 0; + } else { + memset(map, 0xff, mapsize); + } nv_add_uint8(nvout, HAST_SYNCSRC_PRIMARY, "syncsrc"); } else if ( /* Is primary is out-of-date? */ From owner-svn-src-head@FreeBSD.ORG Sun Oct 24 17:48:03 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 952CE106566C; Sun, 24 Oct 2010 17:48:03 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id A58D38FC0C; Sun, 24 Oct 2010 17:48:02 +0000 (UTC) Received: by wwb24 with SMTP id 24so2524953wwb.31 for ; Sun, 24 Oct 2010 10:48:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=kn1xHWXUzSuEBBiJnszf3n8EHIEk98x4G3Xvi/1obXI=; b=sglQFp5RvQMhS0fWpO53BnjWkRQ66FfMEvw1xpQ3MoFjF+9w4jbsxEAmwoTHLVUdNp bEdHaTl+Tl8iP3R3ycZb075r4nYA3Mb9fi7vV8GB2OcWdGObns4RgkRv7jw4A/Pz//gC H3LIIcWVmYPxGU+pgCVxqalx15WuCVva3lcKQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=LVGbwBVFR3eE8OZ5KglK3p8LYL2uFFTL3rKUiakLJcfkkhkvI9hZG8pIt4AsqYSfZr 1z8HpmrWVjDf1VYOaxGwB+7sbHVNssyEyQFkUT6vQ05iYEzxmGmqHFAONk59i6hdYg/Q 00z9HPnDcBde1h3zxR++bpRkTWR+I+ODbCRdY= MIME-Version: 1.0 Received: by 10.216.51.21 with SMTP id a21mr5182008wec.50.1287942481516; Sun, 24 Oct 2010 10:48:01 -0700 (PDT) Sender: yanegomi@gmail.com Received: by 10.216.10.198 with HTTP; Sun, 24 Oct 2010 10:48:01 -0700 (PDT) In-Reply-To: <4CC466D5.6080306@FreeBSD.org> References: <201010241631.o9OGVw1C033817@svn.freebsd.org> <201010241735.32876.bruce@cran.org.uk> <4CC466D5.6080306@FreeBSD.org> Date: Sun, 24 Oct 2010 10:48:01 -0700 X-Google-Sender-Auth: nCRq69EH9kF-5fbE9fnXC4NqJJM Message-ID: From: Garrett Cooper To: Alexander Motin Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Cc: Bruce Cran , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r214279 - in head: share/man/man4 sys/cam sys/cam/ata sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Oct 2010 17:48:03 -0000 On Sun, Oct 24, 2010 at 10:03 AM, Alexander Motin wrote: > Bruce Cran wrote: >> On Sunday 24 October 2010 17:31:58 Bruce Cran wrote: >> >>> Log: >>> =A0 Mostly revert r203420, and add similar functionality into ada(4) si= nce >>> the existing code caused problems with some SCSI controllers. > > Proper way would be IMHO to fix polling in aac driver. > >>> =A0 A new sysctl kern.cam.ada.spindown_shutdown has been added that con= trols >>> =A0 whether or not to spin-down disks when shutting down. >>> =A0 Spinning down the disks unloads/parks the heads - this is >>> =A0 much better than removing power when the disk is still >>> =A0 spinning because otherwise an Emergency Unload occurs which may cau= se >>> damage to the actuator. >> >> The FLUSH CACHE + STANDBY IMMEDIATE commands are issued (instead of just >> SLEEP) following the procedure documented in Fujitsu's MHW series produc= t >> documentation under section 1.10.1, "Recommended power-off sequence". > > Not instead of "just SLEEP", but instead of FLUSH CACHE (by respective > peripheral driver) + SLEEP (by xpt). It should probably be the same. > > Just for the note, SCSI specification states that STOP automatically > implies FLUSH CACHE. ATA - doesn't. I could be wrong, but I think the ANSI ATA<->SCSI spec states otherwise (taken from ANSI INCITS 431-2007 page 62 -- see steps 1-4): 9.11.3 START STOP UNIT START bit LOEJ bit combinations The SATL shall perform the actions shown in table 40 in response to a START STOP UNIT command. Table 40 =97 Definition of START and LOEJ bits in the START STOP UNIT CDB START LOEJ Definition 0 0 The SATL shall: 1) If the IMMED bit is set to one, then return GOOD status; 2) Issue an ATA flush command (see 3.1.11) to the ATA device; 3) If the ATA flush command completes with any error, then process ending s= tatus according to the IMMED bit (see 9.11.2) with the additional sense code set = to COMMAND SEQUENCE ERROR; 4) If the ATA flush command completes without error, then issue an ATA STAN= DBY IMMEDIATE command to the ATA Sector Count set to zero; 5) If the ATA STANDBY IMMEDIATE command completes with any error, then process ending status according to the IMMED bit (see 9.11.2) with the additional sense code set to COMMAND SEQUENCE ERROR; and 6) If the ATA STANDBY IMMEDIATE command completes without error and the IMMED bit is set to zero, then return GOOD status (see 9.11.2) a. Not sure about the ATA spec standalone... might be present in the ATA8 = spec. Thanks! -Garrett From owner-svn-src-head@FreeBSD.ORG Sun Oct 24 17:55:20 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5820A1065673; Sun, 24 Oct 2010 17:55:20 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-fx0-f54.google.com (mail-fx0-f54.google.com [209.85.161.54]) by mx1.freebsd.org (Postfix) with ESMTP id 856868FC18; Sun, 24 Oct 2010 17:55:18 +0000 (UTC) Received: by fxm17 with SMTP id 17so2207419fxm.13 for ; Sun, 24 Oct 2010 10:55:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :x-enigmail-version:content-type:content-transfer-encoding; bh=olUGFM9qA7DvZC9LUgMAyNO4slEoSGQ7lx5cQzVvYZE=; b=J/2gu0k+MCc3WJW7i+ocbYfbC78oqMl9pXJkxD7bQOMXboA52DzJwBwO+3zUCdcMmZ VcHTMbifpSxDA/CbnE1pKSaHRblwciUYGCqMH7jmmwQ1oyZhoI9YVGgnMY6/L71awnLM 6HqGdcsWIb4Iolwn+xHlTpKt+zPMC2Z4qeSEM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; b=NM7/Xzcd0U9dzAMdXrTnpCyvHuGQt7UdGr5Hs611hSgeiCQ5q+9fdaRRobQD9BJX96 Ub6hzF+Ma5R0awKK04wuJEnW3ZtIRd5Y+Duo6yGK7u29wY+a7mpxj2zHV4SF7xDczlTV +8F3OpziE70kXmKtpXMzZGLWxI1ivy9RTWfrM= Received: by 10.102.244.13 with SMTP id r13mr798456muh.14.1287942918087; Sun, 24 Oct 2010 10:55:18 -0700 (PDT) Received: from mavbook2.mavhome.dp.ua (pc.mavhome.dp.ua [212.86.226.226]) by mx.google.com with ESMTPS id p2sm2458753fak.22.2010.10.24.10.55.15 (version=SSLv3 cipher=RC4-MD5); Sun, 24 Oct 2010 10:55:17 -0700 (PDT) Sender: Alexander Motin Message-ID: <4CC47301.9020609@FreeBSD.org> Date: Sun, 24 Oct 2010 20:55:13 +0300 From: Alexander Motin User-Agent: Thunderbird 2.0.0.23 (X11/20091212) MIME-Version: 1.0 To: Garrett Cooper References: <201010241631.o9OGVw1C033817@svn.freebsd.org> <201010241735.32876.bruce@cran.org.uk> <4CC466D5.6080306@FreeBSD.org> In-Reply-To: X-Enigmail-Version: 0.96.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Cc: Bruce Cran , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r214279 - in head: share/man/man4 sys/cam sys/cam/ata sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Oct 2010 17:55:20 -0000 Garrett Cooper wrote: > On Sun, Oct 24, 2010 at 10:03 AM, Alexander Motin wrote: >> Bruce Cran wrote: >>> On Sunday 24 October 2010 17:31:58 Bruce Cran wrote: >>> >>>> Log: >>>> Mostly revert r203420, and add similar functionality into ada(4) since >>>> the existing code caused problems with some SCSI controllers. >> Proper way would be IMHO to fix polling in aac driver. >> >>>> A new sysctl kern.cam.ada.spindown_shutdown has been added that controls >>>> whether or not to spin-down disks when shutting down. >>>> Spinning down the disks unloads/parks the heads - this is >>>> much better than removing power when the disk is still >>>> spinning because otherwise an Emergency Unload occurs which may cause >>>> damage to the actuator. >>> The FLUSH CACHE + STANDBY IMMEDIATE commands are issued (instead of just >>> SLEEP) following the procedure documented in Fujitsu's MHW series product >>> documentation under section 1.10.1, "Recommended power-off sequence". >> Not instead of "just SLEEP", but instead of FLUSH CACHE (by respective >> peripheral driver) + SLEEP (by xpt). It should probably be the same. >> >> Just for the note, SCSI specification states that STOP automatically >> implies FLUSH CACHE. ATA - doesn't. > > I could be wrong, but I think the ANSI ATA<->SCSI spec states > otherwise (taken from ANSI INCITS 431-2007 page 62 -- see steps 1-4): > > 9.11.3 START STOP UNIT START bit LOEJ bit combinations > The SATL shall perform the actions shown in table 40 in response to a > START STOP UNIT command. > Table 40 — Definition of START and LOEJ bits in the START STOP UNIT CDB > START LOEJ Definition > 0 0 The SATL shall: > 1) If the IMMED bit is set to one, then return GOOD status; > 2) Issue an ATA flush command (see 3.1.11) to the ATA device; > 3) If the ATA flush command completes with any error, then process ending status > according to the IMMED bit (see 9.11.2) with the additional sense code set to > COMMAND SEQUENCE ERROR; > 4) If the ATA flush command completes without error, then issue an ATA STANDBY > IMMEDIATE command to the ATA Sector Count set to zero; > 5) If the ATA STANDBY IMMEDIATE command completes with any error, then > process ending status according to the IMMED bit (see 9.11.2) with the > additional > sense code set to COMMAND SEQUENCE ERROR; and > 6) If the ATA STANDBY IMMEDIATE command completes without error and the > IMMED bit is set to zero, then return GOOD status (see 9.11.2) a. > > Not sure about the ATA spec standalone... might be present in the ATA8 spec. As I understand, this just confirms what I have said: SCSI STOP == ATA FLUSH CACHE + STANDBY IMMEDIATE. So SCSI STOP implies flush, while ATA STANDBY IMMEDIATE doesn't. -- Alexander Motin From owner-svn-src-head@FreeBSD.ORG Sun Oct 24 17:58:55 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F2867106566C; Sun, 24 Oct 2010 17:58:54 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id 0C3D58FC12; Sun, 24 Oct 2010 17:58:53 +0000 (UTC) Received: by wyb42 with SMTP id 42so2589317wyb.13 for ; Sun, 24 Oct 2010 10:58:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=6kjr9i32ab5fHwYwIVchjyD9CvV35F65tFSJKzia9II=; b=SPOe/DUkwXM6RGzpIssy//ILX+JsNyEZVpk3g5xLsIEo2v8CF2XUN60MC6vqHTKDSL w9XyIwb9sLspodpQcBZq9x0akfReBZfr3t26V5mC5EHZHI2gB03nrQCb0kUlKEmoqeQd +K4s64aCWIgZDrobYHMoPtBRiiSZ9pGgGOsdY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=XCgrs+OxwfcaQCJ4nUgF5w94OGx3W2FDjAIgSBrdlLZWElwl0QmjnZGQmy3LMCODv8 QjeKDCmkib3it7y0ZQKvEXWTwFSAOg0n5WqixqjcKo3HfCtSuojyuo7U2iIcr6Rae3YL oSppMhd3u/z9OteLmdOv8utB1psBpVmOiPHd0= MIME-Version: 1.0 Received: by 10.216.188.197 with SMTP id a47mr5168480wen.70.1287943132906; Sun, 24 Oct 2010 10:58:52 -0700 (PDT) Sender: yanegomi@gmail.com Received: by 10.216.10.198 with HTTP; Sun, 24 Oct 2010 10:58:52 -0700 (PDT) In-Reply-To: <4CC47301.9020609@FreeBSD.org> References: <201010241631.o9OGVw1C033817@svn.freebsd.org> <201010241735.32876.bruce@cran.org.uk> <4CC466D5.6080306@FreeBSD.org> <4CC47301.9020609@FreeBSD.org> Date: Sun, 24 Oct 2010 10:58:52 -0700 X-Google-Sender-Auth: KbrTlV6qYtzOfp6kVVNG4ndNQ64 Message-ID: From: Garrett Cooper To: Alexander Motin Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Cc: Bruce Cran , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r214279 - in head: share/man/man4 sys/cam sys/cam/ata sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Oct 2010 17:58:55 -0000 On Sun, Oct 24, 2010 at 10:55 AM, Alexander Motin wrote: > Garrett Cooper wrote: >> On Sun, Oct 24, 2010 at 10:03 AM, Alexander Motin wrot= e: >>> Bruce Cran wrote: >>>> On Sunday 24 October 2010 17:31:58 Bruce Cran wrote: >>>> >>>>> Log: >>>>> =A0 Mostly revert r203420, and add similar functionality into ada(4) = since >>>>> the existing code caused problems with some SCSI controllers. >>> Proper way would be IMHO to fix polling in aac driver. >>> >>>>> =A0 A new sysctl kern.cam.ada.spindown_shutdown has been added that c= ontrols >>>>> =A0 whether or not to spin-down disks when shutting down. >>>>> =A0 Spinning down the disks unloads/parks the heads - this is >>>>> =A0 much better than removing power when the disk is still >>>>> =A0 spinning because otherwise an Emergency Unload occurs which may c= ause >>>>> damage to the actuator. >>>> The FLUSH CACHE + STANDBY IMMEDIATE commands are issued (instead of ju= st >>>> SLEEP) following the procedure documented in Fujitsu's MHW series prod= uct >>>> documentation under section 1.10.1, "Recommended power-off sequence". >>> Not instead of "just SLEEP", but instead of FLUSH CACHE (by respective >>> peripheral driver) + SLEEP (by xpt). It should probably be the same. >>> >>> Just for the note, SCSI specification states that STOP automatically >>> implies FLUSH CACHE. ATA - doesn't. >> >> =A0 =A0 I could be wrong, but I think the ANSI ATA<->SCSI spec states >> otherwise (taken from ANSI INCITS 431-2007 page 62 -- see steps 1-4): >> >> 9.11.3 START STOP UNIT START bit LOEJ bit combinations >> The SATL shall perform the actions shown in table 40 in response to a >> START STOP UNIT command. >> Table 40 =97 Definition of START and LOEJ bits in the START STOP UNIT CD= B >> START LOEJ Definition >> 0 0 The SATL shall: >> 1) If the IMMED bit is set to one, then return GOOD status; >> 2) Issue an ATA flush command (see 3.1.11) to the ATA device; >> 3) If the ATA flush command completes with any error, then process endin= g status >> according to the IMMED bit (see 9.11.2) with the additional sense code s= et to >> COMMAND SEQUENCE ERROR; >> 4) If the ATA flush command completes without error, then issue an ATA S= TANDBY >> IMMEDIATE command to the ATA Sector Count set to zero; >> 5) If the ATA STANDBY IMMEDIATE command completes with any error, then >> process ending status according to the IMMED bit (see 9.11.2) with the >> additional >> sense code set to COMMAND SEQUENCE ERROR; and >> 6) If the ATA STANDBY IMMEDIATE command completes without error and the >> IMMED bit is set to zero, then return GOOD status (see 9.11.2) a. >> >> =A0 =A0 Not sure about the ATA spec standalone... might be present in th= e ATA8 spec. > > As I understand, this just confirms what I have said: > SCSI STOP =3D=3D ATA FLUSH CACHE + STANDBY IMMEDIATE. > So SCSI STOP implies flush, while ATA STANDBY IMMEDIATE doesn't. Looking at it from that perspective, I agree. From owner-svn-src-head@FreeBSD.ORG Sun Oct 24 18:53:16 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C12A71065670; Sun, 24 Oct 2010 18:53:16 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AFDA18FC0A; Sun, 24 Oct 2010 18:53:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9OIrGpk037025; Sun, 24 Oct 2010 18:53:16 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9OIrGYn037023; Sun, 24 Oct 2010 18:53:16 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201010241853.o9OIrGYn037023@svn.freebsd.org> From: Alexander Motin Date: Sun, 24 Oct 2010 18:53:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214288 - head/sys/cam/scsi X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Oct 2010 18:53:16 -0000 Author: mav Date: Sun Oct 24 18:53:16 2010 New Revision: 214288 URL: http://svn.freebsd.org/changeset/base/214288 Log: Make da driver to handle some probably broken Android devices, returning zero media and sector size instead of "Medium not present" error, until some confirmation button is tapped on device. Modified: head/sys/cam/scsi/scsi_da.c Modified: head/sys/cam/scsi/scsi_da.c ============================================================================== --- head/sys/cam/scsi/scsi_da.c Sun Oct 24 18:12:11 2010 (r214287) +++ head/sys/cam/scsi/scsi_da.c Sun Oct 24 18:53:16 2010 (r214288) @@ -1667,7 +1667,10 @@ dadone(struct cam_periph *periph, union * give them an 'illegal' value we'll avoid that * here. */ - if (block_size >= MAXPHYS || block_size == 0) { + if (block_size == 0 && maxsector == 0) { + snprintf(announce_buf, sizeof(announce_buf), + "0MB (no media?)"); + } else if (block_size >= MAXPHYS || block_size == 0) { xpt_print(periph->path, "unsupportable block size %ju\n", (uintmax_t) block_size); From owner-svn-src-head@FreeBSD.ORG Sun Oct 24 19:40:08 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2B7371065670; Sun, 24 Oct 2010 19:40:08 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mail.cksoft.de (mail.cksoft.de [IPv6:2001:4068:10::3]) by mx1.freebsd.org (Postfix) with ESMTP id 490868FC13; Sun, 24 Oct 2010 19:40:07 +0000 (UTC) Received: from localhost (amavis.fra.cksoft.de [192.168.74.71]) by mail.cksoft.de (Postfix) with ESMTP id 4253D41C749; Sun, 24 Oct 2010 21:40:06 +0200 (CEST) X-Virus-Scanned: amavisd-new at cksoft.de Received: from mail.cksoft.de ([192.168.74.103]) by localhost (amavis.fra.cksoft.de [192.168.74.71]) (amavisd-new, port 10024) with ESMTP id beAJgRPZetpz; Sun, 24 Oct 2010 21:40:05 +0200 (CEST) Received: by mail.cksoft.de (Postfix, from userid 66) id 7030241C75B; Sun, 24 Oct 2010 21:40:05 +0200 (CEST) Received: from maildrop.int.zabbadoz.net (maildrop.int.zabbadoz.net [10.111.66.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.int.zabbadoz.net (Postfix) with ESMTP id 88AE54448F3; Sun, 24 Oct 2010 19:35:34 +0000 (UTC) Date: Sun, 24 Oct 2010 19:35:34 +0000 (UTC) From: "Bjoern A. Zeeb" X-X-Sender: bz@maildrop.int.zabbadoz.net To: Andre Oppermann In-Reply-To: <20101023131021.C66242@maildrop.int.zabbadoz.net> Message-ID: <20101024191523.R66242@maildrop.int.zabbadoz.net> References: <201009172205.o8HM5RPG043265@svn.freebsd.org> <20101023131021.C66242@maildrop.int.zabbadoz.net> X-OpenPGP-Key: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212803 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Oct 2010 19:40:08 -0000 On Sat, 23 Oct 2010, Bjoern A. Zeeb wrote: > On Fri, 17 Sep 2010, Andre Oppermann wrote: > >> Author: andre >> Date: Fri Sep 17 22:05:27 2010 >> New Revision: 212803 >> URL: http://svn.freebsd.org/changeset/base/212803 >> >> Log: >> Rearrange the TSO code to make it more readable and to clearly >> separate the decision logic, of whether we can do TSO, and the >> calculation of the burst length into two distinct parts. >> >> Change the way the TSO burst length calculation is done. While >> TSO could do bursts of 65535 bytes that can't be represented in >> ip_len together with the IP and TCP header. Account for that and >> use IP_MAXPACKET instead of TCP_MAXWIN as base constant (both >> have the same value of 64K). When more data is available prevent >> less than MSS sized segments from being sent during the current >> TSO burst. >> >> Add two more KASSERTs to ensure the integrity of the packets. I changed the order for simplicity of explanations. >> @@ -1068,6 +1081,9 @@ send: >> m->m_pkthdr.tso_segsz = tp->t_maxopd - optlen; >> } >> >> + KASSERT(len + hdrlen + ipoptlen == m_length(m, NULL), >> + ("%s: mbuf chain shorter than expected", __func__)); >> + I have hit this KASSERT() and it was unhelpful to figure out what was wrong in first place. I had hit it with a TCP6 connect initially. Adter I changed it I realized that it was due to IPSEC and not due to IPv6. So I have two local changes now, neither of which I particularly like but I didn't want to revert ipoptlen in the IPSEC case though it might be the better option if INVARIANTS is on, as it's not used anymore further on but it would obviously confusing as well. +#ifdef IPSEC + KASSERT(len + hdrlen + ipoptlen - ipsec_optlen == m_length(m, NULL), + ("%s: mbuf chain shorter than expected: %ld + %u + %u - %u != %u", + __func__, len, hdrlen, ipoptlen, ipsec_optlen, m_length(m, NULL))); +#else KASSERT(len + hdrlen + ipoptlen == m_length(m, NULL), - ("%s: mbuf chain shorter than expected", __func__)); + ("%s: mbuf chain shorter than expected: %ld + %u + %u != %u", + __func__, len, hdrlen, ipoptlen, m_length(m, NULL))); +#endif >> /* >> * In transmit state, time the transmission and arrange for >> * the retransmit. In persist state, just set snd_max. The second worry I have is ... > > >> Modified: >> head/sys/netinet/tcp_output.c >> >> Modified: head/sys/netinet/tcp_output.c >> ============================================================================== >> --- head/sys/netinet/tcp_output.c Fri Sep 17 21:53:56 2010 >> (r212802) >> +++ head/sys/netinet/tcp_output.c Fri Sep 17 22:05:27 2010 >> (r212803) >> @@ -465,9 +465,8 @@ after_sack_rexmit: >> } >> >> /* >> - * Truncate to the maximum segment length or enable TCP Segmentation >> - * Offloading (if supported by hardware) and ensure that FIN is >> removed >> - * if the length no longer contains the last data byte. >> + * Decide if we can use TCP Segmentation Offloading (if supported by >> + * hardware). >> * >> * TSO may only be used if we are in a pure bulk sending state. The >> * presence of TCP-MD5, SACK retransmits, SACK advertizements and >> @@ -475,10 +474,6 @@ after_sack_rexmit: >> * (except for the sequence number) for all generated packets. This >> * makes it impossible to transmit any options which vary per >> generated >> * segment or packet. >> - * >> - * The length of TSO bursts is limited to TCP_MAXWIN. That limit and >> - * removal of FIN (if not already catched here) are handled later >> after >> - * the exact length of the TCP options are known. >> */ >> #ifdef IPSEC >> /* >> @@ -487,22 +482,15 @@ after_sack_rexmit: >> */ >> ipsec_optlen = ipsec_hdrsiz_tcp(tp); >> #endif >> - if (len > tp->t_maxseg) { >> - if ((tp->t_flags & TF_TSO) && V_tcp_do_tso && >> - ((tp->t_flags & TF_SIGNATURE) == 0) && >> - tp->rcv_numsacks == 0 && sack_rxmit == 0 && >> - tp->t_inpcb->inp_options == NULL && >> - tp->t_inpcb->in6p_options == NULL >> + if ((tp->t_flags & TF_TSO) && V_tcp_do_tso && len > tp->t_maxseg && >> + ((tp->t_flags & TF_SIGNATURE) == 0) && >> + tp->rcv_numsacks == 0 && sack_rxmit == 0 && >> #ifdef IPSEC >> - && ipsec_optlen == 0 >> + ipsec_optlen == 0 && >> #endif >> - ) { >> - tso = 1; >> - } else { >> - len = tp->t_maxseg; >> - sendalot = 1; >> - } >> - } >> + tp->t_inpcb->inp_options == NULL && >> + tp->t_inpcb->in6p_options == NULL) >> + tso = 1; Given the fact that in the TSO case we still check for len > tp->t_maxseg there is the assumption that it can happen. Unfortunately in the non-TSO we no longer adjust len in that case anymore, even though len is just used the second next line and all further on for various calculations and comparisons until the new code comes to re-adjust it, in case of only TSO. Now that changes the meanings of quite a bit of code further down in the former if (!TSO && len > tp->t_maxseg) len = tp->t_maxseg; case. So why was the old code wrong and why is the new code right, assuming it would not just be an oversight. It seems it's just a subtle change but I fear it has non-understood consequences given there was no Reviewed by: on the commit and no explanation for this. Can you explain? >> if (sack_rxmit) { >> if (SEQ_LT(p->rxmit + len, tp->snd_una + so->so_snd.sb_cc)) -- Bjoern A. Zeeb Welcome a new stage of life. Going to jail sucks -- All my daemons like it! http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/jails.html From owner-svn-src-head@FreeBSD.ORG Sun Oct 24 19:56:34 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 746DA106566B; Sun, 24 Oct 2010 19:56:34 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 62A7C8FC15; Sun, 24 Oct 2010 19:56:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9OJuYTQ038273; Sun, 24 Oct 2010 19:56:34 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9OJuYWB038272; Sun, 24 Oct 2010 19:56:34 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201010241956.o9OJuYWB038272@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 24 Oct 2010 19:56:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214289 - head/tools/regression/bin/sh/execution X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Oct 2010 19:56:34 -0000 Author: jilles Date: Sun Oct 24 19:56:34 2010 New Revision: 214289 URL: http://svn.freebsd.org/changeset/base/214289 Log: sh: Add a test trying to close a descriptor that is not open. In stable/8 and older, this fails. Some of the redirection changes in head have fixed it. Added: head/tools/regression/bin/sh/execution/redir3.0 (contents, props changed) Added: head/tools/regression/bin/sh/execution/redir3.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/execution/redir3.0 Sun Oct 24 19:56:34 2010 (r214289) @@ -0,0 +1,3 @@ +# $FreeBSD$ + +3>&- 3>&- From owner-svn-src-head@FreeBSD.ORG Sun Oct 24 20:09:49 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9F604106566C; Sun, 24 Oct 2010 20:09:49 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8D5068FC20; Sun, 24 Oct 2010 20:09:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9OK9n0x038631; Sun, 24 Oct 2010 20:09:49 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9OK9nQ3038628; Sun, 24 Oct 2010 20:09:49 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201010242009.o9OK9nQ3038628@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 24 Oct 2010 20:09:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214290 - in head: bin/sh tools/regression/bin/sh/execution X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Oct 2010 20:09:49 -0000 Author: jilles Date: Sun Oct 24 20:09:49 2010 New Revision: 214290 URL: http://svn.freebsd.org/changeset/base/214290 Log: sh: Check whether dup2 was successful for >&FD and <&FD. A failure (usually caused by FD not being open) is a redirection error. Exp-run done by: pav (with some other sh(1) changes) Added: head/tools/regression/bin/sh/execution/redir4.0 (contents, props changed) Modified: head/bin/sh/redir.c Modified: head/bin/sh/redir.c ============================================================================== --- head/bin/sh/redir.c Sun Oct 24 19:56:34 2010 (r214289) +++ head/bin/sh/redir.c Sun Oct 24 20:09:49 2010 (r214290) @@ -217,8 +217,11 @@ movefd: if (redir->ndup.dupfd >= 0) { /* if not ">&-" */ if (memory[redir->ndup.dupfd]) memory[fd] = 1; - else - dup2(redir->ndup.dupfd, fd); + else { + if (dup2(redir->ndup.dupfd, fd) < 0) + error("%d: %s", redir->ndup.dupfd, + strerror(errno)); + } } else { close(fd); } Added: head/tools/regression/bin/sh/execution/redir4.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/execution/redir4.0 Sun Oct 24 20:09:49 2010 (r214290) @@ -0,0 +1,4 @@ +# $FreeBSD$ + +{ echo bad 0>&3; } 2>/dev/null 3>/dev/null 3>&- +exit 0 From owner-svn-src-head@FreeBSD.ORG Sun Oct 24 20:45:13 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 747AA106564A; Sun, 24 Oct 2010 20:45:13 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4865D8FC17; Sun, 24 Oct 2010 20:45:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9OKjD2t039438; Sun, 24 Oct 2010 20:45:13 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9OKjDCr039435; Sun, 24 Oct 2010 20:45:13 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201010242045.o9OKjDCr039435@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 24 Oct 2010 20:45:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214291 - in head: bin/sh tools/regression/bin/sh/parser X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Oct 2010 20:45:13 -0000 Author: jilles Date: Sun Oct 24 20:45:13 2010 New Revision: 214291 URL: http://svn.freebsd.org/changeset/base/214291 Log: sh: Make sure defined functions can actually be called. Add some conservative checks on function names: - Disallow expansions or quoting characters; these can only be called via strange control characters - Disallow '/'; these functions cannot be called anyway, as exec.c assumes they are pathnames - Make the CTL* bytes work properly in function names. These are syntax errors. POSIX does not require us to support more than names (letters, digits and underscores, not starting with a digit), but I do not want to restrict it that much at this time. Exp-run done by: pav (with some other sh(1) changes) Added: head/tools/regression/bin/sh/parser/func1.0 (contents, props changed) Modified: head/bin/sh/parser.c Modified: head/bin/sh/parser.c ============================================================================== --- head/bin/sh/parser.c Sun Oct 24 20:09:49 2010 (r214290) +++ head/bin/sh/parser.c Sun Oct 24 20:45:13 2010 (r214291) @@ -639,10 +639,14 @@ simplecmd(union node **rpp, union node * if (readtoken() != TRP) synexpect(TRP); funclinno = plinno; -#ifdef notdef - if (! goodname(n->narg.text)) + /* + * - Require plain text. + * - Functions with '/' cannot be called. + */ + if (!noexpand(n->narg.text) || quoteflag || + strchr(n->narg.text, '/')) synerror("Bad function name"); -#endif + rmescapes(n->narg.text); n->type = NDEFUN; n->narg.next = command(); funclinno = 0; Added: head/tools/regression/bin/sh/parser/func1.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/parser/func1.0 Sun Oct 24 20:45:13 2010 (r214291) @@ -0,0 +1,25 @@ +# $FreeBSD$ +# POSIX does not require these bytes to work in function names, +# but making them all work seems a good goal. + +failures=0 +unset LC_ALL +export LC_CTYPE=en_US.ISO8859-1 +i=128 +set -f +while [ "$i" -le 255 ]; do + c=$(printf \\"$(printf %o "$i")") + ok=0 + eval "$c() { ok=1; }" + $c + ok1=$ok + ok=0 + "$c" + if [ "$ok" != 1 ] || [ "$ok1" != 1 ]; then + echo "Bad results for character $i" >&2 + : $((failures += 1)) + fi + unset -f $c + i=$((i+1)) +done +exit $((failures > 0)) From owner-svn-src-head@FreeBSD.ORG Sun Oct 24 20:54:47 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F37171065670; Sun, 24 Oct 2010 20:54:46 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E21D78FC08; Sun, 24 Oct 2010 20:54:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9OKskCY039636; Sun, 24 Oct 2010 20:54:46 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9OKsk5r039634; Sun, 24 Oct 2010 20:54:46 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201010242054.o9OKsk5r039634@svn.freebsd.org> From: Pyun YongHyeon Date: Sun, 24 Oct 2010 20:54:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214292 - head/sys/dev/bge X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Oct 2010 20:54:47 -0000 Author: yongari Date: Sun Oct 24 20:54:46 2010 New Revision: 214292 URL: http://svn.freebsd.org/changeset/base/214292 Log: Use bge_chipid to compare controller ids. r214251 incorrectly used bge_chiprev. Reported by: Buganini gmail dot com > Modified: head/sys/dev/bge/if_bge.c Modified: head/sys/dev/bge/if_bge.c ============================================================================== --- head/sys/dev/bge/if_bge.c Sun Oct 24 20:45:13 2010 (r214291) +++ head/sys/dev/bge/if_bge.c Sun Oct 24 20:54:46 2010 (r214292) @@ -1695,9 +1695,9 @@ bge_blockinit(struct bge_softc *sc) /* Choose de-pipeline mode for BCM5906 A0, A1 and A2. */ if (sc->bge_asicrev == BGE_ASICREV_BCM5906) { - if (sc->bge_chiprev == BGE_CHIPID_BCM5906_A0 || - sc->bge_chiprev == BGE_CHIPID_BCM5906_A1 || - sc->bge_chiprev == BGE_CHIPID_BCM5906_A2) + if (sc->bge_chipid == BGE_CHIPID_BCM5906_A0 || + sc->bge_chipid == BGE_CHIPID_BCM5906_A1 || + sc->bge_chipid == BGE_CHIPID_BCM5906_A2) CSR_WRITE_4(sc, BGE_ISO_PKT_TX, (CSR_READ_4(sc, BGE_ISO_PKT_TX) & ~3) | 2); } From owner-svn-src-head@FreeBSD.ORG Sun Oct 24 21:59:52 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4A46C10656C0; Sun, 24 Oct 2010 21:59:52 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 38BA58FC1E; Sun, 24 Oct 2010 21:59:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9OLxq5B041472; Sun, 24 Oct 2010 21:59:52 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9OLxqH6041470; Sun, 24 Oct 2010 21:59:52 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201010242159.o9OLxqH6041470@svn.freebsd.org> From: Pyun YongHyeon Date: Sun, 24 Oct 2010 21:59:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214302 - head/sys/dev/fxp X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Oct 2010 21:59:52 -0000 Author: yongari Date: Sun Oct 24 21:59:51 2010 New Revision: 214302 URL: http://svn.freebsd.org/changeset/base/214302 Log: Add TSO support over VLAN for i82550/i82551. Controller requires VLAN hardware tagging to make TSO work over VLAN. So if VLAN hardware tagging is disabled explicitly clear TSO over VLAN. While I'm here allow disabling VLAN TX checksum offloading. Tested by: Liudas < liudasb <> centras dot lt > MFC after: 10 days Modified: head/sys/dev/fxp/if_fxp.c Modified: head/sys/dev/fxp/if_fxp.c ============================================================================== --- head/sys/dev/fxp/if_fxp.c Sun Oct 24 21:28:58 2010 (r214301) +++ head/sys/dev/fxp/if_fxp.c Sun Oct 24 21:59:51 2010 (r214302) @@ -862,9 +862,9 @@ fxp_attach(device_t dev) ifp->if_capenable |= IFCAP_VLAN_MTU; /* the hw bits already set */ if ((sc->flags & FXP_FLAG_EXT_RFA) != 0) { ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING | - IFCAP_VLAN_HWCSUM; + IFCAP_VLAN_HWCSUM | IFCAP_VLAN_HWTSO; ifp->if_capenable |= IFCAP_VLAN_HWTAGGING | - IFCAP_VLAN_HWCSUM; + IFCAP_VLAN_HWCSUM | IFCAP_VLAN_HWTSO; } /* @@ -2866,10 +2866,19 @@ fxp_ioctl(struct ifnet *ifp, u_long comm if (ifp->if_flags & IFF_UP) reinit++; } + if ((mask & IFCAP_VLAN_HWCSUM) != 0 && + (ifp->if_capabilities & IFCAP_VLAN_HWCSUM) != 0) + ifp->if_capenable ^= IFCAP_VLAN_HWCSUM; + if ((mask & IFCAP_VLAN_HWTSO) != 0 && + (ifp->if_capabilities & IFCAP_VLAN_HWTSO) != 0) + ifp->if_capenable ^= IFCAP_VLAN_HWTSO; if ((mask & IFCAP_VLAN_HWTAGGING) != 0 && (ifp->if_capabilities & IFCAP_VLAN_HWTAGGING) != 0) { ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING; - reinit++; + if ((ifp->if_capenable & IFCAP_VLAN_HWTAGGING) == 0) + ifp->if_capenable &= + ~(IFCAP_VLAN_HWTSO | IFCAP_VLAN_HWCSUM); + reinit++; } if (reinit > 0 && ifp->if_flags & IFF_UP) fxp_init_body(sc); From owner-svn-src-head@FreeBSD.ORG Sun Oct 24 22:02:37 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2258F106564A; Sun, 24 Oct 2010 22:02:37 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 103F58FC0A; Sun, 24 Oct 2010 22:02:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9OM2aiV041609; Sun, 24 Oct 2010 22:02:36 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9OM2aGo041606; Sun, 24 Oct 2010 22:02:36 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201010242202.o9OM2aGo041606@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sun, 24 Oct 2010 22:02:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214303 - in head/sys: conf netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Oct 2010 22:02:37 -0000 Author: bz Date: Sun Oct 24 22:02:36 2010 New Revision: 214303 URL: http://svn.freebsd.org/changeset/base/214303 Log: Add initial inet DDB support for show in_ifaddr and show sin commands which proved to be useful while debugging address list problems. MFC after: 6 days Added: head/sys/netinet/in_debug.c (contents, props changed) Modified: head/sys/conf/files Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sun Oct 24 21:59:51 2010 (r214302) +++ head/sys/conf/files Sun Oct 24 22:02:36 2010 (r214303) @@ -2559,6 +2559,7 @@ netinet/if_atm.c optional atm netinet/if_ether.c optional inet ether netinet/igmp.c optional inet netinet/in.c optional inet +netinet/in_debug.c optional inet ddb netinet/ip_carp.c optional inet carp | inet6 carp netinet/in_gif.c optional gif inet | netgraph_gif inet netinet/ip_gre.c optional gre inet Added: head/sys/netinet/in_debug.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/netinet/in_debug.c Sun Oct 24 22:02:36 2010 (r214303) @@ -0,0 +1,120 @@ +/*- + * Copyright (c) 2010 Bjoern A. Zeeb + * All rights reserved. + * + * 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 AUTHOR 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 AUTHOR 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_ddb.h" + +#include +#include +#include + +#ifdef DDB +#include +#endif + +#include +#include + +#include +#include + +#ifdef DDB +static void +in_show_sockaddr_in(struct sockaddr_in *sin) +{ + +#define SIN_DB_RPINTF(f, e) db_printf("\t %s = " f "\n", #e, sin->e); + db_printf("\tsockaddr_in = %p\n", sin); + SIN_DB_RPINTF("%u", sin_len); + SIN_DB_RPINTF("%u", sin_family); + SIN_DB_RPINTF("%u", sin_port); + SIN_DB_RPINTF("0x%08x", sin_addr.s_addr); + db_printf("\t %s = %02x%02x%02x%02x%02x%02x%02x%02x\n", + "sin_zero[8]", + sin->sin_zero[0], sin->sin_zero[1], + sin->sin_zero[2], sin->sin_zero[3], + sin->sin_zero[4], sin->sin_zero[5], + sin->sin_zero[6], sin->sin_zero[7]); +#undef SIN_DB_RPINTF +} + +DB_SHOW_COMMAND(sin, db_show_sin) +{ + struct sockaddr_in *sin; + + sin = (struct sockaddr_in *)addr; + if (sin == NULL) { + /* usage: No need to confess if you didn't sin. */ + db_printf("usage: show sin \n"); + return; + } + + in_show_sockaddr_in(sin); +} + +static void +in_show_in_ifaddr(struct in_ifaddr *ia) +{ + +#define IA_DB_RPINTF(f, e) db_printf("\t %s = " f "\n", #e, ia->e); +#define IA_DB_RPINTF_PTR(f, e) db_printf("\t %s = " f "\n", #e, &ia->e); +#define IA_DB_RPINTF_DPTR(f, e) db_printf("\t *%s = " f "\n", #e, *ia->e); + db_printf("\tin_ifaddr = %p\n", ia); + IA_DB_RPINTF_PTR("%p", ia_ifa); + IA_DB_RPINTF("0x%08lx", ia_net); + IA_DB_RPINTF("0x%08lx", ia_netmask); + IA_DB_RPINTF("0x%08lx", ia_subnet); + IA_DB_RPINTF("0x%08lx", ia_subnetmask); + IA_DB_RPINTF("0x%08x", ia_netbroadcast.s_addr); + IA_DB_RPINTF("%p", ia_hash.le_next); + IA_DB_RPINTF("%p", ia_hash.le_prev); + IA_DB_RPINTF_DPTR("%p", ia_hash.le_prev); + IA_DB_RPINTF("%p", ia_link.tqe_next); + IA_DB_RPINTF("%p", ia_link.tqe_prev); + IA_DB_RPINTF_DPTR("%p", ia_link.tqe_prev); + IA_DB_RPINTF_PTR("%p", ia_addr); + IA_DB_RPINTF_PTR("%p", ia_dstaddr); + IA_DB_RPINTF_PTR("%p", ia_sockmask); +#undef IA_DB_RPINTF_DPTR +#undef IA_DB_RPINTF_PTR +#undef IA_DB_RPINTF +} + +DB_SHOW_COMMAND(in_ifaddr, db_show_in_ifaddr) +{ + struct in_ifaddr *ia; + + ia = (struct in_ifaddr *)addr; + if (ia == NULL) { + db_printf("usage: show in_ifaddr \n"); + return; + } + + in_show_in_ifaddr(ia); +} +#endif From owner-svn-src-head@FreeBSD.ORG Sun Oct 24 22:03:21 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ACD1C106566B; Sun, 24 Oct 2010 22:03:21 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 803E18FC0C; Sun, 24 Oct 2010 22:03:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9OM3LH2041682; Sun, 24 Oct 2010 22:03:21 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9OM3LLd041679; Sun, 24 Oct 2010 22:03:21 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201010242203.o9OM3LLd041679@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 24 Oct 2010 22:03:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214304 - in head: bin/sh tools/regression/bin/sh/execution X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Oct 2010 22:03:21 -0000 Author: jilles Date: Sun Oct 24 22:03:21 2010 New Revision: 214304 URL: http://svn.freebsd.org/changeset/base/214304 Log: sh: Do not allow overriding a special builtin with a function. This is a syntax error. POSIX does not say explicitly whether defining a function with the same name as a special builtin is allowed, but it does say that it is impossible to call such a function. A special builtin can still be overridden with an alias. This commit is part of a set of changes that will ensure that when something looks like a special builtin to the parser, it is one. (Not the other way around, as it remains possible to call a special builtin named by a variable or other substitution.) Exp-run done by: pav (with some other sh(1) changes) Added: head/tools/regression/bin/sh/execution/func3.0 (contents, props changed) Modified: head/bin/sh/parser.c Modified: head/bin/sh/parser.c ============================================================================== --- head/bin/sh/parser.c Sun Oct 24 22:02:36 2010 (r214303) +++ head/bin/sh/parser.c Sun Oct 24 22:03:21 2010 (r214304) @@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$"); #include "alias.h" #include "show.h" #include "eval.h" +#include "exec.h" /* to check for special builtins */ #ifndef NO_HISTORY #include "myhistedit.h" #endif @@ -606,6 +607,7 @@ simplecmd(union node **rpp, union node * union node *args, **app; union node **orig_rpp = rpp; union node *n = NULL; + int special; /* If we don't have any redirections already, then we must reset */ /* rpp to be the address of the local redir variable. */ @@ -647,6 +649,9 @@ simplecmd(union node **rpp, union node * strchr(n->narg.text, '/')) synerror("Bad function name"); rmescapes(n->narg.text); + if (find_builtin(n->narg.text, &special) >= 0 && + special) + synerror("Cannot override a special builtin with a function"); n->type = NDEFUN; n->narg.next = command(); funclinno = 0; Added: head/tools/regression/bin/sh/execution/func3.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/execution/func3.0 Sun Oct 24 22:03:21 2010 (r214304) @@ -0,0 +1,7 @@ +# $FreeBSD$ + +# This may fail when parsing or when defining the function, or the definition +# may silently do nothing. In no event may the function be executed. + +sh -c 'unset() { echo overriding function executed, bad; }; v=1; unset v; exit "${v-0}"' 2>/dev/null +: From owner-svn-src-head@FreeBSD.ORG Sun Oct 24 22:25:39 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4645E106566C; Sun, 24 Oct 2010 22:25:39 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 349318FC12; Sun, 24 Oct 2010 22:25:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9OMPdiP042719; Sun, 24 Oct 2010 22:25:39 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9OMPd8u042716; Sun, 24 Oct 2010 22:25:39 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201010242225.o9OMPd8u042716@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 24 Oct 2010 22:25:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214305 - head/bin/sh X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Oct 2010 22:25:39 -0000 Author: jilles Date: Sun Oct 24 22:25:38 2010 New Revision: 214305 URL: http://svn.freebsd.org/changeset/base/214305 Log: sh: Ignore double-quotes in arithmetic rather than treating them as quotes. This provides similar behaviour, but allows a simpler parser. This changes r206473. Exp-run done by: pav (with some other sh(1) changes) Modified: head/bin/sh/mksyntax.c head/bin/sh/parser.c Modified: head/bin/sh/mksyntax.c ============================================================================== --- head/bin/sh/mksyntax.c Sun Oct 24 22:03:21 2010 (r214304) +++ head/bin/sh/mksyntax.c Sun Oct 24 22:25:38 2010 (r214305) @@ -75,6 +75,7 @@ struct synclass synclass[] = { { "CEOF", "end of file" }, { "CCTL", "like CWORD, except it must be escaped" }, { "CSPCL", "these terminate a word" }, + { "CIGN", "character should be ignored" }, { NULL, NULL } }; @@ -232,7 +233,7 @@ main(int argc __unused, char **argv __un add("\n", "CNL"); add("\\", "CBACK"); add("`", "CBQUOTE"); - add("\"", "CDQUOTE"); + add("\"", "CIGN"); add("$", "CVAR"); add("}", "CENDVAR"); add("(", "CLP"); Modified: head/bin/sh/parser.c ============================================================================== --- head/bin/sh/parser.c Sun Oct 24 22:03:21 2010 (r214304) +++ head/bin/sh/parser.c Sun Oct 24 22:25:38 2010 (r214305) @@ -1224,10 +1224,7 @@ readtoken1(int firstc, char const *initi if (eofmark != NULL && newvarnest == 0) USTPUTC(c, out); else { - if (state[level].category == TSTATE_ARITH) - state[level].syntax = ARISYNTAX; - else - state[level].syntax = BASESYNTAX; + state[level].syntax = BASESYNTAX; quotef++; } break; @@ -1282,6 +1279,8 @@ readtoken1(int firstc, char const *initi break; case CEOF: goto endword; /* exit outer loop */ + case CIGN: + break; default: if (level == 0) goto endword; /* exit outer loop */ From owner-svn-src-head@FreeBSD.ORG Sun Oct 24 22:59:38 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E65EE106566B; Sun, 24 Oct 2010 22:59:38 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D37B38FC1A; Sun, 24 Oct 2010 22:59:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9OMxcdt043533; Sun, 24 Oct 2010 22:59:38 GMT (envelope-from julian@svn.freebsd.org) Received: (from julian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9OMxcH7043530; Sun, 24 Oct 2010 22:59:38 GMT (envelope-from julian@svn.freebsd.org) Message-Id: <201010242259.o9OMxcH7043530@svn.freebsd.org> From: Julian Elischer Date: Sun, 24 Oct 2010 22:59:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214306 - in head/share/examples: jails netgraph X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Oct 2010 22:59:39 -0000 Author: julian Date: Sun Oct 24 22:59:38 2010 New Revision: 214306 URL: http://svn.freebsd.org/changeset/base/214306 Log: Add two scripts that demonstrate how to make and hook together jails using teh vortual networking feature. Submitted by: Yavuz Gokirmak MFC after: 2 weeks Added: head/share/examples/jails/ head/share/examples/jails/README (contents, props changed) head/share/examples/netgraph/virtual.chain (contents, props changed) head/share/examples/netgraph/virtual.lan (contents, props changed) Added: head/share/examples/jails/README ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/examples/jails/README Sun Oct 24 22:59:38 2010 (r214306) @@ -0,0 +1,5 @@ +# $FreeBSD$ + +See under share/examples/netgraph for some examples of +making and hooking together jails using netgraph as the +virtual networking fabric. Added: head/share/examples/netgraph/virtual.chain ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/examples/netgraph/virtual.chain Sun Oct 24 22:59:38 2010 (r214306) @@ -0,0 +1,373 @@ +#!/bin/sh +# +# Copyright (c) 2010, Yavuz Gokirmak +# +# All rights reserved. +# +# This source code may be used, modified, copied, distributed, and +# sold, in both source and binary form provided that the above +# copyright and these terms are retained, verbatim, as the first +# lines of this file. Under no circumstances is the author +# responsible for the proper functioning of the software nor does +# the author assume any responsibility for damages incurred with +# its use. +# +# $FreeBSD$ +# +# +# This script creates and connects n router like nodes. Complex wide +# area topologies can be created with the help of script. +# +# Virtual nodes are generated via jails and network connections are +# established using ng_eiface(4) node types. +# +# To use this script: +# +# 0. Make your own copy of this example script. +# +# 1. Edit the definition of ${TARGET_TOPOLOGY} to define your virtual +# nodes. Virtual topology definition includes node names and their +# IP address. Target top. sytax: ( name|ip<->name|ip ... ) +# Example 1: ( n1|10.0.2.1/30<->n2|10.0.2.2/30 ...) +# Example 2: ( n1|2001:b90::14a/125<->n1|2001:b90::14b/125 ...) +# +# 2. Run this script with "start" as the command line argument. +# +# 3. Add necessary static route commands for each virtual node. For +# example assume you have three virtual nodes connected each other +# llike a chain ( n1 is connected to n2, n2 is connecte to n3 ). +# In order to estabklish connectivity among these virtual nodes, +# you have to add default routes to node n1 and node n3. Example +# static route command is: +# STATIC_ROUTE0="jexec n1 route add -inet default 10.0.2.2" +# STATIC_ROUTE1="jexec n3 route add -inet default 10.0.2.5" +# After defining default routes with above format you have to set +# the total number of static route commands as: +# STATIC_ROUTE_CNT=2 +# +# 4. Stop bridging by running this script with "stop" as the +# command line argument. +# +# 5. This cript uses a template file in order to carry information +# between start and stop calls. +# In the start call, the netgraph interfaces and jails are created. +# At the stop phase, all created objects should be removed. +# DO NOT delete the temporary file between the start and stop phases. +# +# Target Topology: +# +# +---------------+ +---------------------------------------------+ +# | n1 (vimage) | | n2 (vimage) | +# | | | | +# | +-----------+ | | +-----------+ +-----------+ +-----------+ | +# | | ngeth0 | | | | ngeth1 | | ngeth2 | | ngeth4 | | +# | |(ng_eiface)| | | |(ng_eiface)| |(ng_eiface)| |(ng_eiface)| | +# | +--+-----+--+ | | +--+-----+--+ +--+-----+--+ +--+-----+--+ | +# | |ether| | | |ether| |ether| |ether| | +# | +-X---+ | | +--X--+ +--X--+ +--X--+ | +# +-------X-------+ +------X--------------X---------------X-------+ +# X X X X +# X X X X +# XXXXXXXXXXXXXXX X X +# X X +# +--------X------+ +--------X------+ +# | -+--X--+- | | -+--X--+- | +# | |ether| | | |ether| | +# | +--+-----+--+ | | +--+-----+--+ | +# | | ngeth3 | | | | ngeth5 | | +# | |(ng_eiface)| | | |(ng_eiface)| | +# | +-----------+ | | +-----------+ | +# | | | | +# | n3 (vimage) | | n4 (vimage) | +# +---------------+ +---------------+ +# +# +# + +# List the names of virtual nodes and their IP addresses. Use ':' +# character to seperate node name from node IP address and netmask. + +TARGET_TOPOLOGY="n1|10.0.2.1/30<->n2|10.0.2.2/30 n2|10.0.2.5/30<->n3|10.0.2.6/30 n2|10.0.2.9/30<->n4|10.0.2.10/30" +STATIC_ROUTE0="jexec n1 route add -inet default 10.0.2.2" +STATIC_ROUTE1="jexec n3 route add -inet default 10.0.2.5" +STATIC_ROUTE2="jexec n4 route add -inet default 10.0.2.9" +STATIC_ROUTE_CNT=3 + +# MAC manifacturer prefix. This can be modified according to needs. +MAC_PREFIX="00:1d:92" + +# Temporary file is important for proper execution of script. +TEMP_FILE="/var/tmp/.virtual.chain.tmp" + +# Set root directory for jails to be created. +JAIL_PATH="/usr/jails/router" + + +#################################################################### +#### Nothing below this point should need to be modified. #### +#################################################################### + + +# Start/restart routine. +virtual_chain_start() { + + # Load netgraph KLD's as necessary. + + for KLD in ng_ether ng_bridge ng_eiface; do + if ! kldstat -v | grep -qw ${KLD}; then + echo -n "Loading ${KLD}.ko... " + kldload ${KLD} || exit 1 + echo "done" + fi + done + + # Reset all interfaces and jails. If temporary file can not be found + # script assumes that there is no previous configuration. + + if [ ! -e ${TEMP_FILE} ]; then + echo "No previous configuration(${TEMP_FILE}) found to clean-up." + else + echo -n "Cleaning previous configuration..." + virtual_chain_stop + echo "done" + fi + + # Create temporary file for usage. This file includes generated + # interface names and jail names. All bridges, interfaces and jails + # are written to file while created. In clean-up process written + # objects are cleaned (i.e removed) from system. + + if [ -e ${TEMP_FILE} ]; then + touch ${TEMP_FILE} + fi + + + # Attach other interfaces as well. + for CONNECTION in ${TARGET_TOPOLOGY}; do + + # Virtual connections are defined in TARGET_TOPOLOGY variable. + # They have the form of 'nodeName|IPaddr'. Below two lines split + + PEER1=`echo ${CONNECTION} | awk -F"<->" '{print $1}'` + PEER1_NAME=`echo ${PEER1} | awk -F"|" '{print $1}'` + PEER1_IP=`echo ${PEER1} | awk -F"|" '{print $2}'` + + PEER2=`echo ${CONNECTION} | awk -F"<->" '{print $2}'` + PEER2_NAME=`echo ${PEER2} | awk -F"|" '{print $1}'` + PEER2_IP=`echo ${PEER2} | awk -F"|" '{print $2}'` + + # !!! if not created already.. + # Create virtual node (jail) with given name and using + # JAIL_PATH as root directory for jail. + + virtual_chain_create_peer_if_necessary ${PEER1_NAME} + virtual_chain_create_peer_if_necessary ${PEER2_NAME} + + # create an interface for peer with the given peer IP. Get interface + # for future use; you will connect this interface to the other + # peers' (PEER2) interface. + virtual_chain_create_interface_with_ip ${PEER1_NAME} ${PEER1_IP} + PEER1_INTERFACE=${RET_INTERFACE} + + # create an interface for peer with the given peer IP. Get interface + # for future use; you will connect this interface to the other + # peers' (PEER2) interface. + virtual_chain_create_interface_with_ip ${PEER2_NAME} ${PEER2_IP} + PEER2_INTERFACE=${RET_INTERFACE} + + # Connect virtual interface to other interface. Syntax is : + # ngctl connect INTERFACE1: INTERFACE2: ether ether. + + echo -n "Connecting ${PEER1_INTERFACE}:ether to ${PEER2_INTERFACE}:ether..." + ngctl connect ${PEER1_INTERFACE}: ${PEER2_INTERFACE}: ether ether \ + || exit 1 + echo "done" + + done + + # Executes static route add commands. + i=0 + while [ $i != $STATIC_ROUTE_CNT ]; do + eval ROUTE=\${STATIC_ROUTE${i}} + ret=`${ROUTE}` + i=`expr $i + 1` + done + + echo "Virtual WAN established succesfully!" +} + +virtual_chain_create_interface_with_ip() { + + NODE_NAME=$1 + NODE_IP=$2 + + # Create a ng_eiface object for virtual node. ng_eiface + # object has a hook that can be connected to one of bridge + # links. After creating interface get its automatically + # generated name for further usage. + + echo "Creating eiface interface for virtual node ${NODE_NAME}." + ngctl mkpeer eiface ether ether + EIFACE=`ngctl l | grep ngeth | tail -n 1| awk '{print $2}'` + echo "Interface ${EIFACE} is created." + + # Write name of the interface to temp file. Clean-up procedure + # will use this name to shutdown interface. + + echo "interface ${EIFACE}" >> ${TEMP_FILE} + + # Move virtual interface to virtual node. Note that Interface + # name will not be changed at the end of this movement. Moved + # interface can be seen at the output of ifconfig command in + # jail: 'jexec jailname ifconfig' + + echo "Moving ${EIFACE} to ${NODE_NAME}" + ifconfig ${EIFACE} vnet ${NODE_NAME} + + # Make lo0 interface localhost. + jexec ${NODE_NAME} ifconfig lo0 localhost + + # Generate a random mac address for virtual interface. First + # three octets can be changed by user. Last three octets are + # generated randomly. + M4=`od -An -N2 -i /dev/random | sed -e 's/ //g' | \ + awk '{ print $1 % 256 }'` + M5=`od -An -N2 -i /dev/random | sed -e 's/ //g' | \ + awk '{ print $1 % 256 }'` + M6=`od -An -N2 -i /dev/random | sed -e 's/ //g' | \ + awk '{ print $1 % 256 }'` + + MAC=`printf ${MAC_PREFIX}:%02x:%02x:%02x ${M4} ${M5} ${M6}` + + # Set the link address (mac address) of virtual interface in + # virtual node to randomly generated MAC. + echo "Setting MAC address of ${EIFACE} to '${MAC}'" + jexec ${NODE_NAME} ifconfig ${EIFACE} link $MAC + + # Either IPv4 or IPv6 can be used in this script. Ifconfig + # IP setting syntax differs slightly for two IP versions. + # For version 4 'inet' keyword is used whereas for version 6 + # 'inet6' is used. Below line tries to decide which IP version + # is given and sets IPVER to 'inet' or 'inet6'. + + IPVER=`echo ${NODE_IP} | awk -F"." '{ split($4,last,"/"); \ + if( NF==4 && $1>0 && $1<256 && $2<256 && $3<256 && \ + last[1]<256) print "inet"; else print "inet6"}'` + + # Set IP address of virtual interface in virtual node. + echo "Setting IP address of ${EIFACE} to '${NODE_IP}'" + jexec ${NODE_NAME} ifconfig ${EIFACE} ${IPVER} ${NODE_IP} + + RET_INTERFACE=${EIFACE} +} + +virtual_chain_create_peer_if_necessary() { + + if ! grep -q $1 ${TEMP_FILE} ; then + + echo -n "Creating virtual node (jail) ${1}..." + jail -c vnet name=${1} host.hostname=${1} \ + path=${JAIL_PATH} persist + jexec ${1} sysctl -w net.inet.ip.forwarding=1 + jexec ${1} sysctl -w net.inet6.ip6.forwarding=1 + echo "done" + + # Write name of the jail to temp file. Clean-up + # procedure will use this name to remove jail. + + echo "node ${1}" >> ${TEMP_FILE} + fi + +} + + +# Stop routine. +virtual_chain_stop() { + + if [ ! -e ${TEMP_FILE} ]; then + echo "Nothing to stop! ${TEMP_FILE}: temp file not found" + else + + echo -n "Shutdown bridge interface.." + OBJECTS=`cat ${TEMP_FILE} | grep bridge | awk '{print $2}'` + for BRIDGE in ${OBJECTS}; do + ngctl shutdown ${BRIDGE}: >/dev/null 2>&1 + done + echo "done" + + echo -n "Shutdown all eiface interfaces..." + OBJECTS=`cat ${TEMP_FILE} | grep interface | awk '{print $2}'` + for INTERFACE in ${OBJECTS}; do + ngctl shutdown ${INTERFACE}: >/dev/null 2>&1 + done + echo "done" + + echo -n "Removing all jails..." + OBJECTS=`cat ${TEMP_FILE} | grep node | awk '{print $2}'` + for NODE in ${OBJECTS}; do + jail -r ${NODE} + done + echo "done" + + echo "Removing tempfile ${TEMP_FILE}" + rm ${TEMP_FILE} + fi + echo "Virtual LAN objects removed succesfully!" + +} + +virtual_chain_usage() { + echo "usage: $0 start [target_topology]" + echo " : $0 [ stop | help ]" +} + + +# Main entry point. + + +case $# in + 1) + case $1 in + start) + echo -n "Creating default target topology:" + echo " ${TARGET_TOPOLOGY}" + virtual_chain_start + ;; + stop) + + if [ ! -e ${TEMP_FILE} ]; then + echo -n "Noting to stop! ${TEMP_FILE}:" + echo " temp file not found" + else + virtual_chain_stop + fi + ;; + help) + virtual_chain_usage + exit 1 + ;; + *) + virtual_chain_usage + exit 1 + + esac + ;; + 2) + case $1 in + start) + TARGET_TOPOLOGY=$2 + echo -n "Creating target topology:" + echo "${TARGET_TOPOLOGY}" + virtual_chain_start + ;; + *) + virtual_chain_usage + exit 1 + esac + ;; + + *) + virtual_chain_usage + exit 1 +esac + Added: head/share/examples/netgraph/virtual.lan ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/examples/netgraph/virtual.lan Sun Oct 24 22:59:38 2010 (r214306) @@ -0,0 +1,360 @@ +#!/bin/sh +# +# Copyright (c) 2010, Yavuz Gokirmak +# +# All rights reserved. +# +# This source code may be used, modified, copied, distributed, and +# sold, in both source and binary form provided that the above +# copyright and these terms are retained, verbatim, as the first +# lines of this file. Under no circumstances is the author +# responsible for the proper functioning of the software nor does +# the author assume any responsibility for damages incurred with +# its use. +# +# $FreeBSD$ + +# +# This script adds virtual nodes to one of the physical interfaces +# visible on your local area network (LAN). Virtual nodes seems real +# to external observers. +# If traceroute is executed to one of virtual nodes, the IP +# address of the physical interface will not be seen in the output. +# Virtual nodes are generated via jails and network connections are +# established using ng_bridge(4) and ng_eiface(4) node types. +# +# To use this script: +# +# 0. Make your own copy of this example script. +# +# 1. Edit the definition of ${ETHER_INTF} as described below +# to define your real interface connected to the LAN. Virtual nodes +# will placed on the same physical network as this interface. +# +# 2. Edit the definition of ${TARGET_TOPOLOGY} to define your virtual +# nodes. Virtual topology definition includes node names and their +# IP address. Target top. sytax: ( node1|ip1/24 node2|ip2/24 ... ) +# Example 1: ( n1|122.122.122.12/24, n2|122.122.122.13/24 ...) +# Example 2: ( n1|2001:b90::14a/125, n1|2001:b90::14b/125 ...) +# +# 3. Run this script with "start" as the command line argument. +# +# 4. Stop bridging by running this script with "stop" as the +# command line argument. +# +# 5. This cript uses a template file in order to carry information +# between start and stop calls. +# In the start call, the netgraph interfaces and jails are created. +# At the stop phase, all created objects should be removed. +# DO NOT delete the temporary file between the start and stop phases. +# +# To add virtual nodes for multiple independent LANs, create multiple +# copies of this script with different variable definitions. +# +# Target Topology: +# +# +# +---------------+ +---------------+ +---------------+ +# | n0 (vimage) | | n1 (vimage) | | nk (vimage) | +# | | | | | | +# | +-----------+ | | +-----------+ | | +-----------+ | +# | | ngeth0 | | | | ngeth1 | | | | ngethk | | +# | |(ng_eiface)| | | |(ng_eiface)| | | |(ng_eiface)| | +# | +--+-----+--+ | | +--+-----+--+ | | +--+-----+--+ | +# | |ether| | | |ether| | | |ether| | +# | +--X--+ | | +--X--+ | | +---X-+ | +# +-----+ +--------\------+ +--------\------+ +-------/-------+ +# |upper|----\ \ip_addr \ip_addr /ip_addr +# +-+-----+--+ \ \ \ \ +# | em0 | \ +--------+ +-+ \ +# |(ng_ether)| +-----------+ \ \ \ +# +-+-----+--+ \ \ / \ +# |lower| +---------\ \ \ / / +# +--X--+ / O--X--O O-X---O O---X-O O--X--O O---X---O +# \ | |link0| |link1| |link2| |link3| |linkk+2| +# \ / +-O-----O-O-----O-O-----O-O-----O-----O-------O-+ +# +---+ | | +# | bridge (ng_bridge) | +# +-----------------------------------------------+ +# +# + +# Give the name of ethernet interface. Virtual nodes will be seen as +# local neighbours of this interface. + +ETHER_INTF="em0" + +# List the names of virtual nodes and their IP addresses. Use ':' +# character to seperate node name from node IP address and netmask. + +TARGET_TOPOLOGY="c1|10.0.2.20/24 c2|10.0.2.21/24 c3|10.0.2.22/24" + +# MAC manifacturer prefix. This can be modified according to needs. +MAC_PREFIX="00:1d:92" + +# Temporary file is important for proper execution of script. +TEMP_FILE="/var/tmp/.virtual.lan.tmp" + +# Set root directory for jails to be created. +JAIL_PATH="/usr/jails/node" + + +#################################################################### +#### Nothing below this point should need to be modified. #### +#################################################################### + + +# Start/restart routine. +virtual_lan_start() { + + # Load netgraph KLD's as necessary. + + for KLD in ng_ether ng_bridge ng_eiface; do + if ! kldstat -v | grep -qw ${KLD}; then + echo -n "Loading ${KLD}.ko... " + kldload ${KLD} || exit 1 + echo "done" + fi + done + + # Reset all interfaces and jails. If temporary file can not be found + # script assumes that there is no previous configuration. + + if [ ! -e ${TEMP_FILE} ]; then + echo "No previous configuration(${TEMP_FILE}) found to clean-up." + else + echo -n "Cleaning previous configuration..." + virtual_lan_stop + echo "done" + fi + + # Create temporary file for usage. This file includes generated + # interface names and jail names. All bridges, interfaces and jails + # are written to file while created. In clean-up process written + # objects are cleaned (i.e removed) from system. + + if [ -e ${TEMP_FILE} ]; then + touch ${TEMP_FILE} + fi + + echo -n "Verifying ethernet interface existence..." + # Verify ethernet interface exist. + if ! ngctl info ${ETHER_INTF}: >/dev/null 2>&1; then + echo "Error: interface ${ETHER_INTF} does not exist" + exit 1 + fi + ifconfig ${ETHER_INTF} up || exit 1 + echo "done" + + # Get current number of bridge interfaces in the system. This number + # is used to create a name for new bridge. + BRIDGE_COUNT=`ngctl l | grep bridge | wc -l | sed -e "s/ //g"` + BRIDGE_NAME="bridge${BRIDGE_COUNT}" + + # Create new ng_bridge(4) node and attach it to the ethernet interface. + # Connect ng_ether:lower hook to bridge:link0 when creating bridge and + # connect ng_ether:upper hook to bridge:link1 after bridge name is set. + + echo "Creating bridge interface: ${BRIDGE_NAME}..." + ngctl mkpeer ${ETHER_INTF}: bridge lower link0 || exit 1 + ngctl name ${ETHER_INTF}:lower ${BRIDGE_NAME} || exit 1 + ngctl connect ${ETHER_INTF}: ${BRIDGE_NAME}: upper link1 || exit 1 + echo "Bridge ${BRIDGE_NAME} is created and ${ETHER_INTF} is connected." + + # In the above code block two hooks are connected to bridge interface, + # therefore LINKNUM is set to 2 indicating total number of connected + # hooks on the bridge interface. + LINKNUM=2 + + # Write name of the bridge to temp file. Clean-up procedure will use + # this name to shutdown bridge interface. + echo "bridge ${BRIDGE_NAME}" > ${TEMP_FILE} + + + # Attach other interfaces as well. + for NODE in ${TARGET_TOPOLOGY}; do + + # Virtual nodes are defined in TARGET_TOPOLOGY variable. They + # have the form of 'nodeName|IPaddr'. Below two lines split + # node definition to get node name and node IP. + + NODE_NAME=`echo ${NODE} | awk -F"|" '{print $1}'` + NODE_IP=`echo ${NODE} | awk -F"|" '{print $2}'` + + # Create virtual node (jail) with given name and using + # JAIL_PATH as root directory for jail. + + echo -n "Creating virtual node (jail) ${NODE_NAME}..." + jail -c vnet name=${NODE_NAME} host.hostname=${NODE_NAME} \ + path=${JAIL_PATH} persist + echo "done" + + # Write name of the jail to temp file. Clean-up procedure will + # use this name to remove jail. + + echo "node ${NODE_NAME}" >> ${TEMP_FILE} + + # Create a ng_eiface object for virtual node. ng_eiface + # object has a hook that can be connected to one of bridge + # links. After creating interface get its automatically + # generated name for further usage. + + echo "Creating eiface interface for virtual node ${NODE_NAME}." + ngctl mkpeer eiface ether ether + EIFACE=`ngctl l | grep ngeth | tail -n 1| awk '{print $2}'` + echo "Interface ${EIFACE} is created." + + # Write name of the interface to temp file. Clean-up procedure + # will use this name to shutdown interface. + + echo "interface ${EIFACE}" >> ${TEMP_FILE} + + # Move virtual interface to virtual node. Note that Interface + # name will not be changed at the end of this movement. Moved + # interface can be seen at the output of ifconfig command in + # jail: 'jexec jailname ifconfig' + + echo "Moving ${EIFACE} to ${NODE_NAME}" + ifconfig ${EIFACE} vnet ${NODE_NAME} + + # Make lo0 interface localhost. + jexec ${NODE_NAME} ifconfig lo0 localhost + + # Generate a random mac address for virtual interface. First + # three octets can be changed by user. Last three octets are + # generated randomly. + M4=`od -An -N2 -i /dev/random | sed -e 's/ //g' | \ + awk '{ print $1 % 256 }'` + M5=`od -An -N2 -i /dev/random | sed -e 's/ //g' | \ + awk '{ print $1 % 256 }'` + M6=`od -An -N2 -i /dev/random | sed -e 's/ //g' | \ + awk '{ print $1 % 256 }'` + + MAC=`printf ${MAC_PREFIX}:%02x:%02x:%02x ${M4} ${M5} ${M6}` + + # Set the link address (mac address) of virtual interface in + # virtual node to randomly generated MAC. + echo "Setting MAC address of ${EIFACE} to '${MAC}'" + jexec ${NODE_NAME} ifconfig ${EIFACE} link $MAC + + # Either IPv4 or IPv6 can be used in this script. Ifconfig + # IP setting syntax differs slightly for two IP versions. + # For version 4 'inet' keyword is used whereas for version 6 + # 'inet6' is used. Below line tries to decide which IP version + # is given and sets IPVER to 'inet' or 'inet6'. + + IPVER=`echo ${NODE_IP} | awk -F"." '{ split($4,last,"/"); \ + if( NF==4 && $1>0 && $1<256 && $2<256 && $3<256 && \ + last[1]<256) print "inet"; else print "inet6"}'` + + # Set IP address of virtual interface in virtual node. + echo "Setting IP address of ${EIFACE} to '${NODE_IP}'" + jexec ${NODE_NAME} ifconfig ${EIFACE} ${IPVER} ${NODE_IP} + + # Connect virtual interface to bridge interface. Syntax is : + # ngctl connect INTERFACE: BRIDGE: INTERFACE_HOOK EMPTY_LINK. + # Interface has one hook named 'ether' and below line connects + # ether hook to bridge's first unconnected link. + + echo -n "Connecting ${EIFACE}:ether to ${BRIDGE_NAME}:link${LINKNUM}..." + ngctl connect ${EIFACE}: ${BRIDGE_NAME}: ether link${LINKNUM} \ + || exit 1 + echo "done" + + # Now, bridge has one more connected link thus link count is + # incremented. + LINKNUM=`expr ${LINKNUM} + 1` + done + echo "Virtual LAN established succesfully!" + +} + +# Stop routine. +virtual_lan_stop() { + + if [ ! -e ${TEMP_FILE} ]; then + echo "Nothing to stop! ${TEMP_FILE}: temp file not found" + else + + echo -n "Shutdown bridge interface.." + OBJECTS=`cat ${TEMP_FILE} | grep bridge | awk '{print $2}'` + for BRIDGE in ${OBJECTS}; do + ngctl shutdown ${BRIDGE}: >/dev/null 2>&1 + done + echo "done" + + echo -n "Shutdown all eiface interfaces..." + OBJECTS=`cat ${TEMP_FILE} | grep interface | awk '{print $2}'` + for INTERFACE in ${OBJECTS}; do + ngctl shutdown ${INTERFACE}: >/dev/null 2>&1 + done + echo "done" + + echo -n "Removing all jails..." + OBJECTS=`cat ${TEMP_FILE} | grep node | awk '{print $2}'` + for NODE in ${OBJECTS}; do + jail -r ${NODE} + done + echo "done" + + echo "Removing tempfile ${TEMP_FILE}" + rm ${TEMP_FILE} + fi + echo "Virtual LAN objects removed succesfully!" + +} + +virtual_lan_usage() { + echo "usage: $0 start [target_topology]" + echo " : $0 [ stop | help ]" +} + + +# Main entry point. + +case $# in + 1) + case $1 in + start) + echo -n "Creating default target topology:" + echo " ${TARGET_TOPOLOGY}" + virtual_lan_start + ;; + stop) + + if [ ! -e ${TEMP_FILE} ]; then + echo -n "Noting to stop! ${TEMP_FILE}:" + echo " temp file not found" + else + virtual_lan_stop + fi + ;; + help) + virtual_lan_usage + exit 1 + ;; + *) + virtual_lan_usage + exit 1 + + esac + ;; + 2) + case $1 in + start) + TARGET_TOPOLOGY=$2 + echo -n "Creating target topology:" + echo "${TARGET_TOPOLOGY}" + virtual_lan_start + ;; + *) + virtual_lan_usage + exit 1 + esac + ;; + + *) + virtual_lan_usage + exit 1 +esac + From owner-svn-src-head@FreeBSD.ORG Sun Oct 24 23:19:11 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AAF3E1065672; Sun, 24 Oct 2010 23:19:11 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 999668FC18; Sun, 24 Oct 2010 23:19:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9ONJBoQ044045; Sun, 24 Oct 2010 23:19:11 GMT (envelope-from julian@svn.freebsd.org) Received: (from julian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9ONJBHi044043; Sun, 24 Oct 2010 23:19:11 GMT (envelope-from julian@svn.freebsd.org) Message-Id: <201010242319.o9ONJBHi044043@svn.freebsd.org> From: Julian Elischer Date: Sun, 24 Oct 2010 23:19:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214308 - head/etc/mtree X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Oct 2010 23:19:11 -0000 Author: julian Date: Sun Oct 24 23:19:11 2010 New Revision: 214308 URL: http://svn.freebsd.org/changeset/base/214308 Log: Add a jails directory in the examples section MFC after: 2 weeks Modified: head/etc/mtree/BSD.usr.dist Modified: head/etc/mtree/BSD.usr.dist ============================================================================== --- head/etc/mtree/BSD.usr.dist Sun Oct 24 23:09:00 2010 (r214307) +++ head/etc/mtree/BSD.usr.dist Sun Oct 24 23:19:11 2010 (r214308) @@ -227,6 +227,8 @@ .. iscsi .. + jails + .. kld cdev module From owner-svn-src-head@FreeBSD.ORG Sun Oct 24 23:25:15 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 33A3F10656A8; Sun, 24 Oct 2010 23:25:15 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 221778FC17; Sun, 24 Oct 2010 23:25:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9ONPF2g044203; Sun, 24 Oct 2010 23:25:15 GMT (envelope-from julian@svn.freebsd.org) Received: (from julian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9ONPFpM044201; Sun, 24 Oct 2010 23:25:15 GMT (envelope-from julian@svn.freebsd.org) Message-Id: <201010242325.o9ONPFpM044201@svn.freebsd.org> From: Julian Elischer Date: Sun, 24 Oct 2010 23:25:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214309 - head/share/examples X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Oct 2010 23:25:15 -0000 Author: julian Date: Sun Oct 24 23:25:14 2010 New Revision: 214309 URL: http://svn.freebsd.org/changeset/base/214309 Log: Add Makefile entry to install two new example files. MFC after: 2 weeks Modified: head/share/examples/Makefile Modified: head/share/examples/Makefile ============================================================================== --- head/share/examples/Makefile Sun Oct 24 23:19:11 2010 (r214308) +++ head/share/examples/Makefile Sun Oct 24 23:25:14 2010 (r214309) @@ -17,6 +17,7 @@ LDIRS= BSD_daemon \ ibcs2 \ indent \ ipfw \ + jails \ kld \ libvgl \ mdoc \ @@ -80,6 +81,7 @@ XFILES= BSD_daemon/FreeBSD.pfa \ ibcs2/hello.uu \ indent/indent.pro \ ipfw/change_rules.sh \ + jails/README \ kld/Makefile \ kld/cdev/Makefile \ kld/cdev/README \ @@ -116,6 +118,8 @@ XFILES= BSD_daemon/FreeBSD.pfa \ netgraph/ngctl \ netgraph/raw \ netgraph/udp.tunnel \ + netgraph/virtual.chain \ + netgraph/virtual.lan \ nwclient/dot.nwfsrc \ nwclient/nwfs.sh.sample \ perfmon/Makefile \ From owner-svn-src-head@FreeBSD.ORG Mon Oct 25 00:00:03 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2CA63106564A; Mon, 25 Oct 2010 00:00:03 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from out-0.mx.aerioconnect.net (out-0-14.mx.aerioconnect.net [216.240.47.74]) by mx1.freebsd.org (Postfix) with ESMTP id F1E1A8FC0A; Mon, 25 Oct 2010 00:00:02 +0000 (UTC) Received: from idiom.com (postfix@mx0.idiom.com [216.240.32.160]) by out-0.mx.aerioconnect.net (8.13.8/8.13.8) with ESMTP id o9ONZB6T000335; Sun, 24 Oct 2010 16:35:11 -0700 X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e Received: from julian-mac.elischer.org (h-67-100-89-137.snfccasy.static.covad.net [67.100.89.137]) by idiom.com (Postfix) with ESMTP id 0CBD62D6011; Sun, 24 Oct 2010 16:35:09 -0700 (PDT) Message-ID: <4CC4C2E8.9020304@freebsd.org> Date: Sun, 24 Oct 2010 16:36:08 -0700 From: Julian Elischer User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.4; en-US; rv:1.9.2.11) Gecko/20101013 Thunderbird/3.1.5 MIME-Version: 1.0 To: "Bjoern A. Zeeb" References: <201010242202.o9OM2aGo041606@svn.freebsd.org> In-Reply-To: <201010242202.o9OM2aGo041606@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.67 on 216.240.47.51 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r214303 - in head/sys: conf netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Oct 2010 00:00:03 -0000 On 10/24/10 3:02 PM, Bjoern A. Zeeb wrote: > Author: bz > Date: Sun Oct 24 22:02:36 2010 > New Revision: 214303 > URL: http://svn.freebsd.org/changeset/base/214303 > > Log: > Add initial inet DDB support for show in_ifaddr and show sin commands which > proved to be useful while debugging address list problems. sin commands? really? "Covet thy neighbor's wife!" > > From owner-svn-src-head@FreeBSD.ORG Mon Oct 25 01:13:47 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 32BB71065670; Mon, 25 Oct 2010 01:13:47 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-gw0-f54.google.com (mail-gw0-f54.google.com [74.125.83.54]) by mx1.freebsd.org (Postfix) with ESMTP id 86E6A8FC08; Mon, 25 Oct 2010 01:13:46 +0000 (UTC) Received: by gwaa18 with SMTP id a18so1359257gwa.13 for ; Sun, 24 Oct 2010 18:13:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:references:in-reply-to :mime-version:content-transfer-encoding:content-type:message-id:cc :x-mailer:from:subject:date:to; bh=BUxsvBVttbm6N74TBjfbc3w6BXR187OU/oAXwgQcaBo=; b=DV4EpqC7Dye4yx/MugI299Mf9Q+feQQSYU41aSvxWOCUkfNWVZuTzCzcZqOlf2+MnU 55eUzyYNyc7wCt2IAoAWFYTRLUXimFqMu9/R8f8aqJ10gzMEgWJrb0MynIsqedNBz6Ca fLX63pNqA2HvhnfHYGLEWFORfvb3oeBcgczZk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=references:in-reply-to:mime-version:content-transfer-encoding :content-type:message-id:cc:x-mailer:from:subject:date:to; b=iD68LcUIMUrhauU0bCU1a6TMIScJMnA9OaxqOmHwO97vu8Q5qgm/AlF7WniB4tq7Vt mHXFvp1q4vbdI/evRI+wRz1sc/2qOP0nAOjsH/TwgWj0ygB3LRl2921LctvhDMKhfDMh ke1Oo9kqHsBQ0no1DSF57Y7vAPyvv8h3WpHOk= Received: by 10.150.198.8 with SMTP id v8mr55572ybf.115.1287969223919; Sun, 24 Oct 2010 18:13:43 -0700 (PDT) Received: from [10.84.243.115] ([166.205.136.210]) by mx.google.com with ESMTPS id x51sm4992557yhc.19.2010.10.24.18.13.39 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 24 Oct 2010 18:13:42 -0700 (PDT) References: <201010242202.o9OM2aGo041606@svn.freebsd.org> <4CC4C2E8.9020304@freebsd.org> In-Reply-To: <4CC4C2E8.9020304@freebsd.org> Mime-Version: 1.0 (iPhone Mail 8B117) Message-Id: X-Mailer: iPhone Mail (8B117) From: Garrett Cooper Date: Sun, 24 Oct 2010 18:13:48 -0700 To: Julian Elischer Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "Bjoern A. Zeeb" , "src-committers@freebsd.org" Subject: Re: svn commit: r214303 - in head/sys: conf netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Oct 2010 01:13:47 -0000 On Oct 24, 2010, at 4:36 PM, Julian Elischer wrote: > On 10/24/10 3:02 PM, Bjoern A. Zeeb wrote: >> Author: bz >> Date: Sun Oct 24 22:02:36 2010 >> New Revision: 214303 >> URL: http://svn.freebsd.org/changeset/base/214303 >>=20 >> Log: >> Add initial inet DDB support for show in_ifaddr and show sin commands w= hich >> proved to be useful while debugging address list problems. >=20 > sin commands? really? "Covet thy neighbor's wife!" >>=20 >>=20 As long as DDB doesn't hold false WITNESS (LOR), we should be ok :)...= From owner-svn-src-head@FreeBSD.ORG Mon Oct 25 07:17:07 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D409110656C7; Mon, 25 Oct 2010 07:17:07 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C1B8D8FC17; Mon, 25 Oct 2010 07:17:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9P7H7vJ054561; Mon, 25 Oct 2010 07:17:07 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9P7H7Uh054559; Mon, 25 Oct 2010 07:17:07 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201010250717.o9P7H7Uh054559@svn.freebsd.org> From: Alexander Motin Date: Mon, 25 Oct 2010 07:17:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214321 - head/sbin/camcontrol X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Oct 2010 07:17:07 -0000 Author: mav Date: Mon Oct 25 07:17:07 2010 New Revision: 214321 URL: http://svn.freebsd.org/changeset/base/214321 Log: Do some whitespace and `identify` output cleanup. Submitted by: arundel MFC after: 2 weeks Modified: head/sbin/camcontrol/camcontrol.c Modified: head/sbin/camcontrol/camcontrol.c ============================================================================== --- head/sbin/camcontrol/camcontrol.c Mon Oct 25 07:11:37 2010 (r214320) +++ head/sbin/camcontrol/camcontrol.c Mon Oct 25 07:17:07 2010 (r214321) @@ -116,7 +116,7 @@ typedef enum { } cam_argmask; struct camcontrol_opts { - const char *optname; + const char *optname; cam_cmdmask cmdnum; cam_argmask argnum; const char *subopt; @@ -204,7 +204,7 @@ static int readdefects(struct cam_device char *combinedopt, int retry_count, int timeout); static void modepage(struct cam_device *device, int argc, char **argv, char *combinedopt, int retry_count, int timeout); -static int scsicmd(struct cam_device *device, int argc, char **argv, +static int scsicmd(struct cam_device *device, int argc, char **argv, char *combinedopt, int retry_count, int timeout); static int tagcontrol(struct cam_device *device, int argc, char **argv, char *combinedopt); @@ -234,7 +234,7 @@ static int atapm(struct cam_device *devi #endif camcontrol_optret -getoption(char *arg, cam_cmdmask *cmdnum, cam_argmask *argnum, +getoption(char *arg, cam_cmdmask *cmdnum, cam_argmask *argnum, const char **subopt) { struct camcontrol_opts *opts; @@ -622,7 +622,7 @@ scsistart(struct cam_device *device, int else fprintf(stdout, "Error received from stop unit command\n"); - + if (arglist & CAM_ARG_VERBOSE) { cam_error_print(device, ccb, CAM_ESF_ALL, CAM_EPF_ALL, stderr); @@ -688,7 +688,7 @@ scsiinquiry(struct cam_device *device, i union ccb *ccb; struct scsi_inquiry_data *inq_buf; int error = 0; - + ccb = cam_getccb(device); if (ccb == NULL) { @@ -721,13 +721,13 @@ scsiinquiry(struct cam_device *device, i * scsi_inquiry() will convert an inq_len (which is passed in as * a u_int32_t, but the field in the CDB is only 1 byte) of 256 * to 0. Evidently, very few devices meet the spec in that - * regard. Some devices, like many Seagate disks, take the 0 as + * regard. Some devices, like many Seagate disks, take the 0 as * 0, and don't return any data. One Pioneer DVD-R drive * returns more data than the command asked for. * * So, since there are numerous devices that just don't work * right with the full inquiry size, we don't send the full size. - * + * * - The second reason not to use the full inquiry data length is * that we don't need it here. The only reason we issue a * standard inquiry is to get the vendor name, device name, @@ -1181,7 +1181,7 @@ atacapprint(struct ata_params *parm) } printf("\nFeature " - "Support Enable Value Vendor\n"); + "Support Enabled Value Vendor\n"); printf("read ahead %s %s\n", parm->support.command1 & ATA_SUPPORT_LOOKAHEAD ? "yes" : "no", parm->enabled.command1 & ATA_SUPPORT_LOOKAHEAD ? "yes" : "no"); @@ -1201,16 +1201,13 @@ atacapprint(struct ata_params *parm) ATA_QUEUE_LEN(parm->queue) + 1); } else printf("\n"); - if (parm->satacapabilities && parm->satacapabilities != 0xffff) { - printf("Native Command Queuing (NCQ) %s ", - parm->satacapabilities & ATA_SUPPORT_NCQ ? - "yes" : "no"); - if (parm->satacapabilities & ATA_SUPPORT_NCQ) { - printf(" %d tags\n", - ATA_QUEUE_LEN(parm->queue) + 1); - } else - printf("\n"); - } + printf("Native Command Queuing (NCQ) "); + if (parm->satacapabilities != 0xffff && + (parm->satacapabilities & ATA_SUPPORT_NCQ)) { + printf("yes %d tags\n", + ATA_QUEUE_LEN(parm->queue) + 1); + } else + printf("no\n"); printf("SMART %s %s\n", parm->support.command1 & ATA_SUPPORT_SMART ? "yes" : "no", parm->enabled.command1 & ATA_SUPPORT_SMART ? "yes" : "no"); @@ -1223,28 +1220,39 @@ atacapprint(struct ata_params *parm) printf("power management %s %s\n", parm->support.command1 & ATA_SUPPORT_POWERMGT ? "yes" : "no", parm->enabled.command1 & ATA_SUPPORT_POWERMGT ? "yes" : "no"); - printf("advanced power management %s %s %d/0x%02X\n", + printf("advanced power management %s %s", parm->support.command2 & ATA_SUPPORT_APM ? "yes" : "no", - parm->enabled.command2 & ATA_SUPPORT_APM ? "yes" : "no", - parm->apm_value, parm->apm_value); - printf("automatic acoustic management %s %s " - "%d/0x%02X %d/0x%02X\n", + parm->enabled.command2 & ATA_SUPPORT_APM ? "yes" : "no"); + if (parm->support.command2 & ATA_SUPPORT_APM) { + printf(" %d/0x%02X\n", + parm->apm_value, parm->apm_value); + } else + printf("\n"); + printf("automatic acoustic management %s %s", parm->support.command2 & ATA_SUPPORT_AUTOACOUSTIC ? "yes" :"no", - parm->enabled.command2 & ATA_SUPPORT_AUTOACOUSTIC ? "yes" :"no", - ATA_ACOUSTIC_CURRENT(parm->acoustic), - ATA_ACOUSTIC_CURRENT(parm->acoustic), - ATA_ACOUSTIC_VENDOR(parm->acoustic), - ATA_ACOUSTIC_VENDOR(parm->acoustic)); + parm->enabled.command2 & ATA_SUPPORT_AUTOACOUSTIC ? "yes" :"no"); + if (parm->support.command2 & ATA_SUPPORT_AUTOACOUSTIC) { + printf(" %d/0x%02X %d/0x%02X\n", + ATA_ACOUSTIC_CURRENT(parm->acoustic), + ATA_ACOUSTIC_CURRENT(parm->acoustic), + ATA_ACOUSTIC_VENDOR(parm->acoustic), + ATA_ACOUSTIC_VENDOR(parm->acoustic)); + } else + printf("\n"); printf("media status notification %s %s\n", parm->support.command2 & ATA_SUPPORT_NOTIFY ? "yes" : "no", parm->enabled.command2 & ATA_SUPPORT_NOTIFY ? "yes" : "no"); printf("power-up in Standby %s %s\n", parm->support.command2 & ATA_SUPPORT_STANDBY ? "yes" : "no", parm->enabled.command2 & ATA_SUPPORT_STANDBY ? "yes" : "no"); - printf("write-read-verify %s %s %d/0x%x\n", + printf("write-read-verify %s %s", parm->support2 & ATA_SUPPORT_WRITEREADVERIFY ? "yes" : "no", - parm->enabled2 & ATA_SUPPORT_WRITEREADVERIFY ? "yes" : "no", - parm->wrv_mode, parm->wrv_mode); + parm->enabled2 & ATA_SUPPORT_WRITEREADVERIFY ? "yes" : "no"); + if (parm->support2 & ATA_SUPPORT_WRITEREADVERIFY) { + printf(" %d/0x%x\n", + parm->wrv_mode, parm->wrv_mode); + } else + printf("\n"); printf("unload %s %s\n", parm->support.extension & ATA_SUPPORT_UNLOAD ? "yes" : "no", parm->enabled.extension & ATA_SUPPORT_UNLOAD ? "yes" : "no"); @@ -1255,7 +1263,6 @@ atacapprint(struct ata_params *parm) parm->support_dsm & ATA_SUPPORT_DSM_TRIM ? "yes" : "no"); } - static int ataidentify(struct cam_device *device, int retry_count, int timeout) { @@ -1902,7 +1909,7 @@ readdefects(struct cam_device *device, i /* * XXX KDM I should probably clean up the printout format for the - * disk defects. + * disk defects. */ switch (returned_format & SRDDH10_DLIST_FORMAT_MASK){ case SRDDH10_PHYSICAL_SECTOR_FORMAT: @@ -2011,7 +2018,7 @@ void reassignblocks(struct cam_device *device, u_int32_t *blocks, int num_blocks) { union ccb *ccb; - + ccb = cam_getccb(device); cam_freeccb(ccb); @@ -2114,7 +2121,7 @@ mode_select(struct cam_device *device, i err(1, "error sending mode select command"); else errx(1, "error sending mode select command"); - + } cam_freeccb(ccb); @@ -2294,7 +2301,7 @@ scsicmd(struct cam_device *device, int a if (arglist & CAM_ARG_CMD_IN) { warnx("command must either be " "read or write, not both"); - error = 1; + error = 1; goto scsicmd_bailout; } arglist |= CAM_ARG_CMD_OUT; @@ -2611,7 +2618,7 @@ camdebug(int argc, char **argv, char *co warnx("bus:target, or bus:target:lun to debug"); } } - + if (error == 0) { ccb.ccb_h.func_code = XPT_DEBUG; @@ -2874,7 +2881,7 @@ cts_print(struct cam_device *device, str } /* - * Get a path inquiry CCB for the specified device. + * Get a path inquiry CCB for the specified device. */ static int get_cpi(struct cam_device *device, struct ccb_pathinq *cpi) @@ -2913,7 +2920,7 @@ get_cpi_bailout: } /* - * Get a get device CCB for the specified device. + * Get a get device CCB for the specified device. */ static int get_cgd(struct cam_device *device, struct ccb_getdev *cgd) @@ -3764,9 +3771,9 @@ doreport: fprintf(stdout, "\rFormatting: %ju.%02u %% " "(%d/%d) done", - (uintmax_t)(percentage / + (uintmax_t)(percentage / (0x10000 * 100)), - (unsigned)((percentage / + (unsigned)((percentage / 0x10000) % 100), val, 0x10000); fflush(stdout); @@ -3956,7 +3963,7 @@ retry: case RPL_LUNDATA_ATYP_PERIPH: if ((lundata->luns[i].lundata[j] & RPL_LUNDATA_PERIPH_BUS_MASK) != 0) - fprintf(stdout, "%d:", + fprintf(stdout, "%d:", lundata->luns[i].lundata[j] & RPL_LUNDATA_PERIPH_BUS_MASK); else if ((j == 0) @@ -3994,7 +4001,7 @@ retry: field_len_code = (lundata->luns[i].lundata[j] & RPL_LUNDATA_EXT_LEN_MASK) >> 4; field_len = field_len_code * 2; - + if ((eam_code == RPL_LUNDATA_EXT_EAM_WK) && (field_len_code == 0x00)) { fprintf(stdout, "%d", @@ -4352,7 +4359,7 @@ bailout: #endif /* MINIMALISTIC */ -void +void usage(int verbose) { fprintf(verbose ? stdout : stderr, @@ -4494,7 +4501,7 @@ usage(int verbose) #endif /* MINIMALISTIC */ } -int +int main(int argc, char **argv) { int c; @@ -4544,7 +4551,7 @@ main(int argc, char **argv) * this. getopt is kinda braindead, so you end up having to run * through the options twice, and give each invocation of getopt * the option string for the other invocation. - * + * * You would think that you could just have two groups of options. * The first group would get parsed by the first invocation of * getopt, and the second group would get parsed by the second @@ -4553,13 +4560,13 @@ main(int argc, char **argv) * to the argument _after_ the first argument in the second group. * So when the second invocation of getopt comes around, it doesn't * recognize the first argument it gets and then bails out. - * + * * A nice alternative would be to have a flag for getopt that says * "just keep parsing arguments even when you encounter an unknown * argument", but there isn't one. So there's no real clean way to * easily parse two sets of arguments without having one invocation * of getopt know about the other. - * + * * Without this hack, the first invocation of getopt would work as * long as the generic arguments are first, but the second invocation * (in the subfunction) would fail in one of two ways. In the case @@ -4573,14 +4580,14 @@ main(int argc, char **argv) * whether optind had been incremented one option too far. The * mechanics of that, however, are more daunting than just giving * both invocations all of the expect options for either invocation. - * + * * Needless to say, I wouldn't mind if someone invented a better * (non-GPL!) command line parsing interface than getopt. I * wouldn't mind if someone added more knobs to getopt to make it * work better. Who knows, I may talk myself into doing it someday, * if the standards weenies let me. As it is, it just leads to * hackery like this and causes people to avoid it in some cases. - * + * * KDM, September 8th, 1998 */ if (subopt != NULL) From owner-svn-src-head@FreeBSD.ORG Mon Oct 25 07:39:05 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DCD3F106564A; Mon, 25 Oct 2010 07:39:05 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CC05F8FC0C; Mon, 25 Oct 2010 07:39:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9P7d5og055235; Mon, 25 Oct 2010 07:39:05 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9P7d5vS055233; Mon, 25 Oct 2010 07:39:05 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201010250739.o9P7d5vS055233@svn.freebsd.org> From: Andriy Gapon Date: Mon, 25 Oct 2010 07:39:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214324 - head X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Oct 2010 07:39:06 -0000 Author: avg Date: Mon Oct 25 07:39:05 2010 New Revision: 214324 URL: http://svn.freebsd.org/changeset/base/214324 Log: add dates along with revision numbers in UPDATING entry for 20100915 Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Mon Oct 25 07:36:39 2010 (r214323) +++ head/UPDATING Mon Oct 25 07:39:05 2010 (r214324) @@ -35,10 +35,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 9. 20100915: A workaround for a fixed ld bug has been removed in kernel code, so make sure that your system ld is built from sources after - revision 210245 (r211583 if building head kernel on stable/8, - r211584 for stable/7). A symptom of incorrect ld version is - different addresses for set_pcpu section and __start_set_pcpu - symbol in kernel and/or modules. + revision 210245 from 2010-07-19 (r211583 if building head kernel + on stable/8, r211584 for stable/7; both from 2010-08-21). + A symptom of incorrect ld version is different addresses for + set_pcpu section and __start_set_pcpu symbol in kernel and/or modules. 20100913: The $ipv6_prefer variable in rc.conf(5) has been split into From owner-svn-src-head@FreeBSD.ORG Mon Oct 25 07:41:21 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C4BE4106566B; Mon, 25 Oct 2010 07:41:21 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B38628FC0A; Mon, 25 Oct 2010 07:41:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9P7fLD6055318; Mon, 25 Oct 2010 07:41:21 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9P7fLJh055315; Mon, 25 Oct 2010 07:41:21 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201010250741.o9P7fLJh055315@svn.freebsd.org> From: Alexander Motin Date: Mon, 25 Oct 2010 07:41:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214325 - in head/sys/dev: ahci siis X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Oct 2010 07:41:21 -0000 Author: mav Date: Mon Oct 25 07:41:21 2010 New Revision: 214325 URL: http://svn.freebsd.org/changeset/base/214325 Log: Add missing mtx_destroy() on channel attach failure. Modified: head/sys/dev/ahci/ahci.c head/sys/dev/siis/siis.c Modified: head/sys/dev/ahci/ahci.c ============================================================================== --- head/sys/dev/ahci/ahci.c Mon Oct 25 07:39:05 2010 (r214324) +++ head/sys/dev/ahci/ahci.c Mon Oct 25 07:41:21 2010 (r214325) @@ -969,6 +969,7 @@ err1: err0: bus_release_resource(dev, SYS_RES_MEMORY, ch->unit, ch->r_mem); mtx_unlock(&ch->mtx); + mtx_destroy(&ch->mtx); return (error); } Modified: head/sys/dev/siis/siis.c ============================================================================== --- head/sys/dev/siis/siis.c Mon Oct 25 07:39:05 2010 (r214324) +++ head/sys/dev/siis/siis.c Mon Oct 25 07:41:21 2010 (r214325) @@ -527,6 +527,7 @@ err1: err0: bus_release_resource(dev, SYS_RES_MEMORY, ch->unit, ch->r_mem); mtx_unlock(&ch->mtx); + mtx_destroy(&ch->mtx); return (error); } From owner-svn-src-head@FreeBSD.ORG Mon Oct 25 08:25:44 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 684391065674; Mon, 25 Oct 2010 08:25:44 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5724B8FC18; Mon, 25 Oct 2010 08:25:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9P8Pif5056918; Mon, 25 Oct 2010 08:25:44 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9P8PiqJ056916; Mon, 25 Oct 2010 08:25:44 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201010250825.o9P8PiqJ056916@svn.freebsd.org> From: Alexander Motin Date: Mon, 25 Oct 2010 08:25:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214332 - head/sys/dev/sound/pcm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Oct 2010 08:25:44 -0000 Author: mav Date: Mon Oct 25 08:25:44 2010 New Revision: 214332 URL: http://svn.freebsd.org/changeset/base/214332 Log: Make hw.snd.vpc_0db to be also a loader tunable. Modified: head/sys/dev/sound/pcm/channel.c Modified: head/sys/dev/sound/pcm/channel.c ============================================================================== --- head/sys/dev/sound/pcm/channel.c Mon Oct 25 08:23:38 2010 (r214331) +++ head/sys/dev/sound/pcm/channel.c Mon Oct 25 08:25:44 2010 (r214332) @@ -124,6 +124,7 @@ SYSCTL_INT(_hw_snd, OID_AUTO, vpc_autore &chn_vpc_autoreset, 0, "automatically reset channels volume to 0db"); static int chn_vol_0db_pcm = SND_VOL_0DB_PCM; +TUNABLE_INT("hw.snd.vpc_0db", &chn_vol_0db_pcm); static void chn_vpc_proc(int reset, int db) From owner-svn-src-head@FreeBSD.ORG Mon Oct 25 08:30:20 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3FD531065673; Mon, 25 Oct 2010 08:30:20 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2D5118FC14; Mon, 25 Oct 2010 08:30:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9P8UKCY057039; Mon, 25 Oct 2010 08:30:20 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9P8UK39057035; Mon, 25 Oct 2010 08:30:20 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201010250830.o9P8UK39057035@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Mon, 25 Oct 2010 08:30:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214333 - in head/sys: conf net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Oct 2010 08:30:20 -0000 Author: bz Date: Mon Oct 25 08:30:19 2010 New Revision: 214333 URL: http://svn.freebsd.org/changeset/base/214333 Log: Factor out DDB commands from r204145, r204279 into if_debug.c for further enhancements (1). Switch to a standard 2-clause BSD license for this (2). Unfortunately we have to un-static the ifindex_table for this but do not publicly export it. Suggested by: rwatson (1) a while back. Approved by: thompsa (2) for the change from r204279. MFC after: 6 days Added: head/sys/net/if_debug.c (contents, props changed) Modified: head/sys/conf/files head/sys/net/if.c Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Mon Oct 25 08:25:44 2010 (r214332) +++ head/sys/conf/files Mon Oct 25 08:30:19 2010 (r214333) @@ -2384,6 +2384,7 @@ net/if_atmsubr.c optional atm net/if_bridge.c optional bridge inet | if_bridge inet net/if_clone.c standard net/if_dead.c standard +net/if_debug.c optional ddb net/if_disc.c optional disc net/if_edsc.c optional edsc net/if_ef.c optional ef Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Mon Oct 25 08:25:44 2010 (r214332) +++ head/sys/net/if.c Mon Oct 25 08:30:19 2010 (r214333) @@ -33,7 +33,6 @@ #include "opt_compat.h" #include "opt_inet6.h" #include "opt_inet.h" -#include "opt_ddb.h" #include #include @@ -62,10 +61,6 @@ #include #include -#ifdef DDB -#include -#endif - #include #include #include @@ -191,7 +186,7 @@ VNET_DEFINE(struct ifgrouphead, ifg_head static VNET_DEFINE(int, if_indexlim) = 8; /* Table of ifnet by index. */ -static VNET_DEFINE(struct ifindex_entry *, ifindex_table); +VNET_DEFINE(struct ifindex_entry *, ifindex_table); #define V_if_indexlim VNET(if_indexlim) #define V_ifindex_table VNET(ifindex_table) @@ -3366,79 +3361,3 @@ if_deregister_com_alloc(u_char type) if_com_alloc[type] = NULL; if_com_free[type] = NULL; } - -#ifdef DDB -static void -if_show_ifnet(struct ifnet *ifp) -{ - - if (ifp == NULL) - return; - db_printf("%s:\n", ifp->if_xname); -#define IF_DB_PRINTF(f, e) db_printf(" %s = " f "\n", #e, ifp->e); - IF_DB_PRINTF("%s", if_dname); - IF_DB_PRINTF("%d", if_dunit); - IF_DB_PRINTF("%s", if_description); - IF_DB_PRINTF("%u", if_index); - IF_DB_PRINTF("%u", if_refcount); - IF_DB_PRINTF("%d", if_index_reserved); - IF_DB_PRINTF("%p", if_softc); - IF_DB_PRINTF("%p", if_l2com); - IF_DB_PRINTF("%p", if_vnet); - IF_DB_PRINTF("%p", if_home_vnet); - IF_DB_PRINTF("%p", if_addr); - IF_DB_PRINTF("%p", if_llsoftc); - IF_DB_PRINTF("%p", if_label); - IF_DB_PRINTF("%u", if_pcount); - IF_DB_PRINTF("0x%08x", if_flags); - IF_DB_PRINTF("0x%08x", if_drv_flags); - IF_DB_PRINTF("0x%08x", if_capabilities); - IF_DB_PRINTF("0x%08x", if_capenable); - IF_DB_PRINTF("%p", if_snd.ifq_head); - IF_DB_PRINTF("%p", if_snd.ifq_tail); - IF_DB_PRINTF("%d", if_snd.ifq_len); - IF_DB_PRINTF("%d", if_snd.ifq_maxlen); - IF_DB_PRINTF("%d", if_snd.ifq_drops); - IF_DB_PRINTF("%p", if_snd.ifq_drv_head); - IF_DB_PRINTF("%p", if_snd.ifq_drv_tail); - IF_DB_PRINTF("%d", if_snd.ifq_drv_len); - IF_DB_PRINTF("%d", if_snd.ifq_drv_maxlen); - IF_DB_PRINTF("%d", if_snd.altq_type); - IF_DB_PRINTF("%x", if_snd.altq_flags); -#undef IF_DB_PRINTF -} - -DB_SHOW_COMMAND(ifnet, db_show_ifnet) -{ - - if (!have_addr) { - db_printf("usage: show ifnet \n"); - return; - } - - if_show_ifnet((struct ifnet *)addr); -} - -DB_SHOW_ALL_COMMAND(ifnets, db_show_all_ifnets) -{ - VNET_ITERATOR_DECL(vnet_iter); - struct ifnet *ifp; - u_short idx; - - VNET_FOREACH(vnet_iter) { - CURVNET_SET_QUIET(vnet_iter); -#ifdef VIMAGE - db_printf("vnet=%p\n", curvnet); -#endif - for (idx = 1; idx <= V_if_index; idx++) { - ifp = V_ifindex_table[idx].ife_ifnet; - if (ifp == NULL) - continue; - db_printf( "%20s ifp=%p\n", ifp->if_xname, ifp); - if (db_pager_quit) - break; - } - CURVNET_RESTORE(); - } -} -#endif Added: head/sys/net/if_debug.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/net/if_debug.c Mon Oct 25 08:30:19 2010 (r214333) @@ -0,0 +1,125 @@ +/*- + * Copyright (c) 2010 Bjoern A. Zeeb + * All rights reserved. + * + * 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 AUTHOR 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 AUTHOR 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_ddb.h" + +#include +#include +#include + +#ifdef DDB +#include +#endif + +#include +#include +#include +#include + +#ifdef DDB +struct ifindex_entry { + struct ifnet *ife_ifnet; +}; +VNET_DECLARE(struct ifindex_entry *, ifindex_table); +#define V_ifindex_table VNET(ifindex_table) + +static void +if_show_ifnet(struct ifnet *ifp) +{ + + if (ifp == NULL) + return; + db_printf("%s:\n", ifp->if_xname); +#define IF_DB_PRINTF(f, e) db_printf(" %s = " f "\n", #e, ifp->e); + IF_DB_PRINTF("%s", if_dname); + IF_DB_PRINTF("%d", if_dunit); + IF_DB_PRINTF("%s", if_description); + IF_DB_PRINTF("%u", if_index); + IF_DB_PRINTF("%u", if_refcount); + IF_DB_PRINTF("%d", if_index_reserved); + IF_DB_PRINTF("%p", if_softc); + IF_DB_PRINTF("%p", if_l2com); + IF_DB_PRINTF("%p", if_vnet); + IF_DB_PRINTF("%p", if_home_vnet); + IF_DB_PRINTF("%p", if_addr); + IF_DB_PRINTF("%p", if_llsoftc); + IF_DB_PRINTF("%p", if_label); + IF_DB_PRINTF("%u", if_pcount); + IF_DB_PRINTF("0x%08x", if_flags); + IF_DB_PRINTF("0x%08x", if_drv_flags); + IF_DB_PRINTF("0x%08x", if_capabilities); + IF_DB_PRINTF("0x%08x", if_capenable); + IF_DB_PRINTF("%p", if_snd.ifq_head); + IF_DB_PRINTF("%p", if_snd.ifq_tail); + IF_DB_PRINTF("%d", if_snd.ifq_len); + IF_DB_PRINTF("%d", if_snd.ifq_maxlen); + IF_DB_PRINTF("%d", if_snd.ifq_drops); + IF_DB_PRINTF("%p", if_snd.ifq_drv_head); + IF_DB_PRINTF("%p", if_snd.ifq_drv_tail); + IF_DB_PRINTF("%d", if_snd.ifq_drv_len); + IF_DB_PRINTF("%d", if_snd.ifq_drv_maxlen); + IF_DB_PRINTF("%d", if_snd.altq_type); + IF_DB_PRINTF("%x", if_snd.altq_flags); +#undef IF_DB_PRINTF +} + +DB_SHOW_COMMAND(ifnet, db_show_ifnet) +{ + + if (!have_addr) { + db_printf("usage: show ifnet \n"); + return; + } + + if_show_ifnet((struct ifnet *)addr); +} + +DB_SHOW_ALL_COMMAND(ifnets, db_show_all_ifnets) +{ + VNET_ITERATOR_DECL(vnet_iter); + struct ifnet *ifp; + u_short idx; + + VNET_FOREACH(vnet_iter) { + CURVNET_SET_QUIET(vnet_iter); +#ifdef VIMAGE + db_printf("vnet=%p\n", curvnet); +#endif + for (idx = 1; idx <= V_if_index; idx++) { + ifp = V_ifindex_table[idx].ife_ifnet; + if (ifp == NULL) + continue; + db_printf( "%20s ifp=%p\n", ifp->if_xname, ifp); + if (db_pager_quit) + break; + } + CURVNET_RESTORE(); + } +} +#endif From owner-svn-src-head@FreeBSD.ORG Mon Oct 25 09:16:04 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C24C01065674; Mon, 25 Oct 2010 09:16:04 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A56538FC0C; Mon, 25 Oct 2010 09:16:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9P9G41f058180; Mon, 25 Oct 2010 09:16:04 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9P9G4YO058177; Mon, 25 Oct 2010 09:16:04 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201010250916.o9P9G4YO058177@svn.freebsd.org> From: David Xu Date: Mon, 25 Oct 2010 09:16:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214334 - head/lib/libthr/thread X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Oct 2010 09:16:05 -0000 Author: davidxu Date: Mon Oct 25 09:16:04 2010 New Revision: 214334 URL: http://svn.freebsd.org/changeset/base/214334 Log: Get cpuset in pthread_attr_get_np() and free it in pthread_attr_destroy(). MFC after: 7 days Modified: head/lib/libthr/thread/thr_attr.c head/lib/libthr/thread/thr_private.h Modified: head/lib/libthr/thread/thr_attr.c ============================================================================== --- head/lib/libthr/thread/thr_attr.c Mon Oct 25 08:30:19 2010 (r214333) +++ head/lib/libthr/thread/thr_attr.c Mon Oct 25 09:16:04 2010 (r214334) @@ -104,6 +104,8 @@ #include "thr_private.h" +static size_t _get_kern_cpuset_size(void); + __weak_reference(_pthread_attr_destroy, pthread_attr_destroy); int @@ -116,6 +118,8 @@ _pthread_attr_destroy(pthread_attr_t *at /* Invalid argument: */ ret = EINVAL; else { + if ((*attr)->cpuset != NULL) + free((*attr)->cpuset); /* Free the memory allocated to the attribute object: */ free(*attr); @@ -132,28 +136,43 @@ _pthread_attr_destroy(pthread_attr_t *at __weak_reference(_pthread_attr_get_np, pthread_attr_get_np); int -_pthread_attr_get_np(pthread_t pthread, pthread_attr_t *dst) +_pthread_attr_get_np(pthread_t pthread, pthread_attr_t *dstattr) { struct pthread *curthread; - struct pthread_attr attr; + struct pthread_attr attr, *dst; int ret; + size_t cpusetsize; - if (pthread == NULL || dst == NULL || *dst == NULL) + if (pthread == NULL || dst_attr == NULL || (dst = *dstattr) == NULL) return (EINVAL); - + cpusetsize = _get_kern_cpuset_size(); + if (dst->cpusetsize < cpusetsize) { + char *newset = realloc(dst->cpuset, cpusetsize); + if (newset == NULL) + return (errno); + memset(newset + dst->cpusetsize, 0, cpusetsize - + dst->cpusetsize); + dst->cpuset = (cpuset_t *)newset; + dst->cpusetsize = cpusetsize; + } curthread = _get_curthread(); if ((ret = _thr_find_thread(curthread, pthread, /*include dead*/0)) != 0) return (ret); attr = pthread->attr; if (pthread->flags & THR_FLAGS_DETACHED) attr.flags |= PTHREAD_DETACHED; + ret = cpuset_getaffinity(CPU_LEVEL_WHICH, CPU_WHICH_TID, TID(pthread), + dst->cpusetsize, dst->cpuset); + if (ret == -1) + ret = errno; THR_THREAD_UNLOCK(curthread, pthread); - - memcpy(*dst, &attr, sizeof(struct pthread_attr)); - /* XXX */ - (*dst)->cpuset = NULL; - (*dst)->cpusetsize = 0; - return (0); + if (ret == 0) { + memcpy(&dst->pthread_attr_start_copy, + &attr.pthread_attr_start_copy, + offsetof(struct pthread_attr, pthread_attr_end_copy) - + offsetof(struct pthread_attr, pthread_attr_start_copy)); + } + return (ret); } __weak_reference(_pthread_attr_getdetachstate, pthread_attr_getdetachstate); Modified: head/lib/libthr/thread/thr_private.h ============================================================================== --- head/lib/libthr/thread/thr_private.h Mon Oct 25 08:30:19 2010 (r214333) +++ head/lib/libthr/thread/thr_private.h Mon Oct 25 09:16:04 2010 (r214334) @@ -230,6 +230,7 @@ struct pthread_atfork { }; struct pthread_attr { +#define pthread_attr_start_copy sched_policy int sched_policy; int sched_inherit; int prio; @@ -239,6 +240,7 @@ struct pthread_attr { void *stackaddr_attr; size_t stacksize_attr; size_t guardsize_attr; +#define pthread_attr_end_copy cpuset cpuset_t *cpuset; size_t cpusetsize; }; From owner-svn-src-head@FreeBSD.ORG Mon Oct 25 11:16:50 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D00B7106564A; Mon, 25 Oct 2010 11:16:50 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BEA278FC12; Mon, 25 Oct 2010 11:16:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9PBGorO063078; Mon, 25 Oct 2010 11:16:50 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9PBGoiY063076; Mon, 25 Oct 2010 11:16:50 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201010251116.o9PBGoiY063076@svn.freebsd.org> From: David Xu Date: Mon, 25 Oct 2010 11:16:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214335 - head/lib/libthr/thread X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Oct 2010 11:16:50 -0000 Author: davidxu Date: Mon Oct 25 11:16:50 2010 New Revision: 214335 URL: http://svn.freebsd.org/changeset/base/214335 Log: Fix typo. Modified: head/lib/libthr/thread/thr_attr.c Modified: head/lib/libthr/thread/thr_attr.c ============================================================================== --- head/lib/libthr/thread/thr_attr.c Mon Oct 25 09:16:04 2010 (r214334) +++ head/lib/libthr/thread/thr_attr.c Mon Oct 25 11:16:50 2010 (r214335) @@ -143,7 +143,7 @@ _pthread_attr_get_np(pthread_t pthread, int ret; size_t cpusetsize; - if (pthread == NULL || dst_attr == NULL || (dst = *dstattr) == NULL) + if (pthread == NULL || dstattr == NULL || (dst = *dstattr) == NULL) return (EINVAL); cpusetsize = _get_kern_cpuset_size(); if (dst->cpusetsize < cpusetsize) { From owner-svn-src-head@FreeBSD.ORG Mon Oct 25 13:13:17 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2D4351065670; Mon, 25 Oct 2010 13:13:17 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1BCAA8FC1A; Mon, 25 Oct 2010 13:13:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9PDDHNg065931; Mon, 25 Oct 2010 13:13:17 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9PDDG6C065929; Mon, 25 Oct 2010 13:13:17 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201010251313.o9PDDG6C065929@svn.freebsd.org> From: David Xu Date: Mon, 25 Oct 2010 13:13:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214337 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Oct 2010 13:13:17 -0000 Author: davidxu Date: Mon Oct 25 13:13:16 2010 New Revision: 214337 URL: http://svn.freebsd.org/changeset/base/214337 Log: Use function tdfind() to find a thread. Modified: head/sys/kern/kern_cpuset.c Modified: head/sys/kern/kern_cpuset.c ============================================================================== --- head/sys/kern/kern_cpuset.c Mon Oct 25 13:01:19 2010 (r214336) +++ head/sys/kern/kern_cpuset.c Mon Oct 25 13:13:16 2010 (r214337) @@ -416,19 +416,10 @@ cpuset_which(cpuwhich_t which, id_t id, td = curthread; break; } - sx_slock(&allproc_lock); - FOREACH_PROC_IN_SYSTEM(p) { - PROC_LOCK(p); - FOREACH_THREAD_IN_PROC(p, td) - if (td->td_tid == id) - break; - if (td != NULL) - break; - PROC_UNLOCK(p); - } - sx_sunlock(&allproc_lock); + td = tdfind(id, -1); if (td == NULL) return (ESRCH); + p = td->td_proc; break; case CPU_WHICH_CPUSET: if (id == -1) { From owner-svn-src-head@FreeBSD.ORG Mon Oct 25 14:05:25 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 588D71065674; Mon, 25 Oct 2010 14:05:25 +0000 (UTC) (envelope-from ivoras@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4711D8FC15; Mon, 25 Oct 2010 14:05:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9PE5P8R067538; Mon, 25 Oct 2010 14:05:25 GMT (envelope-from ivoras@svn.freebsd.org) Received: (from ivoras@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9PE5PRm067536; Mon, 25 Oct 2010 14:05:25 GMT (envelope-from ivoras@svn.freebsd.org) Message-Id: <201010251405.o9PE5PRm067536@svn.freebsd.org> From: Ivan Voras Date: Mon, 25 Oct 2010 14:05:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214342 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Oct 2010 14:05:25 -0000 Author: ivoras Date: Mon Oct 25 14:05:25 2010 New Revision: 214342 URL: http://svn.freebsd.org/changeset/base/214342 Log: Reduce the difference between hirunningspace and lorunningspace, it should help interactivity in edge cases. Modified: head/sys/kern/vfs_bio.c Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Mon Oct 25 14:04:21 2010 (r214341) +++ head/sys/kern/vfs_bio.c Mon Oct 25 14:05:25 2010 (r214342) @@ -623,16 +623,16 @@ bufinit(void) lobufspace = hibufspace - MAXBSIZE; /* - * Note: The 16 MB upper limit for hirunningspace was chosen + * Note: The 16 MiB upper limit for hirunningspace was chosen * arbitrarily and may need further tuning. It corresponds to * 128 outstanding write IO requests (if IO size is 128 KiB), * which fits with many RAID controllers' tagged queuing limits. - * The lower 1 MB limit is the historical upper limit for + * The lower 1 MiB limit is the historical upper limit for * hirunningspace. */ hirunningspace = lmax(lmin(roundup(hibufspace / 64, MAXBSIZE), 16 * 1024 * 1024), 1024 * 1024); - lorunningspace = roundup(hirunningspace / 2, MAXBSIZE); + lorunningspace = roundup((hirunningspace * 2) / 3, MAXBSIZE); /* * Limit the amount of malloc memory since it is wired permanently into From owner-svn-src-head@FreeBSD.ORG Mon Oct 25 15:28:04 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 391931065698; Mon, 25 Oct 2010 15:28:04 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 263788FC17; Mon, 25 Oct 2010 15:28:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9PFS4v7069423; Mon, 25 Oct 2010 15:28:04 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9PFS35p069416; Mon, 25 Oct 2010 15:28:03 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201010251528.o9PFS35p069416@svn.freebsd.org> From: John Baldwin Date: Mon, 25 Oct 2010 15:28:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214346 - in head/sys: amd64/include i386/i386 i386/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Oct 2010 15:28:04 -0000 Author: jhb Date: Mon Oct 25 15:28:03 2010 New Revision: 214346 URL: http://svn.freebsd.org/changeset/base/214346 Log: Use intr_disable() and intr_restore() instead of frobbing the flags register directly to disable interrupts. Reviewed by: bde (earlier version) MFC after: 2 weeks Modified: head/sys/amd64/include/profile.h head/sys/i386/i386/elan-mmcr.c head/sys/i386/i386/identcpu.c head/sys/i386/i386/initcpu.c head/sys/i386/i386/longrun.c head/sys/i386/include/profile.h Modified: head/sys/amd64/include/profile.h ============================================================================== --- head/sys/amd64/include/profile.h Mon Oct 25 15:17:31 2010 (r214345) +++ head/sys/amd64/include/profile.h Mon Oct 25 15:28:03 2010 (r214346) @@ -77,17 +77,17 @@ #error this file needs to be ported to your compiler #endif /* !__GNUCLIKE_ASM */ #else /* !GUPROF */ -#define MCOUNT_DECL(s) u_long s; +#define MCOUNT_DECL(s) register_t s; #ifdef SMP extern int mcount_lock; -#define MCOUNT_ENTER(s) { s = read_rflags(); disable_intr(); \ +#define MCOUNT_ENTER(s) { s = intr_disable(); \ while (!atomic_cmpset_acq_int(&mcount_lock, 0, 1)) \ /* nothing */ ; } #define MCOUNT_EXIT(s) { atomic_store_rel_int(&mcount_lock, 0); \ - write_rflags(s); } + intr_restore(s); } #else -#define MCOUNT_ENTER(s) { s = read_rflags(); disable_intr(); } -#define MCOUNT_EXIT(s) (write_rflags(s)) +#define MCOUNT_ENTER(s) { s = intr_disable(); } +#define MCOUNT_EXIT(s) (intr_restore(s)) #endif #endif /* GUPROF */ Modified: head/sys/i386/i386/elan-mmcr.c ============================================================================== --- head/sys/i386/i386/elan-mmcr.c Mon Oct 25 15:17:31 2010 (r214345) +++ head/sys/i386/i386/elan-mmcr.c Mon Oct 25 15:28:03 2010 (r214346) @@ -228,19 +228,18 @@ elan_poll_pps(struct timecounter *tc) static int state; int i; uint16_t u, x, y, z; - u_long eflags; + register_t saveintr; /* * Grab the HW state as quickly and compactly as we can. Disable * interrupts to avoid measuring our interrupt service time on * hw with quality clock sources. */ - eflags = read_eflags(); - disable_intr(); + saveintr = intr_disable(); x = *pps_ap[0]; /* state, must be first, see below */ y = *pps_ap[1]; /* timer2 */ z = *pps_ap[2]; /* timer1 */ - write_eflags(eflags); + intr_restore(saveintr); /* * Order is important here. We need to check the state of the GPIO Modified: head/sys/i386/i386/identcpu.c ============================================================================== --- head/sys/i386/i386/identcpu.c Mon Oct 25 15:17:31 2010 (r214345) +++ head/sys/i386/i386/identcpu.c Mon Oct 25 15:28:03 2010 (r214346) @@ -1037,12 +1037,11 @@ identblue(void) static void identifycyrix(void) { - u_int eflags; + register_t saveintr; int ccr2_test = 0, dir_test = 0; u_char ccr2, ccr3; - eflags = read_eflags(); - disable_intr(); + saveintr = intr_disable(); ccr2 = read_cyrix_reg(CCR2); write_cyrix_reg(CCR2, ccr2 ^ CCR2_LOCK_NW); @@ -1067,7 +1066,7 @@ identifycyrix(void) else cyrix_did = 0x00ff; /* Old 486SLC/DLC and TI486SXLC/SXL */ - write_eflags(eflags); + intr_restore(saveintr); } /* Update TSC freq with the value indicated by the caller. */ Modified: head/sys/i386/i386/initcpu.c ============================================================================== --- head/sys/i386/i386/initcpu.c Mon Oct 25 15:17:31 2010 (r214345) +++ head/sys/i386/i386/initcpu.c Mon Oct 25 15:28:03 2010 (r214346) @@ -116,14 +116,13 @@ u_int cpu_mxcsr_mask; /* valid bits in static void init_bluelightning(void) { - u_long eflags; + register_t saveintr; #if defined(PC98) && !defined(CPU_UPGRADE_HW_CACHE) need_post_dma_flush = 1; #endif - eflags = read_eflags(); - disable_intr(); + saveintr = intr_disable(); load_cr0(rcr0() | CR0_CD | CR0_NW); invd(); @@ -144,7 +143,7 @@ init_bluelightning(void) /* Enable caching in CR0. */ load_cr0(rcr0() & ~(CR0_CD | CR0_NW)); /* CD = 0 and NW = 0 */ invd(); - write_eflags(eflags); + intr_restore(saveintr); } /* @@ -153,11 +152,10 @@ init_bluelightning(void) static void init_486dlc(void) { - u_long eflags; + register_t saveintr; u_char ccr0; - eflags = read_eflags(); - disable_intr(); + saveintr = intr_disable(); invd(); ccr0 = read_cyrix_reg(CCR0); @@ -189,7 +187,7 @@ init_486dlc(void) load_cr0(rcr0() & ~(CR0_CD | CR0_NW)); /* CD = 0 and NW = 0 */ invd(); #endif /* !CYRIX_CACHE_WORKS */ - write_eflags(eflags); + intr_restore(saveintr); } @@ -199,11 +197,10 @@ init_486dlc(void) static void init_cy486dx(void) { - u_long eflags; + register_t saveintr; u_char ccr2; - eflags = read_eflags(); - disable_intr(); + saveintr = intr_disable(); invd(); ccr2 = read_cyrix_reg(CCR2); @@ -220,7 +217,7 @@ init_cy486dx(void) #endif write_cyrix_reg(CCR2, ccr2); - write_eflags(eflags); + intr_restore(saveintr); } @@ -230,11 +227,10 @@ init_cy486dx(void) static void init_5x86(void) { - u_long eflags; + register_t saveintr; u_char ccr2, ccr3, ccr4, pcr0; - eflags = read_eflags(); - disable_intr(); + saveintr = intr_disable(); load_cr0(rcr0() | CR0_CD | CR0_NW); wbinvd(); @@ -320,29 +316,28 @@ init_5x86(void) /* Lock NW bit in CR0. */ write_cyrix_reg(CCR2, read_cyrix_reg(CCR2) | CCR2_LOCK_NW); - write_eflags(eflags); + intr_restore(saveintr); } #ifdef CPU_I486_ON_386 /* * There are i486 based upgrade products for i386 machines. - * In this case, BIOS doesn't enables CPU cache. + * In this case, BIOS doesn't enable CPU cache. */ static void init_i486_on_386(void) { - u_long eflags; + register_t saveintr; #if defined(PC98) && !defined(CPU_UPGRADE_HW_CACHE) need_post_dma_flush = 1; #endif - eflags = read_eflags(); - disable_intr(); + saveintr = intr_disable(); load_cr0(rcr0() & ~(CR0_CD | CR0_NW)); /* CD = 0, NW = 0 */ - write_eflags(eflags); + intr_restore(saveintr); } #endif @@ -354,11 +349,10 @@ init_i486_on_386(void) static void init_6x86(void) { - u_long eflags; + register_t saveintr; u_char ccr3, ccr4; - eflags = read_eflags(); - disable_intr(); + saveintr = intr_disable(); load_cr0(rcr0() | CR0_CD | CR0_NW); wbinvd(); @@ -422,7 +416,7 @@ init_6x86(void) /* Lock NW bit in CR0. */ write_cyrix_reg(CCR2, read_cyrix_reg(CCR2) | CCR2_LOCK_NW); - write_eflags(eflags); + intr_restore(saveintr); } #endif /* I486_CPU */ @@ -435,11 +429,10 @@ init_6x86(void) static void init_6x86MX(void) { - u_long eflags; + register_t saveintr; u_char ccr3, ccr4; - eflags = read_eflags(); - disable_intr(); + saveintr = intr_disable(); load_cr0(rcr0() | CR0_CD | CR0_NW); wbinvd(); @@ -489,7 +482,7 @@ init_6x86MX(void) /* Lock NW bit in CR0. */ write_cyrix_reg(CCR2, read_cyrix_reg(CCR2) | CCR2_LOCK_NW); - write_eflags(eflags); + intr_restore(saveintr); } static void @@ -513,11 +506,10 @@ static void init_mendocino(void) { #ifdef CPU_PPRO2CELERON - u_long eflags; + register_t saveintr; u_int64_t bbl_cr_ctl3; - eflags = read_eflags(); - disable_intr(); + saveintr = intr_disable(); load_cr0(rcr0() | CR0_CD | CR0_NW); wbinvd(); @@ -541,7 +533,7 @@ init_mendocino(void) } load_cr0(rcr0() & ~(CR0_CD | CR0_NW)); - write_eflags(eflags); + intr_restore(saveintr); #endif /* CPU_PPRO2CELERON */ } @@ -842,10 +834,9 @@ enable_K6_wt_alloc(void) { quad_t size; u_int64_t whcr; - u_long eflags; + register_t saveintr; - eflags = read_eflags(); - disable_intr(); + saveintr = intr_disable(); wbinvd(); #ifdef CPU_DISABLE_CACHE @@ -895,7 +886,7 @@ enable_K6_wt_alloc(void) #endif wrmsr(0x0c0000082, whcr); - write_eflags(eflags); + intr_restore(saveintr); } void @@ -903,10 +894,9 @@ enable_K6_2_wt_alloc(void) { quad_t size; u_int64_t whcr; - u_long eflags; + register_t saveintr; - eflags = read_eflags(); - disable_intr(); + saveintr = intr_disable(); wbinvd(); #ifdef CPU_DISABLE_CACHE @@ -956,7 +946,7 @@ enable_K6_2_wt_alloc(void) #endif wrmsr(0x0c0000082, whcr); - write_eflags(eflags); + intr_restore(saveintr); } #endif /* I585_CPU && CPU_WT_ALLOC */ @@ -966,15 +956,14 @@ enable_K6_2_wt_alloc(void) DB_SHOW_COMMAND(cyrixreg, cyrixreg) { - u_long eflags; + register_t saveintr; u_int cr0; u_char ccr1, ccr2, ccr3; u_char ccr0 = 0, ccr4 = 0, ccr5 = 0, pcr0 = 0; cr0 = rcr0(); if (cpu_vendor_id == CPU_VENDOR_CYRIX) { - eflags = read_eflags(); - disable_intr(); + saveintr = intr_disable(); if ((cpu != CPU_M1SC) && (cpu != CPU_CY486DX)) { @@ -992,7 +981,7 @@ DB_SHOW_COMMAND(cyrixreg, cyrixreg) pcr0 = read_cyrix_reg(PCR0); write_cyrix_reg(CCR3, ccr3); /* Restore CCR3. */ } - write_eflags(eflags); + intr_restore(saveintr); if ((cpu != CPU_M1SC) && (cpu != CPU_CY486DX)) printf("CCR0=%x, ", (u_int)ccr0); Modified: head/sys/i386/i386/longrun.c ============================================================================== --- head/sys/i386/i386/longrun.c Mon Oct 25 15:17:31 2010 (r214345) +++ head/sys/i386/i386/longrun.c Mon Oct 25 15:28:03 2010 (r214346) @@ -84,12 +84,11 @@ static u_int32_t longrun_modes[LONGRUN_M static u_int tmx86_get_longrun_mode(void) { - u_long eflags; + register_t saveintr; union msrinfo msrinfo; u_int low, high, flags, mode; - eflags = read_eflags(); - disable_intr(); + saveintr = intr_disable(); msrinfo.msr = rdmsr(MSR_TMx86_LONGRUN); low = LONGRUN_MODE_MASK(msrinfo.regs[0]); @@ -105,40 +104,38 @@ tmx86_get_longrun_mode(void) } mode = LONGRUN_MODE_UNKNOWN; out: - write_eflags(eflags); + intr_restore(saveintr); return (mode); } static u_int tmx86_get_longrun_status(u_int * frequency, u_int * voltage, u_int * percentage) { - u_long eflags; + register_t saveintr; u_int regs[4]; - eflags = read_eflags(); - disable_intr(); + saveintr = intr_disable(); do_cpuid(0x80860007, regs); *frequency = regs[0]; *voltage = regs[1]; *percentage = regs[2]; - write_eflags(eflags); + intr_restore(saveintr); return (1); } static u_int tmx86_set_longrun_mode(u_int mode) { - u_long eflags; + register_t saveintr; union msrinfo msrinfo; if (mode >= LONGRUN_MODE_UNKNOWN) { return (0); } - eflags = read_eflags(); - disable_intr(); + saveintr = intr_disable(); /* Write LongRun mode values to Model Specific Register. */ msrinfo.msr = rdmsr(MSR_TMx86_LONGRUN); @@ -153,7 +150,7 @@ tmx86_set_longrun_mode(u_int mode) msrinfo.regs[0] = (msrinfo.regs[0] & ~0x01) | longrun_modes[mode][2]; wrmsr(MSR_TMx86_LONGRUN_FLAGS, msrinfo.msr); - write_eflags(eflags); + intr_restore(saveintr); return (1); } Modified: head/sys/i386/include/profile.h ============================================================================== --- head/sys/i386/include/profile.h Mon Oct 25 15:17:31 2010 (r214345) +++ head/sys/i386/include/profile.h Mon Oct 25 15:28:03 2010 (r214346) @@ -77,17 +77,17 @@ #error #endif /* !__GNUCLIKE_ASM */ #else /* !GUPROF */ -#define MCOUNT_DECL(s) u_long s; +#define MCOUNT_DECL(s) register_t s; #ifdef SMP extern int mcount_lock; -#define MCOUNT_ENTER(s) { s = read_eflags(); disable_intr(); \ +#define MCOUNT_ENTER(s) { s = intr_disable(); \ while (!atomic_cmpset_acq_int(&mcount_lock, 0, 1)) \ /* nothing */ ; } #define MCOUNT_EXIT(s) { atomic_store_rel_int(&mcount_lock, 0); \ - write_eflags(s); } + intr_restore(s); } #else -#define MCOUNT_ENTER(s) { s = read_eflags(); disable_intr(); } -#define MCOUNT_EXIT(s) (write_eflags(s)) +#define MCOUNT_ENTER(s) { s = intr_disable(); } +#define MCOUNT_EXIT(s) (intr_restore(s)) #endif #endif /* GUPROF */ From owner-svn-src-head@FreeBSD.ORG Mon Oct 25 15:31:14 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5AF05106564A; Mon, 25 Oct 2010 15:31:14 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 485258FC08; Mon, 25 Oct 2010 15:31:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9PFVEKU069521; Mon, 25 Oct 2010 15:31:14 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9PFVEDj069515; Mon, 25 Oct 2010 15:31:14 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201010251531.o9PFVEDj069515@svn.freebsd.org> From: John Baldwin Date: Mon, 25 Oct 2010 15:31:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214347 - in head/sys: amd64/amd64 i386/i386 i386/isa x86/x86 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Oct 2010 15:31:14 -0000 Author: jhb Date: Mon Oct 25 15:31:13 2010 New Revision: 214347 URL: http://svn.freebsd.org/changeset/base/214347 Log: Use 'saveintr' instead of 'savecrit' or 'eflags' to hold the state returned by intr_disable(). Requested by: bde Modified: head/sys/amd64/amd64/fpu.c head/sys/i386/i386/initcpu.c head/sys/i386/i386/perfmon.c head/sys/i386/isa/npx.c head/sys/x86/x86/local_apic.c Modified: head/sys/amd64/amd64/fpu.c ============================================================================== --- head/sys/amd64/amd64/fpu.c Mon Oct 25 15:28:03 2010 (r214346) +++ head/sys/amd64/amd64/fpu.c Mon Oct 25 15:31:13 2010 (r214347) @@ -113,14 +113,14 @@ static struct savefpu fpu_initialstate; void fpuinit(void) { - register_t savecrit; + register_t saveintr; u_int mxcsr; u_short control; /* * It is too early for critical_enter() to work on AP. */ - savecrit = intr_disable(); + saveintr = intr_disable(); stop_emulating(); fninit(); control = __INITIAL_FPUCW__; @@ -137,7 +137,7 @@ fpuinit(void) bzero(fpu_initialstate.sv_xmm, sizeof(fpu_initialstate.sv_xmm)); } start_emulating(); - intr_restore(savecrit); + intr_restore(saveintr); } /* Modified: head/sys/i386/i386/initcpu.c ============================================================================== --- head/sys/i386/i386/initcpu.c Mon Oct 25 15:28:03 2010 (r214346) +++ head/sys/i386/i386/initcpu.c Mon Oct 25 15:31:13 2010 (r214347) @@ -787,14 +787,14 @@ void enable_K5_wt_alloc(void) { u_int64_t msr; - register_t savecrit; + register_t saveintr; /* * Write allocate is supported only on models 1, 2, and 3, with * a stepping of 4 or greater. */ if (((cpu_id & 0xf0) > 0) && ((cpu_id & 0x0f) > 3)) { - savecrit = intr_disable(); + saveintr = intr_disable(); msr = rdmsr(0x83); /* HWCR */ wrmsr(0x83, msr & !(0x10)); @@ -825,7 +825,7 @@ enable_K5_wt_alloc(void) msr=rdmsr(0x83); wrmsr(0x83, msr|0x10); /* enable write allocate */ - intr_restore(savecrit); + intr_restore(saveintr); } } Modified: head/sys/i386/i386/perfmon.c ============================================================================== --- head/sys/i386/i386/perfmon.c Mon Oct 25 15:28:03 2010 (r214346) +++ head/sys/i386/i386/perfmon.c Mon Oct 25 15:31:13 2010 (r214347) @@ -128,18 +128,18 @@ perfmon_avail(void) int perfmon_setup(int pmc, unsigned int control) { - register_t savecrit; + register_t saveintr; if (pmc < 0 || pmc >= NPMC) return EINVAL; perfmon_inuse |= (1 << pmc); control &= ~(PMCF_SYS_FLAGS << 16); - savecrit = intr_disable(); + saveintr = intr_disable(); ctl_shadow[pmc] = control; writectl(pmc); wrmsr(msr_pmc[pmc], pmc_shadow[pmc] = 0); - intr_restore(savecrit); + intr_restore(saveintr); return 0; } @@ -174,17 +174,17 @@ perfmon_fini(int pmc) int perfmon_start(int pmc) { - register_t savecrit; + register_t saveintr; if (pmc < 0 || pmc >= NPMC) return EINVAL; if (perfmon_inuse & (1 << pmc)) { - savecrit = intr_disable(); + saveintr = intr_disable(); ctl_shadow[pmc] |= (PMCF_EN << 16); wrmsr(msr_pmc[pmc], pmc_shadow[pmc]); writectl(pmc); - intr_restore(savecrit); + intr_restore(saveintr); return 0; } return EBUSY; @@ -193,17 +193,17 @@ perfmon_start(int pmc) int perfmon_stop(int pmc) { - register_t savecrit; + register_t saveintr; if (pmc < 0 || pmc >= NPMC) return EINVAL; if (perfmon_inuse & (1 << pmc)) { - savecrit = intr_disable(); + saveintr = intr_disable(); pmc_shadow[pmc] = rdmsr(msr_pmc[pmc]) & 0xffffffffffULL; ctl_shadow[pmc] &= ~(PMCF_EN << 16); writectl(pmc); - intr_restore(savecrit); + intr_restore(saveintr); return 0; } return EBUSY; Modified: head/sys/i386/isa/npx.c ============================================================================== --- head/sys/i386/isa/npx.c Mon Oct 25 15:28:03 2010 (r214346) +++ head/sys/i386/isa/npx.c Mon Oct 25 15:31:13 2010 (r214347) @@ -343,7 +343,7 @@ void npxinit(void) { static union savefpu dummy; - register_t savecrit; + register_t saveintr; u_short control; if (!hw_float) @@ -355,7 +355,7 @@ npxinit(void) * * It is too early for critical_enter() to work on AP. */ - savecrit = intr_disable(); + saveintr = intr_disable(); npxsave(&dummy); stop_emulating(); #ifdef CPU_ENABLE_SSE @@ -366,7 +366,7 @@ npxinit(void) control = __INITIAL_NPXCW__; fldcw(control); start_emulating(); - intr_restore(savecrit); + intr_restore(saveintr); } /* Modified: head/sys/x86/x86/local_apic.c ============================================================================== --- head/sys/x86/x86/local_apic.c Mon Oct 25 15:28:03 2010 (r214346) +++ head/sys/x86/x86/local_apic.c Mon Oct 25 15:31:13 2010 (r214347) @@ -341,12 +341,12 @@ lapic_setup(int boot) { struct lapic *la; u_int32_t maxlvt; - register_t eflags; + register_t saveintr; char buf[MAXCOMLEN + 1]; la = &lapics[lapic_id()]; KASSERT(la->la_present, ("missing APIC structure")); - eflags = intr_disable(); + saveintr = intr_disable(); maxlvt = (lapic->version & APIC_VER_MAXLVT) >> MAXLVTSHIFT; /* Initialize the TPR to allow all interrupts. */ @@ -393,7 +393,7 @@ lapic_setup(int boot) if (maxlvt >= LVT_CMCI) lapic->lvt_cmci = lvt_mode(la, LVT_CMCI, lapic->lvt_cmci); - intr_restore(eflags); + intr_restore(saveintr); } void @@ -1415,7 +1415,7 @@ lapic_ipi_wait(int delay) void lapic_ipi_raw(register_t icrlo, u_int dest) { - register_t value, eflags; + register_t value, saveintr; /* XXX: Need more sanity checking of icrlo? */ KASSERT(lapic != NULL, ("%s called too early", __func__)); @@ -1425,7 +1425,7 @@ lapic_ipi_raw(register_t icrlo, u_int de ("%s: reserved bits set in ICR LO register", __func__)); /* Set destination in ICR HI register if it is being used. */ - eflags = intr_disable(); + saveintr = intr_disable(); if ((icrlo & APIC_DEST_MASK) == APIC_DEST_DESTFLD) { value = lapic->icr_hi; value &= ~APIC_ID_MASK; @@ -1438,7 +1438,7 @@ lapic_ipi_raw(register_t icrlo, u_int de value &= APIC_ICRLO_RESV_MASK; value |= icrlo; lapic->icr_lo = value; - intr_restore(eflags); + intr_restore(saveintr); } #define BEFORE_SPIN 1000000 From owner-svn-src-head@FreeBSD.ORG Mon Oct 25 15:41:12 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 81EA1106566C; Mon, 25 Oct 2010 15:41:12 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 703278FC0C; Mon, 25 Oct 2010 15:41:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9PFfC8W069766; Mon, 25 Oct 2010 15:41:12 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9PFfCDI069764; Mon, 25 Oct 2010 15:41:12 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201010251541.o9PFfCDI069764@svn.freebsd.org> From: Nathan Whitehorn Date: Mon, 25 Oct 2010 15:41:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214348 - head/sys/powerpc/mambo X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Oct 2010 15:41:12 -0000 Author: nwhitehorn Date: Mon Oct 25 15:41:12 2010 New Revision: 214348 URL: http://svn.freebsd.org/changeset/base/214348 Log: Don't create spurious /dev entries. Submitted by: andreast Modified: head/sys/powerpc/mambo/mambo_console.c Modified: head/sys/powerpc/mambo/mambo_console.c ============================================================================== --- head/sys/powerpc/mambo/mambo_console.c Mon Oct 25 15:31:13 2010 (r214347) +++ head/sys/powerpc/mambo/mambo_console.c Mon Oct 25 15:41:12 2010 (r214348) @@ -86,7 +86,6 @@ cn_drvinit(void *unused) tp = tty_alloc(&mambo_ttydevsw, NULL); tty_init_console(tp, 0); tty_makedev(tp, NULL, "%s", "mambocons"); - tty_makealias(tp, "mambocons"); polltime = 1; From owner-svn-src-head@FreeBSD.ORG Mon Oct 25 15:51:44 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2EF071065675; Mon, 25 Oct 2010 15:51:44 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 025C08FC2B; Mon, 25 Oct 2010 15:51:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9PFph9V070088; Mon, 25 Oct 2010 15:51:43 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9PFphYS070084; Mon, 25 Oct 2010 15:51:43 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201010251551.o9PFphYS070084@svn.freebsd.org> From: Nathan Whitehorn Date: Mon, 25 Oct 2010 15:51:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214349 - in head/sys/dev: pci usb/controller X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Oct 2010 15:51:44 -0000 Author: nwhitehorn Date: Mon Oct 25 15:51:43 2010 New Revision: 214349 URL: http://svn.freebsd.org/changeset/base/214349 Log: The EHCI_CAPLENGTH and EHCI_HCIVERSION registers are actually sub-registers within the first 4 bytes of the EHCI memory space. For controllers that use big-endian MMIO, reading them with 1- and 2-byte reads would then return the wrong values. Instead, read the combined register with a 4-byte read and mask out the interesting quantities. Modified: head/sys/dev/pci/pci.c head/sys/dev/usb/controller/ehci.c head/sys/dev/usb/controller/ehcireg.h Modified: head/sys/dev/pci/pci.c ============================================================================== --- head/sys/dev/pci/pci.c Mon Oct 25 15:41:12 2010 (r214348) +++ head/sys/dev/pci/pci.c Mon Oct 25 15:51:43 2010 (r214349) @@ -2803,7 +2803,7 @@ ehci_early_takeover(device_t self) "SMM does not respond\n"); } /* Disable interrupts */ - offs = bus_read_1(res, EHCI_CAPLENGTH); + offs = EHCI_CAPLENGTH(bus_read_4(res, EHCI_CAPLEN_HCIVERSION)); bus_write_4(res, offs + EHCI_USBINTR, 0); } bus_release_resource(self, SYS_RES_MEMORY, rid, res); Modified: head/sys/dev/usb/controller/ehci.c ============================================================================== --- head/sys/dev/usb/controller/ehci.c Mon Oct 25 15:41:12 2010 (r214348) +++ head/sys/dev/usb/controller/ehci.c Mon Oct 25 15:51:43 2010 (r214349) @@ -270,9 +270,9 @@ ehci_init(ehci_softc_t *sc) } #endif - sc->sc_offs = EREAD1(sc, EHCI_CAPLENGTH); + sc->sc_offs = EHCI_CAPLENGTH(EREAD4(sc, EHCI_CAPLEN_HCIVERSION)); - version = EREAD2(sc, EHCI_HCIVERSION); + version = EHCI_HCIVERSION(EREAD4(sc, EHCI_CAPLEN_HCIVERSION)); device_printf(sc->sc_bus.bdev, "EHCI version %x.%x\n", version >> 8, version & 0xff); Modified: head/sys/dev/usb/controller/ehcireg.h ============================================================================== --- head/sys/dev/usb/controller/ehcireg.h Mon Oct 25 15:41:12 2010 (r214348) +++ head/sys/dev/usb/controller/ehcireg.h Mon Oct 25 15:51:43 2010 (r214349) @@ -54,9 +54,13 @@ #define EHCI_LEGSUP_USBLEGCTLSTS 0x04 /* EHCI capability registers */ -#define EHCI_CAPLENGTH 0x00 /* RO Capability register length field */ -#define EHCI_RESERVED 0x01 /* Reserved register */ -#define EHCI_HCIVERSION 0x02 /* RO Interface version number */ +#define EHCI_CAPLEN_HCIVERSION 0x00 /* RO Capability register length + * (least-significant byte) and + * interface version number (two + * most significant) + */ +#define EHCI_CAPLENGTH(x) ((x) & 0xff) +#define EHCI_HCIVERSION(x) (((x) >> 16) & 0xffff) #define EHCI_HCSPARAMS 0x04 /* RO Structural parameters */ #define EHCI_HCS_DEBUGPORT(x) (((x) >> 20) & 0xf) #define EHCI_HCS_P_INDICATOR(x) ((x) & 0x10000) From owner-svn-src-head@FreeBSD.ORG Mon Oct 25 16:11:37 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6835A1065672; Mon, 25 Oct 2010 16:11:37 +0000 (UTC) (envelope-from thomas@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 56C358FC1D; Mon, 25 Oct 2010 16:11:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9PGBb5p070664; Mon, 25 Oct 2010 16:11:37 GMT (envelope-from thomas@svn.freebsd.org) Received: (from thomas@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9PGBb60070662; Mon, 25 Oct 2010 16:11:37 GMT (envelope-from thomas@svn.freebsd.org) Message-Id: <201010251611.o9PGBb60070662@svn.freebsd.org> From: Thomas Quinot Date: Mon, 25 Oct 2010 16:11:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214351 - head/sys/netipsec X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Oct 2010 16:11:37 -0000 Author: thomas Date: Mon Oct 25 16:11:37 2010 New Revision: 214351 URL: http://svn.freebsd.org/changeset/base/214351 Log: Fix typo in comment. Modified: head/sys/netipsec/ipsec_input.c Modified: head/sys/netipsec/ipsec_input.c ============================================================================== --- head/sys/netipsec/ipsec_input.c Mon Oct 25 15:58:31 2010 (r214350) +++ head/sys/netipsec/ipsec_input.c Mon Oct 25 16:11:37 2010 (r214351) @@ -108,7 +108,7 @@ static void ipsec4_common_ctlinput(int, /* * ipsec_common_input gets called when an IPsec-protected packet - * is received by IPv4 or IPv6. It's job is to find the right SA + * is received by IPv4 or IPv6. Its job is to find the right SA * and call the appropriate transform. The transform callback * takes care of further processing (like ingress filtering). */ From owner-svn-src-head@FreeBSD.ORG Mon Oct 25 16:23:35 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6C1B71065675; Mon, 25 Oct 2010 16:23:35 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 58A188FC13; Mon, 25 Oct 2010 16:23:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9PGNZiM070933; Mon, 25 Oct 2010 16:23:35 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9PGNZ3V070926; Mon, 25 Oct 2010 16:23:35 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201010251623.o9PGNZ3V070926@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Mon, 25 Oct 2010 16:23:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214352 - in head: sbin/geom/class/part sys/geom/part X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Oct 2010 16:23:35 -0000 Author: ae Date: Mon Oct 25 16:23:35 2010 New Revision: 214352 URL: http://svn.freebsd.org/changeset/base/214352 Log: Reimplemented "gpart destroy -F". Now it does all work in kernel. This was needed for recover implementation. Implement the recover command for GPT. Now GPT will marked as corrupt when any of three types of corruption will be detected: 1. Damaged primary GPT header or table 2. Damaged secondary GPT header or table 3. Secondary header is not located in the last LBA Marked GPT becomes read-only. Any changes with corrupt table are prohibited. Only "destroy" and "recover" commands are allowed. Discussed with: geom@ (mostly silence) Tested by: Ilya A. Arhipov Approved by: mav (mentor) MFC after: 2 weeks Modified: head/sbin/geom/class/part/geom_part.c head/sbin/geom/class/part/gpart.8 head/sys/geom/part/g_part.c head/sys/geom/part/g_part.h head/sys/geom/part/g_part_gpt.c head/sys/geom/part/g_part_if.m Modified: head/sbin/geom/class/part/geom_part.c ============================================================================== --- head/sbin/geom/class/part/geom_part.c Mon Oct 25 16:11:37 2010 (r214351) +++ head/sbin/geom/class/part/geom_part.c Mon Oct 25 16:23:35 2010 (r214352) @@ -67,7 +67,6 @@ static char ssize[32]; #define GPART_PARAM_BOOTCODE "bootcode" #define GPART_PARAM_INDEX "index" #define GPART_PARAM_PARTCODE "partcode" -#define GPART_PARAM_FORCE "force" static struct gclass *find_class(struct gmesh *, const char *); static struct ggeom * find_geom(struct gclass *, const char *); @@ -85,7 +84,6 @@ static void gpart_show_geom(struct ggeom static int gpart_show_hasopt(struct gctl_req *, const char *, const char *); static void gpart_write_partcode(struct ggeom *, int, void *, ssize_t); static void gpart_write_partcode_vtoc8(struct ggeom *, int, void *); -static void gpart_destroy(struct gctl_req *, unsigned int); static void gpart_print_error(const char *); struct g_command PUBSYM(class_commands)[] = { @@ -123,8 +121,8 @@ struct g_command PUBSYM(class_commands)[ G_OPT_SENTINEL }, "-i index [-f flags] geom" }, - { "destroy", 0, gpart_destroy, { - { 'F', GPART_PARAM_FORCE, NULL, G_TYPE_BOOL }, + { "destroy", 0, gpart_issue, { + { 'F', "force", NULL, G_TYPE_BOOL }, { 'f', "flags", GPART_FLAGS, G_TYPE_STRING }, G_OPT_SENTINEL }, "[-F] [-f flags] geom" @@ -167,6 +165,11 @@ struct g_command PUBSYM(class_commands)[ G_OPT_SENTINEL }, "[-s size] -i index [-f flags] geom" }, + { "recover", 0, gpart_issue, { + { 'f', "flags", GPART_FLAGS, G_TYPE_STRING }, + G_OPT_SENTINEL }, + "[-f flags] geom" + }, G_CMD_SENTINEL }; @@ -539,13 +542,17 @@ gpart_show_geom(struct ggeom *gp, const s = find_geomcfg(gp, "last"); last = (off_t)strtoimax(s, NULL, 0); wblocks = strlen(s); + s = find_geomcfg(gp, "state"); + if (s != NULL && *s != 'C') + s = NULL; wname = strlen(gp->lg_name); pp = LIST_FIRST(&gp->lg_consumer)->lg_provider; secsz = pp->lg_sectorsize; - printf("=>%*jd %*jd %*s %s (%s)\n", + printf("=>%*jd %*jd %*s %s (%s)%s\n", wblocks, (intmax_t)first, wblocks, (intmax_t)(last - first + 1), wname, gp->lg_name, - scheme, fmtsize(pp->lg_mediasize)); + scheme, fmtsize(pp->lg_mediasize), + s ? " [CORRUPT]": ""); while ((pp = find_provider(gp, first)) != NULL) { s = find_provcfg(pp, "start"); @@ -858,83 +865,6 @@ gpart_bootcode(struct gctl_req *req, uns } static void -gpart_destroy(struct gctl_req *req, unsigned int fl) -{ - struct gmesh mesh; - struct gclass *classp; - struct gctl_req *req2; - struct ggeom *gp; - struct gprovider *pp; - const char *s; - int error, val; - intmax_t idx; - - if (gctl_has_param(req, GPART_PARAM_FORCE)) { - val = gctl_get_int(req, GPART_PARAM_FORCE); - error = gctl_delete_param(req, GPART_PARAM_FORCE); - if (error) - errc(EXIT_FAILURE, error, "internal error"); - if (val == 0) - goto done; - s = gctl_get_ascii(req, "class"); - if (s == NULL) - abort(); - error = geom_gettree(&mesh); - if (error != 0) - errc(EXIT_FAILURE, error, "Cannot get GEOM tree"); - classp = find_class(&mesh, s); - if (classp == NULL) { - geom_deletetree(&mesh); - errx(EXIT_FAILURE, "Class %s not found.", s); - } - s = gctl_get_ascii(req, "arg0"); - if (s == NULL) - abort(); - gp = find_geom(classp, s); - if (gp == NULL) - errx(EXIT_FAILURE, "No such geom: %s.", s); - val = 0; - LIST_FOREACH(pp, &gp->lg_provider, lg_provider){ - s = find_provcfg(pp, "index"); - if (s == NULL) - errx(EXIT_FAILURE, "Index not found for %s.", - pp->lg_name); - idx = strtoimax(s, NULL, 0); - req2 = gctl_get_handle(); - gctl_ro_param(req2, "class", -1, classp->lg_name); - gctl_ro_param(req2, "arg0", -1, gp->lg_name); - gctl_ro_param(req2, "verb", -1, "delete"); - gctl_ro_param(req2, GPART_PARAM_INDEX, - sizeof(intmax_t), &idx); - gctl_ro_param(req2, "flags", -1, "X"); - s = gctl_issue(req2); - if (s != NULL && s[0] != '\0') { - gpart_print_error(s); - gctl_free(req2); - if (val) { /* try to undo changes */ - req2 = gctl_get_handle(); - gctl_ro_param(req2, "verb", -1, - "undo"); - gctl_ro_param(req2, "class", -1, - classp->lg_name); - gctl_ro_param(req2, "arg0", -1, - gp->lg_name); - gctl_issue(req2); - gctl_free(req2); - } - geom_deletetree(&mesh); - exit(EXIT_FAILURE); - } - gctl_free(req2); - val = 1; - } - geom_deletetree(&mesh); - } -done: - gpart_issue(req, fl); -} - -static void gpart_print_error(const char *errstr) { char *errmsg; Modified: head/sbin/geom/class/part/gpart.8 ============================================================================== --- head/sbin/geom/class/part/gpart.8 Mon Oct 25 16:11:37 2010 (r214351) +++ head/sbin/geom/class/part/gpart.8 Mon Oct 25 16:23:35 2010 (r214352) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 28, 2010 +.Dd October 25, 2010 .Dt GPART 8 .Os .Sh NAME @@ -129,6 +129,11 @@ utility: .Op Fl t Ar type .Op Fl f Ar flags .Ar geom +.\" ==== RECOVER ==== +.Nm +.Cm recover +.Op Fl f Ar flags +.Ar geom .\" ==== RESIZE ==== .Nm .Cm resize @@ -353,6 +358,23 @@ See the section entitled below for a discussion about its use. .El +.\" ==== RECOVER ==== +.It Cm recover +Recover corrupt partition's scheme metadata on the geom +.Ar geom . +See the section entitled +.Sx "RECOVERING" +below for the additional information. +.Pp +Additional options include: +.Bl -tag -width 10n +.It Fl f Ar flags +Additional operational flags. +See the section entitled +.Sx "OPERATIONAL FLAGS" +below for a discussion +about its use. +.El .\" ==== RESIZE ==== .It Cm resize Resize a partition from geom @@ -629,6 +651,68 @@ the action or reverted with the .Cm undo action. +.Sh RECOVERING +The GEOM class PART supports recovering of partition tables only for GPT. +The GUID partition table has a primary and secondary (backup) copy of +metadata for redundance. They are stored in the begining and in the end +of device respectively. Therefore it is acceptable to have some corruptions +in the metadata that are not fatal to work with GPT. When kernel detects +corrupt metadata it marks this table as corrupt and reports about corruption. +Any changes in corrupt table are prohibited except +.Cm destroy +and +.Cm recover . +.Pp +In case when only first sector is corrupt kernel can not detect GPT even +if partition table is not corrupt. You can write protective MBR with +.Xr dd 1 +command to restore ability of GPT detection. The copy of protective MBR is +usually located in the +.Pa /boot/pmbr +file. +.Pp +In case when some of metadata is corrupt you will get to know about this +from kernel's messages like these: +.Bd -literal -offset indent +GEOM: provider: the primary GPT table is corrupt or invalid. +GEOM: provider: using the secondary instead -- recovery strongly advised. +.Ed +.Pp +or +.Bd -literal -offset indent +GEOM: provider: the secondary GPT table is corrupt or invalid. +GEOM: provider: using the primary only -- recovery suggested. +.Ed +.Pp +Also +.Cm gpart +commands like +.Cm show , +.Cm status +and +.Cm list +will report about corrupt table. +.Pp +In case when the size of device has changed (e.g. volume expansion) the +secondary GPT header will become located not in the last sector. This is +not a metadata corruption, but it is dangerous because any corruption of +the primary GPT will lead to lost of partition table. Kernel reports about +this problem with message: +.Bd -literal -offset indent +GEOM: provider: the secondary GPT header is not in the last LBA. +.Ed +.Pp +A corrupt table can be recovered with +.Cm gpart recover +command. This command does reconstruction of corrupt metadata using +known valid metadata. Also it can relocate secondary GPT to the end of +device. +.Pp +.Pa NOTE : +The GEOM class PART can detect the same partition table on different GEOM +providers and some of them will marked as corrupt. Be careful when choising +a provider for recovering. If you did incorrect choise you can destroy +metadata of another GEOM class, e.g. GEOM MIRROR or GEOM LABEL. .Sh EXIT STATUS Exit status is 0 on success, and 1 if the command fails. .Sh EXAMPLES @@ -687,6 +771,7 @@ After having created all required partit /sbin/gpart bootcode -p /boot/boot1 da0 .Ed .Sh SEE ALSO +.Xr dd 1 , .Xr geom 4 , .Xr geom 8 .Sh HISTORY Modified: head/sys/geom/part/g_part.c ============================================================================== --- head/sys/geom/part/g_part.c Mon Oct 25 16:11:37 2010 (r214351) +++ head/sys/geom/part/g_part.c Mon Oct 25 16:23:35 2010 (r214352) @@ -924,7 +924,7 @@ g_part_ctl_destroy(struct gctl_req *req, struct g_consumer *cp; struct g_geom *gp; struct g_provider *pp; - struct g_part_entry *entry; + struct g_part_entry *entry, *tmp; struct g_part_table *null, *table; struct sbuf *sb; int error; @@ -934,13 +934,34 @@ g_part_ctl_destroy(struct gctl_req *req, g_topology_assert(); table = gp->softc; + /* Check for busy providers. */ LIST_FOREACH(entry, &table->gpt_entry, gpe_entry) { if (entry->gpe_deleted || entry->gpe_internal) continue; + if (gpp->gpp_force) { + pp = entry->gpe_pp; + if (pp == NULL) + continue; + if (pp->acr == 0 && pp->acw == 0 && pp->ace == 0) + continue; + } gctl_error(req, "%d", EBUSY); return (EBUSY); } + if (gpp->gpp_force) { + /* Destroy all providers. */ + LIST_FOREACH_SAFE(entry, &table->gpt_entry, gpe_entry, tmp) { + pp = entry->gpe_pp; + if (pp != NULL) { + pp->private = NULL; + g_wither_provider(pp, ENXIO); + } + LIST_REMOVE(entry, gpe_entry); + g_free(entry); + } + } + error = G_PART_DESTROY(table, gpp); if (error) { gctl_error(req, "%d", error); @@ -1037,8 +1058,39 @@ g_part_ctl_move(struct gctl_req *req, st static int g_part_ctl_recover(struct gctl_req *req, struct g_part_parms *gpp) { - gctl_error(req, "%d verb 'recover'", ENOSYS); - return (ENOSYS); + struct g_part_table *table; + struct g_geom *gp; + struct sbuf *sb; + int error, recovered; + + gp = gpp->gpp_geom; + G_PART_TRACE((G_T_TOPOLOGY, "%s(%s)", __func__, gp->name)); + g_topology_assert(); + table = gp->softc; + error = recovered = 0; + + if (table->gpt_corrupt) { + error = G_PART_RECOVER(table); + if (error) { + gctl_error(req, "%d recovering '%s' failed", + error, gp->name); + return (error); + } + recovered = 1; + } + /* Provide feedback if so requested. */ + if (gpp->gpp_parms & G_PART_PARM_OUTPUT) { + sb = sbuf_new_auto(); + if (recovered) + sbuf_printf(sb, "%s recovered\n", gp->name); + else + sbuf_printf(sb, "%s recovering is not needed\n", + gp->name); + sbuf_finish(sb); + gctl_set_param(req, "output", sbuf_data(sb), sbuf_len(sb) + 1); + sbuf_delete(sb); + } + return (0); } static int @@ -1341,6 +1393,7 @@ g_part_ctlreq(struct gctl_req *req, stru } else if (!strcmp(verb, "destroy")) { ctlreq = G_PART_CTL_DESTROY; mparms |= G_PART_PARM_GEOM; + oparms |= G_PART_PARM_FORCE; } break; case 'm': @@ -1415,6 +1468,8 @@ g_part_ctlreq(struct gctl_req *req, stru case 'f': if (!strcmp(ap->name, "flags")) parm = G_PART_PARM_FLAGS; + else if (!strcmp(ap->name, "force")) + parm = G_PART_PARM_FORCE; break; case 'i': if (!strcmp(ap->name, "index")) @@ -1453,7 +1508,8 @@ g_part_ctlreq(struct gctl_req *req, stru } switch (parm) { case G_PART_PARM_ATTRIB: - error = g_part_parm_str(req, ap->name, &gpp.gpp_attrib); + error = g_part_parm_str(req, ap->name, + &gpp.gpp_attrib); break; case G_PART_PARM_BOOTCODE: error = g_part_parm_bootcode(req, ap->name, @@ -1466,11 +1522,16 @@ g_part_ctlreq(struct gctl_req *req, stru case G_PART_PARM_FLAGS: error = g_part_parm_str(req, ap->name, &gpp.gpp_flags); break; + case G_PART_PARM_FORCE: + error = g_part_parm_uint32(req, ap->name, + &gpp.gpp_force); + break; case G_PART_PARM_GEOM: error = g_part_parm_geom(req, ap->name, &gpp.gpp_geom); break; case G_PART_PARM_INDEX: - error = g_part_parm_intmax(req, ap->name, &gpp.gpp_index); + error = g_part_parm_intmax(req, ap->name, + &gpp.gpp_index); break; case G_PART_PARM_LABEL: error = g_part_parm_str(req, ap->name, &gpp.gpp_label); @@ -1490,7 +1551,8 @@ g_part_ctlreq(struct gctl_req *req, stru error = g_part_parm_quad(req, ap->name, &gpp.gpp_size); break; case G_PART_PARM_START: - error = g_part_parm_quad(req, ap->name, &gpp.gpp_start); + error = g_part_parm_quad(req, ap->name, + &gpp.gpp_start); break; case G_PART_PARM_TYPE: error = g_part_parm_str(req, ap->name, &gpp.gpp_type); @@ -1524,6 +1586,13 @@ g_part_ctlreq(struct gctl_req *req, stru table = NULL; if (modifies && (gpp.gpp_parms & G_PART_PARM_GEOM)) { table = gpp.gpp_geom->softc; + if (table != NULL && table->gpt_corrupt && + ctlreq != G_PART_CTL_DESTROY && + ctlreq != G_PART_CTL_RECOVER) { + gctl_error(req, "%d table '%s' is corrupt", + EPERM, gpp.gpp_geom->name); + return; + } if (table != NULL && !table->gpt_opened) { error = g_access(LIST_FIRST(&gpp.gpp_geom->consumer), 1, 1, 1); @@ -1789,6 +1858,8 @@ g_part_dumpconf(struct sbuf *sb, const c table->gpt_sectors); sbuf_printf(sb, "%s%u\n", indent, table->gpt_heads); + sbuf_printf(sb, "%s%s\n", indent, + table->gpt_corrupt ? "CORRUPT": "OK"); G_PART_DUMPCONF(table, NULL, sb, indent); } } Modified: head/sys/geom/part/g_part.h ============================================================================== --- head/sys/geom/part/g_part.h Mon Oct 25 16:11:37 2010 (r214351) +++ head/sys/geom/part/g_part.h Mon Oct 25 16:23:35 2010 (r214352) @@ -132,6 +132,7 @@ struct g_part_table { int gpt_modified:1; /* Table changes have been made. */ int gpt_opened:1; /* Permissions obtained. */ int gpt_fixgeom:1; /* Geometry is fixed. */ + int gpt_corrupt:1; /* Table is corrupt. */ }; struct g_part_entry *g_part_new_entry(struct g_part_table *, int, quad_t, @@ -169,6 +170,7 @@ enum g_part_ctl { #define G_PART_PARM_VERSION 0x0800 #define G_PART_PARM_BOOTCODE 0x1000 #define G_PART_PARM_ATTRIB 0x2000 +#define G_PART_PARM_FORCE 0x4000 struct g_part_parms { unsigned int gpp_parms; @@ -186,6 +188,7 @@ struct g_part_parms { const void *gpp_codeptr; unsigned int gpp_codesize; const char *gpp_attrib; + unsigned int gpp_force; }; void g_part_geometry_heads(off_t, u_int, off_t *, u_int *); Modified: head/sys/geom/part/g_part_gpt.c ============================================================================== --- head/sys/geom/part/g_part_gpt.c Mon Oct 25 16:11:37 2010 (r214351) +++ head/sys/geom/part/g_part_gpt.c Mon Oct 25 16:23:35 2010 (r214352) @@ -94,7 +94,7 @@ static int g_part_gpt_destroy(struct g_p static void g_part_gpt_dumpconf(struct g_part_table *, struct g_part_entry *, struct sbuf *, const char *); static int g_part_gpt_dumpto(struct g_part_table *, struct g_part_entry *); -static int g_part_gpt_modify(struct g_part_table *, struct g_part_entry *, +static int g_part_gpt_modify(struct g_part_table *, struct g_part_entry *, struct g_part_parms *); static const char *g_part_gpt_name(struct g_part_table *, struct g_part_entry *, char *, size_t); @@ -107,6 +107,7 @@ static const char *g_part_gpt_type(struc static int g_part_gpt_write(struct g_part_table *, struct g_consumer *); static int g_part_gpt_resize(struct g_part_table *, struct g_part_entry *, struct g_part_parms *); +static int g_part_gpt_recover(struct g_part_table *); static kobj_method_t g_part_gpt_methods[] = { KOBJMETHOD(g_part_add, g_part_gpt_add), @@ -120,6 +121,7 @@ static kobj_method_t g_part_gpt_methods[ KOBJMETHOD(g_part_name, g_part_gpt_name), KOBJMETHOD(g_part_probe, g_part_gpt_probe), KOBJMETHOD(g_part_read, g_part_gpt_read), + KOBJMETHOD(g_part_recover, g_part_gpt_recover), KOBJMETHOD(g_part_setunset, g_part_gpt_setunset), KOBJMETHOD(g_part_type, g_part_gpt_type), KOBJMETHOD(g_part_write, g_part_gpt_write), @@ -170,7 +172,7 @@ static struct uuid gpt_uuid_unused = GPT static struct g_part_uuid_alias { struct uuid *uuid; - int alias; + int alias; } gpt_uuid_alias_match[] = { { &gpt_uuid_apple_boot, G_PART_ALIAS_APPLE_BOOT }, { &gpt_uuid_apple_hfs, G_PART_ALIAS_APPLE_HFS }, @@ -217,8 +219,16 @@ gpt_read_hdr(struct g_part_gpt_table *ta pp = cp->provider; last = (pp->mediasize / pp->sectorsize) - 1; - table->lba[elt] = (elt == GPT_ELT_PRIHDR) ? 1 : last; table->state[elt] = GPT_STATE_MISSING; + /* + * If the primary header is valid look for secondary + * header in AlternateLBA, otherwise in the last medium's LBA. + */ + if (elt == GPT_ELT_SECHDR) { + if (table->state[GPT_ELT_PRIHDR] != GPT_STATE_OK) + table->lba[elt] = last; + } else + table->lba[elt] = 1; buf = g_read_data(cp, table->lba[elt] * pp->sectorsize, pp->sectorsize, &error); if (buf == NULL) @@ -244,12 +254,15 @@ gpt_read_hdr(struct g_part_gpt_table *ta table->state[elt] = GPT_STATE_INVALID; hdr->hdr_revision = le32toh(buf->hdr_revision); - if (hdr->hdr_revision < 0x00010000) + if (hdr->hdr_revision < GPT_HDR_REVISION) goto fail; hdr->hdr_lba_self = le64toh(buf->hdr_lba_self); if (hdr->hdr_lba_self != table->lba[elt]) goto fail; hdr->hdr_lba_alt = le64toh(buf->hdr_lba_alt); + if (hdr->hdr_lba_alt == hdr->hdr_lba_self || + hdr->hdr_lba_alt > last) + goto fail; /* Check the managed area. */ hdr->hdr_lba_start = le64toh(buf->hdr_lba_start); @@ -283,6 +296,10 @@ gpt_read_hdr(struct g_part_gpt_table *ta le_uuid_dec(&buf->hdr_uuid, &hdr->hdr_uuid); hdr->hdr_crc_table = le32toh(buf->hdr_crc_table); + /* save LBA for secondary header */ + if (elt == GPT_ELT_PRIHDR) + table->lba[GPT_ELT_SECHDR] = hdr->hdr_lba_alt; + g_free(buf); return (hdr); @@ -490,18 +507,21 @@ static int g_part_gpt_destroy(struct g_part_table *basetable, struct g_part_parms *gpp) { struct g_part_gpt_table *table; + struct g_provider *pp; table = (struct g_part_gpt_table *)basetable; - if (table->hdr != NULL) - g_free(table->hdr); + pp = LIST_FIRST(&basetable->gpt_gp->consumer)->provider; + g_free(table->hdr); table->hdr = NULL; /* - * Wipe the first 2 sectors as well as the last to clear the - * partitioning. + * Wipe the first 2 sectors to clear the partitioning. Wipe the last + * sector only if it has valid secondary header. */ basetable->gpt_smhead |= 3; - basetable->gpt_smtail |= 1; + if (table->state[GPT_ELT_SECHDR] == GPT_STATE_OK && + table->lba[GPT_ELT_SECHDR] == pp->mediasize / pp->sectorsize - 1) + basetable->gpt_smtail |= 1; return (0); } @@ -665,10 +685,12 @@ g_part_gpt_read(struct g_part_table *bas struct g_part_gpt_table *table; struct g_part_gpt_entry *entry; u_char *buf; + uint64_t last; int error, index; table = (struct g_part_gpt_table *)basetable; pp = cp->provider; + last = (pp->mediasize / pp->sectorsize) - 1; /* Read the PMBR */ buf = g_read_data(cp, 0, pp->sectorsize, &error); @@ -732,6 +754,7 @@ g_part_gpt_read(struct g_part_table *bas printf("GEOM: %s: using the secondary instead -- recovery " "strongly advised.\n", pp->name); table->hdr = sechdr; + basetable->gpt_corrupt = 1; if (prihdr != NULL) g_free(prihdr); tbl = sectbl; @@ -743,6 +766,11 @@ g_part_gpt_read(struct g_part_table *bas "or invalid.\n", pp->name); printf("GEOM: %s: using the primary only -- recovery " "suggested.\n", pp->name); + basetable->gpt_corrupt = 1; + } else if (table->lba[GPT_ELT_SECHDR] != last) { + printf( "GEOM: %s: the secondary GPT header is not in " + "the last LBA.\n", pp->name); + basetable->gpt_corrupt = 1; } table->hdr = prihdr; if (sechdr != NULL) @@ -759,8 +787,9 @@ g_part_gpt_read(struct g_part_table *bas for (index = basetable->gpt_entries - 1; index >= 0; index--) { if (EQUUID(&tbl[index].ent_type, &gpt_uuid_unused)) continue; - entry = (struct g_part_gpt_entry *)g_part_new_entry(basetable, - index+1, tbl[index].ent_lba_start, tbl[index].ent_lba_end); + entry = (struct g_part_gpt_entry *)g_part_new_entry( + basetable, index + 1, tbl[index].ent_lba_start, + tbl[index].ent_lba_end); entry->ent = tbl[index]; } @@ -769,6 +798,38 @@ g_part_gpt_read(struct g_part_table *bas } static int +g_part_gpt_recover(struct g_part_table *basetable) +{ + struct g_part_gpt_table *table; + struct g_provider *pp; + uint64_t last; + size_t tblsz; + + table = (struct g_part_gpt_table *)basetable; + pp = LIST_FIRST(&basetable->gpt_gp->consumer)->provider; + last = pp->mediasize / pp->sectorsize - 1; + tblsz = (table->hdr->hdr_entries * table->hdr->hdr_entsz + + pp->sectorsize - 1) / pp->sectorsize; + + table->lba[GPT_ELT_PRIHDR] = 1; + table->lba[GPT_ELT_PRITBL] = 2; + table->lba[GPT_ELT_SECHDR] = last; + table->lba[GPT_ELT_SECTBL] = last - tblsz; + table->state[GPT_ELT_PRIHDR] = GPT_STATE_OK; + table->state[GPT_ELT_PRITBL] = GPT_STATE_OK; + table->state[GPT_ELT_SECHDR] = GPT_STATE_OK; + table->state[GPT_ELT_SECTBL] = GPT_STATE_OK; + table->hdr->hdr_lba_start = 2 + tblsz; + table->hdr->hdr_lba_end = last - tblsz - 1; + + basetable->gpt_first = table->hdr->hdr_lba_start; + basetable->gpt_last = table->hdr->hdr_lba_end; + basetable->gpt_corrupt = 0; + + return (0); +} + +static int g_part_gpt_setunset(struct g_part_table *table, struct g_part_entry *baseentry, const char *attrib, unsigned int set) { @@ -867,13 +928,13 @@ g_part_gpt_write(struct g_part_table *ba struct g_part_entry *baseentry; struct g_part_gpt_entry *entry; struct g_part_gpt_table *table; - size_t tlbsz; + size_t tblsz; uint32_t crc; int error, index; pp = cp->provider; table = (struct g_part_gpt_table *)basetable; - tlbsz = (table->hdr->hdr_entries * table->hdr->hdr_entsz + + tblsz = (table->hdr->hdr_entries * table->hdr->hdr_entsz + pp->sectorsize - 1) / pp->sectorsize; /* Write the PMBR */ @@ -885,7 +946,7 @@ g_part_gpt_write(struct g_part_table *ba return (error); /* Allocate space for the header and entries. */ - buf = g_malloc((tlbsz + 1) * pp->sectorsize, M_WAITOK | M_ZERO); + buf = g_malloc((tblsz + 1) * pp->sectorsize, M_WAITOK | M_ZERO); memcpy(buf, table->hdr->hdr_sig, sizeof(table->hdr->hdr_sig)); le32enc(buf + 8, table->hdr->hdr_revision); @@ -924,7 +985,7 @@ g_part_gpt_write(struct g_part_table *ba le32enc(buf + 16, crc); error = g_write_data(cp, table->lba[GPT_ELT_PRITBL] * pp->sectorsize, - buf + pp->sectorsize, tlbsz * pp->sectorsize); + buf + pp->sectorsize, tblsz * pp->sectorsize); if (error) goto out; error = g_write_data(cp, table->lba[GPT_ELT_PRIHDR] * pp->sectorsize, @@ -941,7 +1002,7 @@ g_part_gpt_write(struct g_part_table *ba le32enc(buf + 16, crc); error = g_write_data(cp, table->lba[GPT_ELT_SECTBL] * pp->sectorsize, - buf + pp->sectorsize, tlbsz * pp->sectorsize); + buf + pp->sectorsize, tblsz * pp->sectorsize); if (error) goto out; error = g_write_data(cp, table->lba[GPT_ELT_SECHDR] * pp->sectorsize, Modified: head/sys/geom/part/g_part_if.m ============================================================================== --- head/sys/geom/part/g_part_if.m Mon Oct 25 16:11:37 2010 (r214351) +++ head/sys/geom/part/g_part_if.m Mon Oct 25 16:23:35 2010 (r214352) @@ -65,6 +65,12 @@ CODE { { return (ENOSYS); } + + static int + default_recover(struct g_part_table *t __unused) + { + return (ENOSYS); + } }; # add() - scheme specific processing for the add verb. @@ -163,6 +169,11 @@ METHOD int read { struct g_consumer *cp; }; +# recover() - scheme specific processing for the recover verb. +METHOD int recover { + struct g_part_table *table; +} DEFAULT default_recover; + # setunset() - set or unset partition entry attributes. METHOD int setunset { struct g_part_table *table; From owner-svn-src-head@FreeBSD.ORG Mon Oct 25 20:29:41 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9835F1065674; Mon, 25 Oct 2010 20:29:41 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id 368F28FC22; Mon, 25 Oct 2010 20:29:40 +0000 (UTC) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id C51A445CAC; Mon, 25 Oct 2010 22:29:39 +0200 (CEST) Received: from localhost (chello089073192049.chello.pl [89.73.192.49]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id 3A7C945C99; Mon, 25 Oct 2010 22:29:34 +0200 (CEST) Date: Mon, 25 Oct 2010 22:29:01 +0200 From: Pawel Jakub Dawidek To: "Andrey V. Elsukov" Message-ID: <20101025202901.GB1811@garage.freebsd.pl> References: <201010251623.o9PGNZ3V070926@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="H+4ONPRPur6+Ovig" Content-Disposition: inline In-Reply-To: <201010251623.o9PGNZ3V070926@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 9.0-CURRENT amd64 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-0.6 required=4.5 tests=BAYES_00,RCVD_IN_SORBS_DUL autolearn=no version=3.0.4 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r214352 - in head: sbin/geom/class/part sys/geom/part X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Oct 2010 20:29:41 -0000 --H+4ONPRPur6+Ovig Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Oct 25, 2010 at 04:23:35PM +0000, Andrey V. Elsukov wrote: > Author: ae > Date: Mon Oct 25 16:23:35 2010 > New Revision: 214352 > URL: http://svn.freebsd.org/changeset/base/214352 >=20 > Log: > Reimplemented "gpart destroy -F". Now it does all work in kernel. > This was needed for recover implementation. > =20 > Implement the recover command for GPT. Now GPT will marked as > corrupt when any of three types of corruption will be detected: > 1. Damaged primary GPT header or table > 2. Damaged secondary GPT header or table > 3. Secondary header is not located in the last LBA > Marked GPT becomes read-only. Any changes with corrupt table > are prohibited. Only "destroy" and "recover" commands are allowed. Another corruption worth mentioning is when primary and secondary GPT header/table differ. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --H+4ONPRPur6+Ovig Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAkzF6IwACgkQForvXbEpPzTa9gCg9nSuHEEu9DVkl1ypSfcr8ACK GtQAoJ0kuMSP/b+66LiWbbkbMFFEZFuM =/qoC -----END PGP SIGNATURE----- --H+4ONPRPur6+Ovig-- From owner-svn-src-head@FreeBSD.ORG Mon Oct 25 20:52:33 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AD0431065673; Mon, 25 Oct 2010 20:52:33 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9B5BC8FC0A; Mon, 25 Oct 2010 20:52:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9PKqXNf076955; Mon, 25 Oct 2010 20:52:33 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9PKqXFt076953; Mon, 25 Oct 2010 20:52:33 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201010252052.o9PKqXFt076953@svn.freebsd.org> From: Marius Strobl Date: Mon, 25 Oct 2010 20:52:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214358 - head/sys/sparc64/sparc64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Oct 2010 20:52:33 -0000 Author: marius Date: Mon Oct 25 20:52:33 2010 New Revision: 214358 URL: http://svn.freebsd.org/changeset/base/214358 Log: - Given that in one-shot mode tick_et_start() also is called frequently introduce function pointers once set up to the respective implementation for reading the (S)TICK and writing the (S)STICK_COMPARE registers as a compromise between duplicating code and selecting between different implementations during execution over and over again, similar to what is done elsewhere in the MD in order to support different CPU models that won't ever change at runtime. - In the remaining tick interrupt handler further push down disabling of interrupts to the periodic case as it isn't necessary here in one-shot mode at all. Modified: head/sys/sparc64/sparc64/tick.c Modified: head/sys/sparc64/sparc64/tick.c ============================================================================== --- head/sys/sparc64/sparc64/tick.c Mon Oct 25 19:58:28 2010 (r214357) +++ head/sys/sparc64/sparc64/tick.c Mon Oct 25 20:52:33 2010 (r214358) @@ -78,28 +78,69 @@ u_int tick_et_use_stick = 0; SYSCTL_INT(_machdep_tick, OID_AUTO, tick_et_use_stick, CTLFLAG_RD, &tick_et_use_stick, 0, "tick event timer uses STICK instead of TICK"); +typedef uint64_t rd_tick_t(void); +static rd_tick_t *rd_tick; +typedef void wr_tick_cmpr_t(uint64_t); +static wr_tick_cmpr_t *wr_tick_cmpr; + static struct timecounter stick_tc; -static struct timecounter tick_tc; static struct eventtimer tick_et; +static struct timecounter tick_tc; -static uint64_t tick_cputicks(void); -static timecounter_get_t stick_get_timecount_up; #ifdef SMP static timecounter_get_t stick_get_timecount_mp; #endif -static timecounter_get_t tick_get_timecount_up; +static timecounter_get_t stick_get_timecount_up; +static rd_tick_t stick_rd; +static wr_tick_cmpr_t stick_wr_cmpr; +static int tick_et_start(struct eventtimer *et, struct bintime *first, + struct bintime *period); +static int tick_et_stop(struct eventtimer *et); #ifdef SMP static timecounter_get_t tick_get_timecount_mp; #endif -static int tick_et_start(struct eventtimer *et, - struct bintime *first, struct bintime *period); -static int tick_et_stop(struct eventtimer *et); +static timecounter_get_t tick_get_timecount_up; static void tick_intr(struct trapframe *tf); -static void tick_intr_bbwar(struct trapframe *tf); static inline void tick_process(struct trapframe *tf); -static inline void tick_process_periodic(struct trapframe *tf, u_long tick, - u_long tick_increment, u_long adj); -static void stick_intr(struct trapframe *tf); +static rd_tick_t tick_rd; +static wr_tick_cmpr_t tick_wr_cmpr; +static wr_tick_cmpr_t tick_wr_cmpr_bbwar; +static uint64_t tick_cputicks(void); + +static uint64_t +stick_rd(void) +{ + + return (rdstick()); +} + +static void +stick_wr_cmpr(uint64_t tick) +{ + + wrstickcmpr(tick, 0); +} + +static uint64_t +tick_rd(void) +{ + + return (rd(tick)); +} + +static void +tick_wr_cmpr(uint64_t tick_cmpr) +{ + + wr(tick_cmpr, tick_cmpr, 0); +} + +static void +tick_wr_cmpr_bbwar(uint64_t tick_cmpr) +{ + + wrtickcmpr(tick_cmpr, 0); +} static uint64_t tick_cputicks(void) @@ -128,17 +169,22 @@ cpu_initclocks(void) * frequencies they shouldn't be used except when really necessary. */ if (tick_et_use_stick != 0) { - intr_setup(PIL_TICK, stick_intr, -1, NULL, NULL); + rd_tick = stick_rd; + wr_tick_cmpr = stick_wr_cmpr; /* * We don't provide a CPU ticker as long as the frequency * supplied isn't actually used per-CPU. */ } else { - intr_setup(PIL_TICK, PCPU_GET(impl) >= CPU_IMPL_ULTRASPARCI && - PCPU_GET(impl) < CPU_IMPL_ULTRASPARCIII ? - tick_intr_bbwar : tick_intr, -1, NULL, NULL); + rd_tick = tick_rd; + if (PCPU_GET(impl) >= CPU_IMPL_ULTRASPARCI && + PCPU_GET(impl) < CPU_IMPL_ULTRASPARCIII) + wr_tick_cmpr = tick_wr_cmpr_bbwar; + else + wr_tick_cmpr = tick_wr_cmpr; set_cputicker(tick_cputicks, clock, 0); } + intr_setup(PIL_TICK, tick_intr, -1, NULL, NULL); /* * Initialize the (S)TICK-based timecounter(s). @@ -214,106 +260,56 @@ tick_process(struct trapframe *tf) critical_exit(); } -/* - * NB: the sequence of reading the (S)TICK register, calculating the value - * of the next tick and writing it to the (S)TICK_COMPARE register must not - * be interrupted, not even by an IPI, otherwise a value that is in the past - * could be written in the worst case, causing the periodic timer to stop. - */ - static void tick_intr(struct trapframe *tf) { - u_long adj, tick, tick_increment; - register_t s; - - s = intr_disable(); - tick_increment = PCPU_GET(tickincrement); - if (tick_increment != 0) { - adj = PCPU_GET(tickadj); - tick = rd(tick); - wr(tick_cmpr, tick + tick_increment - adj, 0); - intr_restore(s); - tick_process_periodic(tf, tick, tick_increment, adj); - } else { - intr_restore(s); - tick_process(tf); - } -} - -static void -tick_intr_bbwar(struct trapframe *tf) -{ - u_long adj, tick, tick_increment; - register_t s; - - s = intr_disable(); - tick_increment = PCPU_GET(tickincrement); - if (tick_increment != 0) { - adj = PCPU_GET(tickadj); - tick = rd(tick); - wrtickcmpr(tick + tick_increment - adj, 0); - intr_restore(s); - tick_process_periodic(tf, tick, tick_increment, adj); - } else { - intr_restore(s); - tick_process(tf); - } -} - -static void -stick_intr(struct trapframe *tf) -{ - u_long adj, stick, tick_increment; + u_long adj, ref, tick, tick_increment; + long delta; register_t s; + int count; - s = intr_disable(); tick_increment = PCPU_GET(tickincrement); if (tick_increment != 0) { + /* + * NB: the sequence of reading the (S)TICK register, + * calculating the value of the next tick and writing it to + * the (S)TICK_COMPARE register must not be interrupted, not + * even by an IPI, otherwise a value that is in the past could + * be written in the worst case and thus causing the periodic + * timer to stop. + */ + s = intr_disable(); adj = PCPU_GET(tickadj); - stick = rdstick(); - wrstickcmpr(stick + tick_increment - adj, 0); + tick = rd_tick(); + wr_tick_cmpr(tick + tick_increment - adj); intr_restore(s); - tick_process_periodic(tf, stick, tick_increment, adj); - } else { - intr_restore(s); - tick_process(tf); - } -} - -static inline void -tick_process_periodic(struct trapframe *tf, u_long tick, - u_long tick_increment, u_long adj) -{ - u_long ref; - long delta; - int count; - - ref = PCPU_GET(tickref); - delta = tick - ref; - count = 0; - while (delta >= tick_increment) { - tick_process(tf); - delta -= tick_increment; - ref += tick_increment; - if (adj != 0) - adjust_ticks++; - count++; - } - if (count > 0) { - adjust_missed += count - 1; - if (delta > (tick_increment >> 3)) { - if (adj == 0) - adjust_edges++; - adj = tick_increment >> 4; - } else + ref = PCPU_GET(tickref); + delta = tick - ref; + count = 0; + while (delta >= tick_increment) { + tick_process(tf); + delta -= tick_increment; + ref += tick_increment; + if (adj != 0) + adjust_ticks++; + count++; + } + if (count > 0) { + adjust_missed += count - 1; + if (delta > (tick_increment >> 3)) { + if (adj == 0) + adjust_edges++; + adj = tick_increment >> 4; + } else + adj = 0; + } else { adj = 0; - } else { - adj = 0; - adjust_excess++; - } - PCPU_SET(tickref, ref); - PCPU_SET(tickadj, adj); + adjust_excess++; + } + PCPU_SET(tickref, ref); + PCPU_SET(tickadj, adj); + } else + tick_process(tf); } static u_int @@ -387,19 +383,13 @@ tick_et_start(struct eventtimer *et, str * out one tick to make sure that it is not missed. */ s = intr_disable(); - if (tick_et_use_stick != 0) - base = rdstick(); - else - base = rd(tick); + base = rd_tick(); if (div != 0) { PCPU_SET(tickadj, 0); base = roundup(base, div); } PCPU_SET(tickref, base); - if (tick_et_use_stick != 0) - wrstickcmpr(base + fdiv, 0); - else - wrtickcmpr(base + fdiv, 0); + wr_tick_cmpr(base + fdiv); intr_restore(s); return (0); } From owner-svn-src-head@FreeBSD.ORG Mon Oct 25 21:46:23 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7691F1065679; Mon, 25 Oct 2010 21:46:23 +0000 (UTC) (envelope-from ivoras@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 656C58FC12; Mon, 25 Oct 2010 21:46:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9PLkNii078106; Mon, 25 Oct 2010 21:46:23 GMT (envelope-from ivoras@svn.freebsd.org) Received: (from ivoras@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9PLkNNu078104; Mon, 25 Oct 2010 21:46:23 GMT (envelope-from ivoras@svn.freebsd.org) Message-Id: <201010252146.o9PLkNNu078104@svn.freebsd.org> From: Ivan Voras Date: Mon, 25 Oct 2010 21:46:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214359 - head/sys/ufs/ufs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Oct 2010 21:46:23 -0000 Author: ivoras Date: Mon Oct 25 21:46:23 2010 New Revision: 214359 URL: http://svn.freebsd.org/changeset/base/214359 Log: Bring vfs.ufs.dirhash_maxmem into the age of the fruitbat and make it autotuned. It is only an upper bound (the memory is not always allocated) and the system contains a vm_lowmem handler so nothing will crash and burn if it's tuned too high. Reviewed by: mckusick Modified: head/sys/ufs/ufs/ufs_dirhash.c Modified: head/sys/ufs/ufs/ufs_dirhash.c ============================================================================== --- head/sys/ufs/ufs/ufs_dirhash.c Mon Oct 25 20:52:33 2010 (r214358) +++ head/sys/ufs/ufs/ufs_dirhash.c Mon Oct 25 21:46:23 2010 (r214359) @@ -72,7 +72,8 @@ static int ufs_mindirhashsize = DIRBLKSI SYSCTL_INT(_vfs_ufs, OID_AUTO, dirhash_minsize, CTLFLAG_RW, &ufs_mindirhashsize, 0, "minimum directory size in bytes for which to use hashed lookup"); -static int ufs_dirhashmaxmem = 2 * 1024 * 1024; +static int ufs_dirhashmaxmem = 2 * 1024 * 1024; /* NOTE: initial value. It is + tuned in ufsdirhash_init() */ SYSCTL_INT(_vfs_ufs, OID_AUTO, dirhash_maxmem, CTLFLAG_RW, &ufs_dirhashmaxmem, 0, "maximum allowed dirhash memory usage"); static int ufs_dirhashmem; @@ -1290,6 +1291,9 @@ ufsdirhash_lowmem() void ufsdirhash_init() { + ufs_dirhashmaxmem = lmax(roundup(hibufspace / 64, PAGE_SIZE), + 2 * 1024 * 1024); + ufsdirhash_zone = uma_zcreate("DIRHASH", DH_NBLKOFF * sizeof(doff_t), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); mtx_init(&ufsdirhash_mtx, "dirhash list", NULL, MTX_DEF); From owner-svn-src-head@FreeBSD.ORG Tue Oct 26 00:07:58 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 99156106566B; Tue, 26 Oct 2010 00:07:58 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 862548FC15; Tue, 26 Oct 2010 00:07:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9Q07wOk081425; Tue, 26 Oct 2010 00:07:58 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9Q07wpP081422; Tue, 26 Oct 2010 00:07:58 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <201010260007.o9Q07wpP081422@svn.freebsd.org> From: Jack F Vogel Date: Tue, 26 Oct 2010 00:07:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214363 - head/sys/dev/e1000 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Oct 2010 00:07:58 -0000 Author: jfv Date: Tue Oct 26 00:07:58 2010 New Revision: 214363 URL: http://svn.freebsd.org/changeset/base/214363 Log: Bug fix delta to the em driver: - Chasin down bogus watchdogs has led to an improved design to this handling, the hang decision takes place in the tx cleanup, with only a simple report check in local_timer. Our tests have shown no false watchdogs with this code. - VLAN fixes from jhb, the shadow vfta should be per interface, but as global it was not. Thanks John. - Bug fixes in the support for new PCH2 hardware. - Thanks for all the help and feedback on the driver, changes to lem with be coming shortly as well. Modified: head/sys/dev/e1000/if_em.c head/sys/dev/e1000/if_em.h Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Mon Oct 25 23:59:56 2010 (r214362) +++ head/sys/dev/e1000/if_em.c Tue Oct 26 00:07:58 2010 (r214363) @@ -93,8 +93,7 @@ int em_display_debug_stats = 0; /********************************************************************* * Driver version: *********************************************************************/ -char em_driver_version[] = "7.0.8"; - +char em_driver_version[] = "7.1.6"; /********************************************************************* * PCI Device ID Table @@ -170,6 +169,8 @@ static em_vendor_info_t em_vendor_info_a { 0x8086, E1000_DEV_ID_PCH_M_HV_LC, PCI_ANY_ID, PCI_ANY_ID, 0}, { 0x8086, E1000_DEV_ID_PCH_D_HV_DM, PCI_ANY_ID, PCI_ANY_ID, 0}, { 0x8086, E1000_DEV_ID_PCH_D_HV_DC, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_PCH2_LV_LM, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_PCH2_LV_V, PCI_ANY_ID, PCI_ANY_ID, 0}, /* required last entry */ { 0, 0, 0, 0, 0} }; @@ -256,6 +257,8 @@ static int em_dma_malloc(struct adapter static void em_dma_free(struct adapter *, struct em_dma_alloc *); static int em_sysctl_nvm_info(SYSCTL_HANDLER_ARGS); static void em_print_nvm_info(struct adapter *); +static int em_sysctl_debug_info(SYSCTL_HANDLER_ARGS); +static void em_print_debug_info(struct adapter *); static int em_is_valid_ether_addr(u8 *); static int em_sysctl_int_delay(SYSCTL_HANDLER_ARGS); static void em_add_int_delay_sysctl(struct adapter *, const char *, @@ -282,6 +285,8 @@ static void em_handle_link(void *context static void em_add_rx_process_limit(struct adapter *, const char *, const char *, int *, int); +static void em_set_flow_cntrl(struct adapter *, const char *, + const char *, int *, int); static __inline void em_rx_discard(struct rx_ring *, int); @@ -359,14 +364,6 @@ TUNABLE_INT("hw.em.rx_process_limit", &e static int em_fc_setting = e1000_fc_full; TUNABLE_INT("hw.em.fc_setting", &em_fc_setting); -/* -** Shadow VFTA table, this is needed because -** the real vlan filter table gets cleared during -** a soft reset and the driver needs to be able -** to repopulate it. -*/ -static u32 em_shadow_vfta[EM_VFTA_SIZE]; - /* Global used in WOL setup with multiport cards */ static int global_quad_port_a = 0; @@ -449,6 +446,11 @@ em_attach(device_t dev) OID_AUTO, "nvm", CTLTYPE_INT|CTLFLAG_RW, adapter, 0, em_sysctl_nvm_info, "I", "NVM Information"); + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), + OID_AUTO, "debug", CTLTYPE_INT|CTLFLAG_RW, adapter, 0, + em_sysctl_debug_info, "I", "Debug Information"); + callout_init_mtx(&adapter->timer, &adapter->core_mtx, 0); /* Determine hardware and mac info */ @@ -468,9 +470,10 @@ em_attach(device_t dev) ** identified */ if ((adapter->hw.mac.type == e1000_ich8lan) || - (adapter->hw.mac.type == e1000_pchlan) || (adapter->hw.mac.type == e1000_ich9lan) || - (adapter->hw.mac.type == e1000_ich10lan)) { + (adapter->hw.mac.type == e1000_ich10lan) || + (adapter->hw.mac.type == e1000_pchlan) || + (adapter->hw.mac.type == e1000_pch2lan)) { int rid = EM_BAR_TYPE_FLASH; adapter->flash = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); @@ -514,11 +517,16 @@ em_attach(device_t dev) E1000_REGISTER(&adapter->hw, E1000_TADV), em_tx_abs_int_delay_dflt); - /* Sysctls for limiting the amount of work done in the taskqueue */ + /* Sysctl for limiting the amount of work done in the taskqueue */ em_add_rx_process_limit(adapter, "rx_processing_limit", "max number of rx packets to process", &adapter->rx_process_limit, em_rx_process_limit); + /* Sysctl for setting the interface flow control */ + em_set_flow_cntrl(adapter, "flow_control", + "max number of rx packets to process", + &adapter->fc_setting, em_fc_setting); + /* * Validate number of transmit and receive descriptors. It * must not exceed hardware maximum, and must be multiple @@ -581,6 +589,11 @@ em_attach(device_t dev) goto err_late; } + /* Check SOL/IDER usage */ + if (e1000_check_reset_block(&adapter->hw)) + device_printf(dev, "PHY reset is blocked" + " due to SOL/IDER session.\n"); + /* ** Start from a known state, this is ** important in reading the nvm and @@ -644,11 +657,6 @@ em_attach(device_t dev) adapter->hw.mac.get_link_status = 1; em_update_link_status(adapter); - /* Indicate SOL/IDER usage */ - if (e1000_check_reset_block(&adapter->hw)) - device_printf(dev, - "PHY reset is blocked due to SOL/IDER session.\n"); - /* Register for VLAN events */ adapter->vlan_attach = EVENTHANDLER_REGISTER(vlan_config, em_register_vlan, adapter, EVENTHANDLER_PRI_FIRST); @@ -857,7 +865,7 @@ em_mq_start_locked(struct ifnet *ifp, st if (enq > 0) { /* Set the watchdog */ - txr->watchdog_check = TRUE; + txr->queue_status = EM_QUEUE_WORKING; txr->watchdog_time = ticks; } return (err); @@ -870,14 +878,8 @@ static int em_mq_start(struct ifnet *ifp, struct mbuf *m) { struct adapter *adapter = ifp->if_softc; - struct tx_ring *txr; - int i = 0, error = 0; - - /* Which queue to use */ - if ((m->m_flags & M_FLOWID) != 0) - i = m->m_pkthdr.flowid % adapter->num_queues; - - txr = &adapter->tx_rings[i]; + struct tx_ring *txr = adapter->tx_rings; + int error; if (EM_TX_TRYLOCK(txr)) { error = em_mq_start_locked(ifp, txr, m); @@ -953,7 +955,7 @@ em_start_locked(struct ifnet *ifp, struc /* Set timeout in case hardware has problems transmitting. */ txr->watchdog_time = ticks; - txr->watchdog_check = TRUE; + txr->queue_status = EM_QUEUE_WORKING; } return; @@ -1029,6 +1031,7 @@ em_ioctl(struct ifnet *ifp, u_long comma case e1000_82572: case e1000_ich9lan: case e1000_ich10lan: + case e1000_pch2lan: case e1000_82574: case e1000_80003es2lan: /* 9K Jumbo Frame size */ max_frame_size = 9234; @@ -1092,6 +1095,11 @@ em_ioctl(struct ifnet *ifp, u_long comma } break; case SIOCSIFMEDIA: + /* + ** As the speed/duplex settings are being + ** changed, we need to reset the PHY. + */ + adapter->hw.phy.reset_disable = FALSE; /* Check SOL/IDER usage */ EM_CORE_LOCK(adapter); if (e1000_check_reset_block(&adapter->hw)) { @@ -1101,6 +1109,7 @@ em_ioctl(struct ifnet *ifp, u_long comma break; } EM_CORE_UNLOCK(adapter); + /* falls thru */ case SIOCGIFMEDIA: IOCTL_DEBUGOUT("ioctl rcv'd: \ SIOCxIFMEDIA (Get/Set Interface Media)"); @@ -1215,13 +1224,16 @@ em_init_locked(struct adapter *adapter) case e1000_82583: pba = E1000_PBA_20K; /* 20K for Rx, 20K for Tx */ break; + case e1000_ich8lan: + pba = E1000_PBA_8K; + break; case e1000_ich9lan: case e1000_ich10lan: case e1000_pchlan: pba = E1000_PBA_10K; break; - case e1000_ich8lan: - pba = E1000_PBA_8K; + case e1000_pch2lan: + pba = E1000_PBA_26K; break; default: if (adapter->max_frame_size > 8192) @@ -1259,19 +1271,6 @@ em_init_locked(struct adapter *adapter) /* Setup VLAN support, basic and offload if available */ E1000_WRITE_REG(&adapter->hw, E1000_VET, ETHERTYPE_VLAN); - /* Use real VLAN Filter support? */ - if (ifp->if_capenable & IFCAP_VLAN_HWTAGGING) { - if (ifp->if_capenable & IFCAP_VLAN_HWFILTER) - /* Use real VLAN Filter support */ - em_setup_vlan_hw_support(adapter); - else { - u32 ctrl; - ctrl = E1000_READ_REG(&adapter->hw, E1000_CTRL); - ctrl |= E1000_CTRL_VME; - E1000_WRITE_REG(&adapter->hw, E1000_CTRL, ctrl); - } - } - /* Set hardware offload abilities */ ifp->if_hwassist = 0; if (ifp->if_capenable & IFCAP_TXCSUM) @@ -1289,6 +1288,17 @@ em_init_locked(struct adapter *adapter) /* Setup Multicast table */ em_set_multi(adapter); + /* + ** Figure out the desired mbuf + ** pool for doing jumbos + */ + if (adapter->max_frame_size <= 2048) + adapter->rx_mbuf_sz = MCLBYTES; + else if (adapter->max_frame_size <= 4096) + adapter->rx_mbuf_sz = MJUMPAGESIZE; + else + adapter->rx_mbuf_sz = MJUM9BYTES; + /* Prepare receive descriptors and buffers */ if (em_setup_receive_structures(adapter)) { device_printf(dev, "Could not setup receive structures\n"); @@ -1297,6 +1307,19 @@ em_init_locked(struct adapter *adapter) } em_initialize_receive_unit(adapter); + /* Use real VLAN Filter support? */ + if (ifp->if_capenable & IFCAP_VLAN_HWTAGGING) { + if (ifp->if_capenable & IFCAP_VLAN_HWFILTER) + /* Use real VLAN Filter support */ + em_setup_vlan_hw_support(adapter); + else { + u32 ctrl; + ctrl = E1000_READ_REG(&adapter->hw, E1000_CTRL); + ctrl |= E1000_CTRL_VME; + E1000_WRITE_REG(&adapter->hw, E1000_CTRL, ctrl); + } + } + /* Don't lose promiscuous settings */ em_set_promisc(adapter); @@ -1707,11 +1730,6 @@ em_media_change(struct ifnet *ifp) device_printf(adapter->dev, "Unsupported media type\n"); } - /* As the speed/duplex settings my have changed we need to - * reset the PHY. - */ - adapter->hw.phy.reset_disable = FALSE; - em_init_locked(adapter); EM_CORE_UNLOCK(adapter); @@ -1929,15 +1947,12 @@ em_xmit(struct tx_ring *txr, struct mbuf m_head = *m_headp; /* Do hardware assists */ -#if __FreeBSD_version >= 700000 if (m_head->m_pkthdr.csum_flags & CSUM_TSO) { - em_tso_setup(txr, m_head, ip_off, ip, tp, &txd_upper, - &txd_lower); + em_tso_setup(txr, m_head, ip_off, ip, tp, + &txd_upper, &txd_lower); /* we need to make a final sentinel transmit desc */ tso_desc = TRUE; - } else -#endif - if (m_head->m_pkthdr.csum_flags & CSUM_OFFLOAD) + } else if (m_head->m_pkthdr.csum_flags & CSUM_OFFLOAD) em_transmit_checksum_setup(txr, m_head, ip_off, ip, &txd_upper, &txd_lower); @@ -2164,34 +2179,30 @@ em_local_timer(void *arg) em_update_stats_counters(adapter); /* Reset LAA into RAR[0] on 82571 */ - if (e1000_get_laa_state_82571(&adapter->hw) == TRUE) + if ((adapter->hw.mac.type == e1000_82571) && + e1000_get_laa_state_82571(&adapter->hw)) e1000_rar_set(&adapter->hw, adapter->hw.mac.addr, 0); /* - ** If flow control has paused us since last checking - ** it invalidates the watchdog timing, so dont run it. + ** Don't do TX watchdog check if we've been paused */ if (adapter->pause_frames) { adapter->pause_frames = 0; goto out; } /* - ** Check for time since any descriptor was cleaned + ** Check on the state of the TX queue(s), this + ** can be done without the lock because its RO + ** and the HUNG state will be static if set. */ - for (int i = 0; i < adapter->num_queues; i++, txr++) { - EM_TX_LOCK(txr); - if (txr->watchdog_check == FALSE) { - EM_TX_UNLOCK(txr); - continue; - } - if ((ticks - txr->watchdog_time) > EM_WATCHDOG) + for (int i = 0; i < adapter->num_queues; i++, txr++) + if (txr->queue_status == EM_QUEUE_HUNG) goto hung; - EM_TX_UNLOCK(txr); - } out: callout_reset(&adapter->timer, hz, em_local_timer, adapter); return; hung: + /* Looks like we're hung */ device_printf(adapter->dev, "Watchdog timeout -- resetting\n"); device_printf(adapter->dev, "Queue(%d) tdh = %d, hw tdt = %d\n", txr->me, @@ -2272,7 +2283,7 @@ em_update_link_status(struct adapter *ad adapter->link_active = 0; /* Link down, disable watchdog */ for (int i = 0; i < adapter->num_queues; i++, txr++) - txr->watchdog_check = FALSE; + txr->queue_status = EM_QUEUE_IDLE; if_link_state_change(ifp, LINK_STATE_DOWN); } } @@ -2306,7 +2317,7 @@ em_stop(void *arg) /* Unarm watchdog timer. */ for (int i = 0; i < adapter->num_queues; i++, txr++) { EM_TX_LOCK(txr); - txr->watchdog_check = FALSE; + txr->queue_status = EM_QUEUE_IDLE; EM_TX_UNLOCK(txr); } @@ -2571,6 +2582,9 @@ em_free_pci_resources(struct adapter *ad for (int i = 0; i < adapter->num_queues; i++) { txr = &adapter->tx_rings[i]; rxr = &adapter->rx_rings[i]; + /* an early abort? */ + if ((txr == NULL) || (rxr == NULL)) + break; rid = txr->msix +1; if (txr->tag != NULL) { bus_teardown_intr(dev, txr->res, txr->tag); @@ -2689,6 +2703,7 @@ static void em_reset(struct adapter *adapter) { device_t dev = adapter->dev; + struct ifnet *ifp = adapter->ifp; struct e1000_hw *hw = &adapter->hw; u16 rx_buffer_size; @@ -2733,15 +2748,25 @@ em_reset(struct adapter *adapter) hw->fc.send_xon = TRUE; /* Set Flow control, use the tunable location if sane */ - if ((em_fc_setting >= 0) || (em_fc_setting < 4)) - hw->fc.requested_mode = em_fc_setting; - else - hw->fc.requested_mode = e1000_fc_none; + hw->fc.requested_mode = adapter->fc_setting; - /* Override - workaround for PCHLAN issue */ + /* Workaround: no TX flow ctrl for PCH */ if (hw->mac.type == e1000_pchlan) hw->fc.requested_mode = e1000_fc_rx_pause; + /* Override - settings for PCH2LAN, ya its magic :) */ + if (hw->mac.type == e1000_pch2lan) { + hw->fc.high_water = 0x5C20; + hw->fc.low_water = 0x5048; + hw->fc.pause_time = 0x0650; + hw->fc.refresh_time = 0x0400; + /* Jumbos need adjusted PBA */ + if (ifp->if_mtu > ETHERMTU) + E1000_WRITE_REG(hw, E1000_PBA, 12); + else + E1000_WRITE_REG(hw, E1000_PBA, 26); + } + /* Issue a global reset */ e1000_reset_hw(hw); E1000_WRITE_REG(hw, E1000_WUC, 0); @@ -3173,6 +3198,7 @@ em_setup_transmit_ring(struct tx_ring *t /* Set number of descriptors available */ txr->tx_avail = adapter->num_tx_desc; + txr->queue_status = EM_QUEUE_IDLE; /* Clear checksum offload context. */ txr->last_hw_offload = 0; @@ -3233,7 +3259,7 @@ em_initialize_transmit_unit(struct adapt E1000_READ_REG(&adapter->hw, E1000_TDBAL(i)), E1000_READ_REG(&adapter->hw, E1000_TDLEN(i))); - txr->watchdog_check = FALSE; + txr->queue_status = EM_QUEUE_IDLE; } /* Set the default values for the Tx Inter Packet Gap timer */ @@ -3610,16 +3636,20 @@ static bool em_txeof(struct tx_ring *txr) { struct adapter *adapter = txr->adapter; - int first, last, done; + int first, last, done, processed; struct em_buffer *tx_buffer; struct e1000_tx_desc *tx_desc, *eop_desc; struct ifnet *ifp = adapter->ifp; EM_TX_LOCK_ASSERT(txr); - if (txr->tx_avail == adapter->num_tx_desc) + /* No work, make sure watchdog is off */ + if (txr->tx_avail == adapter->num_tx_desc) { + txr->queue_status = EM_QUEUE_IDLE; return (FALSE); + } + processed = 0; first = txr->next_to_clean; tx_desc = &txr->tx_base[first]; tx_buffer = &txr->tx_buffers[first]; @@ -3646,6 +3676,7 @@ em_txeof(struct tx_ring *txr) tx_desc->lower.data = 0; tx_desc->buffer_addr = 0; ++txr->tx_avail; + ++processed; if (tx_buffer->m_head) { bus_dmamap_sync(txr->txtag, @@ -3681,6 +3712,16 @@ em_txeof(struct tx_ring *txr) txr->next_to_clean = first; + /* + ** Watchdog calculation, we know there's + ** work outstanding or the first return + ** would have been taken, so none processed + ** for too long indicates a hang. local timer + ** will examine this and do a reset if needed. + */ + if ((!processed) && ((ticks - txr->watchdog_time) > EM_WATCHDOG)) + txr->queue_status = EM_QUEUE_HUNG; + /* * If we have enough room, clear IFF_DRV_OACTIVE * to tell the stack that it is OK to send packets. @@ -3689,7 +3730,7 @@ em_txeof(struct tx_ring *txr) ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; /* Disable watchdog if all clean */ if (txr->tx_avail == adapter->num_tx_desc) { - txr->watchdog_check = FALSE; + txr->queue_status = EM_QUEUE_IDLE; return (FALSE); } } @@ -3723,7 +3764,8 @@ em_refresh_mbufs(struct rx_ring *rxr, in */ if (rxbuf->m_head != NULL) goto reuse; - m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); + m = m_getjcl(M_DONTWAIT, MT_DATA, + M_PKTHDR, adapter->rx_mbuf_sz); /* ** If we have a temporary resource shortage ** that causes a failure, just abort refresh @@ -3732,10 +3774,7 @@ em_refresh_mbufs(struct rx_ring *rxr, in */ if (m == NULL) goto update; - m->m_len = m->m_pkthdr.len = MCLBYTES; - - if (adapter->max_frame_size <= (MCLBYTES - ETHER_ALIGN)) - m_adj(m, ETHER_ALIGN); + m->m_len = m->m_pkthdr.len = adapter->rx_mbuf_sz; /* Use bus_dma machinery to setup the memory mapping */ error = bus_dmamap_load_mbuf_sg(rxr->rxtag, rxbuf->map, @@ -3801,9 +3840,9 @@ em_allocate_receive_buffers(struct rx_ri BUS_SPACE_MAXADDR, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filter, filterarg */ - MCLBYTES, /* maxsize */ + MJUM9BYTES, /* maxsize */ 1, /* nsegments */ - MCLBYTES, /* maxsegsize */ + MJUM9BYTES, /* maxsegsize */ 0, /* flags */ NULL, /* lockfunc */ NULL, /* lockarg */ @@ -3871,12 +3910,13 @@ em_setup_receive_ring(struct rx_ring *rx for (int j = 0; j != adapter->num_rx_desc; ++j) { rxbuf = &rxr->rx_buffers[j]; - rxbuf->m_head = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); + rxbuf->m_head = m_getjcl(M_DONTWAIT, MT_DATA, + M_PKTHDR, adapter->rx_mbuf_sz); if (rxbuf->m_head == NULL) return (ENOBUFS); - rxbuf->m_head->m_len = MCLBYTES; + rxbuf->m_head->m_len = adapter->rx_mbuf_sz; rxbuf->m_head->m_flags &= ~M_HASFCS; /* we strip it */ - rxbuf->m_head->m_pkthdr.len = MCLBYTES; + rxbuf->m_head->m_pkthdr.len = adapter->rx_mbuf_sz; /* Get the memory mapping */ error = bus_dmamap_load_mbuf_sg(rxr->rxtag, @@ -4082,6 +4122,23 @@ em_initialize_receive_unit(struct adapte E1000_WRITE_REG(hw, E1000_RDT(i), adapter->num_rx_desc - 1); } + /* Set early receive threshold on appropriate hw */ + if (((adapter->hw.mac.type == e1000_ich9lan) || + (adapter->hw.mac.type == e1000_pch2lan) || + (adapter->hw.mac.type == e1000_ich10lan)) && + (ifp->if_mtu > ETHERMTU)) { + u32 rxdctl = E1000_READ_REG(hw, E1000_RXDCTL(0)); + E1000_WRITE_REG(hw, E1000_RXDCTL(0), rxdctl | 3); + E1000_WRITE_REG(hw, E1000_ERT, 0x100 | (1 << 13)); + } + + if (adapter->hw.mac.type == e1000_pch2lan) { + if (ifp->if_mtu > ETHERMTU) + e1000_lv_jumbo_workaround_ich8lan(hw, TRUE); + else + e1000_lv_jumbo_workaround_ich8lan(hw, FALSE); + } + /* Setup the Receive Control Register */ rctl &= ~(3 << E1000_RCTL_MO_SHIFT); rctl |= E1000_RCTL_EN | E1000_RCTL_BAM | @@ -4094,7 +4151,14 @@ em_initialize_receive_unit(struct adapte /* Make sure VLAN Filters are off */ rctl &= ~E1000_RCTL_VFE; rctl &= ~E1000_RCTL_SBP; - rctl |= E1000_RCTL_SZ_2048; + + if (adapter->rx_mbuf_sz == MCLBYTES) + rctl |= E1000_RCTL_SZ_2048; + else if (adapter->rx_mbuf_sz == MJUMPAGESIZE) + rctl |= E1000_RCTL_SZ_4096 | E1000_RCTL_BSEX; + else if (adapter->rx_mbuf_sz > MJUMPAGESIZE) + rctl |= E1000_RCTL_SZ_8192 | E1000_RCTL_BSEX; + if (ifp->if_mtu > ETHERMTU) rctl |= E1000_RCTL_LPE; else @@ -4190,7 +4254,7 @@ em_rxeof(struct rx_ring *rxr, int count, rxr->fmp->m_flags |= M_VLANTAG; } #ifdef EM_MULTIQUEUE - rxr->fmp->m_pkthdr.flowid = curcpu; + rxr->fmp->m_pkthdr.flowid = rxr->msix; rxr->fmp->m_flags |= M_FLOWID; #endif #ifndef __NO_STRICT_ALIGNMENT @@ -4253,6 +4317,7 @@ skip: static __inline void em_rx_discard(struct rx_ring *rxr, int i) { + struct adapter *adapter = rxr->adapter; struct em_buffer *rbuf; struct mbuf *m; @@ -4267,7 +4332,7 @@ em_rx_discard(struct rx_ring *rxr, int i /* Reset state, keep loaded DMA map and reuse */ m = rbuf->m_head; - m->m_len = m->m_pkthdr.len = MCLBYTES; + m->m_len = m->m_pkthdr.len = adapter->rx_mbuf_sz; m->m_flags |= M_PKTHDR; m->m_data = m->m_ext.ext_buf; m->m_next = NULL; @@ -4378,12 +4443,15 @@ em_register_vlan(void *arg, struct ifnet if ((vtag == 0) || (vtag > 4095)) /* Invalid ID */ return; + EM_CORE_LOCK(adapter); index = (vtag >> 5) & 0x7F; bit = vtag & 0x1F; - em_shadow_vfta[index] |= (1 << bit); + adapter->shadow_vfta[index] |= (1 << bit); ++adapter->num_vlans; /* Re-init to load the changes */ - em_init(adapter); + if (ifp->if_capenable & IFCAP_VLAN_HWFILTER) + em_init_locked(adapter); + EM_CORE_UNLOCK(adapter); } /* @@ -4402,12 +4470,15 @@ em_unregister_vlan(void *arg, struct ifn if ((vtag == 0) || (vtag > 4095)) /* Invalid */ return; + EM_CORE_LOCK(adapter); index = (vtag >> 5) & 0x7F; bit = vtag & 0x1F; - em_shadow_vfta[index] &= ~(1 << bit); + adapter->shadow_vfta[index] &= ~(1 << bit); --adapter->num_vlans; /* Re-init to load the changes */ - em_init(adapter); + if (ifp->if_capenable & IFCAP_VLAN_HWFILTER) + em_init_locked(adapter); + EM_CORE_UNLOCK(adapter); } static void @@ -4430,9 +4501,9 @@ em_setup_vlan_hw_support(struct adapter ** we need to repopulate it now. */ for (int i = 0; i < EM_VFTA_SIZE; i++) - if (em_shadow_vfta[i] != 0) + if (adapter->shadow_vfta[i] != 0) E1000_WRITE_REG_ARRAY(hw, E1000_VFTA, - i, em_shadow_vfta[i]); + i, adapter->shadow_vfta[i]); reg = E1000_READ_REG(hw, E1000_CTRL); reg |= E1000_CTRL_VME; @@ -4443,10 +4514,6 @@ em_setup_vlan_hw_support(struct adapter reg &= ~E1000_RCTL_CFIEN; reg |= E1000_RCTL_VFE; E1000_WRITE_REG(hw, E1000_RCTL, reg); - - /* Update the frame size */ - E1000_WRITE_REG(&adapter->hw, E1000_RLPML, - adapter->max_frame_size + VLAN_TAG_SIZE); } static void @@ -4615,6 +4682,7 @@ em_get_wakeup(device_t dev) case e1000_ich9lan: case e1000_ich10lan: case e1000_pchlan: + case e1000_pch2lan: apme_mask = E1000_WUC_APME; adapter->has_amt = TRUE; eeprom_data = E1000_READ_REG(&adapter->hw, E1000_WUC); @@ -4706,7 +4774,8 @@ em_enable_wakeup(device_t dev) E1000_WRITE_REG(&adapter->hw, E1000_RCTL, rctl); } - if (adapter->hw.mac.type == e1000_pchlan) { + if ((adapter->hw.mac.type == e1000_pchlan) || + (adapter->hw.mac.type == e1000_pch2lan)) { if (em_enable_phy_wakeup(adapter)) return; } else { @@ -4739,16 +4808,7 @@ em_enable_phy_wakeup(struct adapter *ada u16 preg; /* copy MAC RARs to PHY RARs */ - for (int i = 0; i < adapter->hw.mac.rar_entry_count; i++) { - mreg = E1000_READ_REG(hw, E1000_RAL(i)); - e1000_write_phy_reg(hw, BM_RAR_L(i), (u16)(mreg & 0xFFFF)); - e1000_write_phy_reg(hw, BM_RAR_M(i), - (u16)((mreg >> 16) & 0xFFFF)); - mreg = E1000_READ_REG(hw, E1000_RAH(i)); - e1000_write_phy_reg(hw, BM_RAR_H(i), (u16)(mreg & 0xFFFF)); - e1000_write_phy_reg(hw, BM_RAR_CTRL(i), - (u16)((mreg >> 16) & 0xFFFF)); - } + e1000_copy_rx_addrs_to_phy_ich8lan(hw); /* copy MAC MTA to PHY MTA */ for (int i = 0; i < adapter->hw.mac.mta_reg_count; i++) { @@ -5359,4 +5419,70 @@ em_add_rx_process_limit(struct adapter * OID_AUTO, name, CTLTYPE_INT|CTLFLAG_RW, limit, value, description); } +static void +em_set_flow_cntrl(struct adapter *adapter, const char *name, + const char *description, int *limit, int value) +{ + *limit = value; + SYSCTL_ADD_INT(device_get_sysctl_ctx(adapter->dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(adapter->dev)), + OID_AUTO, name, CTLTYPE_INT|CTLFLAG_RW, limit, value, description); +} + +static int +em_sysctl_debug_info(SYSCTL_HANDLER_ARGS) +{ + struct adapter *adapter; + int error; + int result; + + result = -1; + error = sysctl_handle_int(oidp, &result, 0, req); + + if (error || !req->newptr) + return (error); + + if (result == 1) { + adapter = (struct adapter *)arg1; + em_print_debug_info(adapter); + } + + return (error); +} + +/* +** This routine is meant to be fluid, add whatever is +** needed for debugging a problem. -jfv +*/ +static void +em_print_debug_info(struct adapter *adapter) +{ + device_t dev = adapter->dev; + struct tx_ring *txr = adapter->tx_rings; + struct rx_ring *rxr = adapter->rx_rings; + if (adapter->ifp->if_drv_flags & IFF_DRV_RUNNING) + printf("Interface is RUNNING "); + else + printf("Interface is NOT RUNNING\n"); + if (adapter->ifp->if_drv_flags & IFF_DRV_OACTIVE) + printf("and ACTIVE\n"); + else + printf("and INACTIVE\n"); + + device_printf(dev, "hw tdh = %d, hw tdt = %d\n", + E1000_READ_REG(&adapter->hw, E1000_TDH(0)), + E1000_READ_REG(&adapter->hw, E1000_TDT(0))); + device_printf(dev, "hw rdh = %d, hw rdt = %d\n", + E1000_READ_REG(&adapter->hw, E1000_RDH(0)), + E1000_READ_REG(&adapter->hw, E1000_RDT(0))); + device_printf(dev, "Tx Queue Status = %d\n", txr->queue_status); + device_printf(dev, "TX descriptors avail = %d\n", + txr->tx_avail); + device_printf(dev, "Tx Descriptors avail failure = %ld\n", + txr->no_desc_avail); + device_printf(dev, "RX discarded packets = %ld\n", + rxr->rx_discarded); + device_printf(dev, "RX Next to Check = %d\n", rxr->next_to_check); + device_printf(dev, "RX Next to Refresh = %d\n", rxr->next_to_refresh); +} Modified: head/sys/dev/e1000/if_em.h ============================================================================== --- head/sys/dev/e1000/if_em.h Mon Oct 25 23:59:56 2010 (r214362) +++ head/sys/dev/e1000/if_em.h Tue Oct 26 00:07:58 2010 (r214363) @@ -188,6 +188,10 @@ #define EM_EEPROM_APME 0x400; #define EM_82544_APME 0x0004; +#define EM_QUEUE_IDLE 0 +#define EM_QUEUE_WORKING 1 +#define EM_QUEUE_HUNG 2 + /* * TDBA/RDBA should be aligned on 16 byte boundary. But TDLEN/RDLEN should be * multiple of 128 bytes. So we align TDBA/RDBA on 128 byte boundary. This will @@ -272,7 +276,7 @@ struct tx_ring { u32 me; u32 msix; u32 ims; - bool watchdog_check; + int queue_status; int watchdog_time; struct em_dma_alloc txdma; struct e1000_tx_desc *tx_base; @@ -391,6 +395,7 @@ struct adapter { struct rx_ring *rx_rings; int num_rx_desc; u32 rx_process_limit; + u32 rx_mbuf_sz; /* Management and WOL features */ u32 wol; @@ -400,11 +405,21 @@ struct adapter { /* Multicast array memory */ u8 *mta; - /* Info about the board itself */ - uint8_t link_active; - uint16_t link_speed; - uint16_t link_duplex; - uint32_t smartspeed; + /* + ** Shadow VFTA table, this is needed because + ** the real vlan filter table gets cleared during + ** a soft reset and the driver needs to be able + ** to repopulate it. + */ + u32 shadow_vfta[EM_VFTA_SIZE]; + + /* Info about the interface */ + u8 link_active; + u16 link_speed; + u16 link_duplex; + u32 smartspeed; + u32 fc_setting; + struct em_int_delay_info tx_int_delay; struct em_int_delay_info tx_abs_int_delay; struct em_int_delay_info rx_int_delay; From owner-svn-src-head@FreeBSD.ORG Tue Oct 26 00:42:35 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 16EB4106566B; Tue, 26 Oct 2010 00:42:35 +0000 (UTC) (envelope-from jfvogel@gmail.com) Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id D494E8FC13; Tue, 26 Oct 2010 00:42:33 +0000 (UTC) Received: by wwb24 with SMTP id 24so3970842wwb.31 for ; Mon, 25 Oct 2010 17:42:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=NEmA+qlVX1W3uISHR5faPGo7aAAHvI1k1y3J76TgcZ0=; b=pAbN1ojTt1GCRvqIqlaph5qWxHxUtPd2SRh0aG69FmnayldyxtaH1+NnGvRpNVf8hN VeV0ki0qmiJghV+MibWmtiyt+t0NXXWASoBLXM7/+ui5Sla1Lq2plv4zzRSYiSKCzAAP NEXOob6GGIXqeFoNLUn5yX2kFXR5Wl8wMY1ws= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=haMdlguC8fThYuVguWNIrPYWlOcp6hEzPUwtGhI9LkgaST27eXwCmKURDJToipm/oc nee1B9x3uqa4FUJ8pJEmzDUP0ZrY2SUsTk1jySYBteCLHltgQaljT27K/1kk1PGJqydd jEt4IUzQmVe07mk23CVd1wtE0o5uhUAeTZhFI= MIME-Version: 1.0 Received: by 10.227.163.7 with SMTP id y7mr7177005wbx.35.1288052245316; Mon, 25 Oct 2010 17:17:25 -0700 (PDT) Received: by 10.216.232.132 with HTTP; Mon, 25 Oct 2010 17:17:25 -0700 (PDT) In-Reply-To: <201010260007.o9Q07wpP081422@svn.freebsd.org> References: <201010260007.o9Q07wpP081422@svn.freebsd.org> Date: Mon, 25 Oct 2010 17:17:25 -0700 Message-ID: From: Jack Vogel To: Jack F Vogel Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r214363 - head/sys/dev/e1000 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Oct 2010 00:42:35 -0000 Always forget a couple items when I list changes and since some people are about such things let me add: - Also add 3 tier mbuf cluster size, based on the MTU, so as you increase beyond standard you go 4K, and once over that you get 9K clusters now. - Add a sysctl to change the flow control setting, this came up while debugging an issue with PCH hardware, and it had long been needed anyway. - I added back the debug print routine that got removed with gnn's cool stats code, I just still find it helpful when I'm tracking down problems so it seems worth keeping around to me :) OK, I think that covers it all. Please give this code some testing, its what I would like to see in 8.2 Cheers, Jack On Mon, Oct 25, 2010 at 5:07 PM, Jack F Vogel wrote: > Author: jfv > Date: Tue Oct 26 00:07:58 2010 > New Revision: 214363 > URL: http://svn.freebsd.org/changeset/base/214363 > > Log: > Bug fix delta to the em driver: > - Chasin down bogus watchdogs has led to an improved > design to this handling, the hang decision takes > place in the tx cleanup, with only a simple report > check in local_timer. Our tests have shown no false > watchdogs with this code. > - VLAN fixes from jhb, the shadow vfta should be per > interface, but as global it was not. Thanks John. > - Bug fixes in the support for new PCH2 hardware. > - Thanks for all the help and feedback on the driver, > changes to lem with be coming shortly as well. > > Modified: > head/sys/dev/e1000/if_em.c > head/sys/dev/e1000/if_em.h > > Modified: head/sys/dev/e1000/if_em.c > > ============================================================================== > --- head/sys/dev/e1000/if_em.c Mon Oct 25 23:59:56 2010 (r214362) > +++ head/sys/dev/e1000/if_em.c Tue Oct 26 00:07:58 2010 (r214363) > @@ -93,8 +93,7 @@ int em_display_debug_stats = 0; > /********************************************************************* > * Driver version: > *********************************************************************/ > -char em_driver_version[] = "7.0.8"; > - > +char em_driver_version[] = "7.1.6"; > > /********************************************************************* > * PCI Device ID Table > @@ -170,6 +169,8 @@ static em_vendor_info_t em_vendor_info_a > { 0x8086, E1000_DEV_ID_PCH_M_HV_LC, PCI_ANY_ID, PCI_ANY_ID, 0}, > { 0x8086, E1000_DEV_ID_PCH_D_HV_DM, PCI_ANY_ID, PCI_ANY_ID, 0}, > { 0x8086, E1000_DEV_ID_PCH_D_HV_DC, PCI_ANY_ID, PCI_ANY_ID, 0}, > + { 0x8086, E1000_DEV_ID_PCH2_LV_LM, PCI_ANY_ID, PCI_ANY_ID, 0}, > + { 0x8086, E1000_DEV_ID_PCH2_LV_V, PCI_ANY_ID, PCI_ANY_ID, 0}, > /* required last entry */ > { 0, 0, 0, 0, 0} > }; > @@ -256,6 +257,8 @@ static int em_dma_malloc(struct adapter > static void em_dma_free(struct adapter *, struct em_dma_alloc *); > static int em_sysctl_nvm_info(SYSCTL_HANDLER_ARGS); > static void em_print_nvm_info(struct adapter *); > +static int em_sysctl_debug_info(SYSCTL_HANDLER_ARGS); > +static void em_print_debug_info(struct adapter *); > static int em_is_valid_ether_addr(u8 *); > static int em_sysctl_int_delay(SYSCTL_HANDLER_ARGS); > static void em_add_int_delay_sysctl(struct adapter *, const char *, > @@ -282,6 +285,8 @@ static void em_handle_link(void *context > > static void em_add_rx_process_limit(struct adapter *, const char *, > const char *, int *, int); > +static void em_set_flow_cntrl(struct adapter *, const char *, > + const char *, int *, int); > > static __inline void em_rx_discard(struct rx_ring *, int); > > @@ -359,14 +364,6 @@ TUNABLE_INT("hw.em.rx_process_limit", &e > static int em_fc_setting = e1000_fc_full; > TUNABLE_INT("hw.em.fc_setting", &em_fc_setting); > > -/* > -** Shadow VFTA table, this is needed because > -** the real vlan filter table gets cleared during > -** a soft reset and the driver needs to be able > -** to repopulate it. > -*/ > -static u32 em_shadow_vfta[EM_VFTA_SIZE]; > - > /* Global used in WOL setup with multiport cards */ > static int global_quad_port_a = 0; > > @@ -449,6 +446,11 @@ em_attach(device_t dev) > OID_AUTO, "nvm", CTLTYPE_INT|CTLFLAG_RW, adapter, 0, > em_sysctl_nvm_info, "I", "NVM Information"); > > + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), > + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), > + OID_AUTO, "debug", CTLTYPE_INT|CTLFLAG_RW, adapter, 0, > + em_sysctl_debug_info, "I", "Debug Information"); > + > callout_init_mtx(&adapter->timer, &adapter->core_mtx, 0); > > /* Determine hardware and mac info */ > @@ -468,9 +470,10 @@ em_attach(device_t dev) > ** identified > */ > if ((adapter->hw.mac.type == e1000_ich8lan) || > - (adapter->hw.mac.type == e1000_pchlan) || > (adapter->hw.mac.type == e1000_ich9lan) || > - (adapter->hw.mac.type == e1000_ich10lan)) { > + (adapter->hw.mac.type == e1000_ich10lan) || > + (adapter->hw.mac.type == e1000_pchlan) || > + (adapter->hw.mac.type == e1000_pch2lan)) { > int rid = EM_BAR_TYPE_FLASH; > adapter->flash = bus_alloc_resource_any(dev, > SYS_RES_MEMORY, &rid, RF_ACTIVE); > @@ -514,11 +517,16 @@ em_attach(device_t dev) > E1000_REGISTER(&adapter->hw, E1000_TADV), > em_tx_abs_int_delay_dflt); > > - /* Sysctls for limiting the amount of work done in the taskqueue */ > + /* Sysctl for limiting the amount of work done in the taskqueue */ > em_add_rx_process_limit(adapter, "rx_processing_limit", > "max number of rx packets to process", > &adapter->rx_process_limit, > em_rx_process_limit); > > + /* Sysctl for setting the interface flow control */ > + em_set_flow_cntrl(adapter, "flow_control", > + "max number of rx packets to process", > + &adapter->fc_setting, em_fc_setting); > + > /* > * Validate number of transmit and receive descriptors. It > * must not exceed hardware maximum, and must be multiple > @@ -581,6 +589,11 @@ em_attach(device_t dev) > goto err_late; > } > > + /* Check SOL/IDER usage */ > + if (e1000_check_reset_block(&adapter->hw)) > + device_printf(dev, "PHY reset is blocked" > + " due to SOL/IDER session.\n"); > + > /* > ** Start from a known state, this is > ** important in reading the nvm and > @@ -644,11 +657,6 @@ em_attach(device_t dev) > adapter->hw.mac.get_link_status = 1; > em_update_link_status(adapter); > > - /* Indicate SOL/IDER usage */ > - if (e1000_check_reset_block(&adapter->hw)) > - device_printf(dev, > - "PHY reset is blocked due to SOL/IDER session.\n"); > - > /* Register for VLAN events */ > adapter->vlan_attach = EVENTHANDLER_REGISTER(vlan_config, > em_register_vlan, adapter, EVENTHANDLER_PRI_FIRST); > @@ -857,7 +865,7 @@ em_mq_start_locked(struct ifnet *ifp, st > > if (enq > 0) { > /* Set the watchdog */ > - txr->watchdog_check = TRUE; > + txr->queue_status = EM_QUEUE_WORKING; > txr->watchdog_time = ticks; > } > return (err); > @@ -870,14 +878,8 @@ static int > em_mq_start(struct ifnet *ifp, struct mbuf *m) > { > struct adapter *adapter = ifp->if_softc; > - struct tx_ring *txr; > - int i = 0, error = 0; > - > - /* Which queue to use */ > - if ((m->m_flags & M_FLOWID) != 0) > - i = m->m_pkthdr.flowid % adapter->num_queues; > - > - txr = &adapter->tx_rings[i]; > + struct tx_ring *txr = adapter->tx_rings; > + int error; > > if (EM_TX_TRYLOCK(txr)) { > error = em_mq_start_locked(ifp, txr, m); > @@ -953,7 +955,7 @@ em_start_locked(struct ifnet *ifp, struc > > /* Set timeout in case hardware has problems transmitting. > */ > txr->watchdog_time = ticks; > - txr->watchdog_check = TRUE; > + txr->queue_status = EM_QUEUE_WORKING; > } > > return; > @@ -1029,6 +1031,7 @@ em_ioctl(struct ifnet *ifp, u_long comma > case e1000_82572: > case e1000_ich9lan: > case e1000_ich10lan: > + case e1000_pch2lan: > case e1000_82574: > case e1000_80003es2lan: /* 9K Jumbo Frame size */ > max_frame_size = 9234; > @@ -1092,6 +1095,11 @@ em_ioctl(struct ifnet *ifp, u_long comma > } > break; > case SIOCSIFMEDIA: > + /* > + ** As the speed/duplex settings are being > + ** changed, we need to reset the PHY. > + */ > + adapter->hw.phy.reset_disable = FALSE; > /* Check SOL/IDER usage */ > EM_CORE_LOCK(adapter); > if (e1000_check_reset_block(&adapter->hw)) { > @@ -1101,6 +1109,7 @@ em_ioctl(struct ifnet *ifp, u_long comma > break; > } > EM_CORE_UNLOCK(adapter); > + /* falls thru */ > case SIOCGIFMEDIA: > IOCTL_DEBUGOUT("ioctl rcv'd: \ > SIOCxIFMEDIA (Get/Set Interface Media)"); > @@ -1215,13 +1224,16 @@ em_init_locked(struct adapter *adapter) > case e1000_82583: > pba = E1000_PBA_20K; /* 20K for Rx, 20K for Tx */ > break; > + case e1000_ich8lan: > + pba = E1000_PBA_8K; > + break; > case e1000_ich9lan: > case e1000_ich10lan: > case e1000_pchlan: > pba = E1000_PBA_10K; > break; > - case e1000_ich8lan: > - pba = E1000_PBA_8K; > + case e1000_pch2lan: > + pba = E1000_PBA_26K; > break; > default: > if (adapter->max_frame_size > 8192) > @@ -1259,19 +1271,6 @@ em_init_locked(struct adapter *adapter) > /* Setup VLAN support, basic and offload if available */ > E1000_WRITE_REG(&adapter->hw, E1000_VET, ETHERTYPE_VLAN); > > - /* Use real VLAN Filter support? */ > - if (ifp->if_capenable & IFCAP_VLAN_HWTAGGING) { > - if (ifp->if_capenable & IFCAP_VLAN_HWFILTER) > - /* Use real VLAN Filter support */ > - em_setup_vlan_hw_support(adapter); > - else { > - u32 ctrl; > - ctrl = E1000_READ_REG(&adapter->hw, E1000_CTRL); > - ctrl |= E1000_CTRL_VME; > - E1000_WRITE_REG(&adapter->hw, E1000_CTRL, ctrl); > - } > - } > - > /* Set hardware offload abilities */ > ifp->if_hwassist = 0; > if (ifp->if_capenable & IFCAP_TXCSUM) > @@ -1289,6 +1288,17 @@ em_init_locked(struct adapter *adapter) > /* Setup Multicast table */ > em_set_multi(adapter); > > + /* > + ** Figure out the desired mbuf > + ** pool for doing jumbos > + */ > + if (adapter->max_frame_size <= 2048) > + adapter->rx_mbuf_sz = MCLBYTES; > + else if (adapter->max_frame_size <= 4096) > + adapter->rx_mbuf_sz = MJUMPAGESIZE; > + else > + adapter->rx_mbuf_sz = MJUM9BYTES; > + > /* Prepare receive descriptors and buffers */ > if (em_setup_receive_structures(adapter)) { > device_printf(dev, "Could not setup receive structures\n"); > @@ -1297,6 +1307,19 @@ em_init_locked(struct adapter *adapter) > } > em_initialize_receive_unit(adapter); > > + /* Use real VLAN Filter support? */ > + if (ifp->if_capenable & IFCAP_VLAN_HWTAGGING) { > + if (ifp->if_capenable & IFCAP_VLAN_HWFILTER) > + /* Use real VLAN Filter support */ > + em_setup_vlan_hw_support(adapter); > + else { > + u32 ctrl; > + ctrl = E1000_READ_REG(&adapter->hw, E1000_CTRL); > + ctrl |= E1000_CTRL_VME; > + E1000_WRITE_REG(&adapter->hw, E1000_CTRL, ctrl); > + } > + } > + > /* Don't lose promiscuous settings */ > em_set_promisc(adapter); > > @@ -1707,11 +1730,6 @@ em_media_change(struct ifnet *ifp) > device_printf(adapter->dev, "Unsupported media type\n"); > } > > - /* As the speed/duplex settings my have changed we need to > - * reset the PHY. > - */ > - adapter->hw.phy.reset_disable = FALSE; > - > em_init_locked(adapter); > EM_CORE_UNLOCK(adapter); > > @@ -1929,15 +1947,12 @@ em_xmit(struct tx_ring *txr, struct mbuf > m_head = *m_headp; > > /* Do hardware assists */ > -#if __FreeBSD_version >= 700000 > if (m_head->m_pkthdr.csum_flags & CSUM_TSO) { > - em_tso_setup(txr, m_head, ip_off, ip, tp, &txd_upper, > - &txd_lower); > + em_tso_setup(txr, m_head, ip_off, ip, tp, > + &txd_upper, &txd_lower); > /* we need to make a final sentinel transmit desc */ > tso_desc = TRUE; > - } else > -#endif > - if (m_head->m_pkthdr.csum_flags & CSUM_OFFLOAD) > + } else if (m_head->m_pkthdr.csum_flags & CSUM_OFFLOAD) > em_transmit_checksum_setup(txr, m_head, > ip_off, ip, &txd_upper, &txd_lower); > > @@ -2164,34 +2179,30 @@ em_local_timer(void *arg) > em_update_stats_counters(adapter); > > /* Reset LAA into RAR[0] on 82571 */ > - if (e1000_get_laa_state_82571(&adapter->hw) == TRUE) > + if ((adapter->hw.mac.type == e1000_82571) && > + e1000_get_laa_state_82571(&adapter->hw)) > e1000_rar_set(&adapter->hw, adapter->hw.mac.addr, 0); > > /* > - ** If flow control has paused us since last checking > - ** it invalidates the watchdog timing, so dont run it. > + ** Don't do TX watchdog check if we've been paused > */ > if (adapter->pause_frames) { > adapter->pause_frames = 0; > goto out; > } > /* > - ** Check for time since any descriptor was cleaned > + ** Check on the state of the TX queue(s), this > + ** can be done without the lock because its RO > + ** and the HUNG state will be static if set. > */ > - for (int i = 0; i < adapter->num_queues; i++, txr++) { > - EM_TX_LOCK(txr); > - if (txr->watchdog_check == FALSE) { > - EM_TX_UNLOCK(txr); > - continue; > - } > - if ((ticks - txr->watchdog_time) > EM_WATCHDOG) > + for (int i = 0; i < adapter->num_queues; i++, txr++) > + if (txr->queue_status == EM_QUEUE_HUNG) > goto hung; > - EM_TX_UNLOCK(txr); > - } > out: > callout_reset(&adapter->timer, hz, em_local_timer, adapter); > return; > hung: > + /* Looks like we're hung */ > device_printf(adapter->dev, "Watchdog timeout -- resetting\n"); > device_printf(adapter->dev, > "Queue(%d) tdh = %d, hw tdt = %d\n", txr->me, > @@ -2272,7 +2283,7 @@ em_update_link_status(struct adapter *ad > adapter->link_active = 0; > /* Link down, disable watchdog */ > for (int i = 0; i < adapter->num_queues; i++, txr++) > - txr->watchdog_check = FALSE; > + txr->queue_status = EM_QUEUE_IDLE; > if_link_state_change(ifp, LINK_STATE_DOWN); > } > } > @@ -2306,7 +2317,7 @@ em_stop(void *arg) > /* Unarm watchdog timer. */ > for (int i = 0; i < adapter->num_queues; i++, txr++) { > EM_TX_LOCK(txr); > - txr->watchdog_check = FALSE; > + txr->queue_status = EM_QUEUE_IDLE; > EM_TX_UNLOCK(txr); > } > > @@ -2571,6 +2582,9 @@ em_free_pci_resources(struct adapter *ad > for (int i = 0; i < adapter->num_queues; i++) { > txr = &adapter->tx_rings[i]; > rxr = &adapter->rx_rings[i]; > + /* an early abort? */ > + if ((txr == NULL) || (rxr == NULL)) > + break; > rid = txr->msix +1; > if (txr->tag != NULL) { > bus_teardown_intr(dev, txr->res, txr->tag); > @@ -2689,6 +2703,7 @@ static void > em_reset(struct adapter *adapter) > { > device_t dev = adapter->dev; > + struct ifnet *ifp = adapter->ifp; > struct e1000_hw *hw = &adapter->hw; > u16 rx_buffer_size; > > @@ -2733,15 +2748,25 @@ em_reset(struct adapter *adapter) > hw->fc.send_xon = TRUE; > > /* Set Flow control, use the tunable location if sane */ > - if ((em_fc_setting >= 0) || (em_fc_setting < 4)) > - hw->fc.requested_mode = em_fc_setting; > - else > - hw->fc.requested_mode = e1000_fc_none; > + hw->fc.requested_mode = adapter->fc_setting; > > - /* Override - workaround for PCHLAN issue */ > + /* Workaround: no TX flow ctrl for PCH */ > if (hw->mac.type == e1000_pchlan) > hw->fc.requested_mode = e1000_fc_rx_pause; > > + /* Override - settings for PCH2LAN, ya its magic :) */ > + if (hw->mac.type == e1000_pch2lan) { > + hw->fc.high_water = 0x5C20; > + hw->fc.low_water = 0x5048; > + hw->fc.pause_time = 0x0650; > + hw->fc.refresh_time = 0x0400; > + /* Jumbos need adjusted PBA */ > + if (ifp->if_mtu > ETHERMTU) > + E1000_WRITE_REG(hw, E1000_PBA, 12); > + else > + E1000_WRITE_REG(hw, E1000_PBA, 26); > + } > + > /* Issue a global reset */ > e1000_reset_hw(hw); > E1000_WRITE_REG(hw, E1000_WUC, 0); > @@ -3173,6 +3198,7 @@ em_setup_transmit_ring(struct tx_ring *t > > /* Set number of descriptors available */ > txr->tx_avail = adapter->num_tx_desc; > + txr->queue_status = EM_QUEUE_IDLE; > > /* Clear checksum offload context. */ > txr->last_hw_offload = 0; > @@ -3233,7 +3259,7 @@ em_initialize_transmit_unit(struct adapt > E1000_READ_REG(&adapter->hw, E1000_TDBAL(i)), > E1000_READ_REG(&adapter->hw, E1000_TDLEN(i))); > > - txr->watchdog_check = FALSE; > + txr->queue_status = EM_QUEUE_IDLE; > } > > /* Set the default values for the Tx Inter Packet Gap timer */ > @@ -3610,16 +3636,20 @@ static bool > em_txeof(struct tx_ring *txr) > { > struct adapter *adapter = txr->adapter; > - int first, last, done; > + int first, last, done, processed; > struct em_buffer *tx_buffer; > struct e1000_tx_desc *tx_desc, *eop_desc; > struct ifnet *ifp = adapter->ifp; > > EM_TX_LOCK_ASSERT(txr); > > - if (txr->tx_avail == adapter->num_tx_desc) > + /* No work, make sure watchdog is off */ > + if (txr->tx_avail == adapter->num_tx_desc) { > + txr->queue_status = EM_QUEUE_IDLE; > return (FALSE); > + } > > + processed = 0; > first = txr->next_to_clean; > tx_desc = &txr->tx_base[first]; > tx_buffer = &txr->tx_buffers[first]; > @@ -3646,6 +3676,7 @@ em_txeof(struct tx_ring *txr) > tx_desc->lower.data = 0; > tx_desc->buffer_addr = 0; > ++txr->tx_avail; > + ++processed; > > if (tx_buffer->m_head) { > bus_dmamap_sync(txr->txtag, > @@ -3681,6 +3712,16 @@ em_txeof(struct tx_ring *txr) > > txr->next_to_clean = first; > > + /* > + ** Watchdog calculation, we know there's > + ** work outstanding or the first return > + ** would have been taken, so none processed > + ** for too long indicates a hang. local timer > + ** will examine this and do a reset if needed. > + */ > + if ((!processed) && ((ticks - txr->watchdog_time) > EM_WATCHDOG)) > + txr->queue_status = EM_QUEUE_HUNG; > + > /* > * If we have enough room, clear IFF_DRV_OACTIVE > * to tell the stack that it is OK to send packets. > @@ -3689,7 +3730,7 @@ em_txeof(struct tx_ring *txr) > ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; > /* Disable watchdog if all clean */ > if (txr->tx_avail == adapter->num_tx_desc) { > - txr->watchdog_check = FALSE; > + txr->queue_status = EM_QUEUE_IDLE; > return (FALSE); > } > } > @@ -3723,7 +3764,8 @@ em_refresh_mbufs(struct rx_ring *rxr, in > */ > if (rxbuf->m_head != NULL) > goto reuse; > - m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); > + m = m_getjcl(M_DONTWAIT, MT_DATA, > + M_PKTHDR, adapter->rx_mbuf_sz); > /* > ** If we have a temporary resource shortage > ** that causes a failure, just abort refresh > @@ -3732,10 +3774,7 @@ em_refresh_mbufs(struct rx_ring *rxr, in > */ > if (m == NULL) > goto update; > - m->m_len = m->m_pkthdr.len = MCLBYTES; > - > - if (adapter->max_frame_size <= (MCLBYTES - ETHER_ALIGN)) > - m_adj(m, ETHER_ALIGN); > + m->m_len = m->m_pkthdr.len = adapter->rx_mbuf_sz; > > /* Use bus_dma machinery to setup the memory mapping */ > error = bus_dmamap_load_mbuf_sg(rxr->rxtag, rxbuf->map, > @@ -3801,9 +3840,9 @@ em_allocate_receive_buffers(struct rx_ri > BUS_SPACE_MAXADDR, /* lowaddr */ > BUS_SPACE_MAXADDR, /* highaddr */ > NULL, NULL, /* filter, filterarg > */ > - MCLBYTES, /* maxsize */ > + MJUM9BYTES, /* maxsize */ > 1, /* nsegments */ > - MCLBYTES, /* maxsegsize */ > + MJUM9BYTES, /* maxsegsize */ > 0, /* flags */ > NULL, /* lockfunc */ > NULL, /* lockarg */ > @@ -3871,12 +3910,13 @@ em_setup_receive_ring(struct rx_ring *rx > for (int j = 0; j != adapter->num_rx_desc; ++j) { > > rxbuf = &rxr->rx_buffers[j]; > - rxbuf->m_head = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); > + rxbuf->m_head = m_getjcl(M_DONTWAIT, MT_DATA, > + M_PKTHDR, adapter->rx_mbuf_sz); > if (rxbuf->m_head == NULL) > return (ENOBUFS); > - rxbuf->m_head->m_len = MCLBYTES; > + rxbuf->m_head->m_len = adapter->rx_mbuf_sz; > rxbuf->m_head->m_flags &= ~M_HASFCS; /* we strip it */ > - rxbuf->m_head->m_pkthdr.len = MCLBYTES; > + rxbuf->m_head->m_pkthdr.len = adapter->rx_mbuf_sz; > > /* Get the memory mapping */ > error = bus_dmamap_load_mbuf_sg(rxr->rxtag, > @@ -4082,6 +4122,23 @@ em_initialize_receive_unit(struct adapte > E1000_WRITE_REG(hw, E1000_RDT(i), adapter->num_rx_desc - 1); > } > > + /* Set early receive threshold on appropriate hw */ > + if (((adapter->hw.mac.type == e1000_ich9lan) || > + (adapter->hw.mac.type == e1000_pch2lan) || > + (adapter->hw.mac.type == e1000_ich10lan)) && > + (ifp->if_mtu > ETHERMTU)) { > + u32 rxdctl = E1000_READ_REG(hw, E1000_RXDCTL(0)); > + E1000_WRITE_REG(hw, E1000_RXDCTL(0), rxdctl | 3); > + E1000_WRITE_REG(hw, E1000_ERT, 0x100 | (1 << 13)); > + } > + > + if (adapter->hw.mac.type == e1000_pch2lan) { > + if (ifp->if_mtu > ETHERMTU) > + e1000_lv_jumbo_workaround_ich8lan(hw, TRUE); > + else > + e1000_lv_jumbo_workaround_ich8lan(hw, FALSE); > + } > + > /* Setup the Receive Control Register */ > rctl &= ~(3 << E1000_RCTL_MO_SHIFT); > rctl |= E1000_RCTL_EN | E1000_RCTL_BAM | > @@ -4094,7 +4151,14 @@ em_initialize_receive_unit(struct adapte > /* Make sure VLAN Filters are off */ > rctl &= ~E1000_RCTL_VFE; > rctl &= ~E1000_RCTL_SBP; > - rctl |= E1000_RCTL_SZ_2048; > + > + if (adapter->rx_mbuf_sz == MCLBYTES) > + rctl |= E1000_RCTL_SZ_2048; > + else if (adapter->rx_mbuf_sz == MJUMPAGESIZE) > + rctl |= E1000_RCTL_SZ_4096 | E1000_RCTL_BSEX; > + else if (adapter->rx_mbuf_sz > MJUMPAGESIZE) > + rctl |= E1000_RCTL_SZ_8192 | E1000_RCTL_BSEX; > + > if (ifp->if_mtu > ETHERMTU) > rctl |= E1000_RCTL_LPE; > else > @@ -4190,7 +4254,7 @@ em_rxeof(struct rx_ring *rxr, int count, > rxr->fmp->m_flags |= M_VLANTAG; > } > #ifdef EM_MULTIQUEUE > - rxr->fmp->m_pkthdr.flowid = curcpu; > + rxr->fmp->m_pkthdr.flowid = rxr->msix; > rxr->fmp->m_flags |= M_FLOWID; > #endif > #ifndef __NO_STRICT_ALIGNMENT > @@ -4253,6 +4317,7 @@ skip: > static __inline void > em_rx_discard(struct rx_ring *rxr, int i) > { > + struct adapter *adapter = rxr->adapter; > struct em_buffer *rbuf; > struct mbuf *m; > > @@ -4267,7 +4332,7 @@ em_rx_discard(struct rx_ring *rxr, int i > > /* Reset state, keep loaded DMA map and reuse */ > m = rbuf->m_head; > - m->m_len = m->m_pkthdr.len = MCLBYTES; > + m->m_len = m->m_pkthdr.len = adapter->rx_mbuf_sz; > m->m_flags |= M_PKTHDR; > m->m_data = m->m_ext.ext_buf; > m->m_next = NULL; > @@ -4378,12 +4443,15 @@ em_register_vlan(void *arg, struct ifnet > if ((vtag == 0) || (vtag > 4095)) /* Invalid ID */ > return; > > + EM_CORE_LOCK(adapter); > index = (vtag >> 5) & 0x7F; > bit = vtag & 0x1F; > - em_shadow_vfta[index] |= (1 << bit); > + adapter->shadow_vfta[index] |= (1 << bit); > ++adapter->num_vlans; > /* Re-init to load the changes */ > - em_init(adapter); > + if (ifp->if_capenable & IFCAP_VLAN_HWFILTER) > + em_init_locked(adapter); > + EM_CORE_UNLOCK(adapter); > } > > /* > @@ -4402,12 +4470,15 @@ em_unregister_vlan(void *arg, struct ifn > if ((vtag == 0) || (vtag > 4095)) /* Invalid */ > return; > > + EM_CORE_LOCK(adapter); > index = (vtag >> 5) & 0x7F; > bit = vtag & 0x1F; > - em_shadow_vfta[index] &= ~(1 << bit); > + adapter->shadow_vfta[index] &= ~(1 << bit); > --adapter->num_vlans; > /* Re-init to load the changes */ > - em_init(adapter); > + if (ifp->if_capenable & IFCAP_VLAN_HWFILTER) > + em_init_locked(adapter); > + EM_CORE_UNLOCK(adapter); > } > > static void > @@ -4430,9 +4501,9 @@ em_setup_vlan_hw_support(struct adapter > ** we need to repopulate it now. > */ > for (int i = 0; i < EM_VFTA_SIZE; i++) > - if (em_shadow_vfta[i] != 0) > + if (adapter->shadow_vfta[i] != 0) > E1000_WRITE_REG_ARRAY(hw, E1000_VFTA, > - i, em_shadow_vfta[i]); > + i, adapter->shadow_vfta[i]); > > reg = E1000_READ_REG(hw, E1000_CTRL); > reg |= E1000_CTRL_VME; > @@ -4443,10 +4514,6 @@ em_setup_vlan_hw_support(struct adapter > reg &= ~E1000_RCTL_CFIEN; > reg |= E1000_RCTL_VFE; > E1000_WRITE_REG(hw, E1000_RCTL, reg); > - > - /* Update the frame size */ > - E1000_WRITE_REG(&adapter->hw, E1000_RLPML, > - adapter->max_frame_size + VLAN_TAG_SIZE); > } > > static void > @@ -4615,6 +4682,7 @@ em_get_wakeup(device_t dev) > case e1000_ich9lan: > case e1000_ich10lan: > case e1000_pchlan: > + case e1000_pch2lan: > apme_mask = E1000_WUC_APME; > adapter->has_amt = TRUE; > eeprom_data = E1000_READ_REG(&adapter->hw, E1000_WUC); > @@ -4706,7 +4774,8 @@ em_enable_wakeup(device_t dev) > E1000_WRITE_REG(&adapter->hw, E1000_RCTL, rctl); > } > > - if (adapter->hw.mac.type == e1000_pchlan) { > + if ((adapter->hw.mac.type == e1000_pchlan) || > + (adapter->hw.mac.type == e1000_pch2lan)) { > if (em_enable_phy_wakeup(adapter)) > return; > } else { > @@ -4739,16 +4808,7 @@ em_enable_phy_wakeup(struct adapter *ada > u16 preg; > > /* copy MAC RARs to PHY RARs */ > - for (int i = 0; i < adapter->hw.mac.rar_entry_count; i++) { > - mreg = E1000_READ_REG(hw, E1000_RAL(i)); > - e1000_write_phy_reg(hw, BM_RAR_L(i), (u16)(mreg & 0xFFFF)); > - e1000_write_phy_reg(hw, BM_RAR_M(i), > - (u16)((mreg >> 16) & 0xFFFF)); > - mreg = E1000_READ_REG(hw, E1000_RAH(i)); > - e1000_write_phy_reg(hw, BM_RAR_H(i), (u16)(mreg & 0xFFFF)); > - e1000_write_phy_reg(hw, BM_RAR_CTRL(i), > - (u16)((mreg >> 16) & 0xFFFF)); > - } > + e1000_copy_rx_addrs_to_phy_ich8lan(hw); > > /* copy MAC MTA to PHY MTA */ > for (int i = 0; i < adapter->hw.mac.mta_reg_count; i++) { > @@ -5359,4 +5419,70 @@ em_add_rx_process_limit(struct adapter * > OID_AUTO, name, CTLTYPE_INT|CTLFLAG_RW, limit, value, > description); > } > > +static void > +em_set_flow_cntrl(struct adapter *adapter, const char *name, > + const char *description, int *limit, int value) > +{ > + *limit = value; > + SYSCTL_ADD_INT(device_get_sysctl_ctx(adapter->dev), > + SYSCTL_CHILDREN(device_get_sysctl_tree(adapter->dev)), > + OID_AUTO, name, CTLTYPE_INT|CTLFLAG_RW, limit, value, > description); > +} > + > +static int > +em_sysctl_debug_info(SYSCTL_HANDLER_ARGS) > +{ > + struct adapter *adapter; > + int error; > + int result; > + > + result = -1; > + error = sysctl_handle_int(oidp, &result, 0, req); > + > + if (error || !req->newptr) > + return (error); > + > + if (result == 1) { > + adapter = (struct adapter *)arg1; > + em_print_debug_info(adapter); > + } > + > + return (error); > +} > + > +/* > +** This routine is meant to be fluid, add whatever is > +** needed for debugging a problem. -jfv > +*/ > +static void > +em_print_debug_info(struct adapter *adapter) > +{ > + device_t dev = adapter->dev; > + struct tx_ring *txr = adapter->tx_rings; > + struct rx_ring *rxr = adapter->rx_rings; > > + if (adapter->ifp->if_drv_flags & IFF_DRV_RUNNING) > + printf("Interface is RUNNING "); > + else > + printf("Interface is NOT RUNNING\n"); > + if (adapter->ifp->if_drv_flags & IFF_DRV_OACTIVE) > + printf("and ACTIVE\n"); > + else > + printf("and INACTIVE\n"); > + > + device_printf(dev, "hw tdh = %d, hw tdt = %d\n", > + E1000_READ_REG(&adapter->hw, E1000_TDH(0)), > + E1000_READ_REG(&adapter->hw, E1000_TDT(0))); > + device_printf(dev, "hw rdh = %d, hw rdt = %d\n", > + E1000_READ_REG(&adapter->hw, E1000_RDH(0)), > + E1000_READ_REG(&adapter->hw, E1000_RDT(0))); > + device_printf(dev, "Tx Queue Status = %d\n", txr->queue_status); > + device_printf(dev, "TX descriptors avail = %d\n", > + txr->tx_avail); > + device_printf(dev, "Tx Descriptors avail failure = %ld\n", > + txr->no_desc_avail); > + device_printf(dev, "RX discarded packets = %ld\n", > + rxr->rx_discarded); > + device_printf(dev, "RX Next to Check = %d\n", rxr->next_to_check); > + device_printf(dev, "RX Next to Refresh = %d\n", > rxr->next_to_refresh); > +} > > Modified: head/sys/dev/e1000/if_em.h > > ============================================================================== > --- head/sys/dev/e1000/if_em.h Mon Oct 25 23:59:56 2010 (r214362) > +++ head/sys/dev/e1000/if_em.h Tue Oct 26 00:07:58 2010 (r214363) > @@ -188,6 +188,10 @@ > #define EM_EEPROM_APME 0x400; > #define EM_82544_APME 0x0004; > > +#define EM_QUEUE_IDLE 0 > +#define EM_QUEUE_WORKING 1 > +#define EM_QUEUE_HUNG 2 > + > /* > * TDBA/RDBA should be aligned on 16 byte boundary. But TDLEN/RDLEN should > be > * multiple of 128 bytes. So we align TDBA/RDBA on 128 byte boundary. This > will > @@ -272,7 +276,7 @@ struct tx_ring { > u32 me; > u32 msix; > u32 ims; > - bool watchdog_check; > + int queue_status; > int watchdog_time; > struct em_dma_alloc txdma; > struct e1000_tx_desc *tx_base; > @@ -391,6 +395,7 @@ struct adapter { > struct rx_ring *rx_rings; > int num_rx_desc; > u32 rx_process_limit; > + u32 rx_mbuf_sz; > > /* Management and WOL features */ > u32 wol; > @@ -400,11 +405,21 @@ struct adapter { > /* Multicast array memory */ > u8 *mta; > > - /* Info about the board itself */ > - uint8_t link_active; > - uint16_t link_speed; > - uint16_t link_duplex; > - uint32_t smartspeed; > + /* > + ** Shadow VFTA table, this is needed because > + ** the real vlan filter table gets cleared during > + ** a soft reset and the driver needs to be able > + ** to repopulate it. > + */ > + u32 shadow_vfta[EM_VFTA_SIZE]; > + > + /* Info about the interface */ > + u8 link_active; > + u16 link_speed; > + u16 link_duplex; > + u32 smartspeed; > + u32 fc_setting; > + > struct em_int_delay_info tx_int_delay; > struct em_int_delay_info tx_abs_int_delay; > struct em_int_delay_info rx_int_delay; > From owner-svn-src-head@FreeBSD.ORG Tue Oct 26 04:57:44 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5A555106564A; Tue, 26 Oct 2010 04:57:44 +0000 (UTC) (envelope-from bu7cher@yandex.ru) Received: from forward5.mail.yandex.net (forward5.mail.yandex.net [77.88.46.21]) by mx1.freebsd.org (Postfix) with ESMTP id F3E368FC19; Tue, 26 Oct 2010 04:57:43 +0000 (UTC) Received: from smtp1.mail.yandex.net (smtp1.mail.yandex.net [77.88.46.101]) by forward5.mail.yandex.net (Yandex) with ESMTP id EA8A314D0462; Tue, 26 Oct 2010 08:57:41 +0400 (MSD) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1288069061; bh=qC6IIa/I3tNbOcFSnqANrfibWSIaKKHUChWSkWlv5bQ=; h=Message-ID:Date:From:MIME-Version:To:CC:Subject:References: In-Reply-To:Content-Type; b=WhFs/YSmiMp6lQO0eHsR/2qsZRtIUtEeZ/sw9aGvS4Finiq0aqZ2tWBSDAHdqJ2Q0 JuCy/F27djTkBOmCVx/GyptHIpopx4BUkTmv5m6SY1xGG4QVCD92DolhYxotcXmNB5 Gcxb3K1zxPX/hWXmtlhSW/6YXwN+NL5kfLYcauDQ= Received: from [127.0.0.1] (ns.kirov.so-ups.ru [77.72.136.145]) by smtp1.mail.yandex.net (Yandex) with ESMTPSA id 98C8D290065; Tue, 26 Oct 2010 08:57:41 +0400 (MSD) Message-ID: <4CC65FC1.3040605@yandex.ru> Date: Tue, 26 Oct 2010 08:57:37 +0400 From: "Andrey V. Elsukov" User-Agent: Mozilla Thunderbird 1.5 (FreeBSD/20051231) MIME-Version: 1.0 To: Pawel Jakub Dawidek References: <201010251623.o9PGNZ3V070926@svn.freebsd.org> <20101025202901.GB1811@garage.freebsd.pl> In-Reply-To: <20101025202901.GB1811@garage.freebsd.pl> X-Enigmail-Version: 1.1.1 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig6C726D0883614CA9242C20D1" X-Yandex-TimeMark: 1288069061 X-Yandex-Spam: 1 X-Yandex-Front: smtp1.mail.yandex.net Cc: svn-src-head@freebsd.org, "Andrey V. Elsukov" , svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r214352 - in head: sbin/geom/class/part sys/geom/part X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Oct 2010 04:57:44 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig6C726D0883614CA9242C20D1 Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: quoted-printable On 26.10.2010 0:29, Pawel Jakub Dawidek wrote: > Another corruption worth mentioning is when primary and secondary GPT > header/table differ. Yes. If both headers are correct then primary GPT will be used. --=20 WBR, Andrey V. Elsukov --------------enig6C726D0883614CA9242C20D1 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (MingW32) iQEcBAEBAgAGBQJMxl/EAAoJEAHF6gQQyKF6UEAIAKlxCEBTzBzyMKcYulf/m7cw 0i4akrw8uAfLhnw/tjDxKglToHIZnrusMeCkLgnNWmLbotvNHsNDBwvZQ8t0WDfB cu3S0w4GmplN4FhpJs/b2VFMoaukI2bZ+TTzBVzsHENzt+WZecv01VHyobawu+ne usioYRLEZw4RZ70w7rZ90nHjHk5PUrPjuRdfoWSPrjmoWdv4u3oUxn5rjqCDEhzN JXIQp9DLTeKpgErnnBAPkF6CCX0iwamMWKoWs8TTzdo3yNtbw1pjK1JJjtJbOOn2 9drvuhDQAumFl46IxP+4EUbk8/PDbpz3lXCgrd6ii4GMPVsZ347jqmErItDGO+I= =GeYh -----END PGP SIGNATURE----- --------------enig6C726D0883614CA9242C20D1-- From owner-svn-src-head@FreeBSD.ORG Tue Oct 26 10:57:12 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0C8D31065670; Tue, 26 Oct 2010 10:57:12 +0000 (UTC) (envelope-from swell.k@gmail.com) Received: from mail-gw0-f54.google.com (mail-gw0-f54.google.com [74.125.83.54]) by mx1.freebsd.org (Postfix) with ESMTP id 5B2E88FC1F; Tue, 26 Oct 2010 10:57:11 +0000 (UTC) Received: by gwaa18 with SMTP id a18so2399607gwa.13 for ; Tue, 26 Oct 2010 03:57:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:references :user-agent:date:message-id:mime-version:content-type; bh=yhlC4oTr8VrcGkxOTCyG5vHzWeUeHWJV4vezI9qLQkQ=; b=iB/GEaN3yqZRQIVj/SazYjNy9udk4kVbNz/bZBjEJW5tvtJwy0fFvma2YLv9Bmx1Tb a8+A3tMnvQkoSYHWPMlDeGLtkHxwXrCeKvZGZYTExZq2u7AMn2YRFkAWipwI2jpd/BgP TrTfjrBhYTuKY2nyL2Iel5RhFPprGMpWcAF88= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:references:user-agent:date:message-id :mime-version:content-type; b=ioMKRtF1GdU1iymu+0GX/dqCVnusvC+xf5DXlKmtBCh8cnpdwf3wtvg47IHTkudVPD c+bDx5gVaTDs1+dM+LMnFKBkncQbFeMFm61hhCCFV0Feztwt9zTBYMlD/TLgvn44GF8/ ylrE0SrXPCK30OzC3sK6CruMat/mwHvX47H9M= Received: by 10.151.10.1 with SMTP id n1mr15107766ybi.380.1288090630557; Tue, 26 Oct 2010 03:57:10 -0700 (PDT) Received: from localhost (tor-exit-proxy3-readme.formlessnetworking.net [208.53.142.39]) by mx.google.com with ESMTPS id z4sm4797577yhz.1.2010.10.26.03.57.07 (version=SSLv3 cipher=RC4-MD5); Tue, 26 Oct 2010 03:57:09 -0700 (PDT) From: Anonymous To: David Xu References: <201010250916.o9P9G4YO058177__37512.3073034503$1287998186$gmane$org@svn.freebsd.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (berkeley-unix) Date: Tue, 26 Oct 2010 14:56:50 +0400 Message-ID: <86lj5lusr1.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r214334 - head/lib/libthr/thread X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Oct 2010 10:57:12 -0000 David Xu writes: > Author: davidxu > Date: Mon Oct 25 09:16:04 2010 > New Revision: 214334 > URL: http://svn.freebsd.org/changeset/base/214334 > > Log: > Get cpuset in pthread_attr_get_np() and free it in pthread_attr_destroy(). > > MFC after: 7 days After this change firefox 4.0b8pre built from mozilla trunk crashes with SIGBUS while starting, on /head@r214363M amd64. It may be related to $ js Assertion failure: stackBase, at jsnativestack.cpp:217 and the calls preceding it pthread_attr_get_np(thread, &sattr); pthread_attr_getstack(&sattr, &stackBase, &stackSize); java/openjdk6 doesn't start, too $ java # # A fatal error has been detected by the Java Runtime Environment: # # Internal Error (os_bsd_x86.cpp:876), pid=10495, tid=34389128704 # Error: pthread_attr_get_np failed with err = 34 From owner-svn-src-head@FreeBSD.ORG Tue Oct 26 12:46:27 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 59F0E1065697; Tue, 26 Oct 2010 12:46:27 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 46F848FC21; Tue, 26 Oct 2010 12:46:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9QCkRiB025361; Tue, 26 Oct 2010 12:46:27 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9QCkRSg025356; Tue, 26 Oct 2010 12:46:27 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201010261246.o9QCkRSg025356@svn.freebsd.org> From: Attilio Rao Date: Tue, 26 Oct 2010 12:46:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214373 - in head/sys: amd64/amd64 conf i386/i386 x86/x86 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Oct 2010 12:46:27 -0000 Author: attilio Date: Tue Oct 26 12:46:26 2010 New Revision: 214373 URL: http://svn.freebsd.org/changeset/base/214373 Log: Merge dump_machdep.c i386/amd64 under the x86 subtree. Sponsored by: Sandvine Incorporated Tested by: gianni Added: head/sys/x86/x86/dump_machdep.c - copied, changed from r214370, head/sys/amd64/amd64/dump_machdep.c Deleted: head/sys/amd64/amd64/dump_machdep.c head/sys/i386/i386/dump_machdep.c Modified: head/sys/conf/files.amd64 head/sys/conf/files.i386 head/sys/conf/files.pc98 Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Tue Oct 26 10:23:49 2010 (r214372) +++ head/sys/conf/files.amd64 Tue Oct 26 12:46:26 2010 (r214373) @@ -104,7 +104,6 @@ amd64/amd64/cpu_switch.S standard amd64/amd64/db_disasm.c optional ddb amd64/amd64/db_interface.c optional ddb amd64/amd64/db_trace.c optional ddb -amd64/amd64/dump_machdep.c standard amd64/amd64/elf_machdep.c standard amd64/amd64/exception.S standard amd64/amd64/fpu.c standard @@ -321,6 +320,7 @@ x86/isa/isa_dma.c standard x86/isa/nmi.c standard x86/isa/orm.c optional isa x86/pci/qpi.c standard +x86/x86/dump_machdep.c standard x86/x86/io_apic.c standard x86/x86/local_apic.c standard x86/x86/mca.c standard Modified: head/sys/conf/files.i386 ============================================================================== --- head/sys/conf/files.i386 Tue Oct 26 10:23:49 2010 (r214372) +++ head/sys/conf/files.i386 Tue Oct 26 12:46:26 2010 (r214373) @@ -263,7 +263,6 @@ i386/i386/busdma_machdep.c standard i386/i386/db_disasm.c optional ddb i386/i386/db_interface.c optional ddb i386/i386/db_trace.c optional ddb -i386/i386/dump_machdep.c standard i386/i386/elan-mmcr.c optional cpu_elan | cpu_soekris i386/i386/elf_machdep.c standard i386/i386/exception.s optional native @@ -395,6 +394,7 @@ x86/isa/isa_dma.c optional isa x86/isa/nmi.c standard x86/isa/orm.c optional isa x86/pci/qpi.c standard +x86/x86/dump_machdep.c standard x86/x86/io_apic.c optional apic x86/x86/local_apic.c optional apic x86/x86/mca.c standard Modified: head/sys/conf/files.pc98 ============================================================================== --- head/sys/conf/files.pc98 Tue Oct 26 10:23:49 2010 (r214372) +++ head/sys/conf/files.pc98 Tue Oct 26 12:46:26 2010 (r214373) @@ -138,7 +138,6 @@ i386/i386/busdma_machdep.c standard i386/i386/db_disasm.c optional ddb i386/i386/db_interface.c optional ddb i386/i386/db_trace.c optional ddb -i386/i386/dump_machdep.c standard i386/i386/elf_machdep.c standard i386/i386/exception.s standard i386/i386/gdb_machdep.c optional gdb @@ -255,6 +254,7 @@ pc98/pc98/pc98_machdep.c standard x86/isa/atpic.c optional atpic x86/isa/clock.c standard x86/isa/isa.c optional isa +x86/x86/dump_machdep.c standard x86/x86/io_apic.c optional apic x86/x86/local_apic.c optional apic x86/x86/mca.c standard Copied and modified: head/sys/x86/x86/dump_machdep.c (from r214370, head/sys/amd64/amd64/dump_machdep.c) ============================================================================== --- head/sys/amd64/amd64/dump_machdep.c Tue Oct 26 08:50:09 2010 (r214370, copy source) +++ head/sys/x86/x86/dump_machdep.c Tue Oct 26 12:46:26 2010 (r214373) @@ -36,9 +36,18 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include +#ifdef __amd64__ +#define KERNELDUMP_VERSION KERNELDUMP_AMD64_VERSION +#define EM_VALUE EM_X86_64 +#else +#define KERNELDUMP_VERSION KERNELDUMP_I386_VERSION +#define EM_VALUE EM_386 +#endif + CTASSERT(sizeof(struct kerneldumpheader) == 512); int do_minidump = 1; @@ -168,7 +177,8 @@ cb_dumpdata(struct md_pa *mdp, int seqnr if (maxdumppgs == 0) /* seatbelt */ maxdumppgs = 1; - printf(" chunk %d: %ldMB (%ld pages)", seqnr, PG2MB(pgs), pgs); + printf(" chunk %d: %"PRIu64"MB (%"PRIu64" pages)", seqnr, PG2MB(pgs), + pgs); while (pgs) { chunk = pgs; @@ -177,7 +187,7 @@ cb_dumpdata(struct md_pa *mdp, int seqnr sz = chunk << PAGE_SHIFT; counter += sz; if (counter >> 24) { - printf(" %ld", PG2MB(pgs)); + printf(" %"PRIu64, PG2MB(pgs)); counter &= (1<<24) - 1; } for (i = 0; i < chunk; i++) { @@ -279,7 +289,7 @@ dumpsys(struct dumperinfo *di) ehdr.e_ident[EI_VERSION] = EV_CURRENT; ehdr.e_ident[EI_OSABI] = ELFOSABI_STANDALONE; /* XXX big picture? */ ehdr.e_type = ET_CORE; - ehdr.e_machine = EM_X86_64; + ehdr.e_machine = EM_VALUE; ehdr.e_phoff = sizeof(ehdr); ehdr.e_flags = 0; ehdr.e_ehsize = sizeof(ehdr); @@ -304,7 +314,8 @@ dumpsys(struct dumperinfo *di) dumplo = di->mediaoffset + di->mediasize - dumpsize; dumplo -= sizeof(kdh) * 2; - mkdumpheader(&kdh, KERNELDUMPMAGIC, KERNELDUMP_AMD64_VERSION, dumpsize, di->blocksize); + mkdumpheader(&kdh, KERNELDUMPMAGIC, KERNELDUMP_VERSION, dumpsize, + di->blocksize); printf("Dumping %llu MB (%d chunks)\n", (long long)dumpsize >> 20, ehdr.e_phnum); From owner-svn-src-head@FreeBSD.ORG Tue Oct 26 13:07:01 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9848F106566B; Tue, 26 Oct 2010 13:07:01 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 86DBB8FC08; Tue, 26 Oct 2010 13:07:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9QD7104026667; Tue, 26 Oct 2010 13:07:01 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9QD71A9026665; Tue, 26 Oct 2010 13:07:01 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201010261307.o9QD71A9026665@svn.freebsd.org> From: Glen Barber Date: Tue, 26 Oct 2010 13:07:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214374 - head/share/man/man7 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Oct 2010 13:07:01 -0000 Author: gjb (doc committer) Date: Tue Oct 26 13:07:01 2010 New Revision: 214374 URL: http://svn.freebsd.org/changeset/base/214374 Log: Minor grammar fix. Submitted by: arundel (via email) Approved by: jkois (mentor) Patch by: arundel MFC after: 5 days Modified: head/share/man/man7/build.7 Modified: head/share/man/man7/build.7 ============================================================================== --- head/share/man/man7/build.7 Tue Oct 26 12:46:26 2010 (r214373) +++ head/share/man/man7/build.7 Tue Oct 26 13:07:01 2010 (r214374) @@ -419,7 +419,7 @@ Typically, one only needs to set .Pp Builds under directory .Pa /usr/src -are also influenced by defining one or more the following symbols, +are also influenced by defining one or more of the following symbols, using the .Fl D option of From owner-svn-src-head@FreeBSD.ORG Tue Oct 26 13:35:37 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from alona.my.domain (localhost [127.0.0.1]) by hub.freebsd.org (Postfix) with ESMTP id 5323B1065670; Tue, 26 Oct 2010 13:35:32 +0000 (UTC) (envelope-from davidxu@freebsd.org) Message-ID: <4CC6D915.3010900@freebsd.org> Date: Tue, 26 Oct 2010 21:35:17 +0800 From: David Xu User-Agent: Thunderbird 2.0.0.21 (X11/20090522) MIME-Version: 1.0 To: Anonymous References: <201010250916.o9P9G4YO058177__37512.3073034503$1287998186$gmane$org@svn.freebsd.org> <86lj5lusr1.fsf@gmail.com> In-Reply-To: <86lj5lusr1.fsf@gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, src-committers@freebsd.org, Jeff Roberson Subject: Re: svn commit: r214334 - head/lib/libthr/thread X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Oct 2010 13:35:37 -0000 Anonymous wrote: > David Xu writes: > > >> Author: davidxu >> Date: Mon Oct 25 09:16:04 2010 >> New Revision: 214334 >> URL: http://svn.freebsd.org/changeset/base/214334 >> >> Log: >> Get cpuset in pthread_attr_get_np() and free it in pthread_attr_destroy(). >> >> MFC after: 7 days >> > > After this change firefox 4.0b8pre built from mozilla trunk crashes with > SIGBUS while starting, on /head@r214363M amd64. It may be related to > > $ js > Assertion failure: stackBase, at jsnativestack.cpp:217 > > and the calls preceding it > > pthread_attr_get_np(thread, &sattr); > pthread_attr_getstack(&sattr, &stackBase, &stackSize); > > java/openjdk6 doesn't start, too > > $ java > # > # A fatal error has been detected by the Java Runtime Environment: > # > # Internal Error (os_bsd_x86.cpp:876), pid=10495, tid=34389128704 > # Error: pthread_attr_get_np failed with err = 34 > > It is difficult to know which cpuset size kernel is using, for example, cpuset_getaffinity has following code: if (uap->cpusetsize < sizeof(cpuset_t) || uap->cpusetsize > CPU_MAXSIZE / NBBY) return (ERANGE); So if I provide a buffer, who can tell me what size I should use? too large or too small ? where can I get the size ? Regards, David Xu From owner-svn-src-head@FreeBSD.ORG Tue Oct 26 15:48:03 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A03D11065670; Tue, 26 Oct 2010 15:48:03 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8E6968FC13; Tue, 26 Oct 2010 15:48:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9QFm3Ok050364; Tue, 26 Oct 2010 15:48:03 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9QFm3bW050360; Tue, 26 Oct 2010 15:48:03 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201010261548.o9QFm3bW050360@svn.freebsd.org> From: Martin Matuska Date: Tue, 26 Oct 2010 15:48:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214378 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Oct 2010 15:48:03 -0000 Author: mm Date: Tue Oct 26 15:48:03 2010 New Revision: 214378 URL: http://svn.freebsd.org/changeset/base/214378 Log: Bugfix merge from OpenSolaris: OpenSolaris onnv-revision: 10209:91f47f0e7728 6830541 zfs_get_data_trips on a verify 6696242 multiple zfs_fillpage() zfs: accessing past end of object panics 6785914 zfs fails to drop dn_struct_rwlock in recovery code path Approved by: delphij (mentor) Obtained from: OpenSolaris (Bug ID 6830541, 6696242, 6785914) MFC after: 2 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Tue Oct 26 14:59:35 2010 (r214377) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Tue Oct 26 15:48:03 2010 (r214378) @@ -192,7 +192,7 @@ dmu_buf_hold_array_by_dnode(dnode_t *dn, ASSERT(length <= DMU_MAX_ACCESS); - dbuf_flags = DB_RF_CANFAIL | DB_RF_NEVERWAIT; + dbuf_flags = DB_RF_CANFAIL | DB_RF_NEVERWAIT | DB_RF_HAVESTRUCT; if (flags & DMU_READ_NO_PREFETCH || length > zfetch_array_rd_sz) dbuf_flags |= DB_RF_NOPREFETCH; @@ -209,6 +209,7 @@ dmu_buf_hold_array_by_dnode(dnode_t *dn, os_dsl_dataset->ds_object, (longlong_t)dn->dn_object, dn->dn_datablksz, (longlong_t)offset, (longlong_t)length); + rw_exit(&dn->dn_struct_rwlock); return (EIO); } nblks = 1; @@ -231,9 +232,7 @@ dmu_buf_hold_array_by_dnode(dnode_t *dn, } /* initiate async i/o */ if (read) { - rw_exit(&dn->dn_struct_rwlock); (void) dbuf_read(db, zio, dbuf_flags); - rw_enter(&dn->dn_struct_rwlock, RW_READER); } dbp[i] = &db->db; } @@ -540,7 +539,7 @@ dmu_read(objset_t *os, uint64_t object, { dnode_t *dn; dmu_buf_t **dbp; - int numbufs, i, err; + int numbufs, err; err = dnode_hold(os->os, object, FTAG, &dn); if (err) @@ -551,7 +550,7 @@ dmu_read(objset_t *os, uint64_t object, * block. If we ever do the tail block optimization, we will need to * handle that here as well. */ - if (dn->dn_datablkshift == 0) { + if (dn->dn_maxblkid == 0) { int newsz = offset > dn->dn_datablksz ? 0 : MIN(size, dn->dn_datablksz - offset); bzero((char *)buf + newsz, size - newsz); @@ -560,6 +559,7 @@ dmu_read(objset_t *os, uint64_t object, while (size > 0) { uint64_t mylen = MIN(size, DMU_MAX_ACCESS / 2); + int i; /* * NB: we could do this block-at-a-time, but it's nice Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Tue Oct 26 14:59:35 2010 (r214377) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Tue Oct 26 15:48:03 2010 (r214378) @@ -1031,6 +1031,10 @@ zfs_get_done(dmu_buf_t *db, void *vzgd) VFS_UNLOCK_GIANT(vfslocked); } +#ifdef DEBUG +static int zil_fault_io = 0; +#endif + /* * Get data to generate a TX_WRITE intent log record. */ @@ -1112,7 +1116,21 @@ zfs_get_data(void *arg, lr_write_t *lr, zgd->zgd_rl = rl; zgd->zgd_zilog = zfsvfs->z_log; zgd->zgd_bp = &lr->lr_blkptr; - VERIFY(0 == dmu_buf_hold(os, lr->lr_foid, boff, zgd, &db)); +#ifdef DEBUG + if (zil_fault_io) { + error = EIO; + zil_fault_io = 0; + } else { + error = dmu_buf_hold(os, lr->lr_foid, boff, zgd, &db); + } +#else + error = dmu_buf_hold(os, lr->lr_foid, boff, zgd, &db); +#endif + if (error != 0) { + kmem_free(zgd, sizeof (zgd_t)); + goto out; + } + ASSERT(boff == db->db_offset); lr->lr_blkoff = off - boff; error = dmu_sync(zio, db, &lr->lr_blkptr, Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Tue Oct 26 14:59:35 2010 (r214377) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Tue Oct 26 15:48:03 2010 (r214378) @@ -933,6 +933,10 @@ zil_lwb_commit(zilog_t *zilog, itx_t *it } error = zilog->zl_get_data( itx->itx_private, lr, dbuf, lwb->lwb_zio); + if (error == EIO) { + txg_wait_synced(zilog->zl_dmu_pool, txg); + return (lwb); + } if (error) { ASSERT(error == ENOENT || error == EEXIST || error == EALREADY); From owner-svn-src-head@FreeBSD.ORG Tue Oct 26 16:16:16 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2BCF91065670; Tue, 26 Oct 2010 16:16:16 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1B0D38FC0A; Tue, 26 Oct 2010 16:16:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9QGGGrw053091; Tue, 26 Oct 2010 16:16:16 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9QGGFgX053089; Tue, 26 Oct 2010 16:16:15 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201010261616.o9QGGFgX053089@svn.freebsd.org> From: Attilio Rao Date: Tue, 26 Oct 2010 16:16:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214380 - head/sys/x86/x86 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Oct 2010 16:16:16 -0000 Author: attilio Date: Tue Oct 26 16:16:15 2010 New Revision: 214380 URL: http://svn.freebsd.org/changeset/base/214380 Log: Remove usage of PRI* macro for style compliancy. Requested by: bde, jhb Sponsored by: Sandvine Incorporated Modified: head/sys/x86/x86/dump_machdep.c Modified: head/sys/x86/x86/dump_machdep.c ============================================================================== --- head/sys/x86/x86/dump_machdep.c Tue Oct 26 16:04:23 2010 (r214379) +++ head/sys/x86/x86/dump_machdep.c Tue Oct 26 16:16:15 2010 (r214380) @@ -36,7 +36,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include @@ -177,8 +176,8 @@ cb_dumpdata(struct md_pa *mdp, int seqnr if (maxdumppgs == 0) /* seatbelt */ maxdumppgs = 1; - printf(" chunk %d: %"PRIu64"MB (%"PRIu64" pages)", seqnr, PG2MB(pgs), - pgs); + printf(" chunk %d: %jdMB (%jd pages)", seqnr, (uintmax_t)PG2MB(pgs), + (uintmax_t)pgs); while (pgs) { chunk = pgs; @@ -187,7 +186,7 @@ cb_dumpdata(struct md_pa *mdp, int seqnr sz = chunk << PAGE_SHIFT; counter += sz; if (counter >> 24) { - printf(" %"PRIu64, PG2MB(pgs)); + printf(" %jd", (uintmax_t)PG2MB(pgs)); counter &= (1<<24) - 1; } for (i = 0; i < chunk; i++) { From owner-svn-src-head@FreeBSD.ORG Tue Oct 26 16:49:18 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A23C11065672; Tue, 26 Oct 2010 16:49:18 +0000 (UTC) (envelope-from brucec@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 916C38FC19; Tue, 26 Oct 2010 16:49:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9QGnI55055174; Tue, 26 Oct 2010 16:49:18 GMT (envelope-from brucec@svn.freebsd.org) Received: (from brucec@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9QGnInL055172; Tue, 26 Oct 2010 16:49:18 GMT (envelope-from brucec@svn.freebsd.org) Message-Id: <201010261649.o9QGnInL055172@svn.freebsd.org> From: Bruce Cran Date: Tue, 26 Oct 2010 16:49:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214381 - head/share/man/man4 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Oct 2010 16:49:18 -0000 Author: brucec Date: Tue Oct 26 16:49:18 2010 New Revision: 214381 URL: http://svn.freebsd.org/changeset/base/214381 Log: Add information about the values and default setting of the kern.cam.ada.spindown_shutdown sysctl. MFC after: 3 weeks Modified: head/share/man/man4/ada.4 Modified: head/share/man/man4/ada.4 ============================================================================== --- head/share/man/man4/ada.4 Tue Oct 26 16:16:15 2010 (r214380) +++ head/share/man/man4/ada.4 Tue Oct 26 16:49:18 2010 (r214381) @@ -121,6 +121,7 @@ seconds. .It kern.cam.ada.spindown_shutdown .Pp This variable determines whether to spin-down disks when shutting down. +Set to 1 to enable spin-down, 0 to disable. The default is currently enabled. .El .Sh FILES .Bl -tag -width ".Pa /dev/ada*" -compact From owner-svn-src-head@FreeBSD.ORG Tue Oct 26 17:12:15 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 072E71065672; Tue, 26 Oct 2010 17:12:15 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (cl-327.ede-01.nl.sixxs.net [IPv6:2001:7b8:2ff:146::2]) by mx1.freebsd.org (Postfix) with ESMTP id BBDDA8FC13; Tue, 26 Oct 2010 17:12:14 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7:0:1866:d44a:eec6:23e0] (unknown [IPv6:2001:7b8:3a7:0:1866:d44a:eec6:23e0]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id D7BAC5C5A; Tue, 26 Oct 2010 19:12:13 +0200 (CEST) Message-ID: <4CC70BF9.30004@FreeBSD.org> Date: Tue, 26 Oct 2010 19:12:25 +0200 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.2.12pre) Gecko/20101016 Lanikai/3.1.6pre MIME-Version: 1.0 To: Attilio Rao References: <201010261616.o9QGGFgX053089@svn.freebsd.org> In-Reply-To: <201010261616.o9QGGFgX053089@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r214380 - head/sys/x86/x86 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Oct 2010 17:12:15 -0000 On 2010-10-26 18:16, Attilio Rao wrote: > Remove usage of PRI* macro for style compliancy. ... > - printf(" chunk %d: %"PRIu64"MB (%"PRIu64" pages)", seqnr, PG2MB(pgs), > - pgs); > + printf(" chunk %d: %jdMB (%jd pages)", seqnr, (uintmax_t)PG2MB(pgs), > + (uintmax_t)pgs); If you cast to uintmax_t, you should use %ju instead. :) Otherwise, cast to intmax_t, e.g. if the PG2MB macro results in a signed value. From owner-svn-src-head@FreeBSD.ORG Tue Oct 26 17:58:07 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2212D106564A; Tue, 26 Oct 2010 17:58:07 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-qy0-f182.google.com (mail-qy0-f182.google.com [209.85.216.182]) by mx1.freebsd.org (Postfix) with ESMTP id 9011B8FC0A; Tue, 26 Oct 2010 17:58:06 +0000 (UTC) Received: by qyk33 with SMTP id 33so2797165qyk.13 for ; Tue, 26 Oct 2010 10:58:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=YcnGvv6YRJgAl+dODvviAsrPSLFXLJaW8Lpry+awcDA=; b=re51LzvTuUMFt4vRMd0inieDIc5fFuf6cMyxDh51KwA4ZmLwAR8x6UQJ7x2PgMXOzF 2YWaT7rmLks5vLK2KoO/r78YozrqthoqP9WsG4tNj7n3S3p25EHYOkbJe3mFiY5w/MEM n+hExtfvErnlMGmhsOlUIGur8BCyyHUcwpbFs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=L6FGQ9EZNWyD+jfJIdI5AcP83qq6HtIgctCcgmpEOtn+X310eL/Xn5P9Bcuw8hNFct fmfIccxAYICkW5XPWBtBh2d30ubI8awxlBb200t423XZdkGCctPW22f+uDFKw5Eh7wI8 maIqtlRc2MDQOHNg/NWSaIh25SsBv0u/+BiHE= MIME-Version: 1.0 Received: by 10.224.120.141 with SMTP id d13mr1665622qar.375.1288115885776; Tue, 26 Oct 2010 10:58:05 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.229.237.9 with HTTP; Tue, 26 Oct 2010 10:58:05 -0700 (PDT) In-Reply-To: <4CC70BF9.30004@FreeBSD.org> References: <201010261616.o9QGGFgX053089@svn.freebsd.org> <4CC70BF9.30004@FreeBSD.org> Date: Tue, 26 Oct 2010 19:58:05 +0200 X-Google-Sender-Auth: -HAdEaOHB50iOr2VJ2xQeGzXopc Message-ID: From: Attilio Rao To: Dimitry Andric Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r214380 - head/sys/x86/x86 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Oct 2010 17:58:07 -0000 2010/10/26 Dimitry Andric : > On 2010-10-26 18:16, Attilio Rao wrote: >> >> =C2=A0 Remove usage of PRI* macro for style compliancy. > > ... >> >> - =C2=A0 =C2=A0 =C2=A0 printf(" =C2=A0chunk %d: %"PRIu64"MB (%"PRIu64" p= ages)", seqnr, >> PG2MB(pgs), >> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 pgs); >> + =C2=A0 =C2=A0 =C2=A0 printf(" =C2=A0chunk %d: %jdMB (%jd pages)", seqn= r, >> (uintmax_t)PG2MB(pgs), >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (uintmax_t)pgs); > > If you cast to uintmax_t, you should use %ju instead. :) =C2=A0Otherwise, > cast to intmax_t, e.g. if the PG2MB macro results in a signed value. This bug was already existing with the old version, but yes, you and Bruce are obviously right. Thanks, Attilio --=20 Peace can only be achieved by understanding - A. Einstein From owner-svn-src-head@FreeBSD.ORG Tue Oct 26 18:01:28 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 63B241065673; Tue, 26 Oct 2010 18:01:28 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 52E288FC16; Tue, 26 Oct 2010 18:01:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9QI1S11059296; Tue, 26 Oct 2010 18:01:28 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9QI1SXZ059294; Tue, 26 Oct 2010 18:01:28 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201010261801.o9QI1SXZ059294@svn.freebsd.org> From: Attilio Rao Date: Tue, 26 Oct 2010 18:01:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214386 - head/sys/x86/x86 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Oct 2010 18:01:28 -0000 Author: attilio Date: Tue Oct 26 18:01:28 2010 New Revision: 214386 URL: http://svn.freebsd.org/changeset/base/214386 Log: Style fix. Reported by: bde, dim Modified: head/sys/x86/x86/dump_machdep.c Modified: head/sys/x86/x86/dump_machdep.c ============================================================================== --- head/sys/x86/x86/dump_machdep.c Tue Oct 26 17:49:17 2010 (r214385) +++ head/sys/x86/x86/dump_machdep.c Tue Oct 26 18:01:28 2010 (r214386) @@ -176,7 +176,7 @@ cb_dumpdata(struct md_pa *mdp, int seqnr if (maxdumppgs == 0) /* seatbelt */ maxdumppgs = 1; - printf(" chunk %d: %jdMB (%jd pages)", seqnr, (uintmax_t)PG2MB(pgs), + printf(" chunk %d: %juMB (%ju pages)", seqnr, (uintmax_t)PG2MB(pgs), (uintmax_t)pgs); while (pgs) { @@ -186,7 +186,7 @@ cb_dumpdata(struct md_pa *mdp, int seqnr sz = chunk << PAGE_SHIFT; counter += sz; if (counter >> 24) { - printf(" %jd", (uintmax_t)PG2MB(pgs)); + printf(" %ju", (uintmax_t)PG2MB(pgs)); counter &= (1<<24) - 1; } for (i = 0; i < chunk; i++) { From owner-svn-src-head@FreeBSD.ORG Tue Oct 26 18:32:51 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C4006106566B; Tue, 26 Oct 2010 18:32:51 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 986118FC17; Tue, 26 Oct 2010 18:32:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9QIWpNp060925; Tue, 26 Oct 2010 18:32:51 GMT (envelope-from bcr@svn.freebsd.org) Received: (from bcr@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9QIWpqX060923; Tue, 26 Oct 2010 18:32:51 GMT (envelope-from bcr@svn.freebsd.org) Message-Id: <201010261832.o9QIWpqX060923@svn.freebsd.org> From: Benedict Reuschling Date: Tue, 26 Oct 2010 18:32:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214387 - head/share/man/man5 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Oct 2010 18:32:51 -0000 Author: bcr (doc committer) Date: Tue Oct 26 18:32:51 2010 New Revision: 214387 URL: http://svn.freebsd.org/changeset/base/214387 Log: Add some missing documentation to the man page: - FILES section ref: ~/nsmb.conf - use of password in examples section - use of simple encryption for password in examples section PR: docs/132311 Submitted by: David Horn (dhorn2000 at gmail dot com) Patch corrected by: trhodes Approved by: trhodes MFC after: 5 days Modified: head/share/man/man5/nsmb.conf.5 Modified: head/share/man/man5/nsmb.conf.5 ============================================================================== --- head/share/man/man5/nsmb.conf.5 Tue Oct 26 18:01:28 2010 (r214386) +++ head/share/man/man5/nsmb.conf.5 Tue Oct 26 18:32:51 2010 (r214387) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 30, 2003 +.Dd October 19, 2010 .Dt NSMB.CONF 5 .Os .Sh NAME @@ -87,7 +87,7 @@ Possible keywords may include: .It Va nbns Ta "+ + - -" Ta "address of NetBIOS name server (WINS)" .It Va nbscope Ta "+ + - -" Ta "NetBIOS scope" .It Va nbtimeout Ta "+ + - -" Ta "timeout for NetBIOS name servers" -.It Va password Ta "- - + +" Ta "plain text password used to access the given share" +.It Va password Ta "- - + +" Ta "plain text or simple encrypted password used to access the given share" .It Va retry_count Ta "+ + - -" Ta "number of retries before connection is marked as broken" .It Va timeout Ta "+ + - -" Ta "SMB request timeout" .It Va workgroup Ta "+ + + +" Ta "workgroup name" @@ -96,6 +96,9 @@ Possible keywords may include: .Bl -tag -width ".Pa /etc/nsmb.conf" .It Pa /etc/nsmb.conf The default remote mount-point configuration file. +.Pa "~/nsmb.conf" +.It Pa ~/nsmb.conf +The user specific remote mount-point configuration file. .El .Sh EXAMPLES What follows is a sample configuration file which may, @@ -108,6 +111,9 @@ workgroup=SALES [FSERVER] charsets=koi8-r:cp866 addr=fserv.example.com +# User specific data for FSERVER +[FSERVER:MYUSER] +password=$$16144562c293a0314e6e1 .Ed .Pp All lines which begin with the @@ -124,6 +130,18 @@ required when Cyrillic characters are no The hostname value, .Dq Li fserv.example.com , is also assigned in this section. +.Dq Li FSERVER:USER , +defines the user settings and is useful for saving the password used +during a specific connection. +The password may be plaintext or obfuscated using simple encryption. +The simple encrypted password starts with the `$$1' symbols. +Warning: the encryption function is very weak and intended only to hide +clear text passwords. +If the use of simple encryption is desired, the following command may be +used on a password: +.Bd -literal -offset indent +smbutil crypt +.Ed .Sh COMPATIBILITY At the time of this writing, the .Tn IPX From owner-svn-src-head@FreeBSD.ORG Tue Oct 26 18:59:50 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D2C2E1065674; Tue, 26 Oct 2010 18:59:50 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C16BF8FC17; Tue, 26 Oct 2010 18:59:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9QIxoZW062549; Tue, 26 Oct 2010 18:59:50 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9QIxoIS062547; Tue, 26 Oct 2010 18:59:50 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201010261859.o9QIxoIS062547@svn.freebsd.org> From: Jung-uk Kim Date: Tue, 26 Oct 2010 18:59:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214390 - head/sys/dev/acpica X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Oct 2010 18:59:51 -0000 Author: jkim Date: Tue Oct 26 18:59:50 2010 New Revision: 214390 URL: http://svn.freebsd.org/changeset/base/214390 Log: Add two new loader tunables 'hw.acpi.install_interface' and 'hw.acpi.remove_interface'. hw.acpi.install_interface lets you install new interfaces. Conversely, hw.acpi.remove_interface lets you remove OS interfaces from the pre-defined list in ACPICA. For example, hw.acpi.install_interface="FreeBSD" lets _OSI("FreeBSD") method to return 0xffffffff (or success) and hw.acpi.remove_interface="Windows 2009" lets _OSI("Windows 2009") method to return zero (or failure). Both are comma-separated lists and leading white spaces are ignored. For example, the following examples are valid: hw.acpi.install_interface="Linux, FreeBSD" hw.acpi.remove_interface="Windows 2006, Windows 2006.1" Modified: head/sys/dev/acpica/acpi.c Modified: head/sys/dev/acpica/acpi.c ============================================================================== --- head/sys/dev/acpica/acpi.c Tue Oct 26 18:59:36 2010 (r214389) +++ head/sys/dev/acpica/acpi.c Tue Oct 26 18:59:50 2010 (r214390) @@ -86,6 +86,11 @@ static struct cdevsw acpi_cdevsw = { .d_name = "acpi", }; +struct acpi_interface { + ACPI_STRING *data; + int num; +}; + /* Global mutex for locking access to the ACPI subsystem. */ struct mtx acpi_mutex; @@ -163,6 +168,7 @@ static void acpi_enable_pcie(void); #endif static void acpi_hint_device_unit(device_t acdev, device_t child, const char *name, int *unitp); +static void acpi_reset_interfaces(device_t dev); static device_method_t acpi_methods[] = { /* Device interface */ @@ -232,6 +238,16 @@ SYSCTL_STRING(_debug_acpi, OID_AUTO, acp acpi_ca_version, 0, "Version of Intel ACPI-CA"); /* + * Allow overriding _OSI methods. + */ +static char acpi_install_interface[256]; +TUNABLE_STR("hw.acpi.install_interface", acpi_install_interface, + sizeof(acpi_install_interface)); +static char acpi_remove_interface[256]; +TUNABLE_STR("hw.acpi.remove_interface", acpi_remove_interface, + sizeof(acpi_remove_interface)); + +/* * Allow override of whether methods execute in parallel or not. * Enable this for serial behavior, which fixes "AE_ALREADY_EXISTS" * errors for AML that really can't handle parallel method execution. @@ -467,6 +483,9 @@ acpi_attach(device_t dev) goto out; } + /* Override OS interfaces if the user requested. */ + acpi_reset_interfaces(dev); + /* Load ACPI name space. */ status = AcpiLoadTables(); if (ACPI_FAILURE(status)) { @@ -3473,6 +3492,93 @@ acpi_debug_objects_sysctl(SYSCTL_HANDLER } static int +acpi_parse_interfaces(char *str, struct acpi_interface *iface) +{ + char *p; + size_t len; + int i, j; + + p = str; + while (isspace(*p) || *p == ',') + p++; + len = strlen(p); + if (len == 0) + return (0); + p = strdup(p, M_TEMP); + for (i = 0; i < len; i++) + if (p[i] == ',') + p[i] = '\0'; + i = j = 0; + while (i < len) + if (isspace(p[i]) || p[i] == '\0') + i++; + else { + i += strlen(p + i) + 1; + j++; + } + if (j == 0) { + free(p, M_TEMP); + return (0); + } + iface->data = malloc(sizeof(*iface->data) * j, M_TEMP, M_WAITOK); + iface->num = j; + i = j = 0; + while (i < len) + if (isspace(p[i]) || p[i] == '\0') + i++; + else { + iface->data[j] = p + i; + i += strlen(p + i) + 1; + j++; + } + + return (j); +} + +static void +acpi_free_interfaces(struct acpi_interface *iface) +{ + + free(iface->data[0], M_TEMP); + free(iface->data, M_TEMP); +} + +static void +acpi_reset_interfaces(device_t dev) +{ + struct acpi_interface list; + ACPI_STATUS status; + int i; + + if (acpi_parse_interfaces(acpi_install_interface, &list) > 0) { + for (i = 0; i < list.num; i++) { + status = AcpiInstallInterface(list.data[i]); + if (ACPI_FAILURE(status)) + device_printf(dev, + "failed to install _OSI(\"%s\"): %s\n", + list.data[i], AcpiFormatException(status)); + else if (bootverbose) + device_printf(dev, "installed _OSI(\"%s\")\n", + list.data[i]); + } + acpi_free_interfaces(&list); + } + if (acpi_parse_interfaces(acpi_remove_interface, &list) > 0) { + for (i = 0; i < list.num; i++) { + status = AcpiRemoveInterface(list.data[i]); + if (ACPI_FAILURE(status)) + device_printf(dev, + "failed to remove _OSI(\"%s\"): %s\n", + list.data[i], AcpiFormatException(status)); + else if (bootverbose) + device_printf(dev, "removed _OSI(\"%s\")\n", + list.data[i]); + } + acpi_free_interfaces(&list); + } +} + +static int acpi_pm_func(u_long cmd, void *arg, ...) { int state, acpi_state; From owner-svn-src-head@FreeBSD.ORG Tue Oct 26 19:11:00 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 158A2106566B; Tue, 26 Oct 2010 19:11:00 +0000 (UTC) (envelope-from brucec@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 04A7E8FC08; Tue, 26 Oct 2010 19:11:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9QJAx2o063538; Tue, 26 Oct 2010 19:10:59 GMT (envelope-from brucec@svn.freebsd.org) Received: (from brucec@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9QJAxnd063536; Tue, 26 Oct 2010 19:10:59 GMT (envelope-from brucec@svn.freebsd.org) Message-Id: <201010261910.o9QJAxnd063536@svn.freebsd.org> From: Bruce Cran Date: Tue, 26 Oct 2010 19:10:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214395 - head/share/man/man4 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Oct 2010 19:11:00 -0000 Author: brucec Date: Tue Oct 26 19:10:59 2010 New Revision: 214395 URL: http://svn.freebsd.org/changeset/base/214395 Log: Fix formatting. Reported by: yongari Modified: head/share/man/man4/ada.4 Modified: head/share/man/man4/ada.4 ============================================================================== --- head/share/man/man4/ada.4 Tue Oct 26 19:08:26 2010 (r214394) +++ head/share/man/man4/ada.4 Tue Oct 26 19:10:59 2010 (r214395) @@ -121,7 +121,8 @@ seconds. .It kern.cam.ada.spindown_shutdown .Pp This variable determines whether to spin-down disks when shutting down. -Set to 1 to enable spin-down, 0 to disable. The default is currently enabled. +Set to 1 to enable spin-down, 0 to disable. +The default is currently enabled. .El .Sh FILES .Bl -tag -width ".Pa /dev/ada*" -compact From owner-svn-src-head@FreeBSD.ORG Tue Oct 26 19:11:09 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EF00810656DC; Tue, 26 Oct 2010 19:11:09 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DC8EC8FC08; Tue, 26 Oct 2010 19:11:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9QJB9MC063609; Tue, 26 Oct 2010 19:11:09 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9QJB9f0063601; Tue, 26 Oct 2010 19:11:09 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201010261911.o9QJB9f0063601@svn.freebsd.org> From: John Baldwin Date: Tue, 26 Oct 2010 19:11:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214396 - head/usr.sbin/mfiutil X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Oct 2010 19:11:10 -0000 Author: jhb Date: Tue Oct 26 19:11:09 2010 New Revision: 214396 URL: http://svn.freebsd.org/changeset/base/214396 Log: - Save errno values before calling warn(3) so that errors are correctly reported. - Use powerof2() from rather than a copy and paste version. Submitted by: gcooper MFC after: 1 week Modified: head/usr.sbin/mfiutil/mfi_config.c head/usr.sbin/mfiutil/mfi_drive.c head/usr.sbin/mfiutil/mfi_evt.c head/usr.sbin/mfiutil/mfi_flash.c head/usr.sbin/mfiutil/mfi_patrol.c head/usr.sbin/mfiutil/mfi_show.c head/usr.sbin/mfiutil/mfi_volume.c Modified: head/usr.sbin/mfiutil/mfi_config.c ============================================================================== --- head/usr.sbin/mfiutil/mfi_config.c Tue Oct 26 19:10:59 2010 (r214395) +++ head/usr.sbin/mfiutil/mfi_config.c Tue Oct 26 19:11:09 2010 (r214396) @@ -29,12 +29,12 @@ * $FreeBSD$ */ -#include +#include #ifdef DEBUG #include #endif -#include #include +#include #include #ifdef DEBUG #include @@ -52,8 +52,6 @@ static void dump_config(int fd, struct m static int add_spare(int ac, char **av); static int remove_spare(int ac, char **av); -#define powerof2(x) ((((x)-1)&(x))==0) - static long dehumanize(const char *value) { @@ -151,13 +149,14 @@ static int clear_config(int ac, char **av) { struct mfi_ld_list list; - int ch, fd; + int ch, error, fd; u_int i; fd = mfi_open(mfi_unit); if (fd < 0) { + error = errno; warn("mfi_open"); - return (errno); + return (error); } if (!mfi_reconfig_supported()) { @@ -167,8 +166,9 @@ clear_config(int ac, char **av) } if (mfi_ld_get_list(fd, &list, NULL) < 0) { + error = errno; warn("Failed to get volume list"); - return (errno); + return (error); } for (i = 0; i < list.ld_count; i++) { @@ -189,8 +189,9 @@ clear_config(int ac, char **av) } if (mfi_dcmd_command(fd, MFI_DCMD_CFG_CLEAR, NULL, 0, NULL, 0, NULL) < 0) { + error = errno; warn("Failed to clear configuration"); - return (errno); + return (error); } printf("mfi%d: Configuration cleared\n", mfi_unit); @@ -335,8 +336,9 @@ parse_array(int fd, int raid_type, char return (error); if (mfi_pd_get_info(fd, device_id, pinfo, NULL) < 0) { + error = errno; warn("Failed to fetch drive info for drive %s", cp); - return (errno); + return (error); } if (pinfo->fw_state != MFI_PD_STATE_UNCONFIGURED_GOOD) { @@ -548,8 +550,9 @@ create_volume(int ac, char **av) fd = mfi_open(mfi_unit); if (fd < 0) { + error = errno; warn("mfi_open"); - return (errno); + return (error); } if (!mfi_reconfig_supported()) { @@ -660,8 +663,9 @@ create_volume(int ac, char **av) * array and volume identifiers. */ if (mfi_config_read(fd, &config) < 0) { + error = errno; warn("Failed to read configuration"); - return (errno); + return (error); } p = (char *)config->array; state.array_ref = 0xffff; @@ -745,14 +749,14 @@ create_volume(int ac, char **av) #ifdef DEBUG if (dump) dump_config(fd, config); - else #endif /* Send the new config to the controller. */ if (mfi_dcmd_command(fd, MFI_DCMD_CFG_ADD, config, config_size, NULL, 0, NULL) < 0) { + error = errno; warn("Failed to add volume"); - return (errno); + return (error); } /* Clean up. */ @@ -774,7 +778,7 @@ static int delete_volume(int ac, char **av) { struct mfi_ld_info info; - int fd; + int error, fd; uint8_t target_id, mbox[4]; /* @@ -799,8 +803,9 @@ delete_volume(int ac, char **av) fd = mfi_open(mfi_unit); if (fd < 0) { + error = errno; warn("mfi_open"); - return (errno); + return (error); } if (!mfi_reconfig_supported()) { @@ -810,13 +815,15 @@ delete_volume(int ac, char **av) } if (mfi_lookup_volume(fd, av[1], &target_id) < 0) { + error = errno; warn("Invalid volume %s", av[1]); - return (errno); + return (error); } if (mfi_ld_get_info(fd, target_id, &info, NULL) < 0) { + error = errno; warn("Failed to get info for volume %d", target_id); - return (errno); + return (error); } if (mfi_volume_busy(fd, target_id)) { @@ -828,8 +835,9 @@ delete_volume(int ac, char **av) mbox_store_ldref(mbox, &info.ld_config.properties.ld); if (mfi_dcmd_command(fd, MFI_DCMD_LD_DELETE, NULL, 0, mbox, sizeof(mbox), NULL) < 0) { + error = errno; warn("Failed to delete volume"); - return (errno); + return (error); } close(fd); @@ -858,8 +866,9 @@ add_spare(int ac, char **av) fd = mfi_open(mfi_unit); if (fd < 0) { + error = errno; warn("mfi_open"); - return (errno); + return (error); } error = mfi_lookup_drive(fd, av[1], &device_id); @@ -867,8 +876,9 @@ add_spare(int ac, char **av) return (error); if (mfi_pd_get_info(fd, device_id, &info, NULL) < 0) { + error = errno; warn("Failed to fetch drive info"); - return (errno); + return (error); } if (info.fw_state != MFI_PD_STATE_UNCONFIGURED_GOOD) { @@ -878,14 +888,16 @@ add_spare(int ac, char **av) if (ac > 2) { if (mfi_lookup_volume(fd, av[2], &target_id) < 0) { + error = errno; warn("Invalid volume %s", av[2]); - return (errno); + return (error); } } if (mfi_config_read(fd, &config) < 0) { + error = errno; warn("Failed to read configuration"); - return (errno); + return (error); } spare = malloc(sizeof(struct mfi_spare) + sizeof(uint16_t) * @@ -939,8 +951,9 @@ add_spare(int ac, char **av) if (mfi_dcmd_command(fd, MFI_DCMD_CFG_MAKE_SPARE, spare, sizeof(struct mfi_spare) + sizeof(uint16_t) * spare->array_count, NULL, 0, NULL) < 0) { + error = errno; warn("Failed to assign spare"); - return (errno); + return (error); } close(fd); @@ -964,8 +977,9 @@ remove_spare(int ac, char **av) fd = mfi_open(mfi_unit); if (fd < 0) { + error = errno; warn("mfi_open"); - return (errno); + return (error); } error = mfi_lookup_drive(fd, av[1], &device_id); @@ -974,8 +988,9 @@ remove_spare(int ac, char **av) /* Get the info for this drive. */ if (mfi_pd_get_info(fd, device_id, &info, NULL) < 0) { + error = errno; warn("Failed to fetch info for drive %u", device_id); - return (errno); + return (error); } if (info.fw_state != MFI_PD_STATE_HOT_SPARE) { @@ -986,8 +1001,9 @@ remove_spare(int ac, char **av) mbox_store_pdref(mbox, &info.ref); if (mfi_dcmd_command(fd, MFI_DCMD_CFG_REMOVE_SPARE, NULL, 0, mbox, sizeof(mbox), NULL) < 0) { + error = errno; warn("Failed to delete spare"); - return (errno); + return (error); } close(fd); @@ -1093,7 +1109,7 @@ static int debug_config(int ac, char **av) { struct mfi_config_data *config; - int fd; + int error, fd; if (ac != 1) { warnx("debug: extra arguments"); @@ -1102,14 +1118,16 @@ debug_config(int ac, char **av) fd = mfi_open(mfi_unit); if (fd < 0) { + error = errno; warn("mfi_open"); - return (errno); + return (error); } /* Get the config from the controller. */ if (mfi_config_read(fd, &config) < 0) { + error = errno; warn("Failed to get config"); - return (errno); + return (error); } /* Dump out the configuration. */ @@ -1127,7 +1145,7 @@ dump(int ac, char **av) struct mfi_config_data *config; char buf[64]; size_t len; - int fd; + int error, fd; if (ac != 1) { warnx("dump: extra arguments"); @@ -1136,23 +1154,26 @@ dump(int ac, char **av) fd = mfi_open(mfi_unit); if (fd < 0) { + error = errno; warn("mfi_open"); - return (errno); + return (error); } /* Get the stashed copy of the last dcmd from the driver. */ snprintf(buf, sizeof(buf), "dev.mfi.%d.debug_command", mfi_unit); if (sysctlbyname(buf, NULL, &len, NULL, 0) < 0) { + error = errno; warn("Failed to read debug command"); - if (errno == ENOENT) - errno = EOPNOTSUPP; - return (errno); + if (error == ENOENT) + error = EOPNOTSUPP; + return (error); } config = malloc(len); if (sysctlbyname(buf, config, &len, NULL, 0) < 0) { + error = errno; warn("Failed to read debug command"); - return (errno); + return (error); } dump_config(fd, config); free(config); Modified: head/usr.sbin/mfiutil/mfi_drive.c ============================================================================== --- head/usr.sbin/mfiutil/mfi_drive.c Tue Oct 26 19:10:59 2010 (r214395) +++ head/usr.sbin/mfiutil/mfi_drive.c Tue Oct 26 19:11:09 2010 (r214396) @@ -79,10 +79,11 @@ int mfi_lookup_drive(int fd, char *drive, uint16_t *device_id) { struct mfi_pd_list *list; - uint8_t encl, slot; long val; + int error; u_int i; char *cp; + uint8_t encl, slot; /* Look for a raw device id first. */ val = strtol(drive, &cp, 0); @@ -118,8 +119,9 @@ mfi_lookup_drive(int fd, char *drive, ui slot = val; if (mfi_pd_get_list(fd, &list, NULL) < 0) { + error = errno; warn("Failed to fetch drive list"); - return (errno); + return (error); } for (i = 0; i < list->count; i++) { @@ -302,8 +304,9 @@ drive_set_state(char *drive, uint16_t ne fd = mfi_open(mfi_unit); if (fd < 0) { + error = errno; warn("mfi_open"); - return (errno); + return (error); } error = mfi_lookup_drive(fd, drive, &device_id); @@ -312,8 +315,9 @@ drive_set_state(char *drive, uint16_t ne /* Get the info for this drive. */ if (mfi_pd_get_info(fd, device_id, &info, NULL) < 0) { + error = errno; warn("Failed to fetch info for drive %u", device_id); - return (errno); + return (error); } /* Try to change the state. */ @@ -327,9 +331,10 @@ drive_set_state(char *drive, uint16_t ne mbox[5] = new_state >> 8; if (mfi_dcmd_command(fd, MFI_DCMD_PD_STATE_SET, NULL, 0, mbox, 6, NULL) < 0) { + error = errno; warn("Failed to set drive %u to %s", device_id, mfi_pdstate(new_state)); - return (errno); + return (error); } close(fd); @@ -395,8 +400,9 @@ start_rebuild(int ac, char **av) fd = mfi_open(mfi_unit); if (fd < 0) { + error = errno; warn("mfi_open"); - return (errno); + return (error); } error = mfi_lookup_drive(fd, av[1], &device_id); @@ -405,13 +411,14 @@ start_rebuild(int ac, char **av) /* Get the info for this drive. */ if (mfi_pd_get_info(fd, device_id, &info, NULL) < 0) { + error = errno; warn("Failed to fetch info for drive %u", device_id); - return (errno); + return (error); } /* Check the state, must be REBUILD. */ if (info.fw_state != MFI_PD_STATE_REBUILD) { - warn("Drive %d is not in the REBUILD state", device_id); + warnx("Drive %d is not in the REBUILD state", device_id); return (EINVAL); } @@ -419,8 +426,9 @@ start_rebuild(int ac, char **av) mbox_store_pdref(&mbox[0], &info.ref); if (mfi_dcmd_command(fd, MFI_DCMD_PD_REBUILD_START, NULL, 0, mbox, 4, NULL) < 0) { + error = errno; warn("Failed to start rebuild on drive %u", device_id); - return (errno); + return (error); } close(fd); @@ -444,8 +452,9 @@ abort_rebuild(int ac, char **av) fd = mfi_open(mfi_unit); if (fd < 0) { + error = errno; warn("mfi_open"); - return (errno); + return (error); } error = mfi_lookup_drive(fd, av[1], &device_id); @@ -454,8 +463,9 @@ abort_rebuild(int ac, char **av) /* Get the info for this drive. */ if (mfi_pd_get_info(fd, device_id, &info, NULL) < 0) { + error = errno; warn("Failed to fetch info for drive %u", device_id); - return (errno); + return (error); } /* Check the state, must be REBUILD. */ @@ -468,8 +478,9 @@ abort_rebuild(int ac, char **av) mbox_store_pdref(&mbox[0], &info.ref); if (mfi_dcmd_command(fd, MFI_DCMD_PD_REBUILD_ABORT, NULL, 0, mbox, 4, NULL) < 0) { + error = errno; warn("Failed to abort rebuild on drive %u", device_id); - return (errno); + return (error); } close(fd); @@ -492,8 +503,9 @@ drive_progress(int ac, char **av) fd = mfi_open(mfi_unit); if (fd < 0) { + error = errno; warn("mfi_open"); - return (errno); + return (error); } error = mfi_lookup_drive(fd, av[1], &device_id); @@ -502,8 +514,9 @@ drive_progress(int ac, char **av) /* Get the info for this drive. */ if (mfi_pd_get_info(fd, device_id, &info, NULL) < 0) { + error = errno; warn("Failed to fetch info for drive %u", device_id); - return (errno); + return (error); } close(fd); @@ -551,8 +564,9 @@ drive_clear(int ac, char **av) fd = mfi_open(mfi_unit); if (fd < 0) { + error = errno; warn("mfi_open"); - return (errno); + return (error); } error = mfi_lookup_drive(fd, av[1], &device_id); @@ -561,16 +575,18 @@ drive_clear(int ac, char **av) /* Get the info for this drive. */ if (mfi_pd_get_info(fd, device_id, &info, NULL) < 0) { + error = errno; warn("Failed to fetch info for drive %u", device_id); - return (errno); + return (error); } mbox_store_pdref(&mbox[0], &info.ref); if (mfi_dcmd_command(fd, opcode, NULL, 0, mbox, 4, NULL) < 0) { + error = errno; warn("Failed to %s clear on drive %u", opcode == MFI_DCMD_PD_CLEAR_START ? "start" : "stop", device_id); - return (errno); + return (error); } close(fd); @@ -604,8 +620,9 @@ drive_locate(int ac, char **av) fd = mfi_open(mfi_unit); if (fd < 0) { + error = errno; warn("mfi_open"); - return (errno); + return (error); } error = mfi_lookup_drive(fd, av[1], &device_id); @@ -617,10 +634,11 @@ drive_locate(int ac, char **av) mbox[2] = 0; mbox[3] = 0; if (mfi_dcmd_command(fd, opcode, NULL, 0, mbox, 4, NULL) < 0) { + error = errno; warn("Failed to %s locate on drive %u", opcode == MFI_DCMD_PD_LOCATE_START ? "start" : "stop", device_id); - return (errno); + return (error); } close(fd); Modified: head/usr.sbin/mfiutil/mfi_evt.c ============================================================================== --- head/usr.sbin/mfiutil/mfi_evt.c Tue Oct 26 19:10:59 2010 (r214395) +++ head/usr.sbin/mfiutil/mfi_evt.c Tue Oct 26 19:11:09 2010 (r214396) @@ -32,7 +32,6 @@ #include #include #include -//#include #include #include #include @@ -67,7 +66,7 @@ static int show_logstate(int ac, char **av) { struct mfi_evt_log_state info; - int fd; + int error, fd; if (ac != 1) { warnx("show logstate: extra arguments"); @@ -76,13 +75,15 @@ show_logstate(int ac, char **av) fd = mfi_open(mfi_unit); if (fd < 0) { + error = errno; warn("mfi_open"); - return (errno); + return (error); } if (mfi_event_get_info(fd, &info, NULL) < 0) { + error = errno; warn("Failed to get event log info"); - return (errno); + return (error); } printf("mfi%d Event Log Sequence Numbers:\n", mfi_unit); @@ -536,18 +537,20 @@ show_events(int ac, char **av) ssize_t size; uint32_t seq, start, stop; uint8_t status; - int ch, fd, num_events, verbose; + int ch, error, fd, num_events, verbose; u_int i; fd = mfi_open(mfi_unit); if (fd < 0) { + error = errno; warn("mfi_open"); - return (errno); + return (error); } if (mfi_event_get_info(fd, &info, NULL) < 0) { + error = errno; warn("Failed to get event log info"); - return (errno); + return (error); } /* Default settings. */ @@ -565,14 +568,16 @@ show_events(int ac, char **av) switch (ch) { case 'c': if (parse_class(optarg, &filter.members.class) < 0) { + error = errno; warn("Error parsing event class"); - return (errno); + return (error); } break; case 'l': if (parse_locale(optarg, &filter.members.locale) < 0) { + error = errno; warn("Error parsing event locale"); - return (errno); + return (error); } break; case 'n': @@ -608,20 +613,23 @@ show_events(int ac, char **av) return (EINVAL); } if (ac > 0 && parse_seq(&info, av[0], &start) < 0) { + error = errno; warn("Error parsing starting sequence number"); - return (errno); + return (error); } if (ac > 1 && parse_seq(&info, av[1], &stop) < 0) { + error = errno; warn("Error parsing ending sequence number"); - return (errno); + return (error); } list = malloc(size); for (seq = start;;) { if (mfi_get_events(fd, list, num_events, filter, seq, &status) < 0) { + error = errno; warn("Failed to fetch events"); - return (errno); + return (error); } if (status == MFI_STAT_NOT_FOUND) { if (seq == start) Modified: head/usr.sbin/mfiutil/mfi_flash.c ============================================================================== --- head/usr.sbin/mfiutil/mfi_flash.c Tue Oct 26 19:10:59 2010 (r214395) +++ head/usr.sbin/mfiutil/mfi_flash.c Tue Oct 26 19:11:09 2010 (r214396) @@ -72,16 +72,18 @@ display_firmware(struct mfi_info_compone fw_time_width, comp->build_time); } -static void +static int display_pending_firmware(int fd) { struct mfi_ctrl_info info; struct mfi_info_component header; + int error; u_int i; if (mfi_ctrl_get_info(fd, &info, NULL) < 0) { + error = errno; warn("Failed to get controller info"); - return; + return (error); } printf("mfi%d Pending Firmware Images:\n", mfi_unit); @@ -97,6 +99,8 @@ display_pending_firmware(int fd) display_firmware(&header); for (i = 0; i < info.pending_image_component_count; i++) display_firmware(&info.pending_image_component[i]); + + return (0); } static void @@ -117,7 +121,7 @@ flash_adapter(int ac, char **av) size_t nread; char *buf; struct stat sb; - int fd, flash; + int error, fd, flash; uint8_t mbox[4], status; if (ac != 2) { @@ -127,13 +131,15 @@ flash_adapter(int ac, char **av) flash = open(av[1], O_RDONLY); if (flash < 0) { + error = errno; warn("flash: Failed to open %s", av[1]); - return (errno); + return (error); } if (fstat(flash, &sb) < 0) { + error = errno; warn("fstat(%s)", av[1]); - return (errno); + return (error); } if (sb.st_size % 1024 != 0 || sb.st_size > 0x7fffffff) { warnx("Invalid flash file size"); @@ -142,8 +148,9 @@ flash_adapter(int ac, char **av) fd = mfi_open(mfi_unit); if (fd < 0) { + error = errno; warn("mfi_open"); - return (errno); + return (error); } /* First, ask the firmware to allocate space for the flash file. */ @@ -190,10 +197,10 @@ flash_adapter(int ac, char **av) return (ENXIO); } printf("finished\n"); - display_pending_firmware(fd); + error = display_pending_firmware(fd); close(fd); - return (0); + return (error); } MFI_COMMAND(top, flash, flash_adapter); Modified: head/usr.sbin/mfiutil/mfi_patrol.c ============================================================================== --- head/usr.sbin/mfiutil/mfi_patrol.c Tue Oct 26 19:10:59 2010 (r214395) +++ head/usr.sbin/mfiutil/mfi_patrol.c Tue Oct 26 19:11:09 2010 (r214396) @@ -62,11 +62,13 @@ mfi_get_time(int fd, uint32_t *at) static int patrol_get_props(int fd, struct mfi_pr_properties *prop) { + int error; if (mfi_dcmd_command(fd, MFI_DCMD_PR_GET_PROPERTIES, prop, sizeof(*prop), NULL, 0, NULL) < 0) { + error = errno; warn("Failed to get patrol read properties"); - return (-1); + return (error); } return (0); } @@ -81,19 +83,21 @@ show_patrol(int ac, char **av) char label[16]; time_t now; uint32_t at; - int fd; + int error, fd; u_int i; fd = mfi_open(mfi_unit); if (fd < 0) { + error = errno; warn("mfi_open"); - return (errno); + return (error); } time(&now); mfi_get_time(fd, &at); - if (patrol_get_props(fd, &prop) < 0) - return (errno); + error = patrol_get_props(fd, &prop); + if (error) + return (error); printf("Operation Mode: "); switch (prop.op_mode) { case MFI_PR_OPMODE_AUTO: @@ -122,8 +126,9 @@ show_patrol(int ac, char **av) if (mfi_dcmd_command(fd, MFI_DCMD_PR_GET_STATUS, &status, sizeof(status), NULL, 0, NULL) < 0) { + error = errno; warn("Failed to get patrol read properties"); - return (errno); + return (error); } printf("Runs Completed: %u\n", status.num_iteration); printf("Current State: "); @@ -146,8 +151,9 @@ show_patrol(int ac, char **av) } if (status.state == MFI_PR_STATE_ACTIVE) { if (mfi_pd_get_list(fd, &list, NULL) < 0) { + error = errno; warn("Failed to get drive list"); - return (errno); + return (error); } for (i = 0; i < list->count; i++) { @@ -156,9 +162,10 @@ show_patrol(int ac, char **av) if (mfi_pd_get_info(fd, list->addr[i].device_id, &info, NULL) < 0) { + error = errno; warn("Failed to fetch info for drive %u", list->addr[i].device_id); - return (errno); + return (error); } if (info.prog_info.active & MFI_PD_PROGRESS_PATROL) { snprintf(label, sizeof(label), " Drive %u", @@ -178,18 +185,20 @@ MFI_COMMAND(show, patrol, show_patrol); static int start_patrol(int ac, char **av) { - int fd; + int error, fd; fd = mfi_open(mfi_unit); if (fd < 0) { + error = errno; warn("mfi_open"); - return (errno); + return (error); } if (mfi_dcmd_command(fd, MFI_DCMD_PR_START, NULL, 0, NULL, 0, NULL) < 0) { + error = errno; warn("Failed to start patrol read"); - return (errno); + return (error); } close(fd); @@ -201,18 +210,20 @@ MFI_COMMAND(start, patrol, start_patrol) static int stop_patrol(int ac, char **av) { - int fd; + int error, fd; fd = mfi_open(mfi_unit); if (fd < 0) { + error = errno; warn("mfi_open"); - return (errno); + return (error); } if (mfi_dcmd_command(fd, MFI_DCMD_PR_STOP, NULL, 0, NULL, 0, NULL) < 0) { + error = errno; warn("Failed to stop patrol read"); - return (errno); + return (error); } close(fd); @@ -227,10 +238,10 @@ patrol_config(int ac, char **av) struct mfi_pr_properties prop; long val; time_t now; + int error, fd; uint32_t at, next_exec, exec_freq; char *cp; uint8_t op_mode; - int fd; exec_freq = 0; /* GCC too stupid */ next_exec = 0; @@ -272,12 +283,14 @@ patrol_config(int ac, char **av) fd = mfi_open(mfi_unit); if (fd < 0) { + error = errno; warn("mfi_open"); - return (errno); + return (error); } - if (patrol_get_props(fd, &prop) < 0) - return (errno); + error = patrol_get_props(fd, &prop); + if (error) + return (error); prop.op_mode = op_mode; if (op_mode == MFI_PR_OPMODE_AUTO) { if (ac > 2) @@ -294,8 +307,9 @@ patrol_config(int ac, char **av) } if (mfi_dcmd_command(fd, MFI_DCMD_PR_SET_PROPERTIES, &prop, sizeof(prop), NULL, 0, NULL) < 0) { + error = errno; warn("Failed to set patrol read properties"); - return (errno); + return (error); } close(fd); Modified: head/usr.sbin/mfiutil/mfi_show.c ============================================================================== --- head/usr.sbin/mfiutil/mfi_show.c Tue Oct 26 19:10:59 2010 (r214395) +++ head/usr.sbin/mfiutil/mfi_show.c Tue Oct 26 19:11:09 2010 (r214396) @@ -54,7 +54,7 @@ show_adapter(int ac, char **av) { struct mfi_ctrl_info info; char stripe[5]; - int fd, comma; + int error, fd, comma; if (ac != 1) { warnx("show adapter: extra arguments"); @@ -63,13 +63,15 @@ show_adapter(int ac, char **av) fd = mfi_open(mfi_unit); if (fd < 0) { + error = errno; warn("mfi_open"); - return (errno); + return (error); } if (mfi_ctrl_get_info(fd, &info, NULL) < 0) { + error = errno; warn("Failed to get controller info"); - return (errno); + return (error); } printf("mfi%d Adapter:\n", mfi_unit); printf(" Product Name: %.80s\n", info.product_name); @@ -137,7 +139,7 @@ show_battery(int ac, char **av) struct mfi_bbu_capacity_info cap; struct mfi_bbu_design_info design; uint8_t status; - int fd; + int error, fd; if (ac != 1) { warnx("show battery: extra arguments"); @@ -146,8 +148,9 @@ show_battery(int ac, char **av) fd = mfi_open(mfi_unit); if (fd < 0) { + error = errno; warn("mfi_open"); - return (errno); + return (error); } if (mfi_dcmd_command(fd, MFI_DCMD_BBU_GET_CAPACITY_INFO, &cap, @@ -156,14 +159,16 @@ show_battery(int ac, char **av) printf("mfi%d: No battery present\n", mfi_unit); return (0); } + error = errno; warn("Failed to get capacity info"); - return (errno); + return (error); } if (mfi_dcmd_command(fd, MFI_DCMD_BBU_GET_DESIGN_INFO, &design, sizeof(design), NULL, 0, NULL) < 0) { + error = errno; warn("Failed to get design info"); - return (errno); + return (error); } printf("mfi%d: Battery State:\n", mfi_unit); @@ -242,7 +247,7 @@ show_config(int ac, char **av) struct mfi_pd_info pinfo; uint16_t device_id; char *p; - int fd, i, j; + int error, fd, i, j; if (ac != 1) { warnx("show config: extra arguments"); @@ -251,14 +256,16 @@ show_config(int ac, char **av) fd = mfi_open(mfi_unit); if (fd < 0) { + error = errno; warn("mfi_open"); - return (errno); + return (error); } /* Get the config from the controller. */ if (mfi_config_read(fd, &config) < 0) { + error = errno; warn("Failed to get config"); - return (errno); + return (error); } /* Dump out the configuration. */ @@ -337,8 +344,8 @@ show_volumes(int ac, char **av) { struct mfi_ld_list list; struct mfi_ld_info info; + int error, fd; u_int i, len, state_len; - int fd; if (ac != 1) { warnx("show volumes: extra arguments"); @@ -347,14 +354,16 @@ show_volumes(int ac, char **av) fd = mfi_open(mfi_unit); if (fd < 0) { + error = errno; warn("mfi_open"); - return (errno); + return (error); } *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Tue Oct 26 21:22:56 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2BF0C1065674; Tue, 26 Oct 2010 21:22:56 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1AEDA8FC13; Tue, 26 Oct 2010 21:22:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9QLMu6v071189; Tue, 26 Oct 2010 21:22:56 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9QLMt33071187; Tue, 26 Oct 2010 21:22:55 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201010262122.o9QLMt33071187@svn.freebsd.org> From: Jung-uk Kim Date: Tue, 26 Oct 2010 21:22:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214401 - head/share/man/man4 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Oct 2010 21:22:56 -0000 Author: jkim Date: Tue Oct 26 21:22:55 2010 New Revision: 214401 URL: http://svn.freebsd.org/changeset/base/214401 Log: Document newly added loader tunables "hw.acpi.install_interface" and "hw.acpi.remove_interface". Modified: head/share/man/man4/acpi.4 Modified: head/share/man/man4/acpi.4 ============================================================================== --- head/share/man/man4/acpi.4 Tue Oct 26 21:19:36 2010 (r214400) +++ head/share/man/man4/acpi.4 Tue Oct 26 21:22:55 2010 (r214401) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 12, 2010 +.Dd October 26, 2010 .Dt ACPI 4 .Os .Sh NAME @@ -224,6 +224,26 @@ Try increasing this number if you get th .Qq Li AE_NO_HARDWARE_RESPONSE . .It Va hw.acpi.host_mem_start Override the assumed memory starting address for PCI host bridges. +.It Va hw.acpi.install_interface , hw.acpi.remove_interface +Install or remove OS interface(s) to control return value of +.Ql _OSI +query method. When an OS interface is specified in +.Va hw.acpi.install_interface , +.Li _OSI +query for the interface returns it is +.Em supported . +Conversely, when an OS interface is specified in +.Va hw.acpi.remove_interface , +.Li _OSI +query returns it is +.Em not supported . +Multiple interfaces can be specified in a comma-separated list and +any leading white spaces will be ignored. For example, +.Qq Li FreeBSD, Linux +is a valid list of two interfaces +.Qq Li FreeBSD +and +.Qq Li Linux . .It Va hw.acpi.reset_video Enables calling the VESA reset BIOS vector on the resume path. This can fix some graphics cards that have problems such as LCD white-out From owner-svn-src-head@FreeBSD.ORG Tue Oct 26 22:46:16 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4BD69106564A; Tue, 26 Oct 2010 22:46:16 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3AE048FC18; Tue, 26 Oct 2010 22:46:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9QMkGb0075751; Tue, 26 Oct 2010 22:46:16 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9QMkG4I075749; Tue, 26 Oct 2010 22:46:16 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201010262246.o9QMkG4I075749@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Tue, 26 Oct 2010 22:46:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214404 - head/sbin/geom/class/eli X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Oct 2010 22:46:16 -0000 Author: pjd Date: Tue Oct 26 22:46:15 2010 New Revision: 214404 URL: http://svn.freebsd.org/changeset/base/214404 Log: Use fprintf(stderr) instead of gctl_error() to print a warning about too big sector size. When gctl error is set gctl_has_param() always returns 'false', which prevents geli(8) from finding some arguments and also masks an error, which is generates in such case. MFC after: 3 days Modified: head/sbin/geom/class/eli/geom_eli.c Modified: head/sbin/geom/class/eli/geom_eli.c ============================================================================== --- head/sbin/geom/class/eli/geom_eli.c Tue Oct 26 21:24:14 2010 (r214403) +++ head/sbin/geom/class/eli/geom_eli.c Tue Oct 26 22:46:15 2010 (r214404) @@ -749,8 +749,8 @@ eli_init(struct gctl_req *req) return; } if (val > sysconf(_SC_PAGE_SIZE)) { - gctl_error(req, "warning: Using sectorsize bigger than " - "the page size!"); + fprintf(stderr, + "warning: Using sectorsize bigger than the page size!\n"); } md.md_sectorsize = val; } From owner-svn-src-head@FreeBSD.ORG Tue Oct 26 23:18:37 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 877E0106564A; Tue, 26 Oct 2010 23:18:37 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 75E9A8FC16; Tue, 26 Oct 2010 23:18:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9QNIbE4077306; Tue, 26 Oct 2010 23:18:37 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9QNIbMe077303; Tue, 26 Oct 2010 23:18:37 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201010262318.o9QNIbMe077303@svn.freebsd.org> From: Rick Macklem Date: Tue, 26 Oct 2010 23:18:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214406 - in head/sys/fs: nfs nfsclient X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Oct 2010 23:18:37 -0000 Author: rmacklem Date: Tue Oct 26 23:18:37 2010 New Revision: 214406 URL: http://svn.freebsd.org/changeset/base/214406 Log: Add a flag to the experimental NFSv4 client to indicate when delegations are being returned for reasons other than a Recall. Also, re-organize nfscl_recalldeleg() slightly, so that it leaves clearing NMODIFIED to the ncl_flush() call and invalidates the attribute cache after flushing. It is hoped that these changes might fix the problem others have seen when using the NFSv4 client with delegations enabled, since I can't reliably reproduce the problem. These changes only affect the client when doing NFSv4 mounts with delegations enabled. MFC after: 10 days Modified: head/sys/fs/nfs/nfsclstate.h head/sys/fs/nfsclient/nfs_clstate.c Modified: head/sys/fs/nfs/nfsclstate.h ============================================================================== --- head/sys/fs/nfs/nfsclstate.h Tue Oct 26 23:06:53 2010 (r214405) +++ head/sys/fs/nfs/nfsclstate.h Tue Oct 26 23:18:37 2010 (r214406) @@ -118,6 +118,7 @@ struct nfscldeleg { #define NFSCLDL_NEEDRECLAIM 0x08 #define NFSCLDL_ZAPPED 0x10 #define NFSCLDL_MODTIMESET 0x20 +#define NFSCLDL_DELEGRET 0x40 /* * MALLOC'd to the correct length to accommodate the file handle. Modified: head/sys/fs/nfsclient/nfs_clstate.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clstate.c Tue Oct 26 23:06:53 2010 (r214405) +++ head/sys/fs/nfsclient/nfs_clstate.c Tue Oct 26 23:18:37 2010 (r214406) @@ -929,8 +929,10 @@ nfscl_getbytelock(vnode_t vp, u_int64_t ldp = dp = nfscl_finddeleg(clp, np->n_fhp->nfh_fh, np->n_fhp->nfh_len); /* Just sanity check for correct type of delegation */ - if (dp != NULL && ((dp->nfsdl_flags & NFSCLDL_RECALL) || - (type == F_WRLCK && !(dp->nfsdl_flags & NFSCLDL_WRITE)))) + if (dp != NULL && ((dp->nfsdl_flags & + (NFSCLDL_RECALL | NFSCLDL_DELEGRET)) != 0 || + (type == F_WRLCK && + (dp->nfsdl_flags & NFSCLDL_WRITE) == 0))) dp = NULL; } if (dp != NULL) { @@ -2495,8 +2497,8 @@ tryagain: if (dp->nfsdl_rwlock.nfslock_usecnt == 0 && dp->nfsdl_rwlock.nfslock_lock == 0 && dp->nfsdl_timestamp < NFSD_MONOSEC && - !(dp->nfsdl_flags & (NFSCLDL_RECALL | NFSCLDL_ZAPPED | - NFSCLDL_NEEDRECLAIM))) { + (dp->nfsdl_flags & (NFSCLDL_RECALL | NFSCLDL_ZAPPED | + NFSCLDL_NEEDRECLAIM | NFSCLDL_DELEGRET)) == 0) { clearok = 1; LIST_FOREACH(owp, &dp->nfsdl_owner, nfsow_list) { op = LIST_FIRST(&owp->nfsow_open); @@ -3086,7 +3088,8 @@ nfscl_docb(struct nfsrv_descript *nd, NF if (clp != NULL) { dp = nfscl_finddeleg(clp, nfhp->nfh_fh, nfhp->nfh_len); - if (dp != NULL) { + if (dp != NULL && (dp->nfsdl_flags & + NFSCLDL_DELEGRET) == 0) { dp->nfsdl_flags |= NFSCLDL_RECALL; wakeup((caddr_t)clp); @@ -3338,7 +3341,6 @@ nfscl_recalldeleg(struct nfsclclient *cl np = VTONFS(vp); } dp->nfsdl_flags &= ~NFSCLDL_MODTIMESET; - NFSINVALATTRCACHE(np); /* * Ok, if it's a write delegation, flush data to the server, so @@ -3347,21 +3349,14 @@ nfscl_recalldeleg(struct nfsclclient *cl ret = 0; NFSLOCKNODE(np); if ((dp->nfsdl_flags & NFSCLDL_WRITE) && (np->n_flag & NMODIFIED)) { -#ifdef APPLE - OSBitOrAtomic((u_int32_t)NDELEGRECALL, (UInt32 *)&np->n_flag); -#else np->n_flag |= NDELEGRECALL; -#endif NFSUNLOCKNODE(np); ret = ncl_flush(vp, MNT_WAIT, cred, p, 1, called_from_renewthread); NFSLOCKNODE(np); -#ifdef APPLE - OSBitAndAtomic((int32_t)~(NMODIFIED | NDELEGRECALL), (UInt32 *)&np->n_flag); -#else - np->n_flag &= ~(NMODIFIED | NDELEGRECALL); -#endif + np->n_flag &= ~NDELEGRECALL; } + NFSINVALATTRCACHE(np); NFSUNLOCKNODE(np); if (ret == EIO && called_from_renewthread != 0) { /* @@ -3534,8 +3529,10 @@ nfscl_totalrecall(struct nfsclclient *cl { struct nfscldeleg *dp; - TAILQ_FOREACH(dp, &clp->nfsc_deleg, nfsdl_list) - dp->nfsdl_flags |= NFSCLDL_RECALL; + TAILQ_FOREACH(dp, &clp->nfsc_deleg, nfsdl_list) { + if ((dp->nfsdl_flags & NFSCLDL_DELEGRET) == 0) + dp->nfsdl_flags |= NFSCLDL_RECALL; + } } /* @@ -3754,8 +3751,9 @@ nfscl_mustflush(vnode_t vp) return (1); } dp = nfscl_finddeleg(clp, np->n_fhp->nfh_fh, np->n_fhp->nfh_len); - if (dp != NULL && (dp->nfsdl_flags & (NFSCLDL_WRITE | NFSCLDL_RECALL)) - == NFSCLDL_WRITE && + if (dp != NULL && (dp->nfsdl_flags & + (NFSCLDL_WRITE | NFSCLDL_RECALL | NFSCLDL_DELEGRET)) == + NFSCLDL_WRITE && (dp->nfsdl_sizelimit >= np->n_size || !NFSHASSTRICT3530(nmp))) { NFSUNLOCKCLSTATE(); @@ -3787,9 +3785,10 @@ nfscl_nodeleg(vnode_t vp, int writedeleg return (1); } dp = nfscl_finddeleg(clp, np->n_fhp->nfh_fh, np->n_fhp->nfh_len); - if (dp != NULL && (dp->nfsdl_flags & NFSCLDL_RECALL) == 0 && - (writedeleg == 0 || (dp->nfsdl_flags & NFSCLDL_WRITE) - == NFSCLDL_WRITE)) { + if (dp != NULL && + (dp->nfsdl_flags & (NFSCLDL_RECALL | NFSCLDL_DELEGRET)) == 0 && + (writedeleg == 0 || (dp->nfsdl_flags & NFSCLDL_WRITE) == + NFSCLDL_WRITE)) { NFSUNLOCKCLSTATE(); return (0); } @@ -3860,6 +3859,7 @@ nfscl_removedeleg(vnode_t vp, NFSPROC_T } } if (needsrecall && !triedrecall) { + dp->nfsdl_flags |= NFSCLDL_DELEGRET; islept = 0; while (!igotlock) { igotlock = nfsv4_lock(&clp->nfsc_lock, 1, @@ -3958,6 +3958,7 @@ nfscl_renamedeleg(vnode_t fvp, nfsv4stat } } if (needsrecall && !triedrecall) { + dp->nfsdl_flags |= NFSCLDL_DELEGRET; islept = 0; while (!igotlock) { igotlock = nfsv4_lock(&clp->nfsc_lock, 1, From owner-svn-src-head@FreeBSD.ORG Wed Oct 27 02:32:54 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 88D29106564A; Wed, 27 Oct 2010 02:32:54 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 77FAA8FC1C; Wed, 27 Oct 2010 02:32:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9R2Wsco084555; Wed, 27 Oct 2010 02:32:54 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9R2Wsu3084553; Wed, 27 Oct 2010 02:32:54 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201010270232.o9R2Wsu3084553@svn.freebsd.org> From: David Xu Date: Wed, 27 Oct 2010 02:32:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214409 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Oct 2010 02:32:54 -0000 Author: davidxu Date: Wed Oct 27 02:32:54 2010 New Revision: 214409 URL: http://svn.freebsd.org/changeset/base/214409 Log: If input parameter cpusetsize is zero, give userland size of cpuset mask kernel is using. Modified: head/sys/kern/kern_cpuset.c Modified: head/sys/kern/kern_cpuset.c ============================================================================== --- head/sys/kern/kern_cpuset.c Wed Oct 27 02:07:25 2010 (r214408) +++ head/sys/kern/kern_cpuset.c Wed Oct 27 02:32:54 2010 (r214409) @@ -889,6 +889,10 @@ cpuset_getaffinity(struct thread *td, st int error; size_t size; + if (uap->cpusetsize == 0) { + td->td_retval[0] = sizeof(cpuset_t); + return (0); + } if (uap->cpusetsize < sizeof(cpuset_t) || uap->cpusetsize > CPU_MAXSIZE / NBBY) return (ERANGE); From owner-svn-src-head@FreeBSD.ORG Wed Oct 27 02:43:06 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 82810106566B; Wed, 27 Oct 2010 02:43:06 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id 976718FC1E; Wed, 27 Oct 2010 02:43:05 +0000 (UTC) Received: by wwb24 with SMTP id 24so174413wwb.31 for ; Tue, 26 Oct 2010 19:43:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=h/uXWnhOC1KT0bGUXhBAl1KfSXkhYrdGapSRAKipdKQ=; b=EvvyqaN+N+fEnGiA3jTxLZK3fDASoLYFnxlqZBg6QaanA+4Na9lXPLydJvvV8+Asn4 c8+vkblGV+LIxDOdSPEc5BikihQeah1H5B52fvBz7q8vNSt7fA+AxH6HiuWoUASnqZ3E 61oyZKcdIrCwezFMzeK4L/C+eM6a58742BpC4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=VuTITHWOcu+uZVgmReVEs8CKEmEqdRMQxCB9Lha2+zaDXf6vrNoalGF9gaSaCMu42W H2y83eS8Th7n+TR8b33Iwi1R6g/+T2pFaJbpwD8Ffn79uPJ8GcIwydM/e+1qkEPV4mJg 16GFyArFE5Z+nx4xcdvrAWEbHUB2rjV+fpKiw= MIME-Version: 1.0 Received: by 10.216.173.7 with SMTP id u7mr210310wel.50.1288147383254; Tue, 26 Oct 2010 19:43:03 -0700 (PDT) Sender: yanegomi@gmail.com Received: by 10.216.10.198 with HTTP; Tue, 26 Oct 2010 19:43:03 -0700 (PDT) In-Reply-To: <201010270232.o9R2Wsu3084553@svn.freebsd.org> References: <201010270232.o9R2Wsu3084553@svn.freebsd.org> Date: Tue, 26 Oct 2010 19:43:03 -0700 X-Google-Sender-Auth: -glZ_QFwNUvxU71OBOY5nsp1NI8 Message-ID: From: Garrett Cooper To: David Xu Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r214409 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Oct 2010 02:43:06 -0000 On Tue, Oct 26, 2010 at 7:32 PM, David Xu wrote: > Author: davidxu > Date: Wed Oct 27 02:32:54 2010 > New Revision: 214409 > URL: http://svn.freebsd.org/changeset/base/214409 > > Log: > =A0If input parameter cpusetsize is zero, give userland size of cpuset ma= sk > =A0kernel is using. > > Modified: > =A0head/sys/kern/kern_cpuset.c > > Modified: head/sys/kern/kern_cpuset.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/kern/kern_cpuset.c Wed Oct 27 02:07:25 2010 =A0 =A0 =A0 =A0(= r214408) > +++ head/sys/kern/kern_cpuset.c Wed Oct 27 02:32:54 2010 =A0 =A0 =A0 =A0(= r214409) > @@ -889,6 +889,10 @@ cpuset_getaffinity(struct thread *td, st > =A0 =A0 =A0 =A0int error; > =A0 =A0 =A0 =A0size_t size; > > + =A0 =A0 =A0 if (uap->cpusetsize =3D=3D 0) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 td->td_retval[0] =3D sizeof(cpuset_t); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (0); > + =A0 =A0 =A0 } > =A0 =A0 =A0 =A0if (uap->cpusetsize < sizeof(cpuset_t) || > =A0 =A0 =A0 =A0 =A0 =A0uap->cpusetsize > CPU_MAXSIZE / NBBY) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return (ERANGE); Isn't this requirement partly broken now? [ERANGE] The cpusetsize was either preposterously large or smaller than the kernel set size. Why should cpuset(2) be broken in favor of people not passing valid val= ues? Thanks, -Garrett From owner-svn-src-head@FreeBSD.ORG Wed Oct 27 02:49:12 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E7DFB106566B; Wed, 27 Oct 2010 02:49:12 +0000 (UTC) (envelope-from davidxu@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id D54C58FC13; Wed, 27 Oct 2010 02:49:12 +0000 (UTC) Received: from xyf.my.dom (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id o9R2nAJ5095111; Wed, 27 Oct 2010 02:49:11 GMT (envelope-from davidxu@freebsd.org) Message-ID: <4CC803A8.3040602@freebsd.org> Date: Wed, 27 Oct 2010 10:49:12 +0000 From: David Xu User-Agent: Thunderbird 2.0.0.24 (X11/20100630) MIME-Version: 1.0 To: Garrett Cooper References: <201010270232.o9R2Wsu3084553@svn.freebsd.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r214409 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Oct 2010 02:49:13 -0000 Garrett Cooper wrote: > On Tue, Oct 26, 2010 at 7:32 PM, David Xu wrote: >> Author: davidxu >> Date: Wed Oct 27 02:32:54 2010 >> New Revision: 214409 >> URL: http://svn.freebsd.org/changeset/base/214409 >> >> Log: >> If input parameter cpusetsize is zero, give userland size of cpuset mask >> kernel is using. >> >> Modified: >> head/sys/kern/kern_cpuset.c >> >> Modified: head/sys/kern/kern_cpuset.c >> ============================================================================== >> --- head/sys/kern/kern_cpuset.c Wed Oct 27 02:07:25 2010 (r214408) >> +++ head/sys/kern/kern_cpuset.c Wed Oct 27 02:32:54 2010 (r214409) >> @@ -889,6 +889,10 @@ cpuset_getaffinity(struct thread *td, st >> int error; >> size_t size; >> >> + if (uap->cpusetsize == 0) { >> + td->td_retval[0] = sizeof(cpuset_t); >> + return (0); >> + } >> if (uap->cpusetsize < sizeof(cpuset_t) || >> uap->cpusetsize > CPU_MAXSIZE / NBBY) >> return (ERANGE); > > Isn't this requirement partly broken now? > > [ERANGE] The cpusetsize was either preposterously large or > smaller than the kernel set size. > > Why should cpuset(2) be broken in favor of people not passing valid values? > Thanks, > -Garrett > I really hate to see such a problem that userland can not figure out what kernel is using, I try hardly to guess, but still can not find what it is using. yes, I think the doc may need to be fixed or another syscall is needed. From owner-svn-src-head@FreeBSD.ORG Wed Oct 27 03:10:43 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5AC4D106566C; Wed, 27 Oct 2010 03:10:43 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id 6DF178FC18; Wed, 27 Oct 2010 03:10:42 +0000 (UTC) Received: by wyb42 with SMTP id 42so208042wyb.13 for ; Tue, 26 Oct 2010 20:10:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=HH6PN73P7eMsBlKzcqfrrKpkoJwME17Pa6ugKOAACOc=; b=pVNH1fituXFYRorCacq6vh/yWtHUyvMLY6OyJ0cDLPY7WV/xsYPw2ausluiNrmBlCH TIHWFro7fyWUN/XYjHajPAVbRqknGhyesNovuLQRAuWzadjiCpJVm2SeRZBfJbXX9uZy Ydkz9AMzclrkuDjMSmuHZZ+CudeKduxvWYrQk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=pa66NpKY1Jyx97E27vrF0P2J2qXJElvuBJ23F8K44MbmBVYUMObUqmu9gvSl1EJEW4 OUF/hK+wT3rhnzoD9iLHhzJK4soJxcpNf9hm/JcmFipPu6CWvmnYqBFnSulY8fdjVxR0 2KIY9gxHJXa0XxkqN/3EZuefiMO8d6lMLaf5M= MIME-Version: 1.0 Received: by 10.216.231.82 with SMTP id k60mr1893751weq.64.1288149041286; Tue, 26 Oct 2010 20:10:41 -0700 (PDT) Sender: yanegomi@gmail.com Received: by 10.216.10.198 with HTTP; Tue, 26 Oct 2010 20:10:41 -0700 (PDT) In-Reply-To: <4CC803A8.3040602@freebsd.org> References: <201010270232.o9R2Wsu3084553@svn.freebsd.org> <4CC803A8.3040602@freebsd.org> Date: Tue, 26 Oct 2010 20:10:41 -0700 X-Google-Sender-Auth: VrpRtpbwABd_53udK2ZH0LgXm0M Message-ID: From: Garrett Cooper To: David Xu Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r214409 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Oct 2010 03:10:43 -0000 On Wed, Oct 27, 2010 at 3:49 AM, David Xu wrote: > Garrett Cooper wrote: >> >> On Tue, Oct 26, 2010 at 7:32 PM, David Xu wrote: >>> >>> Author: davidxu >>> Date: Wed Oct 27 02:32:54 2010 >>> New Revision: 214409 >>> URL: http://svn.freebsd.org/changeset/base/214409 >>> >>> Log: >>> =A0If input parameter cpusetsize is zero, give userland size of cpuset = mask >>> =A0kernel is using. >>> >>> Modified: >>> =A0head/sys/kern/kern_cpuset.c >>> >>> Modified: head/sys/kern/kern_cpuset.c >>> >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>> --- head/sys/kern/kern_cpuset.c Wed Oct 27 02:07:25 2010 =A0 =A0 =A0 = =A0(r214408) >>> +++ head/sys/kern/kern_cpuset.c Wed Oct 27 02:32:54 2010 =A0 =A0 =A0 = =A0(r214409) >>> @@ -889,6 +889,10 @@ cpuset_getaffinity(struct thread *td, st >>> =A0 =A0 =A0 int error; >>> =A0 =A0 =A0 size_t size; >>> >>> + =A0 =A0 =A0 if (uap->cpusetsize =3D=3D 0) { >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 td->td_retval[0] =3D sizeof(cpuset_t); >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (0); >>> + =A0 =A0 =A0 } >>> =A0 =A0 =A0 if (uap->cpusetsize < sizeof(cpuset_t) || >>> =A0 =A0 =A0 =A0 =A0 uap->cpusetsize > CPU_MAXSIZE / NBBY) >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (ERANGE); >> >> =A0 =A0Isn't this requirement partly broken now? >> >> =A0 =A0 [ERANGE] =A0 =A0 =A0 =A0 =A0 The cpusetsize was either preposter= ously large or >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0smaller than the kernel s= et size. >> >> =A0 =A0Why should cpuset(2) be broken in favor of people not passing val= id >> values? > > I really hate to see such a problem that userland can not figure out > what kernel is using, I try hardly to guess, but still can not find > what it is using. yes, I think the doc may need to be fixed or > another syscall is needed. Well... Jeff's code in cpuset(1) does some trivial sizeof(mask) 's, but it just passes in cpuset_t for mask. I've seen different calling conventions at the kernel level when I tried to get my brain in sync with that for a bug I was looking at a few weeks ago (and sadly, failed to some degree). These syscalls are a bit confusing though, and apart from cpuset(1) there aren't any really good examples in the sourcebase on how to use them (at least not the last time I checked)... Thanks, -Garrett From owner-svn-src-head@FreeBSD.ORG Wed Oct 27 03:19:22 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ADA6A106564A; Wed, 27 Oct 2010 03:19:22 +0000 (UTC) (envelope-from davidxu@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 7F0E58FC15; Wed, 27 Oct 2010 03:19:22 +0000 (UTC) Received: from xyf.my.dom (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id o9R3JKqE027667; Wed, 27 Oct 2010 03:19:21 GMT (envelope-from davidxu@freebsd.org) Message-ID: <4CC80ABA.3080404@freebsd.org> Date: Wed, 27 Oct 2010 11:19:22 +0000 From: David Xu User-Agent: Thunderbird 2.0.0.24 (X11/20100630) MIME-Version: 1.0 To: Garrett Cooper References: <201010270232.o9R2Wsu3084553@svn.freebsd.org> <4CC803A8.3040602@freebsd.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r214409 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Oct 2010 03:19:22 -0000 Garrett Cooper wrote: > On Wed, Oct 27, 2010 at 3:49 AM, David Xu wrote: >> Garrett Cooper wrote: >>> On Tue, Oct 26, 2010 at 7:32 PM, David Xu wrote: >>>> Author: davidxu >>>> Date: Wed Oct 27 02:32:54 2010 >>>> New Revision: 214409 >>>> URL: http://svn.freebsd.org/changeset/base/214409 >>>> >>>> Log: >>>> If input parameter cpusetsize is zero, give userland size of cpuset mask >>>> kernel is using. >>>> >>>> Modified: >>>> head/sys/kern/kern_cpuset.c >>>> >>>> Modified: head/sys/kern/kern_cpuset.c >>>> >>>> ============================================================================== >>>> --- head/sys/kern/kern_cpuset.c Wed Oct 27 02:07:25 2010 (r214408) >>>> +++ head/sys/kern/kern_cpuset.c Wed Oct 27 02:32:54 2010 (r214409) >>>> @@ -889,6 +889,10 @@ cpuset_getaffinity(struct thread *td, st >>>> int error; >>>> size_t size; >>>> >>>> + if (uap->cpusetsize == 0) { >>>> + td->td_retval[0] = sizeof(cpuset_t); >>>> + return (0); >>>> + } >>>> if (uap->cpusetsize < sizeof(cpuset_t) || >>>> uap->cpusetsize > CPU_MAXSIZE / NBBY) >>>> return (ERANGE); >>> Isn't this requirement partly broken now? >>> >>> [ERANGE] The cpusetsize was either preposterously large or >>> smaller than the kernel set size. >>> >>> Why should cpuset(2) be broken in favor of people not passing valid >>> values? >> I really hate to see such a problem that userland can not figure out >> what kernel is using, I try hardly to guess, but still can not find >> what it is using. yes, I think the doc may need to be fixed or >> another syscall is needed. > > Well... Jeff's code in cpuset(1) does some trivial sizeof(mask) > 's, but it just passes in cpuset_t for mask. I've seen different > calling conventions at the kernel level when I tried to get my brain > in sync with that for a bug I was looking at a few weeks ago (and > sadly, failed to some degree). > These syscalls are a bit confusing though, and apart from > cpuset(1) there aren't any really good examples in the sourcebase on > how to use them (at least not the last time I checked)... > Thanks, > -Garrett > The problem is that the size of cpuset is not fixed, it is tunable by the recompiling kernel with different parameter, so if you have a program which you want to adapt it to use any size of cpuset, it should be able to get the size the kernel is using, if you don't have source code of the program, you can not compile it with new parameter, then there is trouble. From owner-svn-src-head@FreeBSD.ORG Wed Oct 27 04:19:08 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3D96D106564A; Wed, 27 Oct 2010 04:19:08 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2C57F8FC14; Wed, 27 Oct 2010 04:19:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9R4J8Tl088083; Wed, 27 Oct 2010 04:19:08 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9R4J8Mj088081; Wed, 27 Oct 2010 04:19:08 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201010270419.o9R4J8Mj088081@svn.freebsd.org> From: David Xu Date: Wed, 27 Oct 2010 04:19:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214410 - head/lib/libthr/thread X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Oct 2010 04:19:08 -0000 Author: davidxu Date: Wed Oct 27 04:19:07 2010 New Revision: 214410 URL: http://svn.freebsd.org/changeset/base/214410 Log: Remove locking and unlock in pthread_mutex_destroy, because it can not fix race condition in application code, as a result, the problem described in PR threads/151767 is avoided. Modified: head/lib/libthr/thread/thr_mutex.c Modified: head/lib/libthr/thread/thr_mutex.c ============================================================================== --- head/lib/libthr/thread/thr_mutex.c Wed Oct 27 02:32:54 2010 (r214409) +++ head/lib/libthr/thread/thr_mutex.c Wed Oct 27 04:19:07 2010 (r214410) @@ -257,10 +257,8 @@ _mutex_fork(struct pthread *curthread) int _pthread_mutex_destroy(pthread_mutex_t *mutex) { - struct pthread *curthread = _get_curthread(); pthread_mutex_t m; - uint32_t id; - int ret = 0; + int ret; m = *mutex; if (m < THR_MUTEX_DESTROYED) { @@ -268,34 +266,13 @@ _pthread_mutex_destroy(pthread_mutex_t * } else if (m == THR_MUTEX_DESTROYED) { ret = EINVAL; } else { - id = TID(curthread); - - /* - * Try to lock the mutex structure, we only need to - * try once, if failed, the mutex is in used. - */ - ret = _thr_umutex_trylock(&m->m_lock, id); - if (ret) - return (ret); - /* - * Check mutex other fields to see if this mutex is - * in use. Mostly for prority mutex types, or there - * are condition variables referencing it. - */ if (m->m_owner != NULL || m->m_refcount != 0) { - if (m->m_lock.m_flags & UMUTEX_PRIO_PROTECT) - set_inherited_priority(curthread, m); - _thr_umutex_unlock(&m->m_lock, id); ret = EBUSY; } else { *mutex = THR_MUTEX_DESTROYED; - - if (m->m_lock.m_flags & UMUTEX_PRIO_PROTECT) - set_inherited_priority(curthread, m); - _thr_umutex_unlock(&m->m_lock, id); - MUTEX_ASSERT_NOT_OWNED(m); free(m); + ret = 0; } } From owner-svn-src-head@FreeBSD.ORG Wed Oct 27 07:14:46 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F12781065672; Wed, 27 Oct 2010 07:14:46 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D7CB18FC17; Wed, 27 Oct 2010 07:14:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9R7EkQu093417; Wed, 27 Oct 2010 07:14:46 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9R7EkHU093412; Wed, 27 Oct 2010 07:14:46 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <201010270714.o9R7EkHU093412@svn.freebsd.org> From: Edwin Groothuis Date: Wed, 27 Oct 2010 07:14:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214411 - in head/contrib/tzcode: stdtime zic X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Oct 2010 07:14:47 -0000 Author: edwin Date: Wed Oct 27 07:14:46 2010 New Revision: 214411 URL: http://svn.freebsd.org/changeset/base/214411 Log: Sync code with tzcode2010m asctime.c: * Set errno to EINVAL and return "??? ??? ?? ??:??:?? ????\n" if asctime_r is called with a NULL struct tm pointer. (Note that asctime_r is called by ctime_r and asctime; asctime is called by ctime.) localtime.c: * Set errno to EINVAL and return WRONG if time1 is called with a NULL struct tm pointer; avoid dereference if a NULL struct tm pointer is passed to timelocal, timegm, or timeoff. (Note that time1 is called by mktime, timegm, and timeoff; mktime is called by timelocal.) * more core-avoidance work * Change to set timezone and altzone based on time types with greatest transition times (for the benefit of Asia/Seoul). zic.8: * Warning about case-sensitivity of names, but not of abbrevations zic.c: * Conditionally output extra types with most-recently-use offsets last (for use by systems with pre-2011 versions of localtime.c, helping to ensure that globals "altzone and "timezone" get set correctly). The code has been running for nearly four weeks on my laptop running FreeBSD 8.1 without a problem. MFC after: 1 month Modified: head/contrib/tzcode/stdtime/asctime.c head/contrib/tzcode/stdtime/localtime.c head/contrib/tzcode/zic/zic.8 head/contrib/tzcode/zic/zic.c Modified: head/contrib/tzcode/stdtime/asctime.c ============================================================================== --- head/contrib/tzcode/stdtime/asctime.c Wed Oct 27 04:19:07 2010 (r214410) +++ head/contrib/tzcode/stdtime/asctime.c Wed Oct 27 07:14:46 2010 (r214411) @@ -12,7 +12,7 @@ #include #ifndef lint #ifndef NOID -static char elsieid[] __unused = "@(#)asctime.c 8.2"; +static char elsieid[] __unused = "@(#)asctime.c 8.5"; #endif /* !defined NOID */ #endif /* !defined lint */ __FBSDID("$FreeBSD$"); @@ -95,6 +95,10 @@ char * buf; char year[INT_STRLEN_MAXIMUM(int) + 2]; char result[MAX_ASCTIME_BUF_SIZE]; + if (timeptr == NULL) { + errno = EINVAL; + return strcpy(buf, "??? ??? ?? ??:??:?? ????\n"); + } if (timeptr->tm_wday < 0 || timeptr->tm_wday >= DAYSPERWEEK) wn = "???"; else wn = wday_name[timeptr->tm_wday]; @@ -117,10 +121,9 @@ char * buf; timeptr->tm_mday, timeptr->tm_hour, timeptr->tm_min, timeptr->tm_sec, year); - if (strlen(result) < STD_ASCTIME_BUF_SIZE || buf == buf_asctime) { - (void) strcpy(buf, result); - return buf; - } else { + if (strlen(result) < STD_ASCTIME_BUF_SIZE || buf == buf_asctime) + return strcpy(buf, result); + else { #ifdef EOVERFLOW errno = EOVERFLOW; #else /* !defined EOVERFLOW */ Modified: head/contrib/tzcode/stdtime/localtime.c ============================================================================== --- head/contrib/tzcode/stdtime/localtime.c Wed Oct 27 04:19:07 2010 (r214410) +++ head/contrib/tzcode/stdtime/localtime.c Wed Oct 27 07:14:46 2010 (r214411) @@ -6,7 +6,7 @@ #include #ifndef lint #ifndef NOID -static char elsieid[] __unused = "@(#)localtime.c 8.9"; +static char elsieid[] __unused = "@(#)localtime.c 8.14"; #endif /* !defined NOID */ #endif /* !defined lint */ __FBSDID("$FreeBSD$"); @@ -315,34 +315,26 @@ settzname(void) return; } #endif /* defined ALL_STATE */ + /* + ** And to get the latest zone names into tzname. . . + */ for (i = 0; i < sp->typecnt; ++i) { - const struct ttinfo * const ttisp = &sp->ttis[i]; + const struct ttinfo * const ttisp = &sp->ttis[sp->types[i]]; tzname[ttisp->tt_isdst] = &sp->chars[ttisp->tt_abbrind]; #ifdef USG_COMPAT if (ttisp->tt_isdst) daylight = 1; - if (i == 0 || !ttisp->tt_isdst) + if (!ttisp->tt_isdst) timezone = -(ttisp->tt_gmtoff); #endif /* defined USG_COMPAT */ #ifdef ALTZONE - if (i == 0 || ttisp->tt_isdst) + if (ttisp->tt_isdst) altzone = -(ttisp->tt_gmtoff); #endif /* defined ALTZONE */ } /* - ** And to get the latest zone names into tzname. . . - */ - for (i = 0; i < sp->timecnt; ++i) { - const struct ttinfo * const ttisp = - &sp->ttis[ - sp->types[i]]; - - tzname[ttisp->tt_isdst] = - &sp->chars[ttisp->tt_abbrind]; - } - /* ** Finally, scrub the abbreviations. ** First, replace bogus characters. */ @@ -395,6 +387,8 @@ register const int doextend; 4 * TZ_MAX_TIMES]; } u; + sp->goback = sp->goahead = FALSE; + /* XXX The following is from OpenBSD, and I'm not sure it is correct */ if (name != NULL && issetugid() != 0) if ((name[0] == ':' && name[1] == '/') || @@ -610,7 +604,6 @@ register const int doextend; sp->ttis[sp->typecnt++] = ts.ttis[1]; } } - sp->goback = sp->goahead = FALSE; if (sp->timecnt > 1) { for (i = 1; i < sp->timecnt; ++i) if (typesequiv(sp, sp->types[i], sp->types[0]) && @@ -1221,7 +1214,7 @@ tzsetwall_basic(int rdlocked) #ifdef ALL_STATE if (lclptr == NULL) { - lclptr = (struct state *) malloc(sizeof *lclptr); + lclptr = (struct state *) calloc(1, sizeof *lclptr); if (lclptr == NULL) { settzname(); /* all we can do */ _RWLOCK_UNLOCK(&lcl_rwlock); @@ -1273,7 +1266,7 @@ tzset_basic(int rdlocked) #ifdef ALL_STATE if (lclptr == NULL) { - lclptr = (struct state *) malloc(sizeof *lclptr); + lclptr = (struct state *) calloc(1, sizeof *lclptr); if (lclptr == NULL) { settzname(); /* all we can do */ _RWLOCK_UNLOCK(&lcl_rwlock); @@ -1471,7 +1464,7 @@ gmt_init(void) { #ifdef ALL_STATE - gmtptr = (struct state *) malloc(sizeof *gmtptr); + gmtptr = (struct state *) calloc(1, sizeof *gmtptr); if (gmtptr != NULL) #endif /* defined ALL_STATE */ gmtload(gmtptr); @@ -2054,6 +2047,11 @@ const long offset; int types[TZ_MAX_TYPES]; int okay; + if (tmp == NULL) { + errno = EINVAL; + return WRONG; + } + if (tmp->tm_isdst > 1) tmp->tm_isdst = 1; t = time2(tmp, funcp, offset, &okay); @@ -2129,7 +2127,8 @@ time_t timelocal(tmp) struct tm * const tmp; { - tmp->tm_isdst = -1; /* in case it wasn't initialized */ + if (tmp != NULL) + tmp->tm_isdst = -1; /* in case it wasn't initialized */ return mktime(tmp); } @@ -2137,7 +2136,8 @@ time_t timegm(tmp) struct tm * const tmp; { - tmp->tm_isdst = 0; + if (tmp != NULL) + tmp->tm_isdst = 0; return time1(tmp, gmtsub, 0L); } @@ -2146,7 +2146,8 @@ timeoff(tmp, offset) struct tm * const tmp; const long offset; { - tmp->tm_isdst = 0; + if (tmp != NULL) + tmp->tm_isdst = 0; return time1(tmp, gmtsub, offset); } Modified: head/contrib/tzcode/zic/zic.8 ============================================================================== --- head/contrib/tzcode/zic/zic.8 Wed Oct 27 04:19:07 2010 (r214410) +++ head/contrib/tzcode/zic/zic.8 Wed Oct 27 07:14:46 2010 (r214411) @@ -119,6 +119,9 @@ Any line that is blank (after comment st Non-blank lines are expected to be of one of three types: rule lines, zone lines, and link lines. .Pp +Names (such as month names) must be in English and are case insensitive. +Abbreviations, if used, must be unambiguous in context. +.Pp A rule line has the form: .Dl "Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S" For example: @@ -460,6 +463,6 @@ standard directory used for created file .Xr ctime 3 , .Xr tzfile 5 , .Xr zdump 8 -.\" @(#)zic.8 8.5 +.\" @(#)zic.8 8.6 .\" This file is in the public domain, so clarified as of .\" 2009-05-17 by Arthur David Olson. Modified: head/contrib/tzcode/zic/zic.c ============================================================================== --- head/contrib/tzcode/zic/zic.c Wed Oct 27 04:19:07 2010 (r214410) +++ head/contrib/tzcode/zic/zic.c Wed Oct 27 07:14:46 2010 (r214411) @@ -3,7 +3,7 @@ ** 2006-07-17 by Arthur David Olson. */ -static const char elsieid[] = "@(#)zic.c 8.20"; +static const char elsieid[] = "@(#)zic.c 8.22"; #ifndef lint static const char rcsid[] = @@ -1588,6 +1588,53 @@ const char * const string; if (thistimei == 0) writetype[0] = TRUE; } +#ifndef LEAVE_SOME_PRE_2011_SYSTEMS_IN_THE_LURCH + /* + ** For some pre-2011 systems: if the last-to-be-written + ** standard (or daylight) type has an offset different from the + ** most recently used offset, + ** append an (unused) copy of the most recently used type + ** (to help get global "altzone" and "timezone" variables + ** set correctly). + */ + { + register int mrudst, mrustd, hidst, histd, type; + + hidst = histd = mrudst = mrustd = -1; + for (i = thistimei; i < thistimelim; ++i) + if (isdsts[types[i]]) + mrudst = types[i]; + else mrustd = types[i]; + for (i = 0; i < typecnt; ++i) + if (writetype[i]) { + if (isdsts[i]) + hidst = i; + else histd = i; + } + if (hidst >= 0 && mrudst >= 0 && hidst != mrudst && + gmtoffs[hidst] != gmtoffs[mrudst]) { + isdsts[mrudst] = -1; + type = addtype(gmtoffs[mrudst], + &chars[abbrinds[mrudst]], + TRUE, + ttisstds[mrudst], + ttisgmts[mrudst]); + isdsts[mrudst] = TRUE; + writetype[type] = TRUE; + } + if (histd >= 0 && mrustd >= 0 && histd != mrustd && + gmtoffs[histd] != gmtoffs[mrustd]) { + isdsts[mrustd] = -1; + type = addtype(gmtoffs[mrustd], + &chars[abbrinds[mrustd]], + FALSE, + ttisstds[mrustd], + ttisgmts[mrustd]); + isdsts[mrustd] = FALSE; + writetype[type] = TRUE; + } + } +#endif /* !defined LEAVE_SOME_PRE_2011_SYSTEMS_IN_THE_LURCH */ thistypecnt = 0; for (i = 0; i < typecnt; ++i) typemap[i] = writetype[i] ? thistypecnt++ : -1; From owner-svn-src-head@FreeBSD.ORG Wed Oct 27 08:22:05 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5DD50106566B; Wed, 27 Oct 2010 08:22:05 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id F1D538FC0A; Wed, 27 Oct 2010 08:22:04 +0000 (UTC) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id A73F745C89; Wed, 27 Oct 2010 10:22:03 +0200 (CEST) Received: from localhost (chello089073192049.chello.pl [89.73.192.49]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id 9A03645CAC; Wed, 27 Oct 2010 10:21:57 +0200 (CEST) Date: Wed, 27 Oct 2010 10:21:22 +0200 From: Pawel Jakub Dawidek To: David Xu Message-ID: <20101027082122.GD1848@garage.freebsd.pl> References: <201010270232.o9R2Wsu3084553@svn.freebsd.org> <4CC803A8.3040602@freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="8w3uRX/HFJGApMzv" Content-Disposition: inline In-Reply-To: <4CC803A8.3040602@freebsd.org> User-Agent: Mutt/1.4.2.3i X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 9.0-CURRENT amd64 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-0.6 required=4.5 tests=BAYES_00,RCVD_IN_SORBS_DUL autolearn=no version=3.0.4 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Garrett Cooper Subject: Re: svn commit: r214409 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Oct 2010 08:22:05 -0000 --8w3uRX/HFJGApMzv Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Oct 27, 2010 at 10:49:12AM +0000, David Xu wrote: > I really hate to see such a problem that userland can not figure out > what kernel is using, I try hardly to guess, but still can not find > what it is using. yes, I think the doc may need to be fixed or > another syscall is needed. Maybe you could just add sysctl and eventually put it into sysconf(3)? --=20 Pawel Jakub Dawidek http://www.wheelsystems.com pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --8w3uRX/HFJGApMzv Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAkzH4QIACgkQForvXbEpPzQIiQCfdrTmyy9IcqdG34BaTxv51mtG Af0Anj3Wv1q4GLBXk0IGIHwKBYuUCQzP =oJAe -----END PGP SIGNATURE----- --8w3uRX/HFJGApMzv-- From owner-svn-src-head@FreeBSD.ORG Wed Oct 27 08:37:38 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6CD1A106566B; Wed, 27 Oct 2010 08:37:38 +0000 (UTC) (envelope-from davidxu@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 58BAC8FC19; Wed, 27 Oct 2010 08:37:38 +0000 (UTC) Received: from xyf.my.dom (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id o9R8ba3k092394; Wed, 27 Oct 2010 08:37:37 GMT (envelope-from davidxu@freebsd.org) Message-ID: <4CC85552.2020100@freebsd.org> Date: Wed, 27 Oct 2010 16:37:38 +0000 From: David Xu User-Agent: Thunderbird 2.0.0.24 (X11/20100630) MIME-Version: 1.0 To: Pawel Jakub Dawidek References: <201010270232.o9R2Wsu3084553@svn.freebsd.org> <4CC803A8.3040602@freebsd.org> <20101027082122.GD1848@garage.freebsd.pl> In-Reply-To: <20101027082122.GD1848@garage.freebsd.pl> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Garrett Cooper Subject: Re: svn commit: r214409 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Oct 2010 08:37:38 -0000 Pawel Jakub Dawidek wrote: > On Wed, Oct 27, 2010 at 10:49:12AM +0000, David Xu wrote: >> I really hate to see such a problem that userland can not figure out >> what kernel is using, I try hardly to guess, but still can not find >> what it is using. yes, I think the doc may need to be fixed or >> another syscall is needed. > > Maybe you could just add sysctl and eventually put it into sysconf(3)? > I just found a dirty method, use sizeof(long) and kern.smp.maxcpus 32 to figure out the size the kernel is using, because it is how cpuset_t is constructed, wish it will never be changed. ;-) From owner-svn-src-head@FreeBSD.ORG Wed Oct 27 08:39:53 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C50441065673; Wed, 27 Oct 2010 08:39:53 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id A9A3D8FC18; Wed, 27 Oct 2010 08:39:52 +0000 (UTC) Received: by wyb42 with SMTP id 42so424304wyb.13 for ; Wed, 27 Oct 2010 01:39:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type; bh=Qm/7qYv4HOuqs0A4W0DQIxS8BXURo065sMpU07NrGkU=; b=hGALf0bk4WP45hgmXTxHNTf4zudAyoE8xQfXbzE6EjPtUbx3Puo8nA9DnJldqfMRu/ OxRmEeA3UimAXaLPiH+gn2E8YrM8MtnNbFEb7RPPt5pMWqApPIuGSA+bb7OTi0tjD8Wk HRs0r+qxRg3/zBaW2K/Sb/06zjfkNc+gFlcRc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; b=jOw2Rgzcf97cdxqNTPFXZq84vS8K12Wcfi0sPr7I8oYRv3e9jvRqq0SFFddNs217gw xqz9cVmeYOp7FtPnQ8HEUb78ILqff2f59d37uSTWg5cHZXF8U0UYeVpJb9L67TCyfHl+ TuJn0q+nJlh9ewwbHvdx+QNzvfAGhN18Z05b0= MIME-Version: 1.0 Received: by 10.216.63.77 with SMTP id z55mr4204510wec.66.1288168791204; Wed, 27 Oct 2010 01:39:51 -0700 (PDT) Sender: yanegomi@gmail.com Received: by 10.216.10.198 with HTTP; Wed, 27 Oct 2010 01:39:51 -0700 (PDT) In-Reply-To: <4CC85552.2020100@freebsd.org> References: <201010270232.o9R2Wsu3084553@svn.freebsd.org> <4CC803A8.3040602@freebsd.org> <20101027082122.GD1848@garage.freebsd.pl> <4CC85552.2020100@freebsd.org> Date: Wed, 27 Oct 2010 01:39:51 -0700 X-Google-Sender-Auth: ugvGh5K3n0vYSeQlfY9269s0NYI Message-ID: From: Garrett Cooper To: David Xu Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Pawel Jakub Dawidek Subject: Re: svn commit: r214409 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Oct 2010 08:39:53 -0000 On Wed, Oct 27, 2010 at 9:37 AM, David Xu wrote: > Pawel Jakub Dawidek wrote: >> >> On Wed, Oct 27, 2010 at 10:49:12AM +0000, David Xu wrote: >>> >>> I really hate to see such a problem that userland can not figure out >>> what kernel is using, I try hardly to guess, but still can not find >>> what it is using. yes, I think the doc may need to be fixed or >>> another syscall is needed. >> >> Maybe you could just add sysctl and eventually put it into sysconf(3)? > > I just found a dirty method, use sizeof(long) and kern.smp.maxcpus > 32 to figure out the size the kernel is using, because it is how > cpuset_t is constructed, wish it will never be changed. ;-) Pawel's suggestion makes more sense to be honest. If this should be added to sysconf(3) and is worthy of abstracting out into a more generalized concept, then it might be a good idea to get into POSIX. However, it would need to be hashed out because the current implementation is very FreeBSD centric of course :). From owner-svn-src-head@FreeBSD.ORG Wed Oct 27 09:29:04 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3BCB6106564A; Wed, 27 Oct 2010 09:29:04 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2A0AC8FC08; Wed, 27 Oct 2010 09:29:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9R9T4NO097926; Wed, 27 Oct 2010 09:29:04 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9R9T4oI097923; Wed, 27 Oct 2010 09:29:04 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201010270929.o9R9T4oI097923@svn.freebsd.org> From: David Xu Date: Wed, 27 Oct 2010 09:29:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214412 - in head: lib/libthr/thread sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Oct 2010 09:29:04 -0000 Author: davidxu Date: Wed Oct 27 09:29:03 2010 New Revision: 214412 URL: http://svn.freebsd.org/changeset/base/214412 Log: - Revert r214409. - Use long word to figure out sizeof kernel cpuset, hope it works. Modified: head/lib/libthr/thread/thr_attr.c head/sys/kern/kern_cpuset.c Modified: head/lib/libthr/thread/thr_attr.c ============================================================================== --- head/lib/libthr/thread/thr_attr.c Wed Oct 27 07:14:46 2010 (r214411) +++ head/lib/libthr/thread/thr_attr.c Wed Oct 27 09:29:03 2010 (r214412) @@ -574,13 +574,14 @@ _get_kern_cpuset_size(void) if (kern_cpuset_size == 0) { size_t len; + int maxcpus; - len = sizeof(kern_cpuset_size); - if (sysctlbyname("kern.smp.maxcpus", &kern_cpuset_size, - &len, NULL, 0)) + len = sizeof(maxcpus); + if (sysctlbyname("kern.smp.maxcpus", &maxcpus, &len, NULL, 0)) PANIC("failed to get sysctl kern.smp.maxcpus"); - - kern_cpuset_size = (kern_cpuset_size + 7) / 8; + int nbits_long = sizeof(long) * NBBY; + int num_long = (maxcpus + nbits_long - 1) / nbits_long; + kern_cpuset_size = num_long * sizeof(long); } return (kern_cpuset_size); Modified: head/sys/kern/kern_cpuset.c ============================================================================== --- head/sys/kern/kern_cpuset.c Wed Oct 27 07:14:46 2010 (r214411) +++ head/sys/kern/kern_cpuset.c Wed Oct 27 09:29:03 2010 (r214412) @@ -889,10 +889,6 @@ cpuset_getaffinity(struct thread *td, st int error; size_t size; - if (uap->cpusetsize == 0) { - td->td_retval[0] = sizeof(cpuset_t); - return (0); - } if (uap->cpusetsize < sizeof(cpuset_t) || uap->cpusetsize > CPU_MAXSIZE / NBBY) return (ERANGE); From owner-svn-src-head@FreeBSD.ORG Wed Oct 27 09:34:00 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EB5541065674; Wed, 27 Oct 2010 09:33:59 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id 0F8F88FC13; Wed, 27 Oct 2010 09:33:58 +0000 (UTC) Received: by wwb24 with SMTP id 24so440930wwb.31 for ; Wed, 27 Oct 2010 02:33:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=9XkILs/4XLvbZXQDJc9Ktalfgr3ENzv8gaVYo8KOHNI=; b=chRNYyPBE4hrhpS18+Sq9v4C5nX2rS4gp1GzguA3OiCex0iiMcnNz40wt+TvXu7QVE CxqqYDfrsAmHutuSJNfGpKd0i0l5coHKd6pVWqSbfKRC2DLyAJvMUf13oWvtm04UvewO h+RrZFSudNskMKnCZf3kvWwJWSoT5zdhU99qo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=PXDUDCN39GVuOrnYtUHuNY1Z6R2i9eeQJzjvVycTqheO4+wF+wR5ZvTT68hN+vVuyP Q2kw7OmsV3407c0o5QO6SFt7+ntwDpDy07jHOFqdnsd4FlFby9g3DMVBLBj3DYnHGaDI clsoyWea5BFixCkjvKnC7rgl5HC6mHGKRqOYQ= MIME-Version: 1.0 Received: by 10.216.141.14 with SMTP id f14mr554515wej.22.1288172037937; Wed, 27 Oct 2010 02:33:57 -0700 (PDT) Sender: yanegomi@gmail.com Received: by 10.216.10.198 with HTTP; Wed, 27 Oct 2010 02:33:57 -0700 (PDT) In-Reply-To: <201010270929.o9R9T4oI097923@svn.freebsd.org> References: <201010270929.o9R9T4oI097923@svn.freebsd.org> Date: Wed, 27 Oct 2010 02:33:57 -0700 X-Google-Sender-Auth: olxstP0f6CgCcQgA8nlcet7JgSY Message-ID: From: Garrett Cooper To: David Xu Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r214412 - in head: lib/libthr/thread sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Oct 2010 09:34:00 -0000 On Wed, Oct 27, 2010 at 2:29 AM, David Xu wrote: > Author: davidxu > Date: Wed Oct 27 09:29:03 2010 > New Revision: 214412 > URL: http://svn.freebsd.org/changeset/base/214412 > > Log: > =A0- Revert r214409. > =A0- Use long word to figure out sizeof kernel cpuset, hope it works. > > Modified: > =A0head/lib/libthr/thread/thr_attr.c > =A0head/sys/kern/kern_cpuset.c > > Modified: head/lib/libthr/thread/thr_attr.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/lib/libthr/thread/thr_attr.c =A0 Wed Oct 27 07:14:46 2010 =A0 = =A0 =A0 =A0(r214411) > +++ head/lib/libthr/thread/thr_attr.c =A0 Wed Oct 27 09:29:03 2010 =A0 = =A0 =A0 =A0(r214412) > @@ -574,13 +574,14 @@ _get_kern_cpuset_size(void) > > =A0 =A0 =A0 =A0if (kern_cpuset_size =3D=3D 0) { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0size_t len; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 int maxcpus; > > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 len =3D sizeof(kern_cpuset_size); > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (sysctlbyname("kern.smp.maxcpus", &kern_= cpuset_size, > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 &len, NULL, 0)) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 len =3D sizeof(maxcpus); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (sysctlbyname("kern.smp.maxcpus", &maxcp= us, &len, NULL, 0)) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0PANIC("failed to get sysct= l kern.smp.maxcpus"); > - > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 kern_cpuset_size =3D (kern_cpuset_size + 7)= / 8; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 int nbits_long =3D sizeof(long) * NBBY; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 int num_long =3D (maxcpus + nbits_long - 1)= / nbits_long; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 kern_cpuset_size =3D num_long * sizeof(long= ); > =A0 =A0 =A0 =A0} > > =A0 =A0 =A0 =A0return (kern_cpuset_size); > > Modified: head/sys/kern/kern_cpuset.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/kern/kern_cpuset.c Wed Oct 27 07:14:46 2010 =A0 =A0 =A0 =A0(= r214411) > +++ head/sys/kern/kern_cpuset.c Wed Oct 27 09:29:03 2010 =A0 =A0 =A0 =A0(= r214412) > @@ -889,10 +889,6 @@ cpuset_getaffinity(struct thread *td, st > =A0 =A0 =A0 =A0int error; > =A0 =A0 =A0 =A0size_t size; > > - =A0 =A0 =A0 if (uap->cpusetsize =3D=3D 0) { > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 td->td_retval[0] =3D sizeof(cpuset_t); > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (0); > - =A0 =A0 =A0 } > =A0 =A0 =A0 =A0if (uap->cpusetsize < sizeof(cpuset_t) || > =A0 =A0 =A0 =A0 =A0 =A0uap->cpusetsize > CPU_MAXSIZE / NBBY) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return (ERANGE); Are you sure this won't break 32-bit on 64-bit architectures, i.e. amd64, mips, powerpc64, sparc64? Thanks, -Garrett From owner-svn-src-head@FreeBSD.ORG Wed Oct 27 09:44:05 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 717081065672; Wed, 27 Oct 2010 09:44:05 +0000 (UTC) (envelope-from davidxu@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 44B6D8FC08; Wed, 27 Oct 2010 09:44:05 +0000 (UTC) Received: from xyf.my.dom (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id o9R9i2HL063646; Wed, 27 Oct 2010 09:44:03 GMT (envelope-from davidxu@freebsd.org) Message-ID: <4CC864E4.5050606@freebsd.org> Date: Wed, 27 Oct 2010 17:44:04 +0000 From: David Xu User-Agent: Thunderbird 2.0.0.24 (X11/20100630) MIME-Version: 1.0 To: Garrett Cooper References: <201010270929.o9R9T4oI097923@svn.freebsd.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r214412 - in head: lib/libthr/thread sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Oct 2010 09:44:05 -0000 Garrett Cooper wrote: > On Wed, Oct 27, 2010 at 2:29 AM, David Xu wrote: >> Author: davidxu >> Date: Wed Oct 27 09:29:03 2010 >> New Revision: 214412 >> URL: http://svn.freebsd.org/changeset/base/214412 >> >> Log: >> - Revert r214409. >> - Use long word to figure out sizeof kernel cpuset, hope it works. >> >> Modified: >> head/lib/libthr/thread/thr_attr.c >> head/sys/kern/kern_cpuset.c >> >> Modified: head/lib/libthr/thread/thr_attr.c >> ============================================================================== >> --- head/lib/libthr/thread/thr_attr.c Wed Oct 27 07:14:46 2010 (r214411) >> +++ head/lib/libthr/thread/thr_attr.c Wed Oct 27 09:29:03 2010 (r214412) >> @@ -574,13 +574,14 @@ _get_kern_cpuset_size(void) >> >> if (kern_cpuset_size == 0) { >> size_t len; >> + int maxcpus; >> >> - len = sizeof(kern_cpuset_size); >> - if (sysctlbyname("kern.smp.maxcpus", &kern_cpuset_size, >> - &len, NULL, 0)) >> + len = sizeof(maxcpus); >> + if (sysctlbyname("kern.smp.maxcpus", &maxcpus, &len, NULL, 0)) >> PANIC("failed to get sysctl kern.smp.maxcpus"); >> - >> - kern_cpuset_size = (kern_cpuset_size + 7) / 8; >> + int nbits_long = sizeof(long) * NBBY; >> + int num_long = (maxcpus + nbits_long - 1) / nbits_long; >> + kern_cpuset_size = num_long * sizeof(long); >> } >> >> return (kern_cpuset_size); >> >> Modified: head/sys/kern/kern_cpuset.c >> ============================================================================== >> --- head/sys/kern/kern_cpuset.c Wed Oct 27 07:14:46 2010 (r214411) >> +++ head/sys/kern/kern_cpuset.c Wed Oct 27 09:29:03 2010 (r214412) >> @@ -889,10 +889,6 @@ cpuset_getaffinity(struct thread *td, st >> int error; >> size_t size; >> >> - if (uap->cpusetsize == 0) { >> - td->td_retval[0] = sizeof(cpuset_t); >> - return (0); >> - } >> if (uap->cpusetsize < sizeof(cpuset_t) || >> uap->cpusetsize > CPU_MAXSIZE / NBBY) >> return (ERANGE); > > Are you sure this won't break 32-bit on 64-bit architectures, i.e. > amd64, mips, powerpc64, sparc64? > Thanks, > -Garrett > Unfortunately, I have not thought 32-bit on 64-bit kernel, we have a bunch of system calls, but still can not get a simple size. From owner-svn-src-head@FreeBSD.ORG Wed Oct 27 09:59:43 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 64087106564A; Wed, 27 Oct 2010 09:59:43 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 52B398FC18; Wed, 27 Oct 2010 09:59:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9R9xh8t098987; Wed, 27 Oct 2010 09:59:43 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9R9xh6g098985; Wed, 27 Oct 2010 09:59:43 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201010270959.o9R9xh6g098985@svn.freebsd.org> From: David Xu Date: Wed, 27 Oct 2010 09:59:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214413 - head/lib/libthr/thread X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Oct 2010 09:59:43 -0000 Author: davidxu Date: Wed Oct 27 09:59:43 2010 New Revision: 214413 URL: http://svn.freebsd.org/changeset/base/214413 Log: Check small set and reject it, this is how kernel did. Always use the size kernel is using. Modified: head/lib/libthr/thread/thr_attr.c Modified: head/lib/libthr/thread/thr_attr.c ============================================================================== --- head/lib/libthr/thread/thr_attr.c Wed Oct 27 09:29:03 2010 (r214412) +++ head/lib/libthr/thread/thr_attr.c Wed Oct 27 09:59:43 2010 (r214413) @@ -141,19 +141,14 @@ _pthread_attr_get_np(pthread_t pthread, struct pthread *curthread; struct pthread_attr attr, *dst; int ret; - size_t cpusetsize; + size_t kern_size; if (pthread == NULL || dstattr == NULL || (dst = *dstattr) == NULL) return (EINVAL); - cpusetsize = _get_kern_cpuset_size(); - if (dst->cpusetsize < cpusetsize) { - char *newset = realloc(dst->cpuset, cpusetsize); - if (newset == NULL) - return (errno); - memset(newset + dst->cpusetsize, 0, cpusetsize - - dst->cpusetsize); - dst->cpuset = (cpuset_t *)newset; - dst->cpusetsize = cpusetsize; + kern_size = _get_kern_cpuset_size(); + if (dst->cpuset == NULL) { + dst->cpuset = calloc(1, kern_size); + dst->cpusetsize = kern_size; } curthread = _get_curthread(); if ((ret = _thr_find_thread(curthread, pthread, /*include dead*/0)) != 0) @@ -606,27 +601,25 @@ _pthread_attr_setaffinity_np(pthread_att } return (0); } - - if (cpusetsize > attr->cpusetsize) { - size_t kern_size = _get_kern_cpuset_size(); - if (cpusetsize > kern_size) { - size_t i; - for (i = kern_size; i < cpusetsize; ++i) { - if (((char *)cpusetp)[i]) - return (EINVAL); - } + size_t kern_size = _get_kern_cpuset_size(); + /* Kernel rejects small set, we check it here too. */ + if (cpusetsize < kern_size) + return (ERANGE); + if (cpusetsize > kern_size) { + /* Kernel checks invalid bits, we check it here too. */ + size_t i; + for (i = kern_size; i < cpusetsize; ++i) { + if (((char *)cpusetp)[i]) + return (EINVAL); } - void *newset = realloc(attr->cpuset, cpusetsize); - if (newset == NULL) - return (ENOMEM); - attr->cpuset = newset; - attr->cpusetsize = cpusetsize; - } else { - memset(((char *)attr->cpuset) + cpusetsize, 0, - attr->cpusetsize - cpusetsize); - attr->cpusetsize = cpusetsize; } - memcpy(attr->cpuset, cpusetp, cpusetsize); + if (attr->cpuset == NULL) { + attr->cpuset = calloc(1, kern_size); + if (attr->cpuset == NULL) + return (errno); + attr->cpusetsize = kern_size; + } + memcpy(attr->cpuset, cpusetp, kern_size); ret = 0; } return (ret); @@ -642,16 +635,18 @@ _pthread_attr_getaffinity_np(const pthre if (pattr == NULL || (attr = (*pattr)) == NULL) ret = EINVAL; - else if (attr->cpuset != NULL) { - memcpy(cpusetp, attr->cpuset, MIN(cpusetsize, attr->cpusetsize)); - if (cpusetsize > attr->cpusetsize) - memset(((char *)cpusetp) + attr->cpusetsize, 0, - cpusetsize - attr->cpusetsize); - } else { + else { + /* Kernel rejects small set, we check it here too. */ size_t kern_size = _get_kern_cpuset_size(); - memset(cpusetp, -1, MIN(cpusetsize, kern_size)); + if (cpusetsize < kern_size) + return (ERANGE); + if (attr->cpuset != NULL) + memcpy(cpusetp, attr->cpuset, MIN(cpusetsize, + attr->cpusetsize)); + else + memset(cpusetp, -1, kern_size); if (cpusetsize > kern_size) - memset(((char *)cpusetp) + kern_size, 0, + memset(((char *)cpusetp) + kern_size, 0, cpusetsize - kern_size); } return (ret); From owner-svn-src-head@FreeBSD.ORG Wed Oct 27 11:18:39 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1A0FD106566C; Wed, 27 Oct 2010 11:18:39 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id E67A18FC0C; Wed, 27 Oct 2010 11:18:38 +0000 (UTC) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 8CECD46B06; Wed, 27 Oct 2010 07:18:38 -0400 (EDT) Date: Wed, 27 Oct 2010 12:18:38 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: David Xu In-Reply-To: <4CC80ABA.3080404@freebsd.org> Message-ID: References: <201010270232.o9R2Wsu3084553@svn.freebsd.org> <4CC803A8.3040602@freebsd.org> <4CC80ABA.3080404@freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Garrett Cooper Subject: Re: svn commit: r214409 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Oct 2010 11:18:39 -0000 On Wed, 27 Oct 2010, David Xu wrote: >>> I really hate to see such a problem that userland can not figure out what >>> kernel is using, I try hardly to guess, but still can not find what it is >>> using. yes, I think the doc may need to be fixed or another syscall is >>> needed. >> >> Well... Jeff's code in cpuset(1) does some trivial sizeof(mask) 's, but >> it just passes in cpuset_t for mask. I've seen different calling >> conventions at the kernel level when I tried to get my brain in sync with >> that for a bug I was looking at a few weeks ago (and sadly, failed to some >> degree). >> These syscalls are a bit confusing though, and apart from cpuset(1) >> there aren't any really good examples in the sourcebase on how to use them >> (at least not the last time I checked)... Thanks, -Garrett >> > The problem is that the size of cpuset is not fixed, it is tunable by the > recompiling kernel with different parameter, so if you have a program which > you want to adapt it to use any size of cpuset, it should be able to get the > size the kernel is using, if you don't have source code of the program, you > can not compile it with new parameter, then there is trouble. Yay, it's fd_set all over again :-). It sounds like we might just need to add a sysctl and a few wrapper functions in userspace along the lines of (hand-wave): cpuset_t *cpuset_alloc(); void cpuset_free(); And perhaps some sort of API that abstracts manipulation of the set (or doesn't but allows the user to easily query its bounds). Robert From owner-svn-src-head@FreeBSD.ORG Wed Oct 27 12:51:36 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7F898106566B; Wed, 27 Oct 2010 12:51:36 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6ED938FC14; Wed, 27 Oct 2010 12:51:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9RCpaAH006423; Wed, 27 Oct 2010 12:51:36 GMT (envelope-from bapt@svn.freebsd.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9RCpaIh006421; Wed, 27 Oct 2010 12:51:36 GMT (envelope-from bapt@svn.freebsd.org) Message-Id: <201010271251.o9RCpaIh006421@svn.freebsd.org> From: Baptiste Daroussin Date: Wed, 27 Oct 2010 12:51:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214414 - head/share/misc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Oct 2010 12:51:36 -0000 Author: bapt (ports committer) Date: Wed Oct 27 12:51:36 2010 New Revision: 214414 URL: http://svn.freebsd.org/changeset/base/214414 Log: Add attachement to my mentors Reporter by: wxs (on irc) Modified: head/share/misc/committers-ports.dot Modified: head/share/misc/committers-ports.dot ============================================================================== --- head/share/misc/committers-ports.dot Wed Oct 27 09:59:43 2010 (r214413) +++ head/share/misc/committers-ports.dot Wed Oct 27 12:51:36 2010 (r214414) @@ -261,6 +261,8 @@ itetcu -> araujo itetcu -> dryice itetcu -> sahil +jadawin -> bapt + joerg -> netchild knu -> daichi @@ -365,6 +367,7 @@ steve -> netchild tabthorpe -> ashish tabthorpe -> avilla tabthorpe -> avl +tabthorpe -> bapt tabthorpe -> fluffy tabthorpe -> jacula tabthorpe -> jadawin From owner-svn-src-head@FreeBSD.ORG Wed Oct 27 12:57:09 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from alona.my.domain (localhost [127.0.0.1]) by hub.freebsd.org (Postfix) with ESMTP id 5E1731065673; Wed, 27 Oct 2010 12:57:08 +0000 (UTC) (envelope-from davidxu@freebsd.org) Message-ID: <4CC82195.5000201@freebsd.org> Date: Wed, 27 Oct 2010 20:56:53 +0800 From: David Xu User-Agent: Thunderbird 2.0.0.21 (X11/20090522) MIME-Version: 1.0 To: Robert Watson References: <201010270232.o9R2Wsu3084553@svn.freebsd.org> <4CC803A8.3040602@freebsd.org> <4CC80ABA.3080404@freebsd.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Garrett Cooper Subject: Re: svn commit: r214409 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Oct 2010 12:57:09 -0000 Robert Watson wrote: > > On Wed, 27 Oct 2010, David Xu wrote: > >>>> I really hate to see such a problem that userland can not figure >>>> out what kernel is using, I try hardly to guess, but still can not >>>> find what it is using. yes, I think the doc may need to be fixed or >>>> another syscall is needed. >>> >>> Well... Jeff's code in cpuset(1) does some trivial sizeof(mask) >>> 's, but it just passes in cpuset_t for mask. I've seen different >>> calling conventions at the kernel level when I tried to get my brain >>> in sync with that for a bug I was looking at a few weeks ago (and >>> sadly, failed to some degree). >>> These syscalls are a bit confusing though, and apart from >>> cpuset(1) there aren't any really good examples in the sourcebase on >>> how to use them (at least not the last time I checked)... Thanks, >>> -Garrett >>> >> The problem is that the size of cpuset is not fixed, it is tunable by >> the recompiling kernel with different parameter, so if you have a >> program which you want to adapt it to use any size of cpuset, it >> should be able to get the size the kernel is using, if you don't have >> source code of the program, you can not compile it with new >> parameter, then there is trouble. > > Yay, it's fd_set all over again :-). > > It sounds like we might just need to add a sysctl and a few wrapper > functions in userspace along the lines of (hand-wave): > > cpuset_t *cpuset_alloc(); > void cpuset_free(); > > And perhaps some sort of API that abstracts manipulation of the set (or > doesn't but allows the user to easily query its bounds). > > Robert > Problem is who will use the non-standard interface ? The pthread_attr_getaffinity_np pthread_attr_setaffinity_np and others are from glibc, which let you specify arbitrary cpuset size but kernel only accept one size. :-) Though it is not POSIX, but some software start to use it, AFAIK, Erlang language's VM start to use it for binding its scheduler thread to cpu, we have to live with it. We still lack of some functions to let it compile without modification, one is it wants to know cpu topology, and other crappy functions it wants to use is: sched_getaffinity, sched_setaffinity, which one guy thought each thread is just a process which has a PID. :-) I don't know how it uses Solaris processor binding interface. From owner-svn-src-head@FreeBSD.ORG Wed Oct 27 13:06:08 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7FC101065673; Wed, 27 Oct 2010 13:06:08 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id 618E28FC23; Wed, 27 Oct 2010 13:06:07 +0000 (UTC) Received: by wyb42 with SMTP id 42so662515wyb.13 for ; Wed, 27 Oct 2010 06:06:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=GrOIE+apgTk8JYgo7/kc4XZOmtInF1metD36zLLIy9w=; b=lXjeFm/TdyINbiWYr9rMKxaWmI2uvtgjM45y06FfMSRPGol8ecSZWz3bfKCmx0OegX pTX/X3OUM6I7VS6+LWzqZfEQs7YVkn47DZdHBT617xXv5E7YzuQazVseBbHw6q9X8MP1 F1NQcMT6uTqY7YwtgRJ1VVl0I97BbkFmMpiqI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=fTlW5CgH07GhU6OLHKr5ljF+SEBNvuTcMtDDJFoj/FSzp7PmpP/GiLI2QBuxP5fe18 22YZubTbzB2fPNvImwQQsASL4mbuO5bHnRbt9gg1xv7gg9m1yVATVt51x6dploOMV2pi JycXcun1Mh9vxv55j3neQYl0BHW9uMRm4s/c4= MIME-Version: 1.0 Received: by 10.216.1.6 with SMTP id 6mr9025440wec.24.1288184766388; Wed, 27 Oct 2010 06:06:06 -0700 (PDT) Sender: yanegomi@gmail.com Received: by 10.216.10.198 with HTTP; Wed, 27 Oct 2010 06:06:06 -0700 (PDT) In-Reply-To: <4CC82195.5000201@freebsd.org> References: <201010270232.o9R2Wsu3084553@svn.freebsd.org> <4CC803A8.3040602@freebsd.org> <4CC80ABA.3080404@freebsd.org> <4CC82195.5000201@freebsd.org> Date: Wed, 27 Oct 2010 06:06:06 -0700 X-Google-Sender-Auth: shMS-QCBUz651ZiaUXXXhE5PHIE Message-ID: From: Garrett Cooper To: David Xu Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Robert Watson Subject: Re: svn commit: r214409 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Oct 2010 13:06:08 -0000 On Wed, Oct 27, 2010 at 5:56 AM, David Xu wrote: > Robert Watson wrote: >> >> On Wed, 27 Oct 2010, David Xu wrote: >> >>>>> I really hate to see such a problem that userland can not figure out >>>>> what kernel is using, I try hardly to guess, but still can not find w= hat it >>>>> is using. yes, I think the doc may need to be fixed or another syscal= l is >>>>> needed. >>>> >>>> =A0 =A0Well... Jeff's code in cpuset(1) does some trivial sizeof(mask)= 's, >>>> but it just passes in cpuset_t for mask. I've seen different calling >>>> conventions at the kernel level when I tried to get my brain in sync w= ith >>>> that for a bug I was looking at a few weeks ago (and sadly, failed to = some >>>> degree). >>>> =A0 =A0These syscalls are a bit confusing though, and apart from cpuse= t(1) >>>> there aren't any really good examples in the sourcebase on how to use = them >>>> (at least not the last time I checked)... Thanks, -Garrett >>>> >>> The problem is that the size of cpuset is not fixed, it is tunable by t= he >>> recompiling kernel with different parameter, so if you have a program w= hich >>> you want to adapt it to use any size of cpuset, it should be able to ge= t the >>> size the kernel is using, if you don't have source code of the program,= you >>> can not compile it with new parameter, then there is trouble. >> >> Yay, it's fd_set all over again :-). >> >> It sounds like we might just need to add a sysctl and a few wrapper >> functions in userspace along the lines of (hand-wave): >> >> cpuset_t =A0 =A0*cpuset_alloc(); >> void =A0 =A0 =A0 =A0 cpuset_free(); >> >> And perhaps some sort of API that abstracts manipulation of the set (or >> doesn't but allows the user to easily query its bounds). >> >> Robert >> > Problem is who will use the non-standard interface ? The > pthread_attr_getaffinity_np pthread_attr_setaffinity_np > and others are from glibc, which let you specify arbitrary > cpuset size but kernel only accept one size. =A0:-) > > Though it is not POSIX, but some software start to use it, AFAIK, > Erlang language's VM start to use it for binding its scheduler > thread to cpu, we have to live with it. We still lack of some functions > to let it compile without modification, one is it wants to know > cpu topology, and other crappy functions it wants to use is: > sched_getaffinity, sched_setaffinity, which one guy thought each > thread is just a process which has a =A0PID. =A0:-) > I don't know how it uses Solaris processor binding interface. I brought this up a while back over the Austin Group list, but it looks like I need to file an Aardvark ticket for it and attend the meetings so the OpenGroup folks actually take the issue to heart. From owner-svn-src-head@FreeBSD.ORG Wed Oct 27 13:12:07 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2916C106566B; Wed, 27 Oct 2010 13:12:07 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id F248A8FC15; Wed, 27 Oct 2010 13:12:06 +0000 (UTC) Received: from [192.168.2.105] (host86-177-32-238.range86-177.btcentralplus.com [86.177.32.238]) by cyrus.watson.org (Postfix) with ESMTPSA id BFC2A46B09; Wed, 27 Oct 2010 09:12:05 -0400 (EDT) Mime-Version: 1.0 (Apple Message framework v1081) Content-Type: text/plain; charset=us-ascii From: "Robert N. M. Watson" In-Reply-To: <4CC82195.5000201@freebsd.org> Date: Wed, 27 Oct 2010 14:12:03 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: <0D9C8E2A-520C-4A45-A93F-C958DDA421C6@FreeBSD.org> References: <201010270232.o9R2Wsu3084553@svn.freebsd.org> <4CC803A8.3040602@freebsd.org> <4CC80ABA.3080404@freebsd.org> <4CC82195.5000201@freebsd.org> To: David Xu X-Mailer: Apple Mail (2.1081) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Garrett Cooper Subject: Re: svn commit: r214409 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Oct 2010 13:12:07 -0000 On 27 Oct 2010, at 13:56, David Xu wrote: >> Yay, it's fd_set all over again :-). >>=20 >> It sounds like we might just need to add a sysctl and a few wrapper = functions in userspace along the lines of (hand-wave): >>=20 >> cpuset_t *cpuset_alloc(); >> void cpuset_free(); >>=20 >> And perhaps some sort of API that abstracts manipulation of the set = (or >> doesn't but allows the user to easily query its bounds). > Problem is who will use the non-standard interface ? The = pthread_attr_getaffinity_np pthread_attr_setaffinity_np > and others are from glibc, which let you specify arbitrary > cpuset size but kernel only accept one size. :-) >=20 > Though it is not POSIX, but some software start to use it, AFAIK, > Erlang language's VM start to use it for binding its scheduler > thread to cpu, we have to live with it. We still lack of some = functions > to let it compile without modification, one is it wants to know > cpu topology, and other crappy functions it wants to use is: > sched_getaffinity, sched_setaffinity, which one guy thought each > thread is just a process which has a PID. :-) > I don't know how it uses Solaris processor binding interface. I see two separate problems here: (1) Providing potentially non-portable APIs that do the right thing, and = do it well. (2) Providing definitely portable APIs whose implementation is as robust = as possible given their flawed semantics. I.e., don't crash on common = use. The latter should be implemented in terms of the former. Robert= From owner-svn-src-head@FreeBSD.ORG Wed Oct 27 13:33:18 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 647051065672; Wed, 27 Oct 2010 13:33:18 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id ADF048FC0A; Wed, 27 Oct 2010 13:33:17 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id o9RDX9Nj080213 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 27 Oct 2010 16:33:09 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4) with ESMTP id o9RDX9NH054205; Wed, 27 Oct 2010 16:33:09 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id o9RDX7WA054204; Wed, 27 Oct 2010 16:33:07 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 27 Oct 2010 16:33:07 +0300 From: Kostik Belousov To: David Xu Message-ID: <20101027133307.GQ2392@deviant.kiev.zoral.com.ua> References: <201010270232.o9R2Wsu3084553@svn.freebsd.org> <4CC803A8.3040602@freebsd.org> <20101027082122.GD1848@garage.freebsd.pl> <4CC85552.2020100@freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="qShzMMhzd2CdnVN0" Content-Disposition: inline In-Reply-To: <4CC85552.2020100@freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-3.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Pawel Jakub Dawidek , Garrett Cooper Subject: Re: svn commit: r214409 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Oct 2010 13:33:18 -0000 --qShzMMhzd2CdnVN0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Oct 27, 2010 at 04:37:38PM +0000, David Xu wrote: > Pawel Jakub Dawidek wrote: > >On Wed, Oct 27, 2010 at 10:49:12AM +0000, David Xu wrote: > >>I really hate to see such a problem that userland can not figure out > >>what kernel is using, I try hardly to guess, but still can not find > >>what it is using. yes, I think the doc may need to be fixed or > >>another syscall is needed. > > > >Maybe you could just add sysctl and eventually put it into sysconf(3)? > > >=20 > I just found a dirty method, use sizeof(long) and kern.smp.maxcpus > 32 to figure out the size the kernel is using, because it is how > cpuset_t is constructed, wish it will never be changed. ;-) >=20 I think that sysctl is the way forward, but you may add non-portable FreeBSD function to get the value, and use an ELF aux vector interface to avoid sysctl most of the time. --qShzMMhzd2CdnVN0 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEARECAAYFAkzIKhIACgkQC3+MBN1Mb4g0RACg4rYLGVbX4vXDx5/wOjp30mGc P48AniTB28JicB/3vkEGN6J0nR86AEJn =Wl2c -----END PGP SIGNATURE----- --qShzMMhzd2CdnVN0-- From owner-svn-src-head@FreeBSD.ORG Wed Oct 27 14:08:37 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E4D001065670; Wed, 27 Oct 2010 14:08:37 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D3FCE8FC13; Wed, 27 Oct 2010 14:08:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9RE8be3009106; Wed, 27 Oct 2010 14:08:37 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9RE8b1D009104; Wed, 27 Oct 2010 14:08:37 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201010271408.o9RE8b1D009104@svn.freebsd.org> From: Jaakko Heinonen Date: Wed, 27 Oct 2010 14:08:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214418 - head/sys/nfsclient X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Oct 2010 14:08:38 -0000 Author: jh Date: Wed Oct 27 14:08:37 2010 New Revision: 214418 URL: http://svn.freebsd.org/changeset/base/214418 Log: Add missing "readahead" to the nfs_opts list. PR: 151321 Tested by: Simon Walton MFC after: 2 weeks Modified: head/sys/nfsclient/nfs_vfsops.c Modified: head/sys/nfsclient/nfs_vfsops.c ============================================================================== --- head/sys/nfsclient/nfs_vfsops.c Wed Oct 27 13:38:40 2010 (r214417) +++ head/sys/nfsclient/nfs_vfsops.c Wed Oct 27 14:08:37 2010 (r214418) @@ -779,10 +779,10 @@ static const char *nfs_opts[] = { "from" "noatime", "noexec", "suiddir", "nosuid", "nosymfollow", "union", "noclusterr", "noclusterw", "multilabel", "acls", "force", "update", "async", "dumbtimer", "noconn", "nolockd", "intr", "rdirplus", "resvport", - "readdirsize", "soft", "hard", "mntudp", "tcp", "udp", "wsize", "rsize", - "retrans", "acregmin", "acregmax", "acdirmin", "acdirmax", - "deadthresh", "hostname", "timeout", "addr", "fh", "nfsv3", "sec", - "maxgroups", "principal", "negnametimeo", + "readahead", "readdirsize", "soft", "hard", "mntudp", "tcp", "udp", + "wsize", "rsize", "retrans", "acregmin", "acregmax", "acdirmin", + "acdirmax", "deadthresh", "hostname", "timeout", "addr", "fh", "nfsv3", + "sec", "maxgroups", "principal", "negnametimeo", NULL }; /* From owner-svn-src-head@FreeBSD.ORG Wed Oct 27 14:11:11 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A06B3106566C; Wed, 27 Oct 2010 14:11:11 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8FCEA8FC08; Wed, 27 Oct 2010 14:11:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9REBBt4009246; Wed, 27 Oct 2010 14:11:11 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9REBBNI009244; Wed, 27 Oct 2010 14:11:11 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201010271411.o9REBBNI009244@svn.freebsd.org> From: Jaakko Heinonen Date: Wed, 27 Oct 2010 14:11:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214419 - head/sbin/mount_nfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Oct 2010 14:11:11 -0000 Author: jh Date: Wed Oct 27 14:11:11 2010 New Revision: 214419 URL: http://svn.freebsd.org/changeset/base/214419 Log: Correct a typo. PR: 151321 Submitted by: Simon Walton MFC after: 3 days Modified: head/sbin/mount_nfs/mount_nfs.c Modified: head/sbin/mount_nfs/mount_nfs.c ============================================================================== --- head/sbin/mount_nfs/mount_nfs.c Wed Oct 27 14:08:37 2010 (r214418) +++ head/sbin/mount_nfs/mount_nfs.c Wed Oct 27 14:11:11 2010 (r214419) @@ -177,7 +177,7 @@ main(int argc, char *argv[]) mountmode = V3; break; case 'a': - printf("-a deprecated, use -o readhead=\n"); + printf("-a deprecated, use -o readahead=\n"); build_iovec(&iov, &iovlen, "readahead", optarg, (size_t)-1); break; case 'b': From owner-svn-src-head@FreeBSD.ORG Wed Oct 27 15:19:22 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from alona.my.domain (localhost [127.0.0.1]) by hub.freebsd.org (Postfix) with ESMTP id C3053106566B; Wed, 27 Oct 2010 15:19:21 +0000 (UTC) (envelope-from davidxu@freebsd.org) Message-ID: <4CC842EA.7030308@freebsd.org> Date: Wed, 27 Oct 2010 23:19:06 +0800 From: David Xu User-Agent: Thunderbird 2.0.0.21 (X11/20090522) MIME-Version: 1.0 To: "Robert N. M. Watson" References: <201010270232.o9R2Wsu3084553@svn.freebsd.org> <4CC803A8.3040602@freebsd.org> <4CC80ABA.3080404@freebsd.org> <4CC82195.5000201@freebsd.org> <0D9C8E2A-520C-4A45-A93F-C958DDA421C6@FreeBSD.org> In-Reply-To: <0D9C8E2A-520C-4A45-A93F-C958DDA421C6@FreeBSD.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Garrett Cooper Subject: Re: svn commit: r214409 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Oct 2010 15:19:23 -0000 Robert N. M. Watson wrote: > On 27 Oct 2010, at 13:56, David Xu wrote: > > >>> Yay, it's fd_set all over again :-). >>> >>> It sounds like we might just need to add a sysctl and a few wrapper functions in userspace along the lines of (hand-wave): >>> >>> cpuset_t *cpuset_alloc(); >>> void cpuset_free(); >>> >>> And perhaps some sort of API that abstracts manipulation of the set (or >>> doesn't but allows the user to easily query its bounds). >>> > > >> Problem is who will use the non-standard interface ? The pthread_attr_getaffinity_np pthread_attr_setaffinity_np >> and others are from glibc, which let you specify arbitrary >> cpuset size but kernel only accept one size. :-) >> >> Though it is not POSIX, but some software start to use it, AFAIK, >> Erlang language's VM start to use it for binding its scheduler >> thread to cpu, we have to live with it. We still lack of some functions >> to let it compile without modification, one is it wants to know >> cpu topology, and other crappy functions it wants to use is: >> sched_getaffinity, sched_setaffinity, which one guy thought each >> thread is just a process which has a PID. :-) >> I don't know how it uses Solaris processor binding interface. >> > > I see two separate problems here: > > (1) Providing potentially non-portable APIs that do the right thing, and do it well. > > (2) Providing definitely portable APIs whose implementation is as robust as possible given their flawed semantics. I.e., don't crash on common use. > > The latter should be implemented in terms of the former. > > Robert > You still can make wrapper functions, the glibc pthread API is unrelated to this. you can write a library to manage the cpuset, cpuset allocation and freeing are done by the library, but hide or make the cpuset size read-only, the size can be queried but can not be changed, the cpuset when allocated always has same size as kernel's. you even can do more work, explore kernel cpu topology data and provide interface, current one can only access xml data via sysctl kern.sched.topology_spec which is not easy if a program can not parse xml, even there is a parser, it is still not easy. From owner-svn-src-head@FreeBSD.ORG Wed Oct 27 16:07:40 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E1BD71065672; Wed, 27 Oct 2010 16:07:40 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id CBD1B8FC17; Wed, 27 Oct 2010 16:07:39 +0000 (UTC) Received: by wwb24 with SMTP id 24so810113wwb.31 for ; Wed, 27 Oct 2010 09:07:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type; bh=FRJU5r/w71R+p4m6cqsd6pehK7dikrCOFdDZmh1qLoY=; b=bRyKNxuk0kUbkV+iTFsBBvk8c7mr0eZt9fEI5KZZ8zutZOwwcEstGJqopyD73nZm/z NmjU8uxPmh6qc3kHaBMnPsfCjQWdsjCfF7i9DdsCXy9QOK53AUU3Nf9FPv973nQnTZY2 glLCCuX3Y3q7MR+G4eQxeSXaVqGqiPSmLxOZQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; b=BLmk5oGlG/pBJ7jpk7nhdGHWlYugHmo8gSVjpjL0V4gNQZGWb6OcTpCRfmzulrgxPf 9VTgW3bF7BaKxBGHZiRCcwDWFv97fKh3Mv4qemSoIQFOwfB0jQggW8pDlDC/5x8wJ2Jp 048/9KmmQIGP5snmpXd+vkNhA+mR839edSHGM= MIME-Version: 1.0 Received: by 10.216.23.147 with SMTP id v19mr1054195wev.58.1288195658264; Wed, 27 Oct 2010 09:07:38 -0700 (PDT) Sender: yanegomi@gmail.com Received: by 10.216.10.198 with HTTP; Wed, 27 Oct 2010 09:07:37 -0700 (PDT) In-Reply-To: <20101027133307.GQ2392@deviant.kiev.zoral.com.ua> References: <201010270232.o9R2Wsu3084553@svn.freebsd.org> <4CC803A8.3040602@freebsd.org> <20101027082122.GD1848@garage.freebsd.pl> <4CC85552.2020100@freebsd.org> <20101027133307.GQ2392@deviant.kiev.zoral.com.ua> Date: Wed, 27 Oct 2010 09:07:37 -0700 X-Google-Sender-Auth: mHF7z1HoNYBFVdi1KUJBCbEtzZk Message-ID: From: Garrett Cooper To: Kostik Belousov Content-Type: multipart/mixed; boundary=0016364d1f159cc03b04939b6ccb Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Pawel Jakub Dawidek , David Xu Subject: Re: svn commit: r214409 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Oct 2010 16:07:41 -0000 --0016364d1f159cc03b04939b6ccb Content-Type: text/plain; charset=ISO-8859-1 On Wed, Oct 27, 2010 at 6:33 AM, Kostik Belousov wrote: > On Wed, Oct 27, 2010 at 04:37:38PM +0000, David Xu wrote: >> Pawel Jakub Dawidek wrote: >> >On Wed, Oct 27, 2010 at 10:49:12AM +0000, David Xu wrote: >> >>I really hate to see such a problem that userland can not figure out >> >>what kernel is using, I try hardly to guess, but still can not find >> >>what it is using. yes, I think the doc may need to be fixed or >> >>another syscall is needed. >> > >> >Maybe you could just add sysctl and eventually put it into sysconf(3)? >> > >> >> I just found a dirty method, use sizeof(long) and kern.smp.maxcpus >> 32 to figure out the size the kernel is using, because it is how >> cpuset_t is constructed, wish it will never be changed. ;-) >> > I think that sysctl is the way forward, but you may add non-portable > FreeBSD function to get the value, and use an ELF aux vector interface > to avoid sysctl most of the time. How about this patch? I implemented this as a readonly tunable and sysconf tunable, because (AFAIK) the value that is being tested shouldn't change during runtime after the system has been booted up, and figuring that the value wasn't going to change it was better to lose 4/8 bytes on the kernel stack instead of having to recompute the value every time in a function call, with the associated lost heap / stack memory in the process, as the assumption is that this libcall was going to be called frequently by some programs. Thanks! -Garrett --0016364d1f159cc03b04939b6ccb Content-Type: text/x-patch; charset=US-ASCII; name="cpuset_t-size-sysctl-and-sysconf-value.patch" Content-Disposition: attachment; filename="cpuset_t-size-sysctl-and-sysconf-value.patch" Content-Transfer-Encoding: base64 X-Attachment-Id: f_gfseer440 SW5kZXg6IGluY2x1ZGUvdW5pc3RkLmgKPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQotLS0gaW5jbHVkZS91bmlzdGQuaAko cmV2aXNpb24gMjE0NDEzKQorKysgaW5jbHVkZS91bmlzdGQuaAkod29ya2luZyBjb3B5KQpAQCAt Mjg4LDYgKzI4OCw3IEBACiAjaWYgX19CU0RfVklTSUJMRQogI2RlZmluZQlfU0NfTlBST0NFU1NP UlNfQ09ORgk1NwogI2RlZmluZQlfU0NfTlBST0NFU1NPUlNfT05MTgk1OAorI2RlZmluZQlfU0Nf Q1BVU0VUX1NJWkUJCTEyMgogI2VuZGlmCiAKIC8qIEV4dGVuc2lvbnMgZm91bmQgaW4gU29sYXJp cyBhbmQgTGludXguICovCkluZGV4OiBsaWIvbGliYy9nZW4vc3lzY29uZi5jCj09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0K LS0tIGxpYi9saWJjL2dlbi9zeXNjb25mLmMJKHJldmlzaW9uIDIxNDQxMykKKysrIGxpYi9saWJj L2dlbi9zeXNjb25mLmMJKHdvcmtpbmcgY29weSkKQEAgLTU5Nyw2ICs1OTcsMTUgQEAKIAkJcmV0 dXJuIChsdmFsdWUpOwogI2VuZGlmCiAKKyNpZmRlZiBfU0NfQ1BVU0VUX1NJWkUKKwljYXNlIF9T Q19DUFVTRVRfU0laRToKKwkJbGVuID0gc2l6ZW9mKGx2YWx1ZSk7CisJCWlmIChzeXNjdGxieW5h bWUoImtlcm4uc2NoZWQuY3B1c2V0c2l6ZSIsICZsdmFsdWUsICZsZW4sIE5VTEwsCisJCSAgICAw KSA9PSAtMSkKKwkJCXJldHVybiAoLTEpOworCQlyZXR1cm4gKGx2YWx1ZSk7CisjZW5kaWYKKwog CWRlZmF1bHQ6CiAJCWVycm5vID0gRUlOVkFMOwogCQlyZXR1cm4gKC0xKTsKSW5kZXg6IHN5cy9r ZXJuL3NjaGVkX3VsZS5jCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIHN5cy9rZXJuL3NjaGVkX3VsZS5jCShyZXZp c2lvbiAyMTQ0MTMpCisrKyBzeXMva2Vybi9zY2hlZF91bGUuYwkod29ya2luZyBjb3B5KQpAQCAt MjcxMiw2ICsyNzEyLDggQEAKIAlzYnVmX2RlbGV0ZSh0b3BvKTsKIAlyZXR1cm4gKGVycik7CiB9 CisKK3N0YXRpYyBzaXplX3QgX2tlcm5fY3B1c2V0X3NpemUgPSBzaXplb2YoY3B1c2V0X3QpOwog I2VuZGlmCiAKIFNZU0NUTF9OT0RFKF9rZXJuLCBPSURfQVVUTywgc2NoZWQsIENUTEZMQUdfUlcs IDAsICJTY2hlZHVsZXIiKTsKQEAgLTI3NDgsNiArMjc1MCwxNSBAQAogU1lTQ1RMX1BST0MoX2tl cm5fc2NoZWQsIE9JRF9BVVRPLCB0b3BvbG9neV9zcGVjLCBDVExUWVBFX1NUUklORyB8CiAgICAg Q1RMRkxBR19SRCwgTlVMTCwgMCwgc3lzY3RsX2tlcm5fc2NoZWRfdG9wb2xvZ3lfc3BlYywgIkEi LCAKICAgICAiWE1MIGR1bXAgb2YgZGV0ZWN0ZWQgQ1BVIHRvcG9sb2d5Iik7CisKKy8qIAorICog UmV0dXJuIHRoZSBzaXplIG9mIGNwdXNldF90IGF0IHRoZSBrZXJuZWwgbGV2ZWwKKyAqCisgKiBY WFggKGdjb29wZXIpOiByZXBsYWNlIFVMT05HIHdpdGggU0laRSBvbmNlIENUTFRZUEVfU0laRSBp cyBpbXBsZW1lbnRlZC4KKyAqLworU1lTQ1RMX1VMT05HKF9rZXJuX3NjaGVkLCBPSURfQVVUTywg Y3B1c2V0c2l6ZSwgQ1RMRkxBR19SRFRVTiwKKyAgICAmX2tlcm5fY3B1c2V0X3NpemUsIDAsICJL ZXJuZWwtbGV2ZWwgY3B1c2V0X3Qgc3RydWN0IHNpemUiKTsKKwogI2VuZGlmCiAKIC8qIHBzIGNv bXBhdC4gIEFsbCBjcHUgcGVyY2VudGFnZXMgZnJvbSBVTEUgYXJlIHdlaWdodGVkLiAqLwo= --0016364d1f159cc03b04939b6ccb-- From owner-svn-src-head@FreeBSD.ORG Wed Oct 27 16:22:41 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 54DB7106566B; Wed, 27 Oct 2010 16:22:41 +0000 (UTC) (envelope-from avg@freebsd.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 5CA7D8FC17; Wed, 27 Oct 2010 16:22:39 +0000 (UTC) Received: from odyssey.starpoint.kiev.ua (alpha-e.starpoint.kiev.ua [212.40.38.101]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id TAA26207; Wed, 27 Oct 2010 19:22:37 +0300 (EEST) (envelope-from avg@freebsd.org) Message-ID: <4CC851CC.80509@freebsd.org> Date: Wed, 27 Oct 2010 19:22:36 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.11) Gecko/20101021 Lightning/1.0b2 Thunderbird/3.1.5 MIME-Version: 1.0 To: Garrett Cooper References: <201010270232.o9R2Wsu3084553@svn.freebsd.org> <4CC803A8.3040602@freebsd.org> <20101027082122.GD1848@garage.freebsd.pl> <4CC85552.2020100@freebsd.org> <20101027133307.GQ2392@deviant.kiev.zoral.com.ua> In-Reply-To: X-Enigmail-Version: 1.1.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: src-committers@freebsd.org, Pawel Jakub Dawidek , svn-src-all@freebsd.org, svn-src-head@freebsd.org, David Xu , Kostik Belousov Subject: Re: svn commit: r214409 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Oct 2010 16:22:41 -0000 [patch attachment was lost] on 27/10/2010 19:07 Garrett Cooper said the following: > How about this patch? I implemented this as a readonly tunable and I don't think that it's correct to call it a tunable or use CTLFLAG_RDTUN. As I understand it is a read-only sysctl. > sysconf tunable, because (AFAIK) the value that is being tested > shouldn't change during runtime after the system has been booted up, > and figuring that the value wasn't going to change it was better to > lose 4/8 bytes on the kernel stack instead of having to recompute the > value every time in a function call, with the associated lost heap / > stack memory in the process, as the assumption is that this libcall > was going to be called frequently by some programs. > Thanks! -- Andriy Gapon From owner-svn-src-head@FreeBSD.ORG Wed Oct 27 16:46:38 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4918F1065672; Wed, 27 Oct 2010 16:46:38 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 37A8B8FC18; Wed, 27 Oct 2010 16:46:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9RGkbuw014769; Wed, 27 Oct 2010 16:46:37 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9RGkbvM014765; Wed, 27 Oct 2010 16:46:37 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201010271646.o9RGkbvM014765@svn.freebsd.org> From: Alan Cox Date: Wed, 27 Oct 2010 16:46:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214425 - in head/sys/amd64: amd64 include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Oct 2010 16:46:38 -0000 Author: alc Date: Wed Oct 27 16:46:37 2010 New Revision: 214425 URL: http://svn.freebsd.org/changeset/base/214425 Log: [1] According to the x86 architectural specifications, no virtual-to- physical page mapping should span two or more MTRRs of different types. Add a pmap function, pmap_demote_DMAP(), by which the MTRR module can ensure that the direct map region doesn't have such a mapping. [2] Fix a couple of nearby style errors in amd64_mrset(). [3] Re-enable the use of 1GB page mappings for implementing the direct map. (See also r197580 and r213897.) Tested by: kib@ on a Westmere-family processor [3] MFC after: 3 weeks Modified: head/sys/amd64/amd64/amd64_mem.c head/sys/amd64/amd64/pmap.c head/sys/amd64/include/pmap.h Modified: head/sys/amd64/amd64/amd64_mem.c ============================================================================== --- head/sys/amd64/amd64/amd64_mem.c Wed Oct 27 16:35:23 2010 (r214424) +++ head/sys/amd64/amd64/amd64_mem.c Wed Oct 27 16:46:37 2010 (r214425) @@ -35,6 +35,10 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include +#include + #include #include #include @@ -527,9 +531,9 @@ static int amd64_mrset(struct mem_range_softc *sc, struct mem_range_desc *mrd, int *arg) { struct mem_range_desc *targ; - int error = 0; + int error, i; - switch(*arg) { + switch (*arg) { case MEMRANGE_SET_UPDATE: /* * Make sure that what's being asked for is even @@ -568,6 +572,21 @@ amd64_mrset(struct mem_range_softc *sc, return (EOPNOTSUPP); } + /* + * Ensure that the direct map region does not contain any mappings + * that span MTRRs of different types. However, the fixed MTRRs can + * be ignored, because a large page mapping the first 1 MB of physical + * memory is a special case that the processor handles. The entire + * TLB will be invalidated by amd64_mrstore(), so pmap_demote_DMAP() + * needn't do it. + */ + i = (sc->mr_cap & MR686_FIXMTRR) ? MTRR_N64K + MTRR_N16K + MTRR_N4K : 0; + mrd = sc->mr_desc + i; + for (; i < sc->mr_ndesc; i++, mrd++) { + if (mrd->mr_flags & MDF_ACTIVE) + pmap_demote_DMAP(mrd->mr_base, mrd->mr_len, FALSE); + } + /* Update the hardware. */ amd64_mrstore(sc); @@ -657,6 +676,21 @@ amd64_mrinit(struct mem_range_softc *sc) if (mrd->mr_flags & MDF_ACTIVE) mrd->mr_flags |= MDF_FIRMWARE; } + + /* + * Ensure that the direct map region does not contain any mappings + * that span MTRRs of different types. However, the fixed MTRRs can + * be ignored, because a large page mapping the first 1 MB of physical + * memory is a special case that the processor handles. Invalidate + * any old TLB entries that might hold inconsistent memory type + * information. + */ + i = (sc->mr_cap & MR686_FIXMTRR) ? MTRR_N64K + MTRR_N16K + MTRR_N4K : 0; + mrd = sc->mr_desc + i; + for (; i < sc->mr_ndesc; i++, mrd++) { + if (mrd->mr_flags & MDF_ACTIVE) + pmap_demote_DMAP(mrd->mr_base, mrd->mr_len, TRUE); + } } /* Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Wed Oct 27 16:35:23 2010 (r214424) +++ head/sys/amd64/amd64/pmap.c Wed Oct 27 16:46:37 2010 (r214425) @@ -462,7 +462,7 @@ create_pagetables(vm_paddr_t *firstaddr) if (ndmpdp < 4) /* Minimum 4GB of dirmap */ ndmpdp = 4; DMPDPphys = allocpages(firstaddr, NDMPML4E); - if (TRUE || (amd_feature & AMDID_PAGE1GB) == 0) + if ((amd_feature & AMDID_PAGE1GB) == 0) DMPDphys = allocpages(firstaddr, ndmpdp); dmaplimit = (vm_paddr_t)ndmpdp << PDPSHIFT; @@ -494,11 +494,16 @@ create_pagetables(vm_paddr_t *firstaddr) ((pdp_entry_t *)KPDPphys)[i + KPDPI] |= PG_RW | PG_V | PG_U; } - /* Now set up the direct map space using either 2MB or 1GB pages */ - /* Preset PG_M and PG_A because demotion expects it */ - if (TRUE || (amd_feature & AMDID_PAGE1GB) == 0) { + /* + * Now, set up the direct map region using either 2MB or 1GB pages. + * Later, if pmap_mapdev{_attr}() uses the direct map for non-write- + * back memory, pmap_change_attr() will demote any 2MB or 1GB page + * mappings that are partially used. + */ + if ((amd_feature & AMDID_PAGE1GB) == 0) { for (i = 0; i < NPDEPG * ndmpdp; i++) { ((pd_entry_t *)DMPDphys)[i] = (vm_paddr_t)i << PDRSHIFT; + /* Preset PG_M and PG_A because demotion expects it. */ ((pd_entry_t *)DMPDphys)[i] |= PG_RW | PG_V | PG_PS | PG_G | PG_M | PG_A; } @@ -512,6 +517,7 @@ create_pagetables(vm_paddr_t *firstaddr) for (i = 0; i < ndmpdp; i++) { ((pdp_entry_t *)DMPDPphys)[i] = (vm_paddr_t)i << PDPSHIFT; + /* Preset PG_M and PG_A because demotion expects it. */ ((pdp_entry_t *)DMPDPphys)[i] |= PG_RW | PG_V | PG_PS | PG_G | PG_M | PG_A; } @@ -4948,6 +4954,49 @@ pmap_change_attr_locked(vm_offset_t va, } /* + * Demotes any mapping within the direct map region that covers more than the + * specified range of physical addresses. This range's size must be a power + * of two and its starting address must be a multiple of its size. Since the + * demotion does not change any attributes of the mapping, a TLB invalidation + * is not mandatory. The caller may, however, request a TLB invalidation. + */ +void +pmap_demote_DMAP(vm_paddr_t base, vm_size_t len, boolean_t invalidate) +{ + pdp_entry_t *pdpe; + pd_entry_t *pde; + vm_offset_t va; + boolean_t changed; + + if (len < NBPDP) { + va = PHYS_TO_DMAP(base); + changed = FALSE; + PMAP_LOCK(kernel_pmap); + pdpe = pmap_pdpe(kernel_pmap, va); + if ((*pdpe & PG_V) == 0) + panic("pmap_demote_DMAP: invalid PDPE"); + if ((*pdpe & PG_PS) != 0) { + if (!pmap_demote_pdpe(kernel_pmap, pdpe, va)) + panic("pmap_demote_DMAP: PDPE failed"); + changed = TRUE; + } + if (len < NBPDR) { + pde = pmap_pdpe_to_pde(pdpe, va); + if ((*pde & PG_V) == 0) + panic("pmap_demote_DMAP: invalid PDE"); + if ((*pde & PG_PS) != 0) { + if (!pmap_demote_pde(kernel_pmap, pde, va)) + panic("pmap_demote_DMAP: PDE failed"); + changed = TRUE; + } + } + if (changed && invalidate) + pmap_invalidate_page(kernel_pmap, va); + PMAP_UNLOCK(kernel_pmap); + } +} + +/* * perform the pmap work for mincore */ int Modified: head/sys/amd64/include/pmap.h ============================================================================== --- head/sys/amd64/include/pmap.h Wed Oct 27 16:35:23 2010 (r214424) +++ head/sys/amd64/include/pmap.h Wed Oct 27 16:46:37 2010 (r214425) @@ -307,6 +307,7 @@ extern vm_offset_t virtual_end; void pmap_bootstrap(vm_paddr_t *); int pmap_change_attr(vm_offset_t, vm_size_t, int); +void pmap_demote_DMAP(vm_paddr_t base, vm_size_t len, boolean_t invalidate); void pmap_init_pat(void); void pmap_kenter(vm_offset_t va, vm_paddr_t pa); void *pmap_kenter_temporary(vm_paddr_t pa, int i); From owner-svn-src-head@FreeBSD.ORG Wed Oct 27 17:13:38 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A7A591065695; Wed, 27 Oct 2010 17:13:38 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9715A8FC19; Wed, 27 Oct 2010 17:13:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9RHDc9h015712; Wed, 27 Oct 2010 17:13:38 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9RHDcWg015710; Wed, 27 Oct 2010 17:13:38 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201010271713.o9RHDcWg015710@svn.freebsd.org> From: Xin LI Date: Wed, 27 Oct 2010 17:13:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214426 - head/release X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Oct 2010 17:13:38 -0000 Author: delphij Date: Wed Oct 27 17:13:38 2010 New Revision: 214426 URL: http://svn.freebsd.org/changeset/base/214426 Log: Add a short note about kernel modules in FIXIT mode. MFC after: 1 month Modified: head/release/fixit.profile Modified: head/release/fixit.profile ============================================================================== --- head/release/fixit.profile Wed Oct 27 16:46:37 2010 (r214425) +++ head/release/fixit.profile Wed Oct 27 17:13:38 2010 (r214426) @@ -25,6 +25,10 @@ echo '| You might want to symlink /mnt/e echo '| to /etc after mounting a root filesystem from your disk. |' echo '| tar(1) will not restore all permissions correctly otherwise! |' echo '| |' +echo '| In order to load kernel modules you might want to add the |' +echo '| fixit media to the kern.module_path sysctl variable so that |' +echo '| the kernel knows where to find them. |' +echo '| |' echo '| Note: you can use the arrow keys to browse through the |' echo '| command history of this shell. |' echo '+---------------------------------------------------------------+' From owner-svn-src-head@FreeBSD.ORG Wed Oct 27 17:16:40 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E5B9E1065670; Wed, 27 Oct 2010 17:16:40 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BA7908FC0A; Wed, 27 Oct 2010 17:16:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9RHGenv015864; Wed, 27 Oct 2010 17:16:40 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9RHGeF0015861; Wed, 27 Oct 2010 17:16:40 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201010271716.o9RHGeF0015861@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 27 Oct 2010 17:16:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214427 - head/sys/dev/mii X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Oct 2010 17:16:41 -0000 Author: yongari Date: Wed Oct 27 17:16:40 2010 New Revision: 214427 URL: http://svn.freebsd.org/changeset/base/214427 Log: Add BCM5717C 10/100/1000TX PHY id. Modified: head/sys/dev/mii/brgphy.c head/sys/dev/mii/miidevs Modified: head/sys/dev/mii/brgphy.c ============================================================================== --- head/sys/dev/mii/brgphy.c Wed Oct 27 17:13:38 2010 (r214426) +++ head/sys/dev/mii/brgphy.c Wed Oct 27 17:16:40 2010 (r214427) @@ -141,6 +141,7 @@ static const struct mii_phydesc brgphys[ MII_PHY_DESC(xxBROADCOM_ALT1, BCM5709C), MII_PHY_DESC(xxBROADCOM_ALT1, BCM5761), MII_PHY_DESC(xxBROADCOM_ALT1, BCM5709S), + MII_PHY_DESC(xxBROADCOM_ALT2, BCM5717C), MII_PHY_DESC(BROADCOM2, BCM5906), MII_PHY_END }; @@ -253,6 +254,9 @@ brgphy_attach(device_t dev) break; } break; + case MII_OUI_xxBROADCOM_ALT2: + /* No special handling yet. */ + break; default: device_printf(dev, "Unrecognized OUI for PHY!\n"); } @@ -1011,6 +1015,7 @@ brgphy_reset(struct mii_softc *sc) } break; case MII_OUI_xxBROADCOM_ALT1: + case MII_OUI_xxBROADCOM_ALT2: break; } Modified: head/sys/dev/mii/miidevs ============================================================================== --- head/sys/dev/mii/miidevs Wed Oct 27 17:13:38 2010 (r214426) +++ head/sys/dev/mii/miidevs Wed Oct 27 17:16:40 2010 (r214427) @@ -81,6 +81,7 @@ oui xxINTEL 0x00f800 Intel oui xxALTIMA 0x000895 Altima Communications oui xxBROADCOM 0x000818 Broadcom Corporation oui xxBROADCOM_ALT1 0x0050ef Broadcom Corporation +oui xxBROADCOM_ALT2 0x00d897 Broadcom Corporation oui xxICS 0x00057d Integrated Circuit Systems oui xxSEEQ 0x0005be Seeq oui xxSIS 0x000760 Silicon Integrated Systems @@ -153,6 +154,7 @@ model xxBROADCOM_ALT1 BCM5784 0x003a BCM model xxBROADCOM_ALT1 BCM5709C 0x003c BCM5709C 10/100/1000baseTX PHY model xxBROADCOM_ALT1 BCM5761 0x003d BCM5761 10/100/1000baseTX PHY model xxBROADCOM_ALT1 BCM5709S 0x003f BCM5709S 1000/2500baseSX PHY +model xxBROADCOM_ALT2 BCM5717C 0x0020 BCM5717C 10/100/1000baseTX PHY model BROADCOM2 BCM5906 0x0004 BCM5906 10/100baseTX PHY /* Cicada Semiconductor PHYs (now owned by Vitesse?) */ From owner-svn-src-head@FreeBSD.ORG Wed Oct 27 17:20:19 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 732C4106566B; Wed, 27 Oct 2010 17:20:19 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 612038FC08; Wed, 27 Oct 2010 17:20:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9RHKJ8i016016; Wed, 27 Oct 2010 17:20:19 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9RHKJYK016013; Wed, 27 Oct 2010 17:20:19 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201010271720.o9RHKJYK016013@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 27 Oct 2010 17:20:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214428 - head/sys/dev/bge X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Oct 2010 17:20:19 -0000 Author: yongari Date: Wed Oct 27 17:20:19 2010 New Revision: 214428 URL: http://svn.freebsd.org/changeset/base/214428 Log: Add initial BCM5718 family support. The BCM5718 family includes the dual port BCM5717 and BCM5718 devices which are intended for mainstream workstation and entry-level server designs and represents the twelfth generation of NetXtreme Ethernet controllers. This family is the successor to the BCM5714/BCM5715 family and supports IPv4/IPv6 checksum offloading, TSO, VLAN hardware tagging, jumbo frames, MSI/MSIX, IOV, RSS and TSS. This change set supports all hardware features except IOV and RSS/TSS. Unlike its predecessors, only extended RX buffer descriptors can be posted to the jumbo producer ring. Single RX buffer descriptors for jumbo frame are not supported. RSS requires a more substantial set of changes and will apply to a larger set of NetXtreme devices so RSS/TSS multi-queue support will be implemented in a future releases. Special thanks to Broadcom who kindly sent a sample board to me and to davidch who gave provided the initial support code. Submitted by: davidch (initial version) HW donated by: Broadcom Modified: head/sys/dev/bge/if_bge.c head/sys/dev/bge/if_bgereg.h Modified: head/sys/dev/bge/if_bge.c ============================================================================== --- head/sys/dev/bge/if_bge.c Wed Oct 27 17:16:40 2010 (r214427) +++ head/sys/dev/bge/if_bge.c Wed Oct 27 17:20:19 2010 (r214428) @@ -169,6 +169,8 @@ static const struct bge_type { { BCOM_VENDORID, BCOM_DEVICEID_BCM5714S }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5715 }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5715S }, + { BCOM_VENDORID, BCOM_DEVICEID_BCM5717 }, + { BCOM_VENDORID, BCOM_DEVICEID_BCM5718 }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5720 }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5721 }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5722 }, @@ -289,6 +291,8 @@ static const struct bge_revision { { BGE_CHIPID_BCM5715_A0, "BCM5715 A0" }, { BGE_CHIPID_BCM5715_A1, "BCM5715 A1" }, { BGE_CHIPID_BCM5715_A3, "BCM5715 A3" }, + { BGE_CHIPID_BCM5717_A0, "BCM5717 A0" }, + { BGE_CHIPID_BCM5717_B0, "BCM5717 B0" }, { BGE_CHIPID_BCM5755_A0, "BCM5755 A0" }, { BGE_CHIPID_BCM5755_A1, "BCM5755 A1" }, { BGE_CHIPID_BCM5755_A2, "BCM5755 A2" }, @@ -332,6 +336,7 @@ static const struct bge_revision bge_maj { BGE_ASICREV_BCM5787, "unknown BCM5754/5787" }, { BGE_ASICREV_BCM5906, "unknown BCM5906" }, { BGE_ASICREV_BCM57780, "unknown BCM57780" }, + { BGE_ASICREV_BCM5717, "unknown BCM5717" }, { 0, NULL } }; @@ -342,6 +347,7 @@ static const struct bge_revision bge_maj #define BGE_IS_5714_FAMILY(sc) ((sc)->bge_flags & BGE_FLAG_5714_FAMILY) #define BGE_IS_575X_PLUS(sc) ((sc)->bge_flags & BGE_FLAG_575X_PLUS) #define BGE_IS_5755_PLUS(sc) ((sc)->bge_flags & BGE_FLAG_5755_PLUS) +#define BGE_IS_5717_PLUS(sc) ((sc)->bge_flags & BGE_FLAG_5717_PLUS) const struct bge_revision * bge_lookup_rev(uint32_t); const struct bge_vendor * bge_lookup_vendor(uint16_t); @@ -367,6 +373,7 @@ static int bge_get_eaddr_eeprom(struct b static int bge_get_eaddr(struct bge_softc *, uint8_t[]); static void bge_txeof(struct bge_softc *, uint16_t); +static void bge_rxcsum(struct bge_softc *, struct bge_rx_bd *, struct mbuf *); static int bge_rxeof(struct bge_softc *, uint16_t, int); static void bge_asf_driver_up (struct bge_softc *); @@ -376,7 +383,7 @@ static void bge_stats_update(struct bge_ static void bge_stats_update_regs(struct bge_softc *); static struct mbuf *bge_check_short_dma(struct mbuf *); static struct mbuf *bge_setup_tso(struct bge_softc *, struct mbuf *, - uint16_t *); + uint16_t *, uint16_t *); static int bge_encap(struct bge_softc *, struct mbuf **, uint32_t *); static void bge_intr(void *); @@ -1349,12 +1356,15 @@ bge_stop_fw(struct bge_softc *sc) static int bge_chipinit(struct bge_softc *sc) { - uint32_t dma_rw_ctl; + uint32_t dma_rw_ctl, misc_ctl; uint16_t val; int i; /* Set endianness before we access any non-PCI registers. */ - pci_write_config(sc->bge_dev, BGE_PCI_MISC_CTL, BGE_INIT, 4); + misc_ctl = BGE_INIT; + if (sc->bge_flags & BGE_FLAG_TAGGED_STATUS) + misc_ctl |= BGE_PCIMISCCTL_TAGGED_STATUS; + pci_write_config(sc->bge_dev, BGE_PCI_MISC_CTL, misc_ctl, 4); /* Clear the MAC control register */ CSR_WRITE_4(sc, BGE_MAC_MODE, 0); @@ -1446,6 +1456,8 @@ bge_chipinit(struct bge_softc *sc) if (sc->bge_asicrev == BGE_ASICREV_BCM5703 || sc->bge_asicrev == BGE_ASICREV_BCM5704) dma_rw_ctl &= ~BGE_PCIDMARWCTL_MINDMA; + if (BGE_IS_5717_PLUS(sc)) + dma_rw_ctl &= ~BGE_PCIDMARWCTL_DIS_CACHE_ALIGNMENT; pci_write_config(sc->bge_dev, BGE_PCI_DMA_RW_CTL, dma_rw_ctl, 4); /* @@ -1529,7 +1541,16 @@ bge_blockinit(struct bge_softc *sc) } /* Configure mbuf pool watermarks */ - if (!BGE_IS_5705_PLUS(sc)) { + if (sc->bge_asicrev == BGE_ASICREV_BCM5717) { + CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_READDMA_LOWAT, 0x0); + if (sc->bge_ifp->if_mtu > ETHERMTU) { + CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_MACRX_LOWAT, 0x7e); + CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_HIWAT, 0xea); + } else { + CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_MACRX_LOWAT, 0x2a); + CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_HIWAT, 0xa0); + } + } else if (!BGE_IS_5705_PLUS(sc)) { CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_READDMA_LOWAT, 0x50); CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_MACRX_LOWAT, 0x20); CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_HIWAT, 0x60); @@ -1621,7 +1642,16 @@ bge_blockinit(struct bge_softc *sc) BGE_ADDR_HI(sc->bge_ldata.bge_rx_std_ring_paddr); bus_dmamap_sync(sc->bge_cdata.bge_rx_std_ring_tag, sc->bge_cdata.bge_rx_std_ring_map, BUS_DMASYNC_PREREAD); - if (BGE_IS_5705_PLUS(sc)) { + if (BGE_IS_5717_PLUS(sc)) { + /* + * Bits 31-16: Programmable ring size (2048, 1024, 512, .., 32) + * Bits 15-2 : Maximum RX frame size + * Bit 1 : 1 = Ring Disabled, 0 = Ring ENabled + * Bit 0 : Reserved + */ + rcb->bge_maxlen_flags = + BGE_RCB_MAXLEN_FLAGS(512, BGE_MAX_FRAMELEN << 2); + } else if (BGE_IS_5705_PLUS(sc)) { /* * Bits 31-16: Programmable ring size (512, 256, 128, 64, 32) * Bits 15-2 : Reserved (should be 0) @@ -1640,7 +1670,10 @@ bge_blockinit(struct bge_softc *sc) rcb->bge_maxlen_flags = BGE_RCB_MAXLEN_FLAGS(BGE_MAX_FRAMELEN, 0); } - rcb->bge_nicaddr = BGE_STD_RX_RINGS; + if (sc->bge_asicrev == BGE_ASICREV_BCM5717) + rcb->bge_nicaddr = BGE_STD_RX_RINGS_5717; + else + rcb->bge_nicaddr = BGE_STD_RX_RINGS; /* Write the standard receive producer ring control block. */ CSR_WRITE_4(sc, BGE_RX_STD_RCB_HADDR_HI, rcb->bge_hostaddr.bge_addr_hi); CSR_WRITE_4(sc, BGE_RX_STD_RCB_HADDR_LO, rcb->bge_hostaddr.bge_addr_lo); @@ -1669,7 +1702,10 @@ bge_blockinit(struct bge_softc *sc) BUS_DMASYNC_PREREAD); rcb->bge_maxlen_flags = BGE_RCB_MAXLEN_FLAGS(0, BGE_RCB_FLAG_USE_EXT_RX_BD | BGE_RCB_FLAG_RING_DISABLED); - rcb->bge_nicaddr = BGE_JUMBO_RX_RINGS; + if (sc->bge_asicrev == BGE_ASICREV_BCM5717) + rcb->bge_nicaddr = BGE_JUMBO_RX_RINGS_5717; + else + rcb->bge_nicaddr = BGE_JUMBO_RX_RINGS; CSR_WRITE_4(sc, BGE_RX_JUMBO_RCB_HADDR_HI, rcb->bge_hostaddr.bge_addr_hi); CSR_WRITE_4(sc, BGE_RX_JUMBO_RCB_HADDR_LO, @@ -1726,6 +1762,10 @@ bge_blockinit(struct bge_softc *sc) if (BGE_IS_JUMBO_CAPABLE(sc)) CSR_WRITE_4(sc, BGE_RBDI_JUMBO_REPL_THRESH, BGE_JUMBO_RX_RING_CNT/8); + if (BGE_IS_5717_PLUS(sc)) { + CSR_WRITE_4(sc, BGE_STD_REPLENISH_LWM, 32); + CSR_WRITE_4(sc, BGE_JMB_REPLENISH_LWM, 16); + } /* * Disable all send rings by setting the 'ring disabled' bit @@ -1750,8 +1790,11 @@ bge_blockinit(struct bge_softc *sc) BGE_HOSTADDR(taddr, sc->bge_ldata.bge_tx_ring_paddr); RCB_WRITE_4(sc, vrcb, bge_hostaddr.bge_addr_hi, taddr.bge_addr_hi); RCB_WRITE_4(sc, vrcb, bge_hostaddr.bge_addr_lo, taddr.bge_addr_lo); - RCB_WRITE_4(sc, vrcb, bge_nicaddr, - BGE_NIC_TXRING_ADDR(0, BGE_TX_RING_CNT)); + if (sc->bge_asicrev == BGE_ASICREV_BCM5717) + RCB_WRITE_4(sc, vrcb, bge_nicaddr, BGE_SEND_RING_5717); + else + RCB_WRITE_4(sc, vrcb, bge_nicaddr, + BGE_NIC_TXRING_ADDR(0, BGE_TX_RING_CNT)); RCB_WRITE_4(sc, vrcb, bge_maxlen_flags, BGE_RCB_MAXLEN_FLAGS(BGE_TX_RING_CNT, 0)); @@ -1760,7 +1803,10 @@ bge_blockinit(struct bge_softc *sc) * 'ring diabled' bit in the flags field of all the receive * return ring control blocks, located in NIC memory. */ - if (!BGE_IS_5705_PLUS(sc)) + if (sc->bge_asicrev == BGE_ASICREV_BCM5717) { + /* Should be 17, use 16 until we get an SRAM map. */ + limit = 16; + } else if (!BGE_IS_5705_PLUS(sc)) limit = BGE_RX_RINGS_MAX; else if (sc->bge_asicrev == BGE_ASICREV_BCM5755) limit = 4; @@ -1936,6 +1982,10 @@ bge_blockinit(struct bge_softc *sc) /* Turn on read DMA state machine */ val = BGE_RDMAMODE_ENABLE | BGE_RDMAMODE_ALL_ATTNS; + + if (sc->bge_asicrev == BGE_ASICREV_BCM5717) + val |= BGE_RDMAMODE_MULT_DMA_RD_DIS; + if (sc->bge_asicrev == BGE_ASICREV_BCM5784 || sc->bge_asicrev == BGE_ASICREV_BCM5785 || sc->bge_asicrev == BGE_ASICREV_BCM57780) @@ -1944,16 +1994,18 @@ bge_blockinit(struct bge_softc *sc) BGE_RDMAMODE_MBUF_SBD_CRPT_ATTN; if (sc->bge_flags & BGE_FLAG_PCIE) val |= BGE_RDMAMODE_FIFO_LONG_BURST; - if (sc->bge_flags & BGE_FLAG_TSO) { + if (sc->bge_flags & (BGE_FLAG_TSO | BGE_FLAG_TSO3)) { val |= BGE_RDMAMODE_TSO4_ENABLE; - if (sc->bge_asicrev == BGE_ASICREV_BCM5785 || + if (sc->bge_flags & BGE_FLAG_TSO3 || + sc->bge_asicrev == BGE_ASICREV_BCM5785 || sc->bge_asicrev == BGE_ASICREV_BCM57780) val |= BGE_RDMAMODE_TSO6_ENABLE; } if (sc->bge_asicrev == BGE_ASICREV_BCM5761 || sc->bge_asicrev == BGE_ASICREV_BCM5784 || sc->bge_asicrev == BGE_ASICREV_BCM5785 || - sc->bge_asicrev == BGE_ASICREV_BCM57780) { + sc->bge_asicrev == BGE_ASICREV_BCM57780 || + BGE_IS_5717_PLUS(sc)) { /* * Enable fix for read DMA FIFO overruns. * The fix is to limit the number of RX BDs @@ -1989,8 +2041,9 @@ bge_blockinit(struct bge_softc *sc) CSR_WRITE_4(sc, BGE_SDC_MODE, val); /* Turn on send data initiator state machine */ - if (sc->bge_flags & BGE_FLAG_TSO) - CSR_WRITE_4(sc, BGE_SDI_MODE, BGE_SDIMODE_ENABLE | 0x08); + if (sc->bge_flags & (BGE_FLAG_TSO | BGE_FLAG_TSO3)) + CSR_WRITE_4(sc, BGE_SDI_MODE, BGE_SDIMODE_ENABLE | + BGE_SDIMODE_HW_LSO_PRE_DMA); else CSR_WRITE_4(sc, BGE_SDI_MODE, BGE_SDIMODE_ENABLE); @@ -2104,9 +2157,22 @@ bge_probe(device_t dev) id = pci_read_config(dev, BGE_PCI_MISC_CTL, 4) >> BGE_PCIMISCCTL_ASICREV_SHIFT; - if (BGE_ASICREV(id) == BGE_ASICREV_USE_PRODID_REG) - id = pci_read_config(dev, - BGE_PCI_PRODID_ASICREV, 4); + if (BGE_ASICREV(id) == BGE_ASICREV_USE_PRODID_REG) { + /* + * Find the ASCI revision. Different chips + * use different registers. + */ + switch (pci_get_device(dev)) { + case BCOM_DEVICEID_BCM5717: + case BCOM_DEVICEID_BCM5718: + id = pci_read_config(dev, + BGE_PCI_GEN2_PRODID_ASICREV, 4); + break; + default: + id = pci_read_config(dev, + BGE_PCI_PRODID_ASICREV, 4); + } + } br = bge_lookup_rev(id); v = bge_lookup_vendor(vid); { @@ -2423,7 +2489,7 @@ bge_dma_alloc(struct bge_softc *sc) return (ENOMEM); } /* Create tag for Tx mbufs. */ - if (sc->bge_flags & BGE_FLAG_TSO) { + if (sc->bge_flags & (BGE_FLAG_TSO | BGE_FLAG_TSO3)) { txsegsz = BGE_TSOSEG_SZ; txmaxsegsz = 65535 + sizeof(struct ether_vlan_header); } else { @@ -2539,6 +2605,10 @@ bge_can_use_msi(struct bge_softc *sc) { int can_use_msi = 0; + /* Disable MSI for polling(4). */ +#ifdef DEVICE_POLLING + return (0); +#endif switch (sc->bge_asicrev) { case BGE_ASICREV_BCM5714_A0: case BGE_ASICREV_BCM5714: @@ -2568,7 +2638,7 @@ bge_attach(device_t dev) struct bge_softc *sc; uint32_t hwcfg = 0, misccfg; u_char eaddr[ETHER_ADDR_LEN]; - int error, msicount, phy_addr, reg, rid, trys; + int error, f, msicount, phy_addr, reg, rid, trys; sc = device_get_softc(dev); sc->bge_dev = dev; @@ -2594,14 +2664,55 @@ bge_attach(device_t dev) sc->bge_chipid = pci_read_config(dev, BGE_PCI_MISC_CTL, 4) >> BGE_PCIMISCCTL_ASICREV_SHIFT; - if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_USE_PRODID_REG) - sc->bge_chipid = pci_read_config(dev, BGE_PCI_PRODID_ASICREV, - 4); + if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_USE_PRODID_REG) { + /* + * Find the ASCI revision. Different chips use different + * registers. + */ + switch (pci_get_device(dev)) { + case BCOM_DEVICEID_BCM5717: + case BCOM_DEVICEID_BCM5718: + sc->bge_chipid = pci_read_config(dev, + BGE_PCI_GEN2_PRODID_ASICREV, 4); + break; + default: + sc->bge_chipid = pci_read_config(dev, + BGE_PCI_PRODID_ASICREV, 4); + } + } sc->bge_asicrev = BGE_ASICREV(sc->bge_chipid); sc->bge_chiprev = BGE_CHIPREV(sc->bge_chipid); /* Set default PHY address. */ phy_addr = 1; + /* + * PHY address mapping for various devices. + * + * | F0 Cu | F0 Sr | F1 Cu | F1 Sr | + * ---------+-------+-------+-------+-------+ + * BCM57XX | 1 | X | X | X | + * BCM5704 | 1 | X | 1 | X | + * BCM5717 | 1 | 8 | 2 | 9 | + * + * Other addresses may respond but they are not + * IEEE compliant PHYs and should be ignored. + */ + if (sc->bge_asicrev == BGE_ASICREV_BCM5717) { + f = pci_get_function(dev); + if (sc->bge_chipid == BGE_CHIPID_BCM5717_A0) { + if (CSR_READ_4(sc, BGE_SGDIG_STS) & + BGE_SGDIGSTS_IS_SERDES) + phy_addr = f + 8; + else + phy_addr = f + 1; + } else if (sc->bge_chipid == BGE_CHIPID_BCM5717_B0) { + if (CSR_READ_4(sc, BGE_CPMU_PHY_STRAP) & + BGE_CPMU_PHY_STRAP_IS_SERDES) + phy_addr = f + 8; + else + phy_addr = f + 1; + } + } /* * Don't enable Ethernet@WireSpeed for the 5700, 5906, or the @@ -2610,7 +2721,8 @@ bge_attach(device_t dev) if (sc->bge_asicrev != BGE_ASICREV_BCM5700 && sc->bge_asicrev != BGE_ASICREV_BCM5906 && sc->bge_chipid != BGE_CHIPID_BCM5705_A0 && - sc->bge_chipid != BGE_CHIPID_BCM5705_A1) + sc->bge_chipid != BGE_CHIPID_BCM5705_A1 && + !BGE_IS_5717_PLUS(sc)) sc->bge_phy_flags |= BGE_PHY_WIRESPEED; if (bge_has_eaddr(sc)) @@ -2618,6 +2730,11 @@ bge_attach(device_t dev) /* Save chipset family. */ switch (sc->bge_asicrev) { + case BGE_ASICREV_BCM5717: + sc->bge_flags |= BGE_FLAG_5717_PLUS | BGE_FLAG_5755_PLUS | + BGE_FLAG_575X_PLUS | BGE_FLAG_5705_PLUS | BGE_FLAG_JUMBO | + BGE_FLAG_SHORT_DMA_BUG | BGE_FLAG_JUMBO_FRAME; + break; case BGE_ASICREV_BCM5755: case BGE_ASICREV_BCM5761: case BGE_ASICREV_BCM5784: @@ -2663,6 +2780,7 @@ bge_attach(device_t dev) sc->bge_phy_flags |= BGE_PHY_NO_3LED; if ((BGE_IS_5705_PLUS(sc)) && sc->bge_asicrev != BGE_ASICREV_BCM5906 && + sc->bge_asicrev != BGE_ASICREV_BCM5717 && sc->bge_asicrev != BGE_ASICREV_BCM5785 && sc->bge_asicrev != BGE_ASICREV_BCM57780) { if (sc->bge_asicrev == BGE_ASICREV_BCM5755 || @@ -2679,7 +2797,8 @@ bge_attach(device_t dev) } /* Identify the chips that use an CPMU. */ - if (sc->bge_asicrev == BGE_ASICREV_BCM5784 || + if (BGE_IS_5717_PLUS(sc) || + sc->bge_asicrev == BGE_ASICREV_BCM5784 || sc->bge_asicrev == BGE_ASICREV_BCM5761 || sc->bge_asicrev == BGE_ASICREV_BCM5785 || sc->bge_asicrev == BGE_ASICREV_BCM57780) @@ -2722,7 +2841,10 @@ bge_attach(device_t dev) * the TSO to the controllers that are not affected TSO issues * (e.g. 5755 or higher). */ - if (BGE_IS_5755_PLUS(sc)) { + if (BGE_IS_5717_PLUS(sc)) { + /* BCM5717 requires different TSO configuration. */ + sc->bge_flags |= BGE_FLAG_TSO3; + } else if (BGE_IS_5755_PLUS(sc)) { /* * BCM5754 and BCM5787 shares the same ASIC id so * explicit device id check is required. @@ -2785,6 +2907,16 @@ bge_attach(device_t dev) } } + /* + * All controllers except BCM5700 supports tagged status but + * we use tagged status only for MSI case on BCM5717. Otherwise + * MSI on BCM5717 does not work. + */ +#ifndef DEVICE_POLLING + if (sc->bge_flags & BGE_FLAG_MSI && BGE_IS_5717_PLUS(sc)) + sc->bge_flags |= BGE_FLAG_TAGGED_STATUS; +#endif + sc->bge_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_SHAREABLE | RF_ACTIVE); @@ -2848,7 +2980,9 @@ bge_attach(device_t dev) } /* 5705 limits RX return ring to 512 entries. */ - if (BGE_IS_5705_PLUS(sc)) + if (BGE_IS_5717_PLUS(sc)) + sc->bge_return_ring_cnt = BGE_RETURN_RING_CNT; + else if (BGE_IS_5705_PLUS(sc)) sc->bge_return_ring_cnt = BGE_RETURN_RING_CNT_5705; else sc->bge_return_ring_cnt = BGE_RETURN_RING_CNT; @@ -2893,7 +3027,7 @@ bge_attach(device_t dev) ifp->if_hwassist = sc->bge_csum_features; ifp->if_capabilities = IFCAP_HWCSUM | IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU; - if ((sc->bge_flags & BGE_FLAG_TSO) != 0) { + if ((sc->bge_flags & (BGE_FLAG_TSO | BGE_FLAG_TSO3)) != 0) { ifp->if_hwassist |= CSUM_TSO; ifp->if_capabilities |= IFCAP_TSO4 | IFCAP_VLAN_HWTSO; } @@ -3340,6 +3474,7 @@ bge_reset(struct bge_softc *sc) /* XXX: Broadcom Linux driver. */ if (sc->bge_flags & BGE_FLAG_PCIE && + sc->bge_asicrev != BGE_ASICREV_BCM5717 && sc->bge_chipid != BGE_CHIPID_BCM5750_A0 && sc->bge_asicrev != BGE_ASICREV_BCM5785) { /* Enable Data FIFO protection. */ @@ -3480,20 +3615,8 @@ bge_rxeof(struct bge_softc *sc, uint16_t m->m_pkthdr.len = m->m_len = cur_rx->bge_len - ETHER_CRC_LEN; m->m_pkthdr.rcvif = ifp; - if (ifp->if_capenable & IFCAP_RXCSUM) { - if (cur_rx->bge_flags & BGE_RXBDFLAG_IP_CSUM) { - m->m_pkthdr.csum_flags |= CSUM_IP_CHECKED; - if ((cur_rx->bge_ip_csum ^ 0xFFFF) == 0) - m->m_pkthdr.csum_flags |= CSUM_IP_VALID; - } - if (cur_rx->bge_flags & BGE_RXBDFLAG_TCP_UDP_CSUM && - m->m_pkthdr.len >= ETHER_MIN_NOPAD) { - m->m_pkthdr.csum_data = - cur_rx->bge_tcp_udp_csum; - m->m_pkthdr.csum_flags |= - CSUM_DATA_VALID | CSUM_PSEUDO_HDR; - } - } + if (ifp->if_capenable & IFCAP_RXCSUM) + bge_rxcsum(sc, cur_rx, m); /* * If we received a packet with a vlan tag, @@ -3552,6 +3675,41 @@ bge_rxeof(struct bge_softc *sc, uint16_t } static void +bge_rxcsum(struct bge_softc *sc, struct bge_rx_bd *cur_rx, struct mbuf *m) +{ + + if (BGE_IS_5717_PLUS(sc)) { + if ((cur_rx->bge_flags & BGE_RXBDFLAG_IPV6) == 0) { + if (cur_rx->bge_flags & BGE_RXBDFLAG_IP_CSUM) { + m->m_pkthdr.csum_flags |= CSUM_IP_CHECKED; + if ((cur_rx->bge_error_flag & + BGE_RXERRFLAG_IP_CSUM_NOK) == 0) + m->m_pkthdr.csum_flags |= CSUM_IP_VALID; + } + if (cur_rx->bge_flags & BGE_RXBDFLAG_TCP_UDP_CSUM) { + m->m_pkthdr.csum_data = + cur_rx->bge_tcp_udp_csum; + m->m_pkthdr.csum_flags |= CSUM_DATA_VALID | + CSUM_PSEUDO_HDR; + } + } + } else { + if (cur_rx->bge_flags & BGE_RXBDFLAG_IP_CSUM) { + m->m_pkthdr.csum_flags |= CSUM_IP_CHECKED; + if ((cur_rx->bge_ip_csum ^ 0xFFFF) == 0) + m->m_pkthdr.csum_flags |= CSUM_IP_VALID; + } + if (cur_rx->bge_flags & BGE_RXBDFLAG_TCP_UDP_CSUM && + m->m_pkthdr.len >= ETHER_MIN_NOPAD) { + m->m_pkthdr.csum_data = + cur_rx->bge_tcp_udp_csum; + m->m_pkthdr.csum_flags |= CSUM_DATA_VALID | + CSUM_PSEUDO_HDR; + } + } +} + +static void bge_txeof(struct bge_softc *sc, uint16_t tx_cons) { struct bge_tx_bd *cur_tx; @@ -3668,7 +3826,7 @@ bge_intr_task(void *arg, int pending) { struct bge_softc *sc; struct ifnet *ifp; - uint32_t status; + uint32_t status, status_tag; uint16_t rx_prod, tx_cons; sc = (struct bge_softc *)arg; @@ -3689,16 +3847,19 @@ bge_intr_task(void *arg, int pending) rx_prod = sc->bge_ldata.bge_status_block->bge_idx[0].bge_rx_prod_idx; tx_cons = sc->bge_ldata.bge_status_block->bge_idx[0].bge_tx_cons_idx; status = sc->bge_ldata.bge_status_block->bge_status; + status_tag = sc->bge_ldata.bge_status_block->bge_status_tag << 24; sc->bge_ldata.bge_status_block->bge_status = 0; bus_dmamap_sync(sc->bge_cdata.bge_status_tag, sc->bge_cdata.bge_status_map, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + if ((sc->bge_flags & BGE_FLAG_TAGGED_STATUS) == 0) + status_tag = 0; if ((status & BGE_STATFLAG_LINKSTATE_CHANGED) != 0) bge_link_upd(sc); /* Let controller work. */ - bge_writembx(sc, BGE_MBX_IRQ0_LO, 0); + bge_writembx(sc, BGE_MBX_IRQ0_LO, status_tag); if (ifp->if_drv_flags & IFF_DRV_RUNNING && sc->bge_rx_saved_considx != rx_prod) { @@ -4104,7 +4265,8 @@ bge_check_short_dma(struct mbuf *m) } static struct mbuf * -bge_setup_tso(struct bge_softc *sc, struct mbuf *m, uint16_t *mss) +bge_setup_tso(struct bge_softc *sc, struct mbuf *m, uint16_t *mss, + uint16_t *flags) { struct ip *ip; struct tcphdr *tcp; @@ -4147,14 +4309,30 @@ bge_setup_tso(struct bge_softc *sc, stru * Broadcom controllers uses different descriptor format for * TSO depending on ASIC revision. Due to TSO-capable firmware * license issue and lower performance of firmware based TSO - * we only support hardware based TSO which is applicable for - * BCM5755 or newer controllers. Hardware based TSO uses 11 - * bits to store MSS and upper 5 bits are used to store IP/TCP - * header length(including IP/TCP options). The header length - * is expressed as 32 bits unit. + * we only support hardware based TSO. */ + /* Calculate header length, incl. TCP/IP options, in 32 bit units. */ hlen = ((ip->ip_hl << 2) + (tcp->th_off << 2)) >> 2; - *mss |= (hlen << 11); + if (sc->bge_flags & BGE_FLAG_TSO3) { + /* + * For BCM5717 and newer controllers, hardware based TSO + * uses the 14 lower bits of the bge_mss field to store the + * MSS and the upper 2 bits to store the lowest 2 bits of + * the IP/TCP header length. The upper 6 bits of the header + * length are stored in the bge_flags[14:10,4] field. Jumbo + * frames are supported. + */ + *mss |= ((hlen & 0x3) << 14); + *flags |= ((hlen & 0xF8) << 7) | ((hlen & 0x4) << 2); + } else { + /* + * For BCM5755 and newer controllers, hardware based TSO uses + * the lower 11 bits to store the MSS and the upper 5 bits to + * store the IP/TCP header length. Jumbo frames are not + * supported. + */ + *mss |= (hlen << 11); + } return (m); } @@ -4184,7 +4362,7 @@ bge_encap(struct bge_softc *sc, struct m m = *m_head; } if ((m->m_pkthdr.csum_flags & CSUM_TSO) != 0) { - *m_head = m = bge_setup_tso(sc, m, &mss); + *m_head = m = bge_setup_tso(sc, m, &mss, &csum_flags); if (*m_head == NULL) return (ENOBUFS); csum_flags |= BGE_TXBDFLAG_CPU_PRE_DMA | @@ -4207,21 +4385,26 @@ bge_encap(struct bge_softc *sc, struct m csum_flags |= BGE_TXBDFLAG_IP_FRAG; } - if ((m->m_pkthdr.csum_flags & CSUM_TSO) == 0 && - sc->bge_forced_collapse > 0 && - (sc->bge_flags & BGE_FLAG_PCIE) != 0 && m->m_next != NULL) { - /* - * Forcedly collapse mbuf chains to overcome hardware - * limitation which only support a single outstanding - * DMA read operation. - */ - if (sc->bge_forced_collapse == 1) - m = m_defrag(m, M_DONTWAIT); - else - m = m_collapse(m, M_DONTWAIT, sc->bge_forced_collapse); - if (m == NULL) - m = *m_head; - *m_head = m; + if ((m->m_pkthdr.csum_flags & CSUM_TSO) == 0) { + if (sc->bge_flags & BGE_FLAG_JUMBO_FRAME && + m->m_pkthdr.len > ETHER_MAX_LEN) + csum_flags |= BGE_TXBDFLAG_JUMBO_FRAME; + if (sc->bge_forced_collapse > 0 && + (sc->bge_flags & BGE_FLAG_PCIE) != 0 && m->m_next != NULL) { + /* + * Forcedly collapse mbuf chains to overcome hardware + * limitation which only support a single outstanding + * DMA read operation. + */ + if (sc->bge_forced_collapse == 1) + m = m_defrag(m, M_DONTWAIT); + else + m = m_collapse(m, M_DONTWAIT, + sc->bge_forced_collapse); + if (m == NULL) + m = *m_head; + *m_head = m; + } } map = sc->bge_cdata.bge_tx_dmamap[idx]; Modified: head/sys/dev/bge/if_bgereg.h ============================================================================== --- head/sys/dev/bge/if_bgereg.h Wed Oct 27 17:16:40 2010 (r214427) +++ head/sys/dev/bge/if_bgereg.h Wed Oct 27 17:20:19 2010 (r214428) @@ -82,6 +82,7 @@ #define BGE_UNMAPPED_END 0x00001FFF #define BGE_DMA_DESCRIPTORS 0x00002000 #define BGE_DMA_DESCRIPTORS_END 0x00003FFF +#define BGE_SEND_RING_5717 0x00004000 #define BGE_SEND_RING_1_TO_4 0x00004000 #define BGE_SEND_RING_1_TO_4_END 0x00005FFF @@ -100,6 +101,8 @@ #define BGE_BUFFPOOL_2_END 0x00017FFF #define BGE_BUFFPOOL_3 0x00018000 /* or expansion ROM */ #define BGE_BUFFPOOL_3_END 0x0001FFFF +#define BGE_STD_RX_RINGS_5717 0x00040000 +#define BGE_JUMBO_RX_RINGS_5717 0x00044400 /* Mappings for external SSRAM configurations */ #define BGE_SEND_RING_5_TO_6 0x00006000 @@ -219,6 +222,7 @@ #define BGE_PCI_ISR_MBX_HI 0xB0 #define BGE_PCI_ISR_MBX_LO 0xB4 #define BGE_PCI_PRODID_ASICREV 0xBC +#define BGE_PCI_GEN2_PRODID_ASICREV 0xF4 /* PCI Misc. Host control register */ #define BGE_PCIMISCCTL_CLEAR_INTA 0x00000001 @@ -229,6 +233,7 @@ #define BGE_PCIMISCCTL_CLOCKCTL_RW 0x00000020 #define BGE_PCIMISCCTL_REG_WORDSWAP 0x00000040 #define BGE_PCIMISCCTL_INDIRECT_ACCESS 0x00000080 +#define BGE_PCIMISCCTL_TAGGED_STATUS 0x00000200 #define BGE_PCIMISCCTL_ASICREV 0xFFFF0000 #define BGE_PCIMISCCTL_ASICREV_SHIFT 16 @@ -311,6 +316,8 @@ #define BGE_CHIPID_BCM5906_A2 0xc002 #define BGE_CHIPID_BCM57780_A0 0x57780000 #define BGE_CHIPID_BCM57780_A1 0x57780001 +#define BGE_CHIPID_BCM5717_A0 0x05717000 +#define BGE_CHIPID_BCM5717_B0 0x05717100 /* shorthand one */ #define BGE_ASICREV(x) ((x) >> 12) @@ -331,6 +338,7 @@ /* Should consult BGE_PCI_PRODID_ASICREV for ChipID */ #define BGE_ASICREV_USE_PRODID_REG 0x0f /* BGE_PCI_PRODID_ASICREV ASIC rev. identifiers. */ +#define BGE_ASICREV_BCM5717 0x5717 #define BGE_ASICREV_BCM5761 0x5761 #define BGE_ASICREV_BCM5784 0x5784 #define BGE_ASICREV_BCM5785 0x5785 @@ -348,11 +356,14 @@ #define BGE_CHIPREV_5750_AX 0x40 #define BGE_CHIPREV_5750_BX 0x41 /* BGE_PCI_PRODID_ASICREV chip rev. identifiers. */ +#define BGE_CHIPREV_5717_AX 0x57170 +#define BGE_CHIPREV_5717_BX 0x57171 #define BGE_CHIPREV_5761_AX 0x57611 #define BGE_CHIPREV_5784_AX 0x57841 /* PCI DMA Read/Write Control register */ #define BGE_PCIDMARWCTL_MINDMA 0x000000FF +#define BGE_PCIDMARWCTL_DIS_CACHE_ALIGNMENT 0x00000001 #define BGE_PCIDMARWCTL_RDADRR_BNDRY 0x00000700 #define BGE_PCIDMARWCTL_WRADDR_BNDRY 0x00003800 #define BGE_PCIDMARWCTL_ONEDMA_ATONCE 0x0000C000 @@ -566,6 +577,7 @@ #define BGE_TX_RINGS_MAX 4 #define BGE_TX_RINGS_EXTSSRAM_MAX 16 #define BGE_RX_RINGS_MAX 16 +#define BGE_RX_RINGS_MAX_5717 17 /* Ethernet MAC control registers */ #define BGE_MAC_MODE 0x0400 @@ -843,9 +855,10 @@ #define BGE_SGDIGCFG_AUTO 0x80000000 /* SGDIG status (not documented) */ +#define BGE_SGDIGSTS_DONE 0x00000002 +#define BGE_SGDIGSTS_IS_SERDES 0x00000100 #define BGE_SGDIGSTS_PAUSE_CAP 0x00080000 #define BGE_SGDIGSTS_ASYM_PAUSE 0x00100000 -#define BGE_SGDIGSTS_DONE 0x00000002 /* MI communication register */ @@ -911,6 +924,7 @@ #define BGE_SDIMODE_RESET 0x00000001 #define BGE_SDIMODE_ENABLE 0x00000002 #define BGE_SDIMODE_STATS_OFLOW_ATTN 0x00000004 +#define BGE_SDIMODE_HW_LSO_PRE_DMA 0x00000008 /* Send Data Initiator stats register */ #define BGE_SDISTAT_STATS_OFLOW_ATTN 0x00000004 @@ -1188,6 +1202,9 @@ #define BGE_RBDI_STD_REPL_THRESH 0x2C18 #define BGE_RBDI_JUMBO_REPL_THRESH 0x2C1C +#define BGE_STD_REPLENISH_LWM 0x2D00 +#define BGE_JMB_REPLENISH_LWM 0x2D04 + /* Receive BD Initiator Mode register */ #define BGE_RBDIMODE_RESET 0x00000001 #define BGE_RBDIMODE_ENABLE 0x00000002 @@ -1501,6 +1518,7 @@ #define BGE_RDMAMODE_MBUF_SBD_CRPT_ATTN 0x00002000 #define BGE_RDMAMODE_FIFO_SIZE_128 0x00020000 #define BGE_RDMAMODE_FIFO_LONG_BURST 0x00030000 +#define BGE_RDMAMODE_MULT_DMA_RD_DIS 0x01000000 #define BGE_RDMAMODE_TSO4_ENABLE 0x08000000 #define BGE_RDMAMODE_TSO6_ENABLE 0x10000000 @@ -2068,15 +2086,27 @@ struct bge_tx_bd { #define BGE_TXBDFLAG_IP_CSUM 0x0002 #define BGE_TXBDFLAG_END 0x0004 #define BGE_TXBDFLAG_IP_FRAG 0x0008 +#define BGE_TXBDFLAG_JUMBO_FRAME 0x0008 /* 5717 */ #define BGE_TXBDFLAG_IP_FRAG_END 0x0010 +#define BGE_TXBDFLAG_HDRLEN_BIT2 0x0010 /* 5717 */ +#define BGE_TXBDFLAG_SNAP 0x0020 /* 5717 */ #define BGE_TXBDFLAG_VLAN_TAG 0x0040 #define BGE_TXBDFLAG_COAL_NOW 0x0080 #define BGE_TXBDFLAG_CPU_PRE_DMA 0x0100 #define BGE_TXBDFLAG_CPU_POST_DMA 0x0200 +#define BGE_TXBDFLAG_HDRLEN_BIT3 0x0400 /* 5717 */ +#define BGE_TXBDFLAG_HDRLEN_BIT4 0x0800 /* 5717 */ #define BGE_TXBDFLAG_INSERT_SRC_ADDR 0x1000 +#define BGE_TXBDFLAG_HDRLEN_BIT5 0x1000 /* 5717 */ +#define BGE_TXBDFLAG_HDRLEN_BIT6 0x2000 /* 5717 */ +#define BGE_TXBDFLAG_HDRLEN_BIT7 0x4000 /* 5717 */ #define BGE_TXBDFLAG_CHOOSE_SRC_ADDR 0x6000 #define BGE_TXBDFLAG_NO_CRC 0x8000 +#define BGE_TXBDFLAG_MSS_SIZE_MASK 0x3FFF /* 5717 */ +/* Bits [1:0] of the MSS header length. */ +#define BGE_TXBDFLAG_MSS_HDRLEN_MASK 0xC000 /* 5717 */ + #define BGE_NIC_TXRING_ADDR(ringno, size) \ BGE_SEND_RING_1_TO_4 + \ ((ringno * sizeof(struct bge_tx_bd) * size) / 4) @@ -2153,6 +2183,7 @@ struct bge_extrx_bd { #define BGE_RXBDFLAG_IP_CSUM 0x1000 #define BGE_RXBDFLAG_TCP_UDP_CSUM 0x2000 #define BGE_RXBDFLAG_TCP_UDP_IS_TCP 0x4000 +#define BGE_RXBDFLAG_IPV6 0x8000 #define BGE_RXERRFLAG_BAD_CRC 0x0001 #define BGE_RXERRFLAG_COLL_DETECT 0x0002 @@ -2162,6 +2193,7 @@ struct bge_extrx_bd { #define BGE_RXERRFLAG_RUNT 0x0020 #define BGE_RXERRFLAG_TRUNC_NO_RSRCS 0x0040 #define BGE_RXERRFLAG_GIANT 0x0080 +#define BGE_RXERRFLAG_IP_CSUM_NOK 0x1000 /* 5717 */ struct bge_sts_idx { #if BYTE_ORDER == LITTLE_ENDIAN @@ -2175,7 +2207,7 @@ struct bge_sts_idx { struct bge_status_block { uint32_t bge_status; - uint32_t bge_rsvd0; + uint32_t bge_status_tag; #if BYTE_ORDER == LITTLE_ENDIAN uint16_t bge_rx_jumbo_cons_idx; uint16_t bge_rx_std_cons_idx; @@ -2221,6 +2253,8 @@ struct bge_status_block { #define BCOM_DEVICEID_BCM5714S 0x1669 #define BCOM_DEVICEID_BCM5715 0x1678 #define BCOM_DEVICEID_BCM5715S 0x1679 +#define BCOM_DEVICEID_BCM5717 0x1655 +#define BCOM_DEVICEID_BCM5718 0x1656 #define BCOM_DEVICEID_BCM5720 0x1658 #define BCOM_DEVICEID_BCM5721 0x1659 #define BCOM_DEVICEID_BCM5722 0x165A @@ -2717,16 +2751,20 @@ struct bge_softc { #define BGE_FLAG_EADDR 0x00000008 #define BGE_FLAG_MII_SERDES 0x00000010 #define BGE_FLAG_CPMU_PRESENT 0x00000020 +#define BGE_FLAG_TAGGED_STATUS 0x00000040 #define BGE_FLAG_MSI 0x00000100 #define BGE_FLAG_PCIX 0x00000200 #define BGE_FLAG_PCIE 0x00000400 #define BGE_FLAG_TSO 0x00000800 +#define BGE_FLAG_TSO3 0x00001000 +#define BGE_FLAG_JUMBO_FRAME 0x00002000 #define BGE_FLAG_5700_FAMILY 0x00010000 #define BGE_FLAG_5705_PLUS 0x00020000 #define BGE_FLAG_5714_FAMILY 0x00040000 #define BGE_FLAG_575X_PLUS 0x00080000 #define BGE_FLAG_5755_PLUS 0x00100000 #define BGE_FLAG_5788 0x00200000 +#define BGE_FLAG_5717_PLUS 0x00400000 #define BGE_FLAG_40BIT_BUG 0x01000000 #define BGE_FLAG_4G_BNDRY_BUG 0x02000000 #define BGE_FLAG_RX_ALIGNBUG 0x04000000 From owner-svn-src-head@FreeBSD.ORG Wed Oct 27 17:38:06 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 23D2E106566C; Wed, 27 Oct 2010 17:38:06 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 128668FC08; Wed, 27 Oct 2010 17:38:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9RHc5Ge016660; Wed, 27 Oct 2010 17:38:05 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9RHc50q016656; Wed, 27 Oct 2010 17:38:05 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201010271738.o9RHc50q016656@svn.freebsd.org> From: Hans Petter Selasky Date: Wed, 27 Oct 2010 17:38:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214429 - head/sys/dev/usb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Oct 2010 17:38:06 -0000 Author: hselasky Date: Wed Oct 27 17:38:05 2010 New Revision: 214429 URL: http://svn.freebsd.org/changeset/base/214429 Log: Add support for setting per-interface PnP information. Submitted by: Nick Hibma Approved by: thompsa (mentor) Modified: head/sys/dev/usb/usb_device.c head/sys/dev/usb/usb_hub.c head/sys/dev/usb/usbdi.h Modified: head/sys/dev/usb/usb_device.c ============================================================================== --- head/sys/dev/usb/usb_device.c Wed Oct 27 17:20:19 2010 (r214428) +++ head/sys/dev/usb/usb_device.c Wed Oct 27 17:38:05 2010 (r214429) @@ -88,7 +88,7 @@ static void usb_init_endpoint(struct usb struct usb_endpoint *); static void usb_unconfigure(struct usb_device *, uint8_t); static void usb_detach_device_sub(struct usb_device *, device_t *, - uint8_t); + char **, uint8_t); static uint8_t usb_probe_and_attach_sub(struct usb_device *, struct usb_attach_arg *); static void usb_init_attach_arg(struct usb_device *, @@ -1035,9 +1035,10 @@ usb_reset_iface_endpoints(struct usb_dev *------------------------------------------------------------------------*/ static void usb_detach_device_sub(struct usb_device *udev, device_t *ppdev, - uint8_t flag) + char **ppnpinfo, uint8_t flag) { device_t dev; + char *pnpinfo; int err; dev = *ppdev; @@ -1069,11 +1070,17 @@ usb_detach_device_sub(struct usb_device goto error; } } + + pnpinfo = *ppnpinfo; + if (pnpinfo != NULL) { + *ppnpinfo = NULL; + free(pnpinfo, M_USBDEV); + } return; error: /* Detach is not allowed to fail in the USB world */ - panic("A USB driver would not detach\n"); + panic("usb_detach_device_sub: A USB driver would not detach\n"); } /*------------------------------------------------------------------------* @@ -1122,7 +1129,8 @@ usb_detach_device(struct usb_device *ude /* looks like the end of the USB interfaces */ break; } - usb_detach_device_sub(udev, &iface->subdev, flag); + usb_detach_device_sub(udev, &iface->subdev, + &iface->pnpinfo, flag); } } @@ -2714,3 +2722,37 @@ usbd_enum_is_locked(struct usb_device *u { return (sx_xlocked(&udev->enum_sx)); } + +/* + * The following function is used to set the per-interface specific + * plug and play information. The string referred to by the pnpinfo + * argument can safely be freed after calling this function. The + * pnpinfo of an interface will be reset at device detach or when + * passing a NULL argument to this function. This function + * returns zero on success, else a USB_ERR_XXX failure code. + */ + +usb_error_t +usbd_set_pnpinfo(struct usb_device *udev, uint8_t iface_index, const char *pnpinfo) +{ + struct usb_interface *iface; + + iface = usbd_get_iface(udev, iface_index); + if (iface == NULL) + return (USB_ERR_INVAL); + + if (iface->pnpinfo != NULL) { + free(iface->pnpinfo, M_USBDEV); + iface->pnpinfo = NULL; + } + + if (pnpinfo == NULL || pnpinfo[0] == 0) + return (0); /* success */ + + iface->pnpinfo = strdup(pnpinfo, M_USBDEV); + if (iface->pnpinfo == NULL) + return (USB_ERR_NOMEM); + + return (0); /* success */ +} + Modified: head/sys/dev/usb/usb_hub.c ============================================================================== --- head/sys/dev/usb/usb_hub.c Wed Oct 27 17:20:19 2010 (r214428) +++ head/sys/dev/usb/usb_hub.c Wed Oct 27 17:38:05 2010 (r214429) @@ -1330,7 +1330,7 @@ uhub_child_pnpinfo_string(device_t paren "devclass=0x%02x devsubclass=0x%02x " "sernum=\"%s\" " "release=0x%04x " - "intclass=0x%02x intsubclass=0x%02x", + "intclass=0x%02x intsubclass=0x%02x" "%s%s", UGETW(res.udev->ddesc.idVendor), UGETW(res.udev->ddesc.idProduct), res.udev->ddesc.bDeviceClass, @@ -1338,7 +1338,9 @@ uhub_child_pnpinfo_string(device_t paren usb_get_serial(res.udev), UGETW(res.udev->ddesc.bcdDevice), iface->idesc->bInterfaceClass, - iface->idesc->bInterfaceSubClass); + iface->idesc->bInterfaceSubClass, + iface->pnpinfo ? " " : "", + iface->pnpinfo ? iface->pnpinfo : ""); } else { if (buflen) { buf[0] = '\0'; Modified: head/sys/dev/usb/usbdi.h ============================================================================== --- head/sys/dev/usb/usbdi.h Wed Oct 27 17:20:19 2010 (r214428) +++ head/sys/dev/usb/usbdi.h Wed Oct 27 17:38:05 2010 (r214429) @@ -171,6 +171,7 @@ struct usb_interface { struct usb_host_interface *cur_altsetting; struct usb_device *linux_udev; void *bsd_priv_sc; /* device specific information */ + char *pnpinfo; /* additional PnP-info for this interface */ uint8_t num_altsetting; /* number of alternate settings */ uint8_t bsd_iface_index; }; @@ -444,6 +445,8 @@ enum usb_hc_mode usbd_get_mode(struct us enum usb_dev_speed usbd_get_speed(struct usb_device *udev); void device_set_usb_desc(device_t dev); void usb_pause_mtx(struct mtx *mtx, int _ticks); +usb_error_t usbd_set_pnpinfo(struct usb_device *udev, + uint8_t iface_index, const char *pnpinfo); const struct usb_device_id *usbd_lookup_id_by_info( const struct usb_device_id *id, usb_size_t sizeof_id, From owner-svn-src-head@FreeBSD.ORG Wed Oct 27 18:46:56 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8F2291065670; Wed, 27 Oct 2010 18:46:56 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7E6D58FC08; Wed, 27 Oct 2010 18:46:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9RIku0d019255; Wed, 27 Oct 2010 18:46:56 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9RIkufm019253; Wed, 27 Oct 2010 18:46:56 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201010271846.o9RIkufm019253@svn.freebsd.org> From: Rui Paulo Date: Wed, 27 Oct 2010 18:46:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214430 - head/cddl/lib/drti X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Oct 2010 18:46:56 -0000 Author: rpaulo Date: Wed Oct 27 18:46:56 2010 New Revision: 214430 URL: http://svn.freebsd.org/changeset/base/214430 Log: Use ${PICFLAG} instead of -fpic. Modified: head/cddl/lib/drti/Makefile Modified: head/cddl/lib/drti/Makefile ============================================================================== --- head/cddl/lib/drti/Makefile Wed Oct 27 17:38:05 2010 (r214429) +++ head/cddl/lib/drti/Makefile Wed Oct 27 18:46:56 2010 (r214430) @@ -16,6 +16,6 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/ -I${OPENSOLARIS_USR_DISTDIR}/lib/libctf/common \ -I${OPENSOLARIS_USR_DISTDIR}/lib/libdtrace/common \ -I${OPENSOLARIS_SYS_DISTDIR}/uts/common \ - -DPIC -fpic + -DPIC ${PICFLAG} .include From owner-svn-src-head@FreeBSD.ORG Wed Oct 27 18:48:24 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 13623106564A; Wed, 27 Oct 2010 18:48:24 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 02C5C8FC17; Wed, 27 Oct 2010 18:48:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9RImNYK019346; Wed, 27 Oct 2010 18:48:23 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9RImNSR019344; Wed, 27 Oct 2010 18:48:23 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201010271848.o9RImNSR019344@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Wed, 27 Oct 2010 18:48:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214431 - head/bin/rm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Oct 2010 18:48:24 -0000 Author: des Date: Wed Oct 27 18:48:23 2010 New Revision: 214431 URL: http://svn.freebsd.org/changeset/base/214431 Log: Language cleanup. Modified: head/bin/rm/rm.1 Modified: head/bin/rm/rm.1 ============================================================================== --- head/bin/rm/rm.1 Wed Oct 27 18:46:56 2010 (r214430) +++ head/bin/rm/rm.1 Wed Oct 27 18:48:23 2010 (r214431) @@ -231,6 +231,6 @@ The .Fl P option assumes that the underlying file system updates existing blocks in-place and does not store new data in a new location. -This is true for UFS but not for ZFS, which is using a Copy-On-Write strategy. -In addition, only regular files are overwritten, other types of files -are not. +This is true for UFS, but not for ZFS or other file systems which use +copy-on-write semantics. +In addition, only regular files are overwritten. From owner-svn-src-head@FreeBSD.ORG Wed Oct 27 19:01:09 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 847B2106564A; Wed, 27 Oct 2010 19:01:09 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 58EEB8FC18; Wed, 27 Oct 2010 19:01:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9RJ19dX020283; Wed, 27 Oct 2010 19:01:09 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9RJ19Et020281; Wed, 27 Oct 2010 19:01:09 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201010271901.o9RJ19Et020281@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 27 Oct 2010 19:01:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214432 - head/share/man/man4 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Oct 2010 19:01:09 -0000 Author: yongari Date: Wed Oct 27 19:01:09 2010 New Revision: 214432 URL: http://svn.freebsd.org/changeset/base/214432 Log: Use shorten model name and add RTL8168, RTL8111 to the list of supported device. re(4) had been supported all variants of RTL8168, RTL8111 and RTL810x. I think this change will cover all controllers supported by re(4). MFC after: 1 week Modified: head/share/man/man4/re.4 Modified: head/share/man/man4/re.4 ============================================================================== --- head/share/man/man4/re.4 Wed Oct 27 18:48:23 2010 (r214431) +++ head/share/man/man4/re.4 Wed Oct 27 19:01:09 2010 (r214432) @@ -30,12 +30,12 @@ .\" .\" $FreeBSD$ .\" -.Dd February 9, 2009 +.Dd October 27, 2010 .Dt RE 4 .Os .Sh NAME .Nm re -.Nd "RealTek 8139C+/8169/816xS/811xS/8101E PCI/PCIe Ethernet adapter driver" +.Nd "RealTek 8139C+/8169/816xS/811xS/8168/810xE/8111 PCI/PCIe Ethernet adapter driver" .Sh SYNOPSIS To compile this driver into the kernel, place the following lines in your @@ -55,13 +55,13 @@ if_re_load="YES" The .Nm driver provides support for various NICs based on the RealTek RTL8139C+, -RTL8169, RTL8169S, RTL8110S, RTL8168S, RTL8111S and RTL8101E PCI and +RTL8169, RTL816xS, RTL811xS, RTL8168, RTL810xE and RTL8111 PCI and PCIe Ethernet controllers. .Pp -NICs based on the 8139C+ and 8101E are capable of 10 and 100Mbps speeds +NICs based on the 8139C+ and 810xE are capable of 10 and 100Mbps speeds over CAT5 cable. -NICs based on the 8169, 816xS and 811xS are capable of 10, 100 and -1000Mbps operation. +NICs based on the 8169, 816xS, 811xS, 8168 and 8111 are capable of 10, 100 +and 1000Mbps operation. .Pp All NICs supported by the .Nm @@ -72,8 +72,8 @@ capable of TCP large send (TCP segmentat .Pp The 8139C+ is a single-chip solution combining both a 10/100 MAC and PHY. The 8169 is a 10/100/1000 MAC only, requiring a GMII or TBI external PHY. -The 8169S and 8110S are single-chip devices containing both a 10/100/1000 -MAC and 10/100/1000 copper PHY. +The 816xS, 811xS, 8168 and 8111 are single-chip devices containing both a +10/100/1000 MAC and 10/100/1000 copper PHY. Standalone 10/100/1000 cards are available in both 32-bit PCI and 64-bit PCI models. The 8110S is designed for @@ -144,8 +144,8 @@ For more information on configuring this .Sh HARDWARE The .Nm -driver supports RealTek RTL8139C+, RTL8169, RTL816xS, RTL811xS, -and RTL8101E based Fast Ethernet and Gigabit Ethernet adapters including: +driver supports RealTek RTL8139C+, RTL8169, RTL816xS, RTL811xS, RTL8168, +RTL810xE and RTL8111 based Fast Ethernet and Gigabit Ethernet adapters including: .Pp .Bl -bullet -compact .It From owner-svn-src-head@FreeBSD.ORG Wed Oct 27 21:01:53 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A7667106564A; Wed, 27 Oct 2010 21:01:53 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 966098FC08; Wed, 27 Oct 2010 21:01:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9RL1rmO031716; Wed, 27 Oct 2010 21:01:53 GMT (envelope-from jamie@svn.freebsd.org) Received: (from jamie@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9RL1rF4031714; Wed, 27 Oct 2010 21:01:53 GMT (envelope-from jamie@svn.freebsd.org) Message-Id: <201010272101.o9RL1rF4031714@svn.freebsd.org> From: Jamie Gritton Date: Wed, 27 Oct 2010 21:01:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214434 - head/lib/libjail X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Oct 2010 21:01:53 -0000 Author: jamie Date: Wed Oct 27 21:01:53 2010 New Revision: 214434 URL: http://svn.freebsd.org/changeset/base/214434 Log: Find a jail's type as part of jailparam_init rather than waiting until it's absolutely necessary. MFC after: 1 week Modified: head/lib/libjail/jail.c Modified: head/lib/libjail/jail.c ============================================================================== --- head/lib/libjail/jail.c Wed Oct 27 20:25:55 2010 (r214433) +++ head/lib/libjail/jail.c Wed Oct 27 21:01:53 2010 (r214434) @@ -250,10 +250,6 @@ jailparam_all(struct jailparam **jpp) } if (jailparam_init(jp + njp, buf + sizeof(SJPARAM)) < 0) goto error; - if (jailparam_type(jp + njp) < 0) { - njp++; - goto error; - } mib1[1] = 2; } jp = realloc(jp, njp * sizeof(*jp)); @@ -279,6 +275,10 @@ jailparam_init(struct jailparam *jp, con strerror_r(errno, jail_errmsg, JAIL_ERRMSGLEN); return (-1); } + if (jailparam_type(jp) < 0) { + jailparam_free(jp, 1); + return (-1); + } return (0); } @@ -293,8 +293,6 @@ jailparam_import(struct jailparam *jp, c const char *avalue; int i, nval, fw; - if (!jp->jp_ctltype && jailparam_type(jp) < 0) - return (-1); if (value == NULL) return (0); if ((jp->jp_ctltype & CTLTYPE) == CTLTYPE_STRING) { @@ -563,8 +561,6 @@ jailparam_get(struct jailparam *jp, unsi jp_lastjid = jp_jid = jp_name = NULL; arrays = 0; for (ai = j = 0; j < njp; j++) { - if (!jp[j].jp_ctltype && jailparam_type(jp + j) < 0) - return (-1); if (!strcmp(jp[j].jp_name, "lastjid")) jp_lastjid = jp + j; else if (!strcmp(jp[j].jp_name, "jid")) @@ -725,8 +721,6 @@ jailparam_export(struct jailparam *jp) int i, nval, ival; char valbuf[INET6_ADDRSTRLEN]; - if (!jp->jp_ctltype && jailparam_type(jp) < 0) - return (NULL); if ((jp->jp_ctltype & CTLTYPE) == CTLTYPE_STRING) { value = strdup(jp->jp_value); if (value == NULL) From owner-svn-src-head@FreeBSD.ORG Wed Oct 27 21:26:02 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1233) id 0C5DD1065743; Wed, 27 Oct 2010 21:26:02 +0000 (UTC) Date: Wed, 27 Oct 2010 21:26:02 +0000 From: Alexander Best To: Dag-Erling Smorgrav Message-ID: <20101027212601.GA78062@freebsd.org> References: <201010271848.o9RImNSR019344@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201010271848.o9RImNSR019344@svn.freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r214431 - head/bin/rm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Oct 2010 21:26:02 -0000 On Wed Oct 27 10, Dag-Erling Smorgrav wrote: > Author: des > Date: Wed Oct 27 18:48:23 2010 > New Revision: 214431 > URL: http://svn.freebsd.org/changeset/base/214431 > > Log: > Language cleanup. > > Modified: > head/bin/rm/rm.1 > > Modified: head/bin/rm/rm.1 > ============================================================================== > --- head/bin/rm/rm.1 Wed Oct 27 18:46:56 2010 (r214430) > +++ head/bin/rm/rm.1 Wed Oct 27 18:48:23 2010 (r214431) > @@ -231,6 +231,6 @@ The > .Fl P > option assumes that the underlying file system updates existing blocks > in-place and does not store new data in a new location. > -This is true for UFS but not for ZFS, which is using a Copy-On-Write strategy. > -In addition, only regular files are overwritten, other types of files > -are not. > +This is true for UFS, but not for ZFS or other file systems which use > +copy-on-write semantics. > +In addition, only regular files are overwritten. are in fact COW fs the only exception where the -P flag won't work? before r213582 LFS was mentioned here and that the block size must be fixed. also the comment in rm.c says that -P won't work for any logging file systems. i'm not a fs expert, but i think mentioning that -P won't work for COW fs isn't enough. -- a13x From owner-svn-src-head@FreeBSD.ORG Wed Oct 27 21:29:44 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 34AE8106564A for ; Wed, 27 Oct 2010 21:29:44 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from mail2.fluidhosting.com (mx23.fluidhosting.com [204.14.89.6]) by mx1.freebsd.org (Postfix) with ESMTP id B545B8FC0C for ; Wed, 27 Oct 2010 21:29:43 +0000 (UTC) Received: (qmail 18643 invoked by uid 399); 27 Oct 2010 21:29:41 -0000 Received: from localhost (HELO doug-optiplex.ka9q.net) (dougb@dougbarton.us@127.0.0.1) by localhost with ESMTPAM; 27 Oct 2010 21:29:41 -0000 X-Originating-IP: 127.0.0.1 X-Sender: dougb@dougbarton.us Message-ID: <4CC899C3.7040107@FreeBSD.org> Date: Wed, 27 Oct 2010 14:29:39 -0700 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.11) Gecko/20101024 Thunderbird/3.1.5 MIME-Version: 1.0 To: Alexander Best References: <201010271848.o9RImNSR019344@svn.freebsd.org> <20101027212601.GA78062@freebsd.org> In-Reply-To: <20101027212601.GA78062@freebsd.org> X-Enigmail-Version: 1.1.2 OpenPGP: id=1A1ABC84 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Dag-Erling Smorgrav Subject: Re: svn commit: r214431 - head/bin/rm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Oct 2010 21:29:44 -0000 On 10/27/10 14:26, Alexander Best wrote: > are in fact COW fs the only exception where the -P flag won't work? before > r213582 LFS was mentioned here and that the block size must be fixed. > also the comment in rm.c says that -P won't work for any logging file systems. > i'm not a fs expert, but i think mentioning that -P won't work for COW fs isn't > enough. What may be a better approach is to confirm the fs' that DO work, list them, and then add something to the effect of, "This feature is unlikely to work on other file systems." hth, Doug -- Nothin' ever doesn't change, but nothin' changes much. -- OK Go Breadth of IT experience, and depth of knowledge in the DNS. Yours for the right price. :) http://SupersetSolutions.com/ From owner-svn-src-head@FreeBSD.ORG Wed Oct 27 21:48:22 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1233) id 46CF11065696; Wed, 27 Oct 2010 21:48:22 +0000 (UTC) Date: Wed, 27 Oct 2010 21:48:22 +0000 From: Alexander Best To: Doug Barton Message-ID: <20101027214822.GA82697@freebsd.org> References: <201010271848.o9RImNSR019344@svn.freebsd.org> <20101027212601.GA78062@freebsd.org> <4CC899C3.7040107@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4CC899C3.7040107@FreeBSD.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Dag-Erling Smorgrav Subject: Re: svn commit: r214431 - head/bin/rm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Oct 2010 21:48:22 -0000 On Wed Oct 27 10, Doug Barton wrote: > On 10/27/10 14:26, Alexander Best wrote: > >are in fact COW fs the only exception where the -P flag won't work? before > >r213582 LFS was mentioned here and that the block size must be fixed. > >also the comment in rm.c says that -P won't work for any logging file > >systems. > >i'm not a fs expert, but i think mentioning that -P won't work for COW fs > >isn't > >enough. > > What may be a better approach is to confirm the fs' that DO work, list > them, and then add something to the effect of, "This feature is unlikely > to work on other file systems." i don't think that's a good approach, because then the rm(1) has to be changed everytime freebsd gets a new fs which works with the -P option. i think it's better to list which fs semantics DON'T work. so if freebsd gets a new fs, users simply have to know which semantics the new fs is based on and can decide for themselves whether the -P switch will work or not. so far the -P option doesn't seem to work for: - COW fs and/or - fs with a variable block size and/or - fs which do journaling please correct me if i got anything wrong. so i think having such a list in the rm(1) manual would be very nice (maybe improving the comment in rm.c too). cheers. alex > > > hth, > > Doug > > -- > > Nothin' ever doesn't change, but nothin' changes much. > -- OK Go > > Breadth of IT experience, and depth of knowledge in the DNS. > Yours for the right price. :) http://SupersetSolutions.com/ > -- a13x From owner-svn-src-head@FreeBSD.ORG Wed Oct 27 22:26:07 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E0974106566C; Wed, 27 Oct 2010 22:26:07 +0000 (UTC) (envelope-from juli@clockworksquid.com) Received: from mail-gy0-f182.google.com (mail-gy0-f182.google.com [209.85.160.182]) by mx1.freebsd.org (Postfix) with ESMTP id 43FB28FC17; Wed, 27 Oct 2010 22:26:06 +0000 (UTC) Received: by gya6 with SMTP id 6so914331gya.13 for ; Wed, 27 Oct 2010 15:26:06 -0700 (PDT) Received: by 10.151.13.10 with SMTP id q10mr18555026ybi.436.1288216560767; Wed, 27 Oct 2010 14:56:00 -0700 (PDT) MIME-Version: 1.0 Sender: juli@clockworksquid.com Received: by 10.236.103.139 with HTTP; Wed, 27 Oct 2010 14:55:40 -0700 (PDT) In-Reply-To: <20101027214822.GA82697@freebsd.org> References: <201010271848.o9RImNSR019344@svn.freebsd.org> <20101027212601.GA78062@freebsd.org> <4CC899C3.7040107@FreeBSD.org> <20101027214822.GA82697@freebsd.org> From: Juli Mallett Date: Wed, 27 Oct 2010 14:55:40 -0700 X-Google-Sender-Auth: aZUsib2Kz_Gsmk2QwG2AaLB9F6Y Message-ID: To: Alexander Best Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Doug Barton , src-committers@freebsd.org, Dag-Erling Smorgrav Subject: Re: svn commit: r214431 - head/bin/rm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Oct 2010 22:26:08 -0000 On Wed, Oct 27, 2010 at 14:48, Alexander Best wrote: > On Wed Oct 27 10, Doug Barton wrote: >> What may be a better approach is to confirm the fs' that DO work, list >> them, and then add something to the effect of, "This feature is unlikely >> to work on other file systems." > > i don't think that's a good approach, because then the rm(1) has to be changed > everytime freebsd gets a new fs which works with the -P option. i think it's > better to list which fs semantics DON'T work. so if freebsd gets a new fs, > users simply have to know which semantics the new fs is based on and can decide > for themselves whether the -P switch will work or not. > > so far the -P option doesn't seem to work for: > > - COW fs and/or > - fs with a variable block size and/or > - fs which do journaling I really don't want to ask the average user to know whether their filesystem is in-place block-rewriting or not. That's just silly. In this case Doug is right; I don't think FreeBSD gets new file systems as often as you think that it would be a big burden. Having a general description of the types of filesystem it can work on might be useful, but a list seems more useful still. Listing the types it can't work on is backwards because that requires a user to understand the dichotomy as well as knowing what kind of filesystem they don't have / do have. And for them to never get it backwards. At least mount(8) will tell you what filesystem you are using; there's no tool to tell you the properties of your filesystem, and good luck easily-mining an answer to the question of whether your filesystem fits into that category from a manpage without introducing substantial confusion. Maybe there should be substantial confusion around this feature, though, since that's what it seems to be there for. Juli. From owner-svn-src-head@FreeBSD.ORG Wed Oct 27 22:33:19 2010 Return-Path: Delivered-To: svn-src-head@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 26F95106566C; Wed, 27 Oct 2010 22:33:19 +0000 (UTC) (envelope-from delphij@delphij.net) Received: from tarsier.geekcn.org (tarsier.geekcn.org [IPv6:2001:470:a803::1]) by mx1.freebsd.org (Postfix) with ESMTP id AA9138FC13; Wed, 27 Oct 2010 22:33:18 +0000 (UTC) Received: from mail.geekcn.org (tarsier.geekcn.org [211.166.10.233]) by tarsier.geekcn.org (Postfix) with ESMTP id 17991A683DE; Thu, 28 Oct 2010 06:33:17 +0800 (CST) X-Virus-Scanned: amavisd-new at geekcn.org Received: from tarsier.geekcn.org ([211.166.10.233]) by mail.geekcn.org (mail.geekcn.org [211.166.10.233]) (amavisd-new, port 10024) with LMTP id jli3LUb0jJLt; Thu, 28 Oct 2010 06:33:08 +0800 (CST) Received: from delta.delphij.net (drawbridge.ixsystems.com [206.40.55.65]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tarsier.geekcn.org (Postfix) with ESMTPSA id B124CA683D2; Thu, 28 Oct 2010 06:33:05 +0800 (CST) DomainKey-Signature: a=rsa-sha1; s=default; d=delphij.net; c=nofws; q=dns; h=message-id:date:from:reply-to:organization:user-agent: mime-version:to:cc:subject:references:in-reply-to: x-enigmail-version:openpgp:content-type:content-transfer-encoding; b=Q273MbKmQIOm7fXgqrOfdl240PeYhIpYUzp9ooFekkLZCrKeo3KoRumcf9y3x7JmF O+8NrwrDrNlKqoB5McGnA== Message-ID: <4CC8A89D.5070909@delphij.net> Date: Wed, 27 Oct 2010 15:33:01 -0700 From: Xin LI Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.1.14) Gecko/20101020 Thunderbird/3.0.9 ThunderBrowse/3.3.2 MIME-Version: 1.0 To: Alexander Best References: <201010271848.o9RImNSR019344@svn.freebsd.org> <20101027212601.GA78062@freebsd.org> <4CC899C3.7040107@FreeBSD.org> <20101027214822.GA82697@freebsd.org> In-Reply-To: <20101027214822.GA82697@freebsd.org> X-Enigmail-Version: 1.0.1 OpenPGP: id=3FCA37C1; url=http://www.delphij.net/delphij.asc Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, Doug Barton , src-committers@FreeBSD.ORG, Dag-Erling Smorgrav Subject: Re: svn commit: r214431 - head/bin/rm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: d@delphij.net List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Oct 2010 22:33:19 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 On 10/27/10 14:48, Alexander Best wrote: > On Wed Oct 27 10, Doug Barton wrote: >> On 10/27/10 14:26, Alexander Best wrote: >>> are in fact COW fs the only exception where the -P flag won't work? before >>> r213582 LFS was mentioned here and that the block size must be fixed. >>> also the comment in rm.c says that -P won't work for any logging file >>> systems. >>> i'm not a fs expert, but i think mentioning that -P won't work for COW fs >>> isn't >>> enough. >> >> What may be a better approach is to confirm the fs' that DO work, list >> them, and then add something to the effect of, "This feature is unlikely >> to work on other file systems." > > i don't think that's a good approach, because then the rm(1) has to be changed > everytime freebsd gets a new fs which works with the -P option. i think it's > better to list which fs semantics DON'T work. so if freebsd gets a new fs, > users simply have to know which semantics the new fs is based on and can decide > for themselves whether the -P switch will work or not. > > so far the -P option doesn't seem to work for: > > - COW fs and/or > - fs with a variable block size and/or > - fs which do journaling > > please correct me if i got anything wrong. so i think having such a list in the > rm(1) manual would be very nice (maybe improving the comment in rm.c too). I think what really defeats -P is the fact that the file system or underlying data storage would not overwrite data on a file at sync(). COW is of course one of the case, journaling MAY defeat -P but is not guaranteed. FS with variable block size - I believe this really depends on the implementation. If I understood the code correctly, UFS, UFS+SU, UFS+SUJ, msdosfs and ext2fs supports rm -P as long as they are not being put on gjournal'ed disk, ZFS zvol, etc., and no snapshot is being used. It seems to be hard for me to conclude all cases in short, plain English but I'm all for improvements to the manual page to describe that in an elegant and precise manner. Maybe something like: =============== BUGS The -P option assumes that the underlying storage overwrites file block when data is written on existing offset. Several factors including the file system and its backing store could defeat the assumption, this includes, but is not limited to file systems that uses Copy-On-Write strategy (e.g. ZFS or UFS when snapshot is being used), or backing datastore that does journaling, etc. In addition, only regular files are overwritten, other types of files are not. =============== Cheers, - -- Xin LI http://www.delphij.net/ FreeBSD - The Power to Serve! Live free or die -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (FreeBSD) iQEcBAEBCAAGBQJMyKicAAoJEATO+BI/yjfBElYIAMP70g1a+YheuKD14NXugVTU sG4KEWAjRSZCe808f46AXU+wJePnRFkYVKD+A+6aH63y/r2V0e3CVMUYZZXr4l/d HJRnZjJK9e/YJv8pcCpq7PgnmPzMa4m4BQNYVJoNGbPd75V27wMi3hgBzzPrJxWL aBuB31hpU32PcpvzQgBPLiNzjEuLRq5be42HjgTPT1qGwSMEQcLgXOfG9l6TS27s I5n5KPU7dEFt0Z+3ljQM+F3Fk2wmy/EOAeRcZL89xvFZIAYmtVrL3UcniHALPRSn CAbGrNpCbvh2RZvJX1Cwu3H+PVIlIcl2uG/aiOEC7m/tA29LfPPXG0IzUN9qVLc= =LQen -----END PGP SIGNATURE----- From owner-svn-src-head@FreeBSD.ORG Wed Oct 27 22:38:56 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1233) id 10D65106566C; Wed, 27 Oct 2010 22:38:56 +0000 (UTC) Date: Wed, 27 Oct 2010 22:38:56 +0000 From: Alexander Best To: Juli Mallett Message-ID: <20101027223856.GA87087@freebsd.org> References: <201010271848.o9RImNSR019344@svn.freebsd.org> <20101027212601.GA78062@freebsd.org> <4CC899C3.7040107@FreeBSD.org> <20101027214822.GA82697@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Doug Barton , src-committers@freebsd.org, Dag-Erling Smorgrav Subject: Re: svn commit: r214431 - head/bin/rm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Oct 2010 22:38:56 -0000 On Wed Oct 27 10, Juli Mallett wrote: > On Wed, Oct 27, 2010 at 14:48, Alexander Best wrote: > > On Wed Oct 27 10, Doug Barton wrote: > >> What may be a better approach is to confirm the fs' that DO work, list > >> them, and then add something to the effect of, "This feature is unlikely > >> to work on other file systems." > > > > i don't think that's a good approach, because then the rm(1) has to be changed > > everytime freebsd gets a new fs which works with the -P option. i think it's > > better to list which fs semantics DON'T work. so if freebsd gets a new fs, > > users simply have to know which semantics the new fs is based on and can decide > > for themselves whether the -P switch will work or not. > > > > so far the -P option doesn't seem to work for: > > > > - COW fs and/or > > - fs with a variable block size and/or > > - fs which do journaling > > I really don't want to ask the average user to know whether their > filesystem is in-place block-rewriting or not. That's just silly. In > this case Doug is right; I don't think FreeBSD gets new file systems > as often as you think that it would be a big burden. Having a general > description of the types of filesystem it can work on might be useful, > but a list seems more useful still. Listing the types it can't work > on is backwards because that requires a user to understand the > dichotomy as well as knowing what kind of filesystem they don't have / > do have. And for them to never get it backwards. At least mount(8) > will tell you what filesystem you are using; there's no tool to tell > you the properties of your filesystem, and good luck easily-mining an > answer to the question of whether your filesystem fits into that > category from a manpage without introducing substantial confusion. > > Maybe there should be substantial confusion around this feature, > though, since that's what it seems to be there for. how about fusefs? i think there's an ongoing disussion about importing it into HEAD on arch@ or fs@. won't this bring in support for a number of new filesystems which then all have to be documented in the rm(1) manual? but if in fact all working fs should get mentioned...what are they? - UFS1/2 - ext2fs - FAT12/16/32 ...any more? what about memory backed fs like tmpfs? cheers. alex > > Juli. -- a13x From owner-svn-src-head@FreeBSD.ORG Wed Oct 27 22:42:57 2010 Return-Path: Delivered-To: svn-src-head@FreeBSD.ORG Received: by hub.freebsd.org (Postfix, from userid 1233) id 665BE106566C; Wed, 27 Oct 2010 22:42:57 +0000 (UTC) Date: Wed, 27 Oct 2010 22:42:57 +0000 From: Alexander Best To: d@delphij.net Message-ID: <20101027224257.GB87087@freebsd.org> References: <201010271848.o9RImNSR019344@svn.freebsd.org> <20101027212601.GA78062@freebsd.org> <4CC899C3.7040107@FreeBSD.org> <20101027214822.GA82697@freebsd.org> <4CC8A89D.5070909@delphij.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4CC8A89D.5070909@delphij.net> Cc: svn-src-head@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, Doug Barton , src-committers@FreeBSD.ORG, Dag-Erling Smorgrav Subject: Re: svn commit: r214431 - head/bin/rm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Oct 2010 22:42:57 -0000 On Wed Oct 27 10, Xin LI wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA256 > > On 10/27/10 14:48, Alexander Best wrote: > > On Wed Oct 27 10, Doug Barton wrote: > >> On 10/27/10 14:26, Alexander Best wrote: > >>> are in fact COW fs the only exception where the -P flag won't work? before > >>> r213582 LFS was mentioned here and that the block size must be fixed. > >>> also the comment in rm.c says that -P won't work for any logging file > >>> systems. > >>> i'm not a fs expert, but i think mentioning that -P won't work for COW fs > >>> isn't > >>> enough. > >> > >> What may be a better approach is to confirm the fs' that DO work, list > >> them, and then add something to the effect of, "This feature is unlikely > >> to work on other file systems." > > > > i don't think that's a good approach, because then the rm(1) has to be changed > > everytime freebsd gets a new fs which works with the -P option. i think it's > > better to list which fs semantics DON'T work. so if freebsd gets a new fs, > > users simply have to know which semantics the new fs is based on and can decide > > for themselves whether the -P switch will work or not. > > > > so far the -P option doesn't seem to work for: > > > > - COW fs and/or > > - fs with a variable block size and/or > > - fs which do journaling > > > > please correct me if i got anything wrong. so i think having such a list in the > > rm(1) manual would be very nice (maybe improving the comment in rm.c too). > > I think what really defeats -P is the fact that the file system or > underlying data storage would not overwrite data on a file at sync(). > COW is of course one of the case, journaling MAY defeat -P but is not > guaranteed. FS with variable block size - I believe this really depends > on the implementation. > > If I understood the code correctly, UFS, UFS+SU, UFS+SUJ, msdosfs and > ext2fs supports rm -P as long as they are not being put on gjournal'ed > disk, ZFS zvol, etc., and no snapshot is being used. > > It seems to be hard for me to conclude all cases in short, plain English > but I'm all for improvements to the manual page to describe that in an > elegant and precise manner. > > Maybe something like: > > =============== > BUGS > > The -P option assumes that the underlying storage overwrites file block > when data is written on existing offset. Several factors including the > file system and its backing store could defeat the assumption, this > includes, but is not limited to file systems that uses Copy-On-Write > strategy (e.g. ZFS or UFS when snapshot is being used), or backing > datastore that does journaling, etc. In addition, only regular files > are overwritten, other types of files are not. > =============== personally i like this approach a lot better than listing all working fs, because that list would be quite long since e.g. for UFS2 (as you mentioned) one cannot asume that it will support the -P option at all times. cheers. alex > > Cheers, > - -- > Xin LI http://www.delphij.net/ > FreeBSD - The Power to Serve! Live free or die > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v2.0.16 (FreeBSD) > > iQEcBAEBCAAGBQJMyKicAAoJEATO+BI/yjfBElYIAMP70g1a+YheuKD14NXugVTU > sG4KEWAjRSZCe808f46AXU+wJePnRFkYVKD+A+6aH63y/r2V0e3CVMUYZZXr4l/d > HJRnZjJK9e/YJv8pcCpq7PgnmPzMa4m4BQNYVJoNGbPd75V27wMi3hgBzzPrJxWL > aBuB31hpU32PcpvzQgBPLiNzjEuLRq5be42HjgTPT1qGwSMEQcLgXOfG9l6TS27s > I5n5KPU7dEFt0Z+3ljQM+F3Fk2wmy/EOAeRcZL89xvFZIAYmtVrL3UcniHALPRSn > CAbGrNpCbvh2RZvJX1Cwu3H+PVIlIcl2uG/aiOEC7m/tA29LfPPXG0IzUN9qVLc= > =LQen > -----END PGP SIGNATURE----- -- a13x From owner-svn-src-head@FreeBSD.ORG Thu Oct 28 00:16:55 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5211B1065674; Thu, 28 Oct 2010 00:16:55 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 273438FC12; Thu, 28 Oct 2010 00:16:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9S0Gt80048090; Thu, 28 Oct 2010 00:16:55 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9S0GtHf048088; Thu, 28 Oct 2010 00:16:55 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <201010280016.o9S0GtHf048088@svn.freebsd.org> From: Jack F Vogel Date: Thu, 28 Oct 2010 00:16:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214441 - head/sys/dev/e1000 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 00:16:55 -0000 Author: jfv Date: Thu Oct 28 00:16:54 2010 New Revision: 214441 URL: http://svn.freebsd.org/changeset/base/214441 Log: In the data setup code for doing offloads the ip and tcp pointers were not reset after some pullups. In practice this led to an NFS mount failure when using UDP reported by Kevin Lo, thanks Kevin. Fix from yongari, thank you! Modified: head/sys/dev/e1000/if_em.c Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Wed Oct 27 23:55:15 2010 (r214440) +++ head/sys/dev/e1000/if_em.c Thu Oct 28 00:16:54 2010 (r214441) @@ -93,7 +93,7 @@ int em_display_debug_stats = 0; /********************************************************************* * Driver version: *********************************************************************/ -char em_driver_version[] = "7.1.6"; +char em_driver_version[] = "7.1.7"; /********************************************************************* * PCI Device ID Table @@ -1848,6 +1848,7 @@ em_xmit(struct tx_ring *txr, struct mbuf *m_headp = NULL; return (ENOBUFS); } + ip = (struct ip *)(mtod(m_head, char *) + ip_off); ip->ip_len = 0; ip->ip_sum = 0; /* @@ -1856,6 +1857,7 @@ em_xmit(struct tx_ring *txr, struct mbuf * what hardware expect to see. This is adherence of * Microsoft's Large Send specification. */ + tp = (struct tcphdr *)(mtod(m_head, char *) + poff); tp->th_sum = in_pseudo(ip->ip_src.s_addr, ip->ip_dst.s_addr, htons(IPPROTO_TCP)); } else if (m_head->m_pkthdr.csum_flags & CSUM_TCP) { @@ -1865,12 +1867,15 @@ em_xmit(struct tx_ring *txr, struct mbuf *m_headp = NULL; return (ENOBUFS); } + ip = (struct ip *)(mtod(m_head, char *) + ip_off); + tp = (struct tcphdr *)(mtod(m_head, char *) + poff); } else if (m_head->m_pkthdr.csum_flags & CSUM_UDP) { m_head = m_pullup(m_head, poff + sizeof(struct udphdr)); if (m_head == NULL) { *m_headp = NULL; return (ENOBUFS); } + ip = (struct ip *)(mtod(m_head, char *) + ip_off); } *m_headp = m_head; } From owner-svn-src-head@FreeBSD.ORG Thu Oct 28 00:52:36 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BD07B106564A; Thu, 28 Oct 2010 00:52:36 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id 75B588FC08; Thu, 28 Oct 2010 00:52:35 +0000 (UTC) Received: by wwi17 with SMTP id 17so111023wwi.31 for ; Wed, 27 Oct 2010 17:52:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type; bh=7HYUvgh5gmoLReYbkeJxykoBuCU9Oac891nYJXN6dXQ=; b=b25K0hYbb2L+sb0E5qnMIqs19Q0BgJx7XdoQ6WEg7N530cdiYCgzPUcw8l172cop/4 Kc2tqdbe5lB8Md3nOsFqSWV/8hRr33PVfWm9l4HCb1eRL5pjoSW7Uzk4SM1HCcfCrng7 zFeI1aewMxx+t72LaG1g2ZHYDH/fQCUgsu7Nw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; b=Qu5qMYjHhYnBSJjIOZoyMm8rwFsXGtVcqAPsZ9PgyRrzRxxXE4Btd8NJRMChsv5rQE RT1iWW5ynd2ukK3YNEfhdvcSdJrmdlzsAQZZyhcXwOCxDzgYTVDS9blnkv+7lGYnzkux 1H3YFqDl7Grxj4ZnI+uh9RB3R9yC/Yfy9tMd4= MIME-Version: 1.0 Received: by 10.216.11.205 with SMTP id 55mr9833917wex.51.1288227154317; Wed, 27 Oct 2010 17:52:34 -0700 (PDT) Sender: yanegomi@gmail.com Received: by 10.216.10.198 with HTTP; Wed, 27 Oct 2010 17:52:34 -0700 (PDT) In-Reply-To: <4CC851CC.80509@freebsd.org> References: <201010270232.o9R2Wsu3084553@svn.freebsd.org> <4CC803A8.3040602@freebsd.org> <20101027082122.GD1848@garage.freebsd.pl> <4CC85552.2020100@freebsd.org> <20101027133307.GQ2392@deviant.kiev.zoral.com.ua> <4CC851CC.80509@freebsd.org> Date: Wed, 27 Oct 2010 17:52:34 -0700 X-Google-Sender-Auth: g5uen7lMADsl5cItc3H3YgFSqbQ Message-ID: From: Garrett Cooper To: Andriy Gapon Content-Type: multipart/mixed; boundary=0016364d2cbdec533f0493a2c1cf Cc: src-committers@freebsd.org, Pawel Jakub Dawidek , svn-src-all@freebsd.org, svn-src-head@freebsd.org, David Xu , Kostik Belousov Subject: Re: svn commit: r214409 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 00:52:36 -0000 --0016364d2cbdec533f0493a2c1cf Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Wed, Oct 27, 2010 at 9:22 AM, Andriy Gapon wrote: > > [patch attachment was lost] Ugh... Mailman hates me I guess :(... > on 27/10/2010 19:07 Garrett Cooper said the following: >> =A0 =A0 How about this patch? I implemented this as a readonly tunable a= nd > > I don't think that it's correct to call it a tunable or use CTLFLAG_RDTUN= . > As I understand it is a read-only sysctl. Converted to CTLFLAG_RD. >> sysconf tunable, because (AFAIK) the value that is being tested >> shouldn't change during runtime after the system has been booted up, >> and figuring that the value wasn't going to change it was better to >> lose 4/8 bytes on the kernel stack instead of having to recompute the >> value every time in a function call, with the associated lost heap / >> stack memory in the process, as the assumption is that this libcall >> was going to be called frequently by some programs. Thanks! -Garrett --0016364d2cbdec533f0493a2c1cf Content-Type: text/x-patch; charset=US-ASCII; name="cpuset_t-size-sysctl-and-sysconf-value.patch" Content-Disposition: attachment; filename="cpuset_t-size-sysctl-and-sysconf-value.patch" Content-Transfer-Encoding: base64 X-Attachment-Id: f_gfsx6dxs0 SW5kZXg6IGluY2x1ZGUvdW5pc3RkLmgKPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQotLS0gaW5jbHVkZS91bmlzdGQuaAko cmV2aXNpb24gMjE0NDEzKQorKysgaW5jbHVkZS91bmlzdGQuaAkod29ya2luZyBjb3B5KQpAQCAt Mjg4LDYgKzI4OCw3IEBACiAjaWYgX19CU0RfVklTSUJMRQogI2RlZmluZQlfU0NfTlBST0NFU1NP UlNfQ09ORgk1NwogI2RlZmluZQlfU0NfTlBST0NFU1NPUlNfT05MTgk1OAorI2RlZmluZQlfU0Nf Q1BVU0VUX1NJWkUJCTEyMgogI2VuZGlmCiAKIC8qIEV4dGVuc2lvbnMgZm91bmQgaW4gU29sYXJp cyBhbmQgTGludXguICovCkluZGV4OiBsaWIvbGliYy9nZW4vc3lzY29uZi5jCj09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0K LS0tIGxpYi9saWJjL2dlbi9zeXNjb25mLmMJKHJldmlzaW9uIDIxNDQxMykKKysrIGxpYi9saWJj L2dlbi9zeXNjb25mLmMJKHdvcmtpbmcgY29weSkKQEAgLTU5Nyw2ICs1OTcsMTUgQEAKIAkJcmV0 dXJuIChsdmFsdWUpOwogI2VuZGlmCiAKKyNpZmRlZiBfU0NfQ1BVU0VUX1NJWkUKKwljYXNlIF9T Q19DUFVTRVRfU0laRToKKwkJbGVuID0gc2l6ZW9mKGx2YWx1ZSk7CisJCWlmIChzeXNjdGxieW5h bWUoImtlcm4uc2NoZWQuY3B1c2V0c2l6ZSIsICZsdmFsdWUsICZsZW4sIE5VTEwsCisJCSAgICAw KSA9PSAtMSkKKwkJCXJldHVybiAoLTEpOworCQlyZXR1cm4gKGx2YWx1ZSk7CisjZW5kaWYKKwog CWRlZmF1bHQ6CiAJCWVycm5vID0gRUlOVkFMOwogCQlyZXR1cm4gKC0xKTsKSW5kZXg6IHN5cy9r ZXJuL3NjaGVkX3VsZS5jCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIHN5cy9rZXJuL3NjaGVkX3VsZS5jCShyZXZp c2lvbiAyMTQ0MTMpCisrKyBzeXMva2Vybi9zY2hlZF91bGUuYwkod29ya2luZyBjb3B5KQpAQCAt MjcxMiw2ICsyNzEyLDggQEAKIAlzYnVmX2RlbGV0ZSh0b3BvKTsKIAlyZXR1cm4gKGVycik7CiB9 CisKK3N0YXRpYyBzaXplX3QgX2tlcm5fY3B1c2V0X3NpemUgPSBzaXplb2YoY3B1c2V0X3QpOwog I2VuZGlmCiAKIFNZU0NUTF9OT0RFKF9rZXJuLCBPSURfQVVUTywgc2NoZWQsIENUTEZMQUdfUlcs IDAsICJTY2hlZHVsZXIiKTsKQEAgLTI3NDgsNiArMjc1MCwxNSBAQAogU1lTQ1RMX1BST0MoX2tl cm5fc2NoZWQsIE9JRF9BVVRPLCB0b3BvbG9neV9zcGVjLCBDVExUWVBFX1NUUklORyB8CiAgICAg Q1RMRkxBR19SRCwgTlVMTCwgMCwgc3lzY3RsX2tlcm5fc2NoZWRfdG9wb2xvZ3lfc3BlYywgIkEi LCAKICAgICAiWE1MIGR1bXAgb2YgZGV0ZWN0ZWQgQ1BVIHRvcG9sb2d5Iik7CisKKy8qIAorICog UmV0dXJuIHRoZSBzaXplIG9mIGNwdXNldF90IGF0IHRoZSBrZXJuZWwgbGV2ZWwKKyAqCisgKiBY WFggKGdjb29wZXIpOiByZXBsYWNlIFVMT05HIHdpdGggU0laRSBvbmNlIENUTFRZUEVfU0laRSBp cyBpbXBsZW1lbnRlZC4KKyAqLworU1lTQ1RMX1VMT05HKF9rZXJuX3NjaGVkLCBPSURfQVVUTywg Y3B1c2V0c2l6ZSwgQ1RMRkxBR19SRCwKKyAgICAmX2tlcm5fY3B1c2V0X3NpemUsIDAsICJLZXJu ZWwtbGV2ZWwgY3B1c2V0X3Qgc3RydWN0IHNpemUiKTsKKwogI2VuZGlmCiAKIC8qIHBzIGNvbXBh dC4gIEFsbCBjcHUgcGVyY2VudGFnZXMgZnJvbSBVTEUgYXJlIHdlaWdodGVkLiAqLwo= --0016364d2cbdec533f0493a2c1cf-- From owner-svn-src-head@FreeBSD.ORG Thu Oct 28 01:38:57 2010 Return-Path: Delivered-To: svn-src-head@FreeBSD.ORG Received: by hub.freebsd.org (Postfix, from userid 1033) id D91A51065673; Thu, 28 Oct 2010 01:38:57 +0000 (UTC) Date: Thu, 28 Oct 2010 01:38:57 +0000 From: Alexey Dokuchaev To: d@delphij.net Message-ID: <20101028013857.GA4476@FreeBSD.org> References: <201010271848.o9RImNSR019344@svn.freebsd.org> <20101027212601.GA78062@freebsd.org> <4CC899C3.7040107@FreeBSD.org> <20101027214822.GA82697@freebsd.org> <4CC8A89D.5070909@delphij.net> Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <4CC8A89D.5070909@delphij.net> User-Agent: Mutt/1.4.2.1i Cc: Doug Barton , svn-src-all@FreeBSD.ORG, src-committers@FreeBSD.ORG, svn-src-head@FreeBSD.ORG, Alexander Best , Dag-Erling Smorgrav Subject: Re: svn commit: r214431 - head/bin/rm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 01:38:57 -0000 On Wed, Oct 27, 2010 at 03:33:01PM -0700, Xin LI wrote: > Maybe something like: > > BUGS > > The -P option assumes that the underlying storage overwrites file block > when data is written on existing offset. Several factors including the > file system and its backing store could defeat the assumption, this > includes, but is not limited to file systems that uses Copy-On-Write > strategy (e.g. ZFS or UFS when snapshot is being used), or backing > datastore that does journaling, etc. In addition, only regular files > are overwritten, other types of files are not. This sounds very nice and FreeBSD-ish. ./danfe From owner-svn-src-head@FreeBSD.ORG Thu Oct 28 01:54:05 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2DB7B106566B; Thu, 28 Oct 2010 01:54:05 +0000 (UTC) (envelope-from davidxu@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 1425A8FC13; Thu, 28 Oct 2010 01:54:05 +0000 (UTC) Received: from xyf.my.dom (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id o9S1s2tD064930; Thu, 28 Oct 2010 01:54:02 GMT (envelope-from davidxu@freebsd.org) Message-ID: <4CC9483C.7050507@freebsd.org> Date: Thu, 28 Oct 2010 09:54:04 +0000 From: David Xu User-Agent: Thunderbird 2.0.0.24 (X11/20100630) MIME-Version: 1.0 To: Garrett Cooper References: <201010270232.o9R2Wsu3084553@svn.freebsd.org> <4CC803A8.3040602@freebsd.org> <20101027082122.GD1848@garage.freebsd.pl> <4CC85552.2020100@freebsd.org> <20101027133307.GQ2392@deviant.kiev.zoral.com.ua> <4CC851CC.80509@freebsd.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: src-committers@freebsd.org, Pawel Jakub Dawidek , svn-src-all@freebsd.org, Andriy Gapon , svn-src-head@freebsd.org, Kostik Belousov Subject: Re: svn commit: r214409 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 01:54:05 -0000 Garrett Cooper wrote: > On Wed, Oct 27, 2010 at 9:22 AM, Andriy Gapon wrote: >> [patch attachment was lost] > > Ugh... Mailman hates me I guess :(... > >> on 27/10/2010 19:07 Garrett Cooper said the following: >>> How about this patch? I implemented this as a readonly tunable and >> I don't think that it's correct to call it a tunable or use CTLFLAG_RDTUN. >> As I understand it is a read-only sysctl. > > Converted to CTLFLAG_RD. > >>> sysconf tunable, because (AFAIK) the value that is being tested >>> shouldn't change during runtime after the system has been booted up, >>> and figuring that the value wasn't going to change it was better to >>> lose 4/8 bytes on the kernel stack instead of having to recompute the >>> value every time in a function call, with the associated lost heap / >>> stack memory in the process, as the assumption is that this libcall >>> was going to be called frequently by some programs. > > Thanks! > -Garrett > The patch looks fine to me. ;-) From owner-svn-src-head@FreeBSD.ORG Thu Oct 28 02:59:25 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9456B106564A; Thu, 28 Oct 2010 02:59:25 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8300E8FC0A; Thu, 28 Oct 2010 02:59:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9S2xPpn059382; Thu, 28 Oct 2010 02:59:25 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9S2xPnD059380; Thu, 28 Oct 2010 02:59:25 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201010280259.o9S2xPnD059380@svn.freebsd.org> From: David Xu Date: Thu, 28 Oct 2010 02:59:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214443 - head/share/man/man3 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 02:59:25 -0000 Author: davidxu Date: Thu Oct 28 02:59:25 2010 New Revision: 214443 URL: http://svn.freebsd.org/changeset/base/214443 Log: Follow the change made in libthr, add ERANGE error code and more EINVAL error cases. Modified: head/share/man/man3/pthread_attr_affinity_np.3 Modified: head/share/man/man3/pthread_attr_affinity_np.3 ============================================================================== --- head/share/man/man3/pthread_attr_affinity_np.3 Thu Oct 28 00:54:18 2010 (r214442) +++ head/share/man/man3/pthread_attr_affinity_np.3 Thu Oct 28 02:59:25 2010 (r214443) @@ -94,8 +94,6 @@ to indicate the error. .Sh ERRORS The .Fn pthread_attr_getaffinity_np -and -.Fn pthread_attr_setaffinity_np functions will fail if: .Bl -tag -width Er .It Bq Er EINVAL @@ -103,6 +101,10 @@ The .Fa pattr or the attribute specified by it is .Dv NULL . +.It Bq Er ERANGE +The +.Fa cpusetsize +is too small. .El .Pp The @@ -114,6 +116,14 @@ The .Fa pattr or the attribute specified by it is .Dv NULL . +.It Bq Er EINVAL +The +.Fa cpusetp +specified a CPU that was outside the set supported by the kernel. +.It Bq Er ERANGE +The +.Fa cpusetsize +is too small. .It Bq Er ENOMEM Insufficient memory exists to store the cpuset mask. .El From owner-svn-src-head@FreeBSD.ORG Thu Oct 28 04:14:29 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 47FB11065672; Thu, 28 Oct 2010 04:14:29 +0000 (UTC) (envelope-from gibbs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3698A8FC17; Thu, 28 Oct 2010 04:14:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9S4ETuJ061203; Thu, 28 Oct 2010 04:14:29 GMT (envelope-from gibbs@svn.freebsd.org) Received: (from gibbs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9S4ETeD061201; Thu, 28 Oct 2010 04:14:29 GMT (envelope-from gibbs@svn.freebsd.org) Message-Id: <201010280414.o9S4ETeD061201@svn.freebsd.org> From: "Justin T. Gibbs" Date: Thu, 28 Oct 2010 04:14:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214444 - head/sys/dev/xen/blkback X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 04:14:29 -0000 Author: gibbs Date: Thu Oct 28 04:14:28 2010 New Revision: 214444 URL: http://svn.freebsd.org/changeset/base/214444 Log: sys/dev/xen/blkback/blkback.c: In xbb_detach() only perform cleanup of our taskqueue and device statistics structures if they have been initialized. This avoids a panic when xbb_detach() is called on a partially initialized device instance, due to an early failure in attach. Sponsored by: Spectra Logic Corporation Modified: head/sys/dev/xen/blkback/blkback.c Modified: head/sys/dev/xen/blkback/blkback.c ============================================================================== --- head/sys/dev/xen/blkback/blkback.c Thu Oct 28 02:59:25 2010 (r214443) +++ head/sys/dev/xen/blkback/blkback.c Thu Oct 28 04:14:28 2010 (r214444) @@ -2827,8 +2827,11 @@ xbb_detach(device_t dev) DPRINTF("\n"); - taskqueue_free(xbb->io_taskqueue); - devstat_remove_entry(xbb->xbb_stats); + if (xbb->io_taskqueue != NULL) + taskqueue_free(xbb->io_taskqueue); + + if (xbb->xbb_stats != NULL) + devstat_remove_entry(xbb->xbb_stats); xbb_close_backend(xbb); xbb_free_communication_mem(xbb); From owner-svn-src-head@FreeBSD.ORG Thu Oct 28 05:22:28 2010 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 81470106566B; Thu, 28 Oct 2010 05:22:28 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail04.syd.optusnet.com.au (mail04.syd.optusnet.com.au [211.29.132.185]) by mx1.freebsd.org (Postfix) with ESMTP id 143338FC12; Thu, 28 Oct 2010 05:22:27 +0000 (UTC) Received: from c122-106-146-165.carlnfd1.nsw.optusnet.com.au (c122-106-146-165.carlnfd1.nsw.optusnet.com.au [122.106.146.165]) by mail04.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id o9S5M5Q0004681 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 28 Oct 2010 16:22:07 +1100 Date: Thu, 28 Oct 2010 16:22:05 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: d@delphij.net In-Reply-To: <4CC8A89D.5070909@delphij.net> Message-ID: <20101028152418.A916@besplex.bde.org> References: <201010271848.o9RImNSR019344@svn.freebsd.org> <20101027212601.GA78062@freebsd.org> <4CC899C3.7040107@FreeBSD.org> <20101027214822.GA82697@freebsd.org> <4CC8A89D.5070909@delphij.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: Doug Barton , svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, svn-src-head@FreeBSD.org, Alexander Best , Dag-Erling Smorgrav Subject: Re: svn commit: r214431 - head/bin/rm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 05:22:28 -0000 On Wed, 27 Oct 2010, Xin LI wrote: > I think what really defeats -P is the fact that the file system or > underlying data storage would not overwrite data on a file at sync(). > COW is of course one of the case, journaling MAY defeat -P but is not > guaranteed. FS with variable block size - I believe this really depends > on the implementation. > > If I understood the code correctly, UFS, UFS+SU, UFS+SUJ, msdosfs and > ext2fs supports rm -P as long as they are not being put on gjournal'ed > disk, ZFS zvol, etc., and no snapshot is being used. And that the underlying data storage us dumb. Any flash drive now tries to minimise writes. It wouldn't take much buffering to defeat the 0xff, 0,0xff pattern. Wear leveling should result in different physical blocks being written each time if the writes get to the lowest level of storage. And that block reallocation (done by ffs1 and ffs2) doesn't choose different blocks. > It seems to be hard for me to conclude all cases in short, plain English > but I'm all for improvements to the manual page to describe that in an > elegant and precise manner. > > Maybe something like: > > =============== > BUGS > > The -P option assumes that the underlying storage overwrites file block > when data is written on existing offset. Several factors including the > file system and its backing store could defeat the assumption, this > includes, but is not limited to file systems that uses Copy-On-Write > strategy (e.g. ZFS or UFS when snapshot is being used), or backing > datastore that does journaling, etc. In addition, only regular files > are overwritten, other types of files are not. > =============== Summary: it is very hard to tell whether -P works, even when you think you know what all the subsystems are doing. Bruce From owner-svn-src-head@FreeBSD.ORG Thu Oct 28 06:45:21 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3E223106564A; Thu, 28 Oct 2010 06:45:21 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2C0838FC0A; Thu, 28 Oct 2010 06:45:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9S6jLcr064373; Thu, 28 Oct 2010 06:45:21 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9S6jLIp064371; Thu, 28 Oct 2010 06:45:21 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201010280645.o9S6jLIp064371@svn.freebsd.org> From: Warner Losh Date: Thu, 28 Oct 2010 06:45:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214445 - head/usr.sbin/pc-sysinstall/backend-query X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 06:45:21 -0000 Author: imp Date: Thu Oct 28 06:45:20 2010 New Revision: 214445 URL: http://svn.freebsd.org/changeset/base/214445 Log: Turns out we need functions.sh in this file for convert_to_megabytes call. Modified: head/usr.sbin/pc-sysinstall/backend-query/disk-info.sh Modified: head/usr.sbin/pc-sysinstall/backend-query/disk-info.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend-query/disk-info.sh Thu Oct 28 04:14:28 2010 (r214444) +++ head/usr.sbin/pc-sysinstall/backend-query/disk-info.sh Thu Oct 28 06:45:20 2010 (r214445) @@ -28,6 +28,7 @@ # Query a disk for partitions and display them ############################################################################# +. ${PROGDIR}/backend/functions.sh . ${PROGDIR}/backend/functions-disk.sh DISK="${1}" @@ -57,4 +58,3 @@ echo "heads=${HEADS}" echo "sectors=${SECS}" echo "size=${MB}" echo "type=${CTYPE}" - From owner-svn-src-head@FreeBSD.ORG Thu Oct 28 07:58:06 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A0A331065670; Thu, 28 Oct 2010 07:58:06 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8BDCE8FC16; Thu, 28 Oct 2010 07:58:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9S7w6J3069192; Thu, 28 Oct 2010 07:58:06 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9S7w6Vj069186; Thu, 28 Oct 2010 07:58:06 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201010280758.o9S7w6Vj069186@svn.freebsd.org> From: Attilio Rao Date: Thu, 28 Oct 2010 07:58:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214446 - in head/sys: amd64/amd64 conf i386/i386 x86/x86 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 07:58:06 -0000 Author: attilio Date: Thu Oct 28 07:58:06 2010 New Revision: 214446 URL: http://svn.freebsd.org/changeset/base/214446 Log: Merge the mptable support from MD bits to x86 subtree. Sponsored by: Sandvine Incorporated Discussed with: jhb Added: head/sys/x86/x86/mptable.c - copied, changed from r214370, head/sys/i386/i386/mptable.c head/sys/x86/x86/mptable_pci.c - copied unchanged from r214370, head/sys/i386/i386/mptable_pci.c Deleted: head/sys/amd64/amd64/mptable.c head/sys/amd64/amd64/mptable_pci.c head/sys/i386/i386/mptable.c head/sys/i386/i386/mptable_pci.c Modified: head/sys/conf/files.amd64 head/sys/conf/files.i386 head/sys/conf/files.pc98 Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Thu Oct 28 06:45:20 2010 (r214445) +++ head/sys/conf/files.amd64 Thu Oct 28 07:58:06 2010 (r214446) @@ -121,8 +121,6 @@ amd64/amd64/minidump_machdep.c standard amd64/amd64/mp_machdep.c optional smp amd64/amd64/mp_watchdog.c optional mp_watchdog smp amd64/amd64/mpboot.S optional smp -amd64/amd64/mptable.c optional mptable -amd64/amd64/mptable_pci.c optional mptable pci amd64/amd64/nexus.c standard amd64/amd64/pmap.c standard amd64/amd64/prof_machdep.c optional profiling-routine @@ -324,4 +322,6 @@ x86/x86/dump_machdep.c standard x86/x86/io_apic.c standard x86/x86/local_apic.c standard x86/x86/mca.c standard +x86/x86/mptable.c optional mptable +x86/x86/mptable_pci.c optional mptable pci x86/x86/msi.c optional pci Modified: head/sys/conf/files.i386 ============================================================================== --- head/sys/conf/files.i386 Thu Oct 28 06:45:20 2010 (r214445) +++ head/sys/conf/files.i386 Thu Oct 28 07:58:06 2010 (r214446) @@ -289,9 +289,7 @@ i386/i386/mp_machdep.c optional native i386/xen/mp_machdep.c optional xen smp i386/i386/mp_watchdog.c optional mp_watchdog smp i386/i386/mpboot.s optional smp native -i386/i386/mptable.c optional apic native i386/xen/mptable.c optional apic xen -i386/i386/mptable_pci.c optional apic pci i386/i386/nexus.c standard i386/i386/perfmon.c optional perfmon i386/i386/pmap.c optional native @@ -398,4 +396,6 @@ x86/x86/dump_machdep.c standard x86/x86/io_apic.c optional apic x86/x86/local_apic.c optional apic x86/x86/mca.c standard +x86/x86/mptable.c optional apic native +x86/x86/mptable_pci.c optional apic pci x86/x86/msi.c optional apic pci Modified: head/sys/conf/files.pc98 ============================================================================== --- head/sys/conf/files.pc98 Thu Oct 28 06:45:20 2010 (r214445) +++ head/sys/conf/files.pc98 Thu Oct 28 07:58:06 2010 (r214446) @@ -156,8 +156,6 @@ i386/i386/mp_clock.c optional smp i386/i386/mp_machdep.c optional smp i386/i386/mp_watchdog.c optional mp_watchdog smp i386/i386/mpboot.s optional smp -i386/i386/mptable.c optional apic -i386/i386/mptable_pci.c optional apic pci i386/i386/nexus.c standard i386/i386/perfmon.c optional perfmon i386/i386/pmap.c standard @@ -258,4 +256,6 @@ x86/x86/dump_machdep.c standard x86/x86/io_apic.c optional apic x86/x86/local_apic.c optional apic x86/x86/mca.c standard +x86/x86/mptable.c optional apic +x86/x86/mptable_pci.c optional apic pci x86/x86/msi.c optional apic pci Copied and modified: head/sys/x86/x86/mptable.c (from r214370, head/sys/i386/i386/mptable.c) ============================================================================== --- head/sys/i386/i386/mptable.c Tue Oct 26 08:50:09 2010 (r214370, copy source) +++ head/sys/x86/x86/mptable.c Thu Oct 28 07:58:06 2010 (r214446) @@ -51,7 +51,11 @@ __FBSDID("$FreeBSD$"); /* string defined by the Intel MP Spec as identifying the MP table */ #define MP_SIG 0x5f504d5f /* _MP_ */ +#ifdef __amd64__ +#define MAX_LAPIC_ID 63 /* Max local APIC ID for HTT fixup */ +#else #define MAX_LAPIC_ID 31 /* Max local APIC ID for HTT fixup */ +#endif #ifdef PC98 #define BIOS_BASE (0xe8000) Copied: head/sys/x86/x86/mptable_pci.c (from r214370, head/sys/i386/i386/mptable_pci.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/x86/x86/mptable_pci.c Thu Oct 28 07:58:06 2010 (r214446, copy of r214370, head/sys/i386/i386/mptable_pci.c) @@ -0,0 +1,177 @@ +/*- + * Copyright (c) 2003 John Baldwin + * All rights reserved. + * + * 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. + * 3. Neither the name of the author nor the names of any co-contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + */ + +/* + * Host to PCI and PCI to PCI bridge drivers that use the MP Table to route + * interrupts from PCI devices to I/O APICs. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "pcib_if.h" + +/* Host to PCI bridge driver. */ + +static int +mptable_hostb_probe(device_t dev) +{ + + if (pci_cfgregopen() == 0) + return (ENXIO); + if (mptable_pci_probe_table(pcib_get_bus(dev)) != 0) + return (ENXIO); + device_set_desc(dev, "MPTable Host-PCI bridge"); + return (0); +} + +static int +mptable_hostb_attach(device_t dev) +{ + + device_add_child(dev, "pci", pcib_get_bus(dev)); + return (bus_generic_attach(dev)); +} + +/* Pass MSI requests up to the nexus. */ +static int +mptable_hostb_alloc_msi(device_t pcib, device_t dev, int count, int maxcount, + int *irqs) +{ + device_t bus; + + bus = device_get_parent(pcib); + return (PCIB_ALLOC_MSI(device_get_parent(bus), dev, count, maxcount, + irqs)); +} + +static int +mptable_hostb_alloc_msix(device_t pcib, device_t dev, int *irq) +{ + device_t bus; + + bus = device_get_parent(pcib); + return (PCIB_ALLOC_MSIX(device_get_parent(bus), dev, irq)); +} + +static int +mptable_hostb_map_msi(device_t pcib, device_t dev, int irq, uint64_t *addr, + uint32_t *data) +{ + device_t bus; + + bus = device_get_parent(pcib); + return (PCIB_MAP_MSI(device_get_parent(bus), dev, irq, addr, data)); +} + +static device_method_t mptable_hostb_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, mptable_hostb_probe), + DEVMETHOD(device_attach, mptable_hostb_attach), + DEVMETHOD(device_shutdown, bus_generic_shutdown), + DEVMETHOD(device_suspend, bus_generic_suspend), + DEVMETHOD(device_resume, bus_generic_resume), + + /* Bus interface */ + DEVMETHOD(bus_print_child, bus_generic_print_child), + DEVMETHOD(bus_read_ivar, legacy_pcib_read_ivar), + DEVMETHOD(bus_write_ivar, legacy_pcib_write_ivar), + DEVMETHOD(bus_alloc_resource, legacy_pcib_alloc_resource), + DEVMETHOD(bus_release_resource, bus_generic_release_resource), + DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), + DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), + DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), + DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), + + /* pcib interface */ + DEVMETHOD(pcib_maxslots, legacy_pcib_maxslots), + DEVMETHOD(pcib_read_config, legacy_pcib_read_config), + DEVMETHOD(pcib_write_config, legacy_pcib_write_config), + DEVMETHOD(pcib_route_interrupt, mptable_pci_route_interrupt), + DEVMETHOD(pcib_alloc_msi, mptable_hostb_alloc_msi), + DEVMETHOD(pcib_release_msi, pcib_release_msi), + DEVMETHOD(pcib_alloc_msix, mptable_hostb_alloc_msix), + DEVMETHOD(pcib_release_msix, pcib_release_msix), + DEVMETHOD(pcib_map_msi, mptable_hostb_map_msi), + + { 0, 0 } +}; + +static devclass_t hostb_devclass; + +DEFINE_CLASS_0(pcib, mptable_hostb_driver, mptable_hostb_methods, 1); +DRIVER_MODULE(mptable_pcib, legacy, mptable_hostb_driver, hostb_devclass, 0, 0); + +/* PCI to PCI bridge driver. */ + +static int +mptable_pcib_probe(device_t dev) +{ + int bus; + + if ((pci_get_class(dev) != PCIC_BRIDGE) || + (pci_get_subclass(dev) != PCIS_BRIDGE_PCI)) + return (ENXIO); + bus = pci_read_config(dev, PCIR_SECBUS_1, 1); + if (bus == 0) + return (ENXIO); + if (mptable_pci_probe_table(bus) != 0) + return (ENXIO); + device_set_desc(dev, "MPTable PCI-PCI bridge"); + return (-1000); +} + +static device_method_t mptable_pcib_pci_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, mptable_pcib_probe), + + /* pcib interface */ + DEVMETHOD(pcib_route_interrupt, mptable_pci_route_interrupt), + + {0, 0} +}; + +static devclass_t pcib_devclass; + +DEFINE_CLASS_1(pcib, mptable_pcib_driver, mptable_pcib_pci_methods, + sizeof(struct pcib_softc), pcib_driver); +DRIVER_MODULE(mptable_pcib, pci, mptable_pcib_driver, pcib_devclass, 0, 0); From owner-svn-src-head@FreeBSD.ORG Thu Oct 28 08:00:21 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 108391065698; Thu, 28 Oct 2010 08:00:21 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-qw0-f54.google.com (mail-qw0-f54.google.com [209.85.216.54]) by mx1.freebsd.org (Postfix) with ESMTP id 8B30A8FC15; Thu, 28 Oct 2010 08:00:20 +0000 (UTC) Received: by qwe4 with SMTP id 4so1656927qwe.13 for ; Thu, 28 Oct 2010 01:00:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:content-type:content-transfer-encoding; bh=hH7nOhtPLcSVkQff6Sx2FFM8l3ZDzLdt6YEsIHK1ltM=; b=EKUZAg29jA1ZFJ10FEpnRWcVoAknLuUXtSa+6kVHhdif5coz5vCdp0WHO0NFYSrLrv yyoA9Z1ZEnUDWFRTuGVeufJxeHCw/wwAzTGewrYNgbpdFLFoDI3qBa855BqPwf39o95f qvmHEoKpDWRTNoglvwVcn2ZzcQtzeuqQjbK1k= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding; b=Gura6gVt5CMVAT7BM5zdcMA5iQiqYwGQruIR6cgohkN77ARWLH8t8eUtCCjK4YjflM tWD2wmPWpP1tASubed0Ub/GFdATUI2oqrzsgMKmCvUD8perU8yZ9sh4mJXm6Ky6a8WKn 9qmDU86682u1pYbxEsxkCQxaIEj1lyVNwr8eI= MIME-Version: 1.0 Received: by 10.229.224.82 with SMTP id in18mr5001477qcb.262.1288252819759; Thu, 28 Oct 2010 01:00:19 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.229.237.9 with HTTP; Thu, 28 Oct 2010 01:00:19 -0700 (PDT) In-Reply-To: <201010280758.o9S7w6Vj069186@svn.freebsd.org> References: <201010280758.o9S7w6Vj069186@svn.freebsd.org> Date: Thu, 28 Oct 2010 10:00:19 +0200 X-Google-Sender-Auth: V9mHDxFe_IKfLf4pi3ojiXjzIbI Message-ID: From: Attilio Rao To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: Subject: Re: svn commit: r214446 - in head/sys: amd64/amd64 conf i386/i386 x86/x86 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 08:00:21 -0000 2010/10/28 Attilio Rao : > Author: attilio > Date: Thu Oct 28 07:58:06 2010 > New Revision: 214446 > URL: http://svn.freebsd.org/changeset/base/214446 > > Log: > =C2=A0Merge the mptable support from MD bits to x86 subtree. This commit should also fix a bug as in the amd64 version the presence of MPTABLE_FORCE_HTT will never be correctly detected because of the missing opt inclusion. Thanks, Attilio --=20 Peace can only be achieved by understanding - A. Einstein From owner-svn-src-head@FreeBSD.ORG Thu Oct 28 08:22:44 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EF33110656AC; Thu, 28 Oct 2010 08:22:43 +0000 (UTC) (envelope-from gljennjohn@googlemail.com) Received: from mail-fx0-f54.google.com (mail-fx0-f54.google.com [209.85.161.54]) by mx1.freebsd.org (Postfix) with ESMTP id F37A88FC1C; Thu, 28 Oct 2010 08:22:42 +0000 (UTC) Received: by fxm17 with SMTP id 17so1691321fxm.13 for ; Thu, 28 Oct 2010 01:22:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:in-reply-to:references:reply-to:x-mailer:mime-version :content-type:content-transfer-encoding; bh=JoYKgNc12xXkPiut6QkDPLgzKO3JsCXyfLWvct/OBTo=; b=fBMW5bQykTqnDfbPDI729nTuYosvFV16xaYoowYAfsmgpEbsMYWMv47kVBwJD0Eo66 ItO2gIe5xj18adks1QlFV2+04H++9cDOrCQwdEGL1jKx+jzvX/iFsHlu4slwDXMD5opF ag40s3dLvD+g8ad2Ow/uDlCYp0llJAZlzGmVI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=date:from:to:cc:subject:message-id:in-reply-to:references:reply-to :x-mailer:mime-version:content-type:content-transfer-encoding; b=R4d/Y9gSlDogBe1BJGMI39O4fwAYchbFNuGS/UBCW6COt5hFju7M/bNZK4ehuQGhjB fSa3T/WYVyIExdk+oeIMsFjqVbXf+qNrb7YZB1xk4OGE9GrbBNRmXrmvgIGHkREcQPQs 3yDrfD9ddw+Jc80APXto6AEXbCmEtKInf33gA= Received: by 10.223.78.199 with SMTP id m7mr3597858fak.11.1288252543530; Thu, 28 Oct 2010 00:55:43 -0700 (PDT) Received: from ernst.jennejohn.org (p578E3401.dip.t-dialin.net [87.142.52.1]) by mx.google.com with ESMTPS id p18sm335237faa.16.2010.10.28.00.55.40 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 28 Oct 2010 00:55:41 -0700 (PDT) Date: Thu, 28 Oct 2010 09:55:38 +0200 From: Gary Jennejohn To: Bruce Evans Message-ID: <20101028095538.24147119@ernst.jennejohn.org> In-Reply-To: <20101028152418.A916@besplex.bde.org> References: <201010271848.o9RImNSR019344@svn.freebsd.org> <20101027212601.GA78062@freebsd.org> <4CC899C3.7040107@FreeBSD.org> <20101027214822.GA82697@freebsd.org> <4CC8A89D.5070909@delphij.net> <20101028152418.A916@besplex.bde.org> X-Mailer: Claws Mail 3.7.6 (GTK+ 2.18.7; amd64-portbld-freebsd9.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: Doug Barton , d@delphij.net, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, svn-src-head@FreeBSD.org, Alexander Best , Dag-Erling Smorgrav Subject: Re: svn commit: r214431 - head/bin/rm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: gljennjohn@googlemail.com List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 08:22:44 -0000 On Thu, 28 Oct 2010 16:22:05 +1100 (EST) Bruce Evans wrote: > On Wed, 27 Oct 2010, Xin LI wrote: > > > I think what really defeats -P is the fact that the file system or > > underlying data storage would not overwrite data on a file at sync(). > > COW is of course one of the case, journaling MAY defeat -P but is not > > guaranteed. FS with variable block size - I believe this really depends > > on the implementation. > > > > If I understood the code correctly, UFS, UFS+SU, UFS+SUJ, msdosfs and > > ext2fs supports rm -P as long as they are not being put on gjournal'ed > > disk, ZFS zvol, etc., and no snapshot is being used. > > And that the underlying data storage us dumb. Any flash drive now > tries to minimise writes. It wouldn't take much buffering to defeat > the 0xff, 0,0xff pattern. Wear leveling should result in different > physical blocks being written each time if the writes get to the > lowest level of storage. > > And that block reallocation (done by ffs1 and ffs2) doesn't choose > different blocks. > > > It seems to be hard for me to conclude all cases in short, plain English > > but I'm all for improvements to the manual page to describe that in an > > elegant and precise manner. > > > > Maybe something like: > > > > =============== > > BUGS > > > > The -P option assumes that the underlying storage overwrites file block > > when data is written on existing offset. Several factors including the > > file system and its backing store could defeat the assumption, this > > includes, but is not limited to file systems that uses Copy-On-Write > > strategy (e.g. ZFS or UFS when snapshot is being used), or backing > > datastore that does journaling, etc. In addition, only regular files > > are overwritten, other types of files are not. > > =============== > > Summary: it is very hard to tell whether -P works, even when you think > you know what all the subsystems are doing. > All this discussion leads me to the conclusion that we should just remove the -P functionality and add a remark to the man page that that was done because it isn't guaranteed to work on all file systems. Why give users a false sense of security? If they're concerned about data security then they should use geli or something similar. -- Gary Jennejohn From owner-svn-src-head@FreeBSD.ORG Thu Oct 28 09:34:53 2010 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B8BC4106566B; Thu, 28 Oct 2010 09:34:53 +0000 (UTC) (envelope-from ceri@submonkey.net) Received: from scuttle.submonkey.net (scuttle.submonkey.net [208.111.43.184]) by mx1.freebsd.org (Postfix) with ESMTP id C16B48FC08; Thu, 28 Oct 2010 09:34:48 +0000 (UTC) Received: from cpc6-cdif11-2-0-cust58.5-1.cable.virginmedia.com ([62.255.146.59] helo=shrike.submonkey.net) by scuttle.submonkey.net with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.69) (envelope-from ) id 1PBNsg-0005jx-Hb; Thu, 28 Oct 2010 08:30:42 +0000 Received: from ceri by shrike.submonkey.net with local (Exim 4.69 (FreeBSD)) (envelope-from ) id 1PBNse-000KSr-7r; Thu, 28 Oct 2010 09:30:40 +0100 Date: Thu, 28 Oct 2010 09:30:40 +0100 From: Ceri Davies To: Gary Jennejohn Message-ID: <20101028083040.GA5488@submonkey.net> References: <201010271848.o9RImNSR019344@svn.freebsd.org> <20101027212601.GA78062@freebsd.org> <4CC899C3.7040107@FreeBSD.org> <20101027214822.GA82697@freebsd.org> <4CC8A89D.5070909@delphij.net> <20101028152418.A916@besplex.bde.org> <20101028095538.24147119@ernst.jennejohn.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="TB36FDmn/VVEgNH/" Content-Disposition: inline In-Reply-To: <20101028095538.24147119@ernst.jennejohn.org> X-PGP: finger ceri@FreeBSD.org User-Agent: Mutt/1.5.20 (2009-06-14) Sender: Ceri Davies Cc: Doug Barton , d@delphij.net, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Bruce Evans , svn-src-head@FreeBSD.org, Alexander Best , Dag-Erling Smorgrav Subject: Re: svn commit: r214431 - head/bin/rm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 09:34:53 -0000 --TB36FDmn/VVEgNH/ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Oct 28, 2010 at 09:55:38AM +0200, Gary Jennejohn wrote: > On Thu, 28 Oct 2010 16:22:05 +1100 (EST) > Bruce Evans wrote: >=20 > > On Wed, 27 Oct 2010, Xin LI wrote: > >=20 > > > I think what really defeats -P is the fact that the file system or > > > underlying data storage would not overwrite data on a file at sync(). > > > COW is of course one of the case, journaling MAY defeat -P but is not > > > guaranteed. FS with variable block size - I believe this really depe= nds > > > on the implementation. > > > > > > If I understood the code correctly, UFS, UFS+SU, UFS+SUJ, msdosfs and > > > ext2fs supports rm -P as long as they are not being put on gjournal'ed > > > disk, ZFS zvol, etc., and no snapshot is being used. > >=20 > > And that the underlying data storage us dumb. Any flash drive now > > tries to minimise writes. It wouldn't take much buffering to defeat > > the 0xff, 0,0xff pattern. Wear leveling should result in different > > physical blocks being written each time if the writes get to the > > lowest level of storage. > >=20 > > And that block reallocation (done by ffs1 and ffs2) doesn't choose > > different blocks. > >=20 > > > It seems to be hard for me to conclude all cases in short, plain Engl= ish > > > but I'm all for improvements to the manual page to describe that in an > > > elegant and precise manner. > > > > > > Maybe something like: > > > > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > > BUGS > > > > > > The -P option assumes that the underlying storage overwrites file blo= ck > > > when data is written on existing offset. Several factors including t= he > > > file system and its backing store could defeat the assumption, this > > > includes, but is not limited to file systems that uses Copy-On-Write > > > strategy (e.g. ZFS or UFS when snapshot is being used), or backing > > > datastore that does journaling, etc. In addition, only regular files > > > are overwritten, other types of files are not. > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > >=20 > > Summary: it is very hard to tell whether -P works, even when you think > > you know what all the subsystems are doing. > >=20 >=20 > All this discussion leads me to the conclusion that we should just > remove the -P functionality and add a remark to the man page that that > was done because it isn't guaranteed to work on all file systems. I was about to suggest the same thing. Sounds like -P requires far too many ducks to be lined up in order to work. Ceri --=20 Haffely, Gaffely, Gaffely, Gonward. --TB36FDmn/VVEgNH/ Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iD8DBQFMyTSvocfcwTS3JF8RAn69AJ9GRZnT5EdnwaDyu2juqGFRZPH2AACgiinY H+lZcVTTdV/QDr5e846LoM4= =gdId -----END PGP SIGNATURE----- --TB36FDmn/VVEgNH/-- From owner-svn-src-head@FreeBSD.ORG Thu Oct 28 10:25:47 2010 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: by hub.freebsd.org (Postfix, from userid 1233) id 5BE551065672; Thu, 28 Oct 2010 10:25:47 +0000 (UTC) Date: Thu, 28 Oct 2010 10:25:47 +0000 From: Alexander Best To: Gary Jennejohn Message-ID: <20101028102547.GA56817@freebsd.org> References: <201010271848.o9RImNSR019344@svn.freebsd.org> <20101027212601.GA78062@freebsd.org> <4CC899C3.7040107@FreeBSD.org> <20101027214822.GA82697@freebsd.org> <4CC8A89D.5070909@delphij.net> <20101028152418.A916@besplex.bde.org> <20101028095538.24147119@ernst.jennejohn.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20101028095538.24147119@ernst.jennejohn.org> Cc: Doug Barton , d@delphij.net, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Bruce Evans , svn-src-head@FreeBSD.org, Dag-Erling Smorgrav Subject: Re: svn commit: r214431 - head/bin/rm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 10:25:47 -0000 On Thu Oct 28 10, Gary Jennejohn wrote: > On Thu, 28 Oct 2010 16:22:05 +1100 (EST) > Bruce Evans wrote: > > > On Wed, 27 Oct 2010, Xin LI wrote: > > > > > I think what really defeats -P is the fact that the file system or > > > underlying data storage would not overwrite data on a file at sync(). > > > COW is of course one of the case, journaling MAY defeat -P but is not > > > guaranteed. FS with variable block size - I believe this really depends > > > on the implementation. > > > > > > If I understood the code correctly, UFS, UFS+SU, UFS+SUJ, msdosfs and > > > ext2fs supports rm -P as long as they are not being put on gjournal'ed > > > disk, ZFS zvol, etc., and no snapshot is being used. > > > > And that the underlying data storage us dumb. Any flash drive now > > tries to minimise writes. It wouldn't take much buffering to defeat > > the 0xff, 0,0xff pattern. Wear leveling should result in different > > physical blocks being written each time if the writes get to the > > lowest level of storage. > > > > And that block reallocation (done by ffs1 and ffs2) doesn't choose > > different blocks. > > > > > It seems to be hard for me to conclude all cases in short, plain English > > > but I'm all for improvements to the manual page to describe that in an > > > elegant and precise manner. > > > > > > Maybe something like: > > > > > > =============== > > > BUGS > > > > > > The -P option assumes that the underlying storage overwrites file block > > > when data is written on existing offset. Several factors including the > > > file system and its backing store could defeat the assumption, this > > > includes, but is not limited to file systems that uses Copy-On-Write > > > strategy (e.g. ZFS or UFS when snapshot is being used), or backing > > > datastore that does journaling, etc. In addition, only regular files > > > are overwritten, other types of files are not. > > > =============== > > > > Summary: it is very hard to tell whether -P works, even when you think > > you know what all the subsystems are doing. > > > > All this discussion leads me to the conclusion that we should just > remove the -P functionality and add a remark to the man page that that > was done because it isn't guaranteed to work on all file systems. > > Why give users a false sense of security? If they're concerned about > data security then they should use geli or something similar. that might be the ultimate solution. also one could use security/srm instead. +1 here. ;) question is: should -P be removed entirely or be made a no op? cheers. alex > > -- > Gary Jennejohn -- a13x From owner-svn-src-head@FreeBSD.ORG Thu Oct 28 10:37:34 2010 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 54382106566B; Thu, 28 Oct 2010 10:37:34 +0000 (UTC) (envelope-from ceri@submonkey.net) Received: from scuttle.submonkey.net (scuttle.submonkey.net [208.111.43.184]) by mx1.freebsd.org (Postfix) with ESMTP id 2DA6D8FC19; Thu, 28 Oct 2010 10:37:33 +0000 (UTC) Received: from cpc6-cdif11-2-0-cust58.5-1.cable.virginmedia.com ([62.255.146.59] helo=shrike.submonkey.net) by scuttle.submonkey.net with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.69) (envelope-from ) id 1PBPrL-0000n0-SR; Thu, 28 Oct 2010 10:37:28 +0000 Received: from ceri by shrike.submonkey.net with local (Exim 4.69 (FreeBSD)) (envelope-from ) id 1PBPrJ-0003M3-CP; Thu, 28 Oct 2010 11:37:25 +0100 Date: Thu, 28 Oct 2010 11:37:25 +0100 From: Ceri Davies To: Alexander Best Message-ID: <20101028103725.GC5488@submonkey.net> References: <201010271848.o9RImNSR019344@svn.freebsd.org> <20101027212601.GA78062@freebsd.org> <4CC899C3.7040107@FreeBSD.org> <20101027214822.GA82697@freebsd.org> <4CC8A89D.5070909@delphij.net> <20101028152418.A916@besplex.bde.org> <20101028095538.24147119@ernst.jennejohn.org> <20101028102547.GA56817@freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="ghzN8eJ9Qlbqn3iT" Content-Disposition: inline In-Reply-To: <20101028102547.GA56817@freebsd.org> X-PGP: finger ceri@FreeBSD.org User-Agent: Mutt/1.5.20 (2009-06-14) Sender: Ceri Davies Cc: Doug Barton , d@delphij.net, svn-src-all@FreeBSD.org, Gary Jennejohn , src-committers@FreeBSD.org, Bruce Evans , svn-src-head@FreeBSD.org, Dag-Erling Smorgrav Subject: Re: svn commit: r214431 - head/bin/rm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 10:37:34 -0000 --ghzN8eJ9Qlbqn3iT Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Oct 28, 2010 at 10:25:47AM +0000, Alexander Best wrote: > On Thu Oct 28 10, Gary Jennejohn wrote: > > On Thu, 28 Oct 2010 16:22:05 +1100 (EST) > > Bruce Evans wrote: > >=20 > > > On Wed, 27 Oct 2010, Xin LI wrote: > > >=20 > > > > I think what really defeats -P is the fact that the file system or > > > > underlying data storage would not overwrite data on a file at sync(= ). > > > > COW is of course one of the case, journaling MAY defeat -P but is n= ot > > > > guaranteed. FS with variable block size - I believe this really de= pends > > > > on the implementation. > > > > > > > > If I understood the code correctly, UFS, UFS+SU, UFS+SUJ, msdosfs a= nd > > > > ext2fs supports rm -P as long as they are not being put on gjournal= 'ed > > > > disk, ZFS zvol, etc., and no snapshot is being used. > > >=20 > > > And that the underlying data storage us dumb. Any flash drive now > > > tries to minimise writes. It wouldn't take much buffering to defeat > > > the 0xff, 0,0xff pattern. Wear leveling should result in different > > > physical blocks being written each time if the writes get to the > > > lowest level of storage. > > >=20 > > > And that block reallocation (done by ffs1 and ffs2) doesn't choose > > > different blocks. > > >=20 > > > > It seems to be hard for me to conclude all cases in short, plain En= glish > > > > but I'm all for improvements to the manual page to describe that in= an > > > > elegant and precise manner. > > > > > > > > Maybe something like: > > > > > > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > > > BUGS > > > > > > > > The -P option assumes that the underlying storage overwrites file b= lock > > > > when data is written on existing offset. Several factors including= the > > > > file system and its backing store could defeat the assumption, this > > > > includes, but is not limited to file systems that uses Copy-On-Write > > > > strategy (e.g. ZFS or UFS when snapshot is being used), or backing > > > > datastore that does journaling, etc. In addition, only regular fil= es > > > > are overwritten, other types of files are not. > > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > >=20 > > > Summary: it is very hard to tell whether -P works, even when you think > > > you know what all the subsystems are doing. > > >=20 > >=20 > > All this discussion leads me to the conclusion that we should just > > remove the -P functionality and add a remark to the man page that that > > was done because it isn't guaranteed to work on all file systems. > >=20 > > Why give users a false sense of security? If they're concerned about > > data security then they should use geli or something similar. >=20 > that might be the ultimate solution. also one could use security/srm inst= ead. >=20 > +1 here. ;) >=20 > question is: should -P be removed entirely or be made a no op? Probably best that it fail. Ceri --=20 Haffely, Gaffely, Gaffely, Gonward. --ghzN8eJ9Qlbqn3iT Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iD8DBQFMyVJlocfcwTS3JF8RAjW4AJ41Ld0fBOrTS2f+FXDgcQKwfEhI3QCgq5a4 3G0STMIOJJwW2RudigPfA3o= =7vl4 -----END PGP SIGNATURE----- --ghzN8eJ9Qlbqn3iT-- From owner-svn-src-head@FreeBSD.ORG Thu Oct 28 11:09:13 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F413E106566B; Thu, 28 Oct 2010 11:09:12 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E342F8FC1E; Thu, 28 Oct 2010 11:09:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9SB9CJn088435; Thu, 28 Oct 2010 11:09:12 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9SB9Cmt088433; Thu, 28 Oct 2010 11:09:12 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201010281109.o9SB9Cmt088433@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Thu, 28 Oct 2010 11:09:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214447 - head/usr.sbin/rtadvd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 11:09:13 -0000 Author: bz Date: Thu Oct 28 11:09:12 2010 New Revision: 214447 URL: http://svn.freebsd.org/changeset/base/214447 Log: Correct a typo. MFC after: 3 days Modified: head/usr.sbin/rtadvd/rtadvd.conf.5 Modified: head/usr.sbin/rtadvd/rtadvd.conf.5 ============================================================================== --- head/usr.sbin/rtadvd/rtadvd.conf.5 Thu Oct 28 07:58:06 2010 (r214446) +++ head/usr.sbin/rtadvd/rtadvd.conf.5 Thu Oct 28 11:09:12 2010 (r214447) @@ -109,7 +109,7 @@ The default value is 64. (str or num) A 8-bit flags field in router advertisement message header. This field can be specified either as a case-sensitive string or as an integer. -A sting consists of characters each of which corresponds to a +A string consists of characters each of which corresponds to a particular flag bit(s). An integer should be the logical OR of all enabled bits. Bit 7 From owner-svn-src-head@FreeBSD.ORG Thu Oct 28 13:14:14 2010 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: by hub.freebsd.org (Postfix, from userid 1233) id DD8A21065679; Thu, 28 Oct 2010 13:14:14 +0000 (UTC) Date: Thu, 28 Oct 2010 13:14:14 +0000 From: Alexander Best To: Ceri Davies Message-ID: <20101028131414.GA79254@freebsd.org> References: <201010271848.o9RImNSR019344@svn.freebsd.org> <20101027212601.GA78062@freebsd.org> <4CC899C3.7040107@FreeBSD.org> <20101027214822.GA82697@freebsd.org> <4CC8A89D.5070909@delphij.net> <20101028152418.A916@besplex.bde.org> <20101028095538.24147119@ernst.jennejohn.org> <20101028102547.GA56817@freebsd.org> <20101028103725.GC5488@submonkey.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="3MwIy2ne0vdjdPXF" Content-Disposition: inline In-Reply-To: <20101028103725.GC5488@submonkey.net> Cc: Doug Barton , d@delphij.net, svn-src-all@FreeBSD.org, Gary Jennejohn , src-committers@FreeBSD.org, Bruce Evans , svn-src-head@FreeBSD.org, Dag-Erling Smorgrav Subject: Re: svn commit: r214431 - head/bin/rm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 13:14:15 -0000 --3MwIy2ne0vdjdPXF Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thu Oct 28 10, Ceri Davies wrote: > On Thu, Oct 28, 2010 at 10:25:47AM +0000, Alexander Best wrote: > > On Thu Oct 28 10, Gary Jennejohn wrote: > > > On Thu, 28 Oct 2010 16:22:05 +1100 (EST) > > > Bruce Evans wrote: > > > > > > > On Wed, 27 Oct 2010, Xin LI wrote: > > > > > > > > > I think what really defeats -P is the fact that the file system or > > > > > underlying data storage would not overwrite data on a file at sync(). > > > > > COW is of course one of the case, journaling MAY defeat -P but is not > > > > > guaranteed. FS with variable block size - I believe this really depends > > > > > on the implementation. > > > > > > > > > > If I understood the code correctly, UFS, UFS+SU, UFS+SUJ, msdosfs and > > > > > ext2fs supports rm -P as long as they are not being put on gjournal'ed > > > > > disk, ZFS zvol, etc., and no snapshot is being used. > > > > > > > > And that the underlying data storage us dumb. Any flash drive now > > > > tries to minimise writes. It wouldn't take much buffering to defeat > > > > the 0xff, 0,0xff pattern. Wear leveling should result in different > > > > physical blocks being written each time if the writes get to the > > > > lowest level of storage. > > > > > > > > And that block reallocation (done by ffs1 and ffs2) doesn't choose > > > > different blocks. > > > > > > > > > It seems to be hard for me to conclude all cases in short, plain English > > > > > but I'm all for improvements to the manual page to describe that in an > > > > > elegant and precise manner. > > > > > > > > > > Maybe something like: > > > > > > > > > > =============== > > > > > BUGS > > > > > > > > > > The -P option assumes that the underlying storage overwrites file block > > > > > when data is written on existing offset. Several factors including the > > > > > file system and its backing store could defeat the assumption, this > > > > > includes, but is not limited to file systems that uses Copy-On-Write > > > > > strategy (e.g. ZFS or UFS when snapshot is being used), or backing > > > > > datastore that does journaling, etc. In addition, only regular files > > > > > are overwritten, other types of files are not. > > > > > =============== > > > > > > > > Summary: it is very hard to tell whether -P works, even when you think > > > > you know what all the subsystems are doing. > > > > > > > > > > All this discussion leads me to the conclusion that we should just > > > remove the -P functionality and add a remark to the man page that that > > > was done because it isn't guaranteed to work on all file systems. > > > > > > Why give users a false sense of security? If they're concerned about > > > data security then they should use geli or something similar. > > > > that might be the ultimate solution. also one could use security/srm instead. > > > > +1 here. ;) > > > > question is: should -P be removed entirely or be made a no op? > > Probably best that it fail. how about the following patch? cheers. alex > > Ceri > -- > Haffely, Gaffely, Gaffely, Gonward. -- a13x --3MwIy2ne0vdjdPXF Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="rm.diff" diff --git a/bin/rm/rm.1 b/bin/rm/rm.1 index 11bc77d..569e7db 100644 --- a/bin/rm/rm.1 +++ b/bin/rm/rm.1 @@ -84,22 +84,6 @@ directory is being recursively removed. This is a far less intrusive option than .Fl i yet provides almost the same level of protection against mistakes. -.It Fl P -Overwrite regular files before deleting them. -Files are overwritten three times, first with the byte pattern 0xff, -then 0x00, and then 0xff again, before they are deleted. -Files with multiple links will not be overwritten nor deleted -and a warning will be issued. -If the -.Fl f -option is specified, files with multiple links will also be overwritten -and deleted. -No warning will be issued. -.Pp -Specifying this flag for a read only file will cause -.Nm -to generate an error message and exit. -The file will not be removed or overwritten. .It Fl R Attempt to remove the file hierarchy rooted in each .Ar file @@ -182,12 +166,6 @@ For example: .Pp .Dl "rm /home/user/-filename" .Dl "rm ./-filename" -.Pp -When -.Fl P -is specified with -.Fl f -the file will be overwritten and removed even if it has hard links. .Sh COMPATIBILITY The .Nm @@ -203,6 +181,23 @@ Also, historical .Bx implementations prompted on the standard output, not the standard error output. +.Pp +Previous +.Bx +versions of +.Nm +featured a +.Fl P +option which instructed +.Nm +to overwrite regular files three times with the byte pattern +0xff, then 0x00, and then 0xff again, before they were deleted. +Support for the +.Fl P +flag was removed in +.Fx 9.0 , +because overwriting specific blocks cannot be assured +on certain filesystems and media. .Sh SEE ALSO .Xr chflags 1 , .Xr rmdir 1 , @@ -226,11 +221,3 @@ A .Nm command appeared in .At v1 . -.Sh BUGS -The -.Fl P -option assumes that the underlying file system updates existing blocks -in-place and does not store new data in a new location. -This is true for UFS but not for ZFS, which is using a Copy-On-Write strategy. -In addition, only regular files are overwritten, other types of files -are not. diff --git a/bin/rm/rm.c b/bin/rm/rm.c index 653833a..1aff60f 100644 --- a/bin/rm/rm.c +++ b/bin/rm/rm.c @@ -57,7 +57,7 @@ __FBSDID("$FreeBSD$"); #include #include -int dflag, eval, fflag, iflag, Pflag, vflag, Wflag, stdin_ok; +int dflag, eval, fflag, iflag, vflag, Wflag, stdin_ok; int rflag, Iflag; uid_t uid; volatile sig_atomic_t info; @@ -67,7 +67,6 @@ int check2(char **); void checkdot(char **); void checkslash(char **); void rm_file(char **); -int rm_overwrite(char *, struct stat *); void rm_tree(char **); static void siginfo(int __unused); void usage(void); @@ -105,8 +104,8 @@ main(int argc, char *argv[]) exit(eval); } - Pflag = rflag = 0; - while ((ch = getopt(argc, argv, "dfiIPRrvW")) != -1) + rflag = 0; + while ((ch = getopt(argc, argv, "dfiIRrvW")) != -1) switch(ch) { case 'd': dflag = 1; @@ -122,9 +121,6 @@ main(int argc, char *argv[]) case 'I': Iflag = 1; break; - case 'P': - Pflag = 1; - break; case 'R': case 'r': /* Compatibility. */ rflag = 1; @@ -302,9 +298,6 @@ rm_tree(char **argv) continue; /* FALLTHROUGH */ default: - if (Pflag) - if (!rm_overwrite(p->fts_accpath, NULL)) - continue; rval = unlink(p->fts_accpath); if (rval == 0 || (fflag && errno == ENOENT)) { if (rval == 0 && vflag) @@ -374,12 +367,8 @@ rm_file(char **argv) rval = undelete(f); else if (S_ISDIR(sb.st_mode)) rval = rmdir(f); - else { - if (Pflag) - if (!rm_overwrite(f, &sb)) - continue; + else rval = unlink(f); - } } if (rval && (!fflag || errno != ENOENT)) { warn("%s", f); @@ -394,77 +383,6 @@ rm_file(char **argv) } } -/* - * rm_overwrite -- - * Overwrite the file 3 times with varying bit patterns. - * - * XXX - * This is a cheap way to *really* delete files. Note that only regular - * files are deleted, directories (and therefore names) will remain. - * Also, this assumes a fixed-block file system (like FFS, or a V7 or a - * System V file system). In a logging or COW file system, you'll have to - * have kernel support. - */ -int -rm_overwrite(char *file, struct stat *sbp) -{ - struct stat sb; - struct statfs fsb; - off_t len; - int bsize, fd, wlen; - char *buf = NULL; - - fd = -1; - if (sbp == NULL) { - if (lstat(file, &sb)) - goto err; - sbp = &sb; - } - if (!S_ISREG(sbp->st_mode)) - return (1); - if (sbp->st_nlink > 1 && !fflag) { - warnx("%s (inode %u): not overwritten due to multiple links", - file, sbp->st_ino); - return (0); - } - if ((fd = open(file, O_WRONLY, 0)) == -1) - goto err; - if (fstatfs(fd, &fsb) == -1) - goto err; - bsize = MAX(fsb.f_iosize, 1024); - if ((buf = malloc(bsize)) == NULL) - err(1, "%s: malloc", file); - -#define PASS(byte) { \ - memset(buf, byte, bsize); \ - for (len = sbp->st_size; len > 0; len -= wlen) { \ - wlen = len < bsize ? len : bsize; \ - if (write(fd, buf, wlen) != wlen) \ - goto err; \ - } \ -} - PASS(0xff); - if (fsync(fd) || lseek(fd, (off_t)0, SEEK_SET)) - goto err; - PASS(0x00); - if (fsync(fd) || lseek(fd, (off_t)0, SEEK_SET)) - goto err; - PASS(0xff); - if (!fsync(fd) && !close(fd)) { - free(buf); - return (1); - } - -err: eval = 1; - if (buf) - free(buf); - if (fd != -1) - close(fd); - warn("%s", file); - return (0); -} - - int check(char *path, char *name, struct stat *sp) { @@ -489,10 +407,6 @@ check(char *path, char *name, struct stat *sp) strmode(sp->st_mode, modep); if ((flagsp = fflagstostr(sp->st_flags)) == NULL) err(1, "fflagstostr"); - if (Pflag) - errx(1, - "%s: -P was specified, but file is not writable", - path); (void)fprintf(stderr, "override %s%s%s/%s %s%sfor %s? ", modep + 1, modep[9] == ' ' ? "" : " ", user_from_uid(sp->st_uid, 0), @@ -610,7 +524,7 @@ usage(void) { (void)fprintf(stderr, "%s\n%s\n", - "usage: rm [-f | -i] [-dIPRrvW] file ...", + "usage: rm [-f | -i] [-dIRrvW] file ...", " unlink file"); exit(EX_USAGE); } --3MwIy2ne0vdjdPXF-- From owner-svn-src-head@FreeBSD.ORG Thu Oct 28 13:44:19 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C6559106566B; Thu, 28 Oct 2010 13:44:19 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B58CB8FC18; Thu, 28 Oct 2010 13:44:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9SDiJPG003015; Thu, 28 Oct 2010 13:44:19 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9SDiJ4c003012; Thu, 28 Oct 2010 13:44:19 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201010281344.o9SDiJ4c003012@svn.freebsd.org> From: John Baldwin Date: Thu, 28 Oct 2010 13:44:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214448 - in head/sys: amd64/amd64 i386/i386 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 13:44:19 -0000 Author: jhb Date: Thu Oct 28 13:44:19 2010 New Revision: 214448 URL: http://svn.freebsd.org/changeset/base/214448 Log: Use 'PCPU_GET(apic_id)' to determine the BSP's APIC ID on a UP machine when routing interrupts instead of cpu_apic_ids[0] since cpu_apic_ids[] is only populated for multiple-CPU machines. This also matches what the code does when SMP is not enabled. PR: bin/151616 Tested by: "Damian S. Kolodziejczyk" damkol | gmail Submitted by: avg MFC after: 1 week Modified: head/sys/amd64/amd64/intr_machdep.c head/sys/i386/i386/intr_machdep.c Modified: head/sys/amd64/amd64/intr_machdep.c ============================================================================== --- head/sys/amd64/amd64/intr_machdep.c Thu Oct 28 11:09:12 2010 (r214447) +++ head/sys/amd64/amd64/intr_machdep.c Thu Oct 28 13:44:19 2010 (r214448) @@ -458,7 +458,7 @@ intr_next_cpu(void) /* Leave all interrupts on the BSP during boot. */ if (!assign_cpu) - return (cpu_apic_ids[0]); + return (PCPU_GET(apic_id)); mtx_lock_spin(&icu_lock); apic_id = cpu_apic_ids[current_cpu]; Modified: head/sys/i386/i386/intr_machdep.c ============================================================================== --- head/sys/i386/i386/intr_machdep.c Thu Oct 28 11:09:12 2010 (r214447) +++ head/sys/i386/i386/intr_machdep.c Thu Oct 28 13:44:19 2010 (r214448) @@ -424,7 +424,7 @@ intr_next_cpu(void) /* Leave all interrupts on the BSP during boot. */ if (!assign_cpu) - return (cpu_apic_ids[0]); + return (PCPU_GET(apic_id)); mtx_lock_spin(&icu_lock); apic_id = cpu_apic_ids[current_cpu]; From owner-svn-src-head@FreeBSD.ORG Thu Oct 28 14:17:06 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 91FE0106566B; Thu, 28 Oct 2010 14:17:06 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 81BAD8FC0A; Thu, 28 Oct 2010 14:17:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9SEH6uN005192; Thu, 28 Oct 2010 14:17:06 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9SEH6Ep005190; Thu, 28 Oct 2010 14:17:06 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201010281417.o9SEH6Ep005190@svn.freebsd.org> From: John Baldwin Date: Thu, 28 Oct 2010 14:17:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214449 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 14:17:06 -0000 Author: jhb Date: Thu Oct 28 14:17:06 2010 New Revision: 214449 URL: http://svn.freebsd.org/changeset/base/214449 Log: Set bootverbose directly in mi_startup() rather than via a SYSINIT. This ensures 'bootverbose' is in a valid state for all SYSINITs. Reported by: avg MFC after: 1 week Modified: head/sys/kern/init_main.c Modified: head/sys/kern/init_main.c ============================================================================== --- head/sys/kern/init_main.c Thu Oct 28 13:44:19 2010 (r214448) +++ head/sys/kern/init_main.c Thu Oct 28 14:17:06 2010 (r214449) @@ -180,6 +180,9 @@ mi_startup(void) int verbose; #endif + if (boothowto & RB_VERBOSE) + bootverbose++; + if (sysinit == NULL) { sysinit = SET_BEGIN(sysinit_set); sysinit_end = SET_LIMIT(sysinit_set); @@ -327,15 +330,6 @@ SYSINIT(diagwarn2, SI_SUB_RUN_SCHEDULER, print_caddr_t, diag_warn); #endif -static void -set_boot_verbose(void *data __unused) -{ - - if (boothowto & RB_VERBOSE) - bootverbose++; -} -SYSINIT(boot_verbose, SI_SUB_TUNABLES, SI_ORDER_ANY, set_boot_verbose, NULL); - static int null_fetch_syscall_args(struct thread *td __unused, struct syscall_args *sa __unused) From owner-svn-src-head@FreeBSD.ORG Thu Oct 28 16:31:39 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E7B49106566C; Thu, 28 Oct 2010 16:31:39 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D4EA68FC1C; Thu, 28 Oct 2010 16:31:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9SGVdka014928; Thu, 28 Oct 2010 16:31:39 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9SGVdtZ014923; Thu, 28 Oct 2010 16:31:39 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201010281631.o9SGVdtZ014923@svn.freebsd.org> From: Attilio Rao Date: Thu, 28 Oct 2010 16:31:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214457 - in head/sys: amd64/amd64 conf i386/i386 x86/x86 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 16:31:40 -0000 Author: attilio Date: Thu Oct 28 16:31:39 2010 New Revision: 214457 URL: http://svn.freebsd.org/changeset/base/214457 Log: Merge nexus.c from amd64 and i386 to x86 subtree. Sponsored by: Sandvine Incorporated Tested by: gianni Added: head/sys/x86/x86/nexus.c - copied, changed from r214446, head/sys/i386/i386/nexus.c Deleted: head/sys/amd64/amd64/nexus.c head/sys/i386/i386/nexus.c Modified: head/sys/conf/files.amd64 head/sys/conf/files.i386 head/sys/conf/files.pc98 Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Thu Oct 28 16:23:25 2010 (r214456) +++ head/sys/conf/files.amd64 Thu Oct 28 16:31:39 2010 (r214457) @@ -121,7 +121,6 @@ amd64/amd64/minidump_machdep.c standard amd64/amd64/mp_machdep.c optional smp amd64/amd64/mp_watchdog.c optional mp_watchdog smp amd64/amd64/mpboot.S optional smp -amd64/amd64/nexus.c standard amd64/amd64/pmap.c standard amd64/amd64/prof_machdep.c optional profiling-routine amd64/amd64/sigtramp.S standard @@ -325,3 +324,4 @@ x86/x86/mca.c standard x86/x86/mptable.c optional mptable x86/x86/mptable_pci.c optional mptable pci x86/x86/msi.c optional pci +x86/x86/nexus.c standard Modified: head/sys/conf/files.i386 ============================================================================== --- head/sys/conf/files.i386 Thu Oct 28 16:23:25 2010 (r214456) +++ head/sys/conf/files.i386 Thu Oct 28 16:31:39 2010 (r214457) @@ -290,7 +290,6 @@ i386/xen/mp_machdep.c optional xen smp i386/i386/mp_watchdog.c optional mp_watchdog smp i386/i386/mpboot.s optional smp native i386/xen/mptable.c optional apic xen -i386/i386/nexus.c standard i386/i386/perfmon.c optional perfmon i386/i386/pmap.c optional native i386/xen/pmap.c optional xen @@ -399,3 +398,4 @@ x86/x86/mca.c standard x86/x86/mptable.c optional apic native x86/x86/mptable_pci.c optional apic pci x86/x86/msi.c optional apic pci +x86/x86/nexus.c standard Modified: head/sys/conf/files.pc98 ============================================================================== --- head/sys/conf/files.pc98 Thu Oct 28 16:23:25 2010 (r214456) +++ head/sys/conf/files.pc98 Thu Oct 28 16:31:39 2010 (r214457) @@ -156,7 +156,6 @@ i386/i386/mp_clock.c optional smp i386/i386/mp_machdep.c optional smp i386/i386/mp_watchdog.c optional mp_watchdog smp i386/i386/mpboot.s optional smp -i386/i386/nexus.c standard i386/i386/perfmon.c optional perfmon i386/i386/pmap.c standard i386/i386/ptrace_machdep.c standard @@ -259,3 +258,4 @@ x86/x86/mca.c standard x86/x86/mptable.c optional apic x86/x86/mptable_pci.c optional apic pci x86/x86/msi.c optional apic pci +x86/x86/nexus.c standard Copied and modified: head/sys/x86/x86/nexus.c (from r214446, head/sys/i386/i386/nexus.c) ============================================================================== --- head/sys/i386/i386/nexus.c Thu Oct 28 07:58:06 2010 (r214446, copy source) +++ head/sys/x86/x86/nexus.c Thu Oct 28 16:31:39 2010 (r214457) @@ -41,13 +41,20 @@ __FBSDID("$FreeBSD$"); * and I/O memory address space. */ +#ifdef __amd64__ +#define DEV_APIC +#else #include "opt_apic.h" +#endif #include "opt_isa.h" #include #include #include #include +#ifdef __amd64__ +#include +#endif #include #include #include @@ -60,6 +67,10 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef __amd64__ +#include +#include +#endif #include #include @@ -77,6 +88,14 @@ __FBSDID("$FreeBSD$"); #endif #include +#ifdef __amd64__ +#define RMAN_BUS_SPACE_IO AMD64_BUS_SPACE_IO +#define RMAN_BUS_SPACE_MEM AMD64_BUS_SPACE_MEM +#else +#define RMAN_BUS_SPACE_IO I386_BUS_SPACE_IO +#define RMAN_BUS_SPACE_MEM I386_BUS_SPACE_MEM +#endif + static MALLOC_DEFINE(M_NEXUSDEV, "nexusdev", "Nexus device"); #define DEVTONX(dev) ((struct nexus_device *)device_get_ivars(dev)) @@ -416,7 +435,7 @@ nexus_activate_resource(device_t bus, de #else rman_set_bushandle(r, rman_get_start(r)); #endif - rman_set_bustag(r, I386_BUS_SPACE_IO); + rman_set_bustag(r, RMAN_BUS_SPACE_IO); break; case SYS_RES_MEMORY: #ifdef PC98 @@ -427,7 +446,7 @@ nexus_activate_resource(device_t bus, de #endif vaddr = pmap_mapdev(rman_get_start(r), rman_get_size(r)); rman_set_virtual(r, vaddr); - rman_set_bustag(r, I386_BUS_SPACE_MEM); + rman_set_bustag(r, RMAN_BUS_SPACE_MEM); #ifdef PC98 /* PC-98: the type of bus_space_handle_t is the structure. */ bh->bsh_base = (bus_addr_t) vaddr; @@ -649,6 +668,42 @@ ram_probe(device_t dev) return (0); } +#ifdef __amd64__ +static int +ram_attach(device_t dev) +{ + struct bios_smap *smapbase, *smap, *smapend; + struct resource *res; + caddr_t kmdp; + uint32_t smapsize; + int error, rid; + + /* Retrieve the system memory map from the loader. */ + kmdp = preload_search_by_type("elf kernel"); + if (kmdp == NULL) + kmdp = preload_search_by_type("elf64 kernel"); + smapbase = (struct bios_smap *)preload_search_info(kmdp, + MODINFO_METADATA | MODINFOMD_SMAP); + smapsize = *((u_int32_t *)smapbase - 1); + smapend = (struct bios_smap *)((uintptr_t)smapbase + smapsize); + + rid = 0; + for (smap = smapbase; smap < smapend; smap++) { + if (smap->type != SMAP_TYPE_MEMORY || smap->length == 0) + continue; + error = bus_set_resource(dev, SYS_RES_MEMORY, rid, smap->base, + smap->length); + if (error) + panic("ram_attach: resource %d failed set with %d", rid, + error); + res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, 0); + if (res == NULL) + panic("ram_attach: resource %d failed to attach", rid); + rid++; + } + return (0); +} +#else static int ram_attach(device_t dev) { @@ -688,6 +743,7 @@ ram_attach(device_t dev) } return (0); } +#endif static device_method_t ram_methods[] = { /* Device interface */ From owner-svn-src-head@FreeBSD.ORG Thu Oct 28 16:57:48 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BDCD5106566B; Thu, 28 Oct 2010 16:57:48 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 8E18F8FC1F; Thu, 28 Oct 2010 16:57:48 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 3DA5346B49; Thu, 28 Oct 2010 12:57:48 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 20B3E8A009; Thu, 28 Oct 2010 12:57:47 -0400 (EDT) From: John Baldwin To: Attilio Rao Date: Thu, 28 Oct 2010 12:57:05 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100819; KDE/4.4.5; amd64; ; ) References: <201010281631.o9SGVdtZ014923@svn.freebsd.org> In-Reply-To: <201010281631.o9SGVdtZ014923@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201010281257.05481.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Thu, 28 Oct 2010 12:57:47 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.96.3 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-1.9 required=4.2 tests=BAYES_00 autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r214457 - in head/sys: amd64/amd64 conf i386/i386 x86/x86 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 16:57:48 -0000 On Thursday, October 28, 2010 12:31:39 pm Attilio Rao wrote: > Author: attilio > Date: Thu Oct 28 16:31:39 2010 > New Revision: 214457 > URL: http://svn.freebsd.org/changeset/base/214457 > > Log: > Merge nexus.c from amd64 and i386 to x86 subtree. > > Sponsored by: Sandvine Incorporated > Tested by: gianni > > Added: > head/sys/x86/x86/nexus.c > - copied, changed from r214446, head/sys/i386/i386/nexus.c > Deleted: > head/sys/amd64/amd64/nexus.c > head/sys/i386/i386/nexus.c > Modified: > head/sys/conf/files.amd64 > head/sys/conf/files.i386 > head/sys/conf/files.pc98 > ============================================================================== > --- head/sys/conf/files.pc98 Thu Oct 28 16:23:25 2010 (r214456) > +++ head/sys/conf/files.pc98 Thu Oct 28 16:31:39 2010 (r214457) > @@ -156,7 +156,6 @@ i386/i386/mp_clock.c optional smp > i386/i386/mp_machdep.c optional smp > i386/i386/mp_watchdog.c optional mp_watchdog smp > i386/i386/mpboot.s optional smp > -i386/i386/nexus.c standard > i386/i386/perfmon.c optional perfmon > i386/i386/pmap.c standard > i386/i386/ptrace_machdep.c standard > @@ -259,3 +258,4 @@ x86/x86/mca.c standard > x86/x86/mptable.c optional apic > x86/x86/mptable_pci.c optional apic pci > x86/x86/msi.c optional apic pci > +x86/x86/nexus.c standard > > Copied and modified: head/sys/x86/x86/nexus.c (from r214446, head/sys/i386/i386/nexus.c) > ============================================================================== > --- head/sys/i386/i386/nexus.c Thu Oct 28 07:58:06 2010 (r214446, copy source) > +++ head/sys/x86/x86/nexus.c Thu Oct 28 16:31:39 2010 (r214457) > @@ -41,13 +41,20 @@ __FBSDID("$FreeBSD$"); > * and I/O memory address space. > */ > > +#ifdef __amd64__ > +#define DEV_APIC > +#else > #include "opt_apic.h" > +#endif > #include "opt_isa.h" > > #include > #include > #include > #include > +#ifdef __amd64__ > +#include > +#endif > #include > #include > #include > @@ -60,6 +67,10 @@ __FBSDID("$FreeBSD$"); > #include > #include > > +#ifdef __amd64__ > +#include > +#include > +#endif > #include > #include > > @@ -77,6 +88,14 @@ __FBSDID("$FreeBSD$"); > #endif > #include > > +#ifdef __amd64__ > +#define RMAN_BUS_SPACE_IO AMD64_BUS_SPACE_IO > +#define RMAN_BUS_SPACE_MEM AMD64_BUS_SPACE_MEM > +#else > +#define RMAN_BUS_SPACE_IO I386_BUS_SPACE_IO > +#define RMAN_BUS_SPACE_MEM I386_BUS_SPACE_MEM > +#endif > + Perhaps we should be using X86_BUS_SPACE_* instead? > @@ -649,6 +668,42 @@ ram_probe(device_t dev) > return (0); > } > > +#ifdef __amd64__ > +static int > +ram_attach(device_t dev) > +{ > + struct bios_smap *smapbase, *smap, *smapend; > + struct resource *res; > + caddr_t kmdp; > + uint32_t smapsize; > + int error, rid; > + > + /* Retrieve the system memory map from the loader. */ > + kmdp = preload_search_by_type("elf kernel"); > + if (kmdp == NULL) > + kmdp = preload_search_by_type("elf64 kernel"); > + smapbase = (struct bios_smap *)preload_search_info(kmdp, > + MODINFO_METADATA | MODINFOMD_SMAP); > + smapsize = *((u_int32_t *)smapbase - 1); > + smapend = (struct bios_smap *)((uintptr_t)smapbase + smapsize); > + > + rid = 0; > + for (smap = smapbase; smap < smapend; smap++) { > + if (smap->type != SMAP_TYPE_MEMORY || smap->length == 0) > + continue; > + error = bus_set_resource(dev, SYS_RES_MEMORY, rid, smap->base, > + smap->length); > + if (error) > + panic("ram_attach: resource %d failed set with %d", rid, > + error); > + res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, 0); > + if (res == NULL) > + panic("ram_attach: resource %d failed to attach", rid); > + rid++; > + } > + return (0); > +} > +#else > static int > ram_attach(device_t dev) > { > @@ -688,6 +743,7 @@ ram_attach(device_t dev) > } > return (0); > } > +#endif It would be better to merge these two routines. The loader now passes the smap to i386 kernels as well, so ram_attach() should probably be changed to try the amd64 approach first and if that fails fall back to using the phys_avail[] array instead. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Thu Oct 28 17:21:36 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 373E3106566B; Thu, 28 Oct 2010 17:21:36 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-qy0-f175.google.com (mail-qy0-f175.google.com [209.85.216.175]) by mx1.freebsd.org (Postfix) with ESMTP id 91A8A8FC14; Thu, 28 Oct 2010 17:21:35 +0000 (UTC) Received: by qyk7 with SMTP id 7so5061610qyk.13 for ; Thu, 28 Oct 2010 10:21:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=gX9IMByX9I62+n02gzEiommMKBInxX3WrdwXyVPFuGE=; b=gxPP30vkMuBkR5/uKaw1UbZIGORv5PcjPBsOrd06WIh/5tYcz3vVPLXmW9AnmHiDcd xatMinmNpBN6tRFh7nRW38ezueW6P+mpXkbdCaGxmWDWrWUA40P1oIwEdHaXSuk5IfU7 xSKd9/gA2QeGeLvg9+kMVlA8WimuhA5WedFZ4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=qk8eD4pZ/ZWsOHXcnLQpPTTy2G2rHL1Ev+23HJ6yz1oX92V9v3nqCCY/0Y/YU2O9NK IxvFKax5I/iK4COJcGzGtx3tWS1VGiiU3TIoY03dzcR5f7tHiCcwiC7FjRJoxK4I4t+5 YnV4djAV3WDBRDDTanv+k9JJgTGhVR43Y+POA= MIME-Version: 1.0 Received: by 10.229.224.81 with SMTP id in17mr5845671qcb.81.1288286494550; Thu, 28 Oct 2010 10:21:34 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.229.237.9 with HTTP; Thu, 28 Oct 2010 10:21:34 -0700 (PDT) In-Reply-To: <201010281257.05481.jhb@freebsd.org> References: <201010281631.o9SGVdtZ014923@svn.freebsd.org> <201010281257.05481.jhb@freebsd.org> Date: Thu, 28 Oct 2010 19:21:34 +0200 X-Google-Sender-Auth: DourtyZ_MWrdNLSDgB4fz5-583Q Message-ID: From: Attilio Rao To: John Baldwin Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r214457 - in head/sys: amd64/amd64 conf i386/i386 x86/x86 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 17:21:36 -0000 2010/10/28 John Baldwin : > On Thursday, October 28, 2010 12:31:39 pm Attilio Rao wrote: >> Author: attilio >> Date: Thu Oct 28 16:31:39 2010 >> New Revision: 214457 >> URL: http://svn.freebsd.org/changeset/base/214457 >> >> Log: >> =C2=A0 Merge nexus.c from amd64 and i386 to x86 subtree. >> >> =C2=A0 Sponsored by: =C2=A0 =C2=A0 =C2=A0 Sandvine Incorporated >> =C2=A0 Tested by: =C2=A0gianni >> > > It would be better to merge these two routines. =C2=A0The loader now pass= es the > smap to i386 kernels as well, so ram_attach() should probably be changed = to > try the amd64 approach first and if that fails fall back to using the > phys_avail[] array instead. What do you think about this patch?: Index: nexus.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- nexus.c (revision 214457) +++ nexus.c (working copy) @@ -52,9 +52,7 @@ #include #include #include -#ifdef __amd64__ #include -#endif #include #include #include @@ -67,12 +65,10 @@ #include #include -#ifdef __amd64__ #include -#include -#endif #include #include +#include #ifdef DEV_APIC #include "pcib_if.h" @@ -89,11 +85,13 @@ #include #ifdef __amd64__ -#define RMAN_BUS_SPACE_IO AMD64_BUS_SPACE_IO -#define RMAN_BUS_SPACE_MEM AMD64_BUS_SPACE_MEM +#define X86_BUS_SPACE_IO AMD64_BUS_SPACE_IO +#define X86_BUS_SPACE_MEM AMD64_BUS_SPACE_MEM +#define ELF_KERN_STR "elf64 kernel" #else -#define RMAN_BUS_SPACE_IO I386_BUS_SPACE_IO -#define RMAN_BUS_SPACE_MEM I386_BUS_SPACE_MEM +#define X86_BUS_SPACE_IO I386_BUS_SPACE_IO +#define X86_BUS_SPACE_MEM I386_BUS_SPACE_MEM +#define ELF_KERN_STR "elf32 kernel" #endif static MALLOC_DEFINE(M_NEXUSDEV, "nexusdev", "Nexus device"); @@ -435,7 +433,7 @@ #else rman_set_bushandle(r, rman_get_start(r)); #endif - rman_set_bustag(r, RMAN_BUS_SPACE_IO); + rman_set_bustag(r, X86_BUS_SPACE_IO); break; case SYS_RES_MEMORY: #ifdef PC98 @@ -446,7 +444,7 @@ #endif vaddr =3D pmap_mapdev(rman_get_start(r), rman_get_size(r)); rman_set_virtual(r, vaddr); - rman_set_bustag(r, RMAN_BUS_SPACE_MEM); + rman_set_bustag(r, X86_BUS_SPACE_MEM); #ifdef PC98 /* PC-98: the type of bus_space_handle_t is the structure. = */ bh->bsh_base =3D (bus_addr_t) vaddr; @@ -668,20 +666,20 @@ return (0); } -#ifdef __amd64__ static int ram_attach(device_t dev) { struct bios_smap *smapbase, *smap, *smapend; struct resource *res; + vm_paddr_t *p; caddr_t kmdp; uint32_t smapsize; - int error, rid; + int error, i, rid; /* Retrieve the system memory map from the loader. */ kmdp =3D preload_search_by_type("elf kernel"); if (kmdp =3D=3D NULL) - kmdp =3D preload_search_by_type("elf64 kernel"); + kmdp =3D preload_search_by_type(ELF_KERN_STR); smapbase =3D (struct bios_smap *)preload_search_info(kmdp, MODINFO_METADATA | MODINFOMD_SMAP); smapsize =3D *((u_int32_t *)smapbase - 1); @@ -701,16 +699,11 @@ panic("ram_attach: resource %d failed to attach", r= id); rid++; } - return (0); -} -#else -static int -ram_attach(device_t dev) -{ - struct resource *res; - vm_paddr_t *p; - int error, i, rid; + /* If at least one smap attached, return. */ + if (rid !=3D 0) + return (0); + /* * We use the dump_avail[] array rather than phys_avail[] for * the memory map as phys_avail[] contains holes for kernel @@ -724,7 +717,7 @@ */ for (i =3D 0, p =3D dump_avail; p[1] !=3D 0; i++, p +=3D 2) { rid =3D i; -#ifdef PAE +#if !defined(__amd64__) && defined(PAE) /* * Resources use long's to track resources, so we can't * include memory regions above 4GB. @@ -743,7 +736,6 @@ } return (0); } -#endif static device_method_t ram_methods[] =3D { /* Device interface */ From owner-svn-src-head@FreeBSD.ORG Thu Oct 28 17:44:26 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E62C11065781; Thu, 28 Oct 2010 17:44:26 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail09.syd.optusnet.com.au (mail09.syd.optusnet.com.au [211.29.132.190]) by mx1.freebsd.org (Postfix) with ESMTP id 611478FC17; Thu, 28 Oct 2010 17:44:25 +0000 (UTC) Received: from c122-106-146-165.carlnfd1.nsw.optusnet.com.au (c122-106-146-165.carlnfd1.nsw.optusnet.com.au [122.106.146.165]) by mail09.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id o9SHiKYD027722 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 29 Oct 2010 04:44:23 +1100 Date: Fri, 29 Oct 2010 04:44:20 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: John Baldwin In-Reply-To: <201010281257.05481.jhb@freebsd.org> Message-ID: <20101029042046.L899@besplex.bde.org> References: <201010281631.o9SGVdtZ014923@svn.freebsd.org> <201010281257.05481.jhb@freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: Attilio Rao , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r214457 - in head/sys: amd64/amd64 conf i386/i386 x86/x86 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 17:44:27 -0000 On Thu, 28 Oct 2010, John Baldwin wrote: > On Thursday, October 28, 2010 12:31:39 pm Attilio Rao wrote: >> Log: >> Merge nexus.c from amd64 and i386 to x86 subtree. >> ... > ============================================================================== >> --- head/sys/i386/i386/nexus.c Thu Oct 28 07:58:06 2010 (r214446, copy > source) >> ... >> @@ -77,6 +88,14 @@ __FBSDID("$FreeBSD$"); >> #endif >> #include >> >> +#ifdef __amd64__ >> +#define RMAN_BUS_SPACE_IO AMD64_BUS_SPACE_IO >> +#define RMAN_BUS_SPACE_MEM AMD64_BUS_SPACE_MEM >> +#else >> +#define RMAN_BUS_SPACE_IO I386_BUS_SPACE_IO >> +#define RMAN_BUS_SPACE_MEM I386_BUS_SPACE_MEM >> +#endif >> + > > Perhaps we should be using X86_BUS_SPACE_* instead? Why not just BUS_SPACE_*? The semantics are in the suffix. You would only need the prefix if an arch supported both its own bus spaces and another arch's bus spaces. I use the following horribleness in one tree partly to work around gratuitously different spellings of BUS_SPACE_MEM. The memory bus space is currently used only for ia64, but works for amd64 and ia64 and might work for all arches; there are massive ifdefs to avoid using it, and less-meassive ifdefs would be needed to use different spellings of it. % diff -c2 ./dev/fb/fbreg.h~ ./dev/fb/fbreg.h % *** ./dev/fb/fbreg.h~ Wed Jun 3 09:29:27 2009 % --- ./dev/fb/fbreg.h Wed Jun 17 02:23:39 2009 % *************** % *** 35,75 **** % % /* some macros */ % ! #ifdef __i386__ % ! #define bcopy_io(s, d, c) generic_bcopy((void *)(s), (void *)(d), (c)) % ! #define bcopy_toio(s, d, c) generic_bcopy((void *)(s), (void *)(d), (c)) % ! #define bcopy_fromio(s, d, c) generic_bcopy((void *)(s), (void *)(d), (c)) % ! #define bzero_io(d, c) generic_bzero((void *)(d), (c)) % ! #define fill_io(p, d, c) fill((p), (void *)(d), (c)) % ! #define fillw_io(p, d, c) fillw((p), (void *)(d), (c)) % ! void generic_bcopy(const void *s, void *d, size_t c); % ! void generic_bzero(void *d, size_t c); % ! #elif defined(__amd64__) % ! #define bcopy_io(s, d, c) bcopy((void *)(s), (void *)(d), (c)) % ! #define bcopy_toio(s, d, c) bcopy((void *)(s), (void *)(d), (c)) % ! #define bcopy_fromio(s, d, c) bcopy((void *)(s), (void *)(d), (c)) % ! #define bzero_io(d, c) bzero((void *)(d), (c)) % ! #define fill_io(p, d, c) fill((p), (void *)(d), (c)) % ! #define fillw_io(p, d, c) fillw((p), (void *)(d), (c)) % ! #elif defined(__ia64__) || defined(__sparc64__) % ! #if defined(__ia64__) % #include % #define bcopy_fromio(s, d, c) \ % ! bus_space_read_region_1(IA64_BUS_SPACE_MEM, s, 0, (void*)(d), c) % #define bcopy_io(s, d, c) \ % ! bus_space_copy_region_1(IA64_BUS_SPACE_MEM, s, 0, d, 0, c) % #define bcopy_toio(s, d, c) \ % ! bus_space_write_region_1(IA64_BUS_SPACE_MEM, d, 0, (void*)(s), c) % #define bzero_io(d, c) \ % ! bus_space_set_region_1(IA64_BUS_SPACE_MEM, (intptr_t)(d), 0, 0, c) % #define fill_io(p, d, c) \ % ! bus_space_set_region_1(IA64_BUS_SPACE_MEM, (intptr_t)(d), 0, p, c) % #define fillw_io(p, d, c) \ % ! bus_space_set_region_2(IA64_BUS_SPACE_MEM, (intptr_t)(d), 0, p, c) % ! #define readb(a) bus_space_read_1(IA64_BUS_SPACE_MEM, a, 0) % ! #define readw(a) bus_space_read_2(IA64_BUS_SPACE_MEM, a, 0) % ! #define writeb(a, v) bus_space_write_1(IA64_BUS_SPACE_MEM, a, 0, v) % ! #define writew(a, v) bus_space_write_2(IA64_BUS_SPACE_MEM, a, 0, v) % ! #define writel(a, v) bus_space_write_4(IA64_BUS_SPACE_MEM, a, 0, v) % ! #endif /* __ia64__ */ % static __inline void % fillw(int val, uint16_t *buf, size_t size) % --- 35,74 ---- % % /* some macros */ % ! #if defined(__amd64__) || defined(__i386__) || defined(__ia64__) || \ % ! defined(__sparc64__) % ! /* XXX __sparc64__ doesn't seem to belong here. */ % ! #if defined(__amd64__) || defined(__i386__) || defined(__ia64__) % #include % + #endif % + /* XXX fix gratuitous MD spelling: */ % + #ifdef __amd64__ % + #define BUS_SPACE_MEM AMD64_BUS_SPACE_MEM % + #endif % + #ifdef __i386__ % + #define BUS_SPACE_MEM I386_BUS_SPACE_MEM % + #endif % + #ifdef __ia64__ % + #define BUS_SPACE_MEM IA64_BUS_SPACE_MEM % + #endif % + #if defined(__amd64__) || defined(__i386__) || defined(__ia64__) % #define bcopy_fromio(s, d, c) \ % ! bus_space_read_region_1(BUS_SPACE_MEM, s, 0, (void*)(d), c) % #define bcopy_io(s, d, c) \ % ! bus_space_copy_region_1(BUS_SPACE_MEM, s, 0, d, 0, c) % #define bcopy_toio(s, d, c) \ % ! bus_space_write_region_1(BUS_SPACE_MEM, d, 0, (void*)(s), c) % #define bzero_io(d, c) \ % ! bus_space_set_region_1(BUS_SPACE_MEM, (intptr_t)(d), 0, 0, c) % #define fill_io(p, d, c) \ % ! bus_space_set_region_1(BUS_SPACE_MEM, (intptr_t)(d), 0, p, c) % #define fillw_io(p, d, c) \ % ! bus_space_set_region_2(BUS_SPACE_MEM, (intptr_t)(d), 0, p, c) % ! #define readb(a) bus_space_read_1(BUS_SPACE_MEM, a, 0) % ! #define readw(a) bus_space_read_2(BUS_SPACE_MEM, a, 0) % ! #define writeb(a, v) bus_space_write_1(BUS_SPACE_MEM, a, 0, v) % ! #define writew(a, v) bus_space_write_2(BUS_SPACE_MEM, a, 0, v) % ! #define writel(a, v) bus_space_write_4(BUS_SPACE_MEM, a, 0, v) % ! #endif /* __amd64__ || __i386__ || __ia64__ */ % ! /* fillw for __amd64__ || __i386__ || __ia64__ and || __sparc64__ too, ugh. */ % static __inline void % fillw(int val, uint16_t *buf, size_t size) % *************** % *** 102,106 **** % #define fillw(p, d, c) memsetw((d), (p), (c)) % #define fillw_io(p, d, c) memsetw_io((d), (p), (c)) % ! #endif /* !__i386__ */ % % /* video function table */ % --- 101,105 ---- % #define fillw(p, d, c) memsetw((d), (p), (c)) % #define fillw_io(p, d, c) memsetw_io((d), (p), (c)) % ! #endif % % /* video function table */ >> @@ -649,6 +668,42 @@ ram_probe(device_t dev) >> return (0); >> } >> >> +#ifdef __amd64__ >> +static int >> +ram_attach(device_t dev) >> ... >> +#else >> static int >> ram_attach(device_t dev) >> { >> @@ -688,6 +743,7 @@ ram_attach(device_t dev) >> } >> return (0); >> } >> +#endif > > It would be better to merge these two routines. The loader now passes the > smap to i386 kernels as well, so ram_attach() should probably be changed to > try the amd64 approach first and if that fails fall back to using the > phys_avail[] array instead. Or if it is MD, it doesn't belong under x86. Bruce From owner-svn-src-head@FreeBSD.ORG Thu Oct 28 17:50:23 2010 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E5B211065673; Thu, 28 Oct 2010 17:50:23 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id B53158FC19; Thu, 28 Oct 2010 17:50:23 +0000 (UTC) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 490E746B2E; Thu, 28 Oct 2010 13:50:23 -0400 (EDT) Date: Thu, 28 Oct 2010 18:50:23 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Gary Jennejohn In-Reply-To: <20101028095538.24147119@ernst.jennejohn.org> Message-ID: References: <201010271848.o9RImNSR019344@svn.freebsd.org> <20101027212601.GA78062@freebsd.org> <4CC899C3.7040107@FreeBSD.org> <20101027214822.GA82697@freebsd.org> <4CC8A89D.5070909@delphij.net> <20101028152418.A916@besplex.bde.org> <20101028095538.24147119@ernst.jennejohn.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: Doug Barton , d@delphij.net, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Bruce Evans , svn-src-head@FreeBSD.org, Alexander Best , Dag-Erling Smorgrav Subject: Re: svn commit: r214431 - head/bin/rm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 17:50:24 -0000 On Thu, 28 Oct 2010, Gary Jennejohn wrote: >>> The -P option assumes that the underlying storage overwrites file block >>> when data is written on existing offset. Several factors including the >>> file system and its backing store could defeat the assumption, this >>> includes, but is not limited to file systems that uses Copy-On-Write >>> strategy (e.g. ZFS or UFS when snapshot is being used), or backing >>> datastore that does journaling, etc. In addition, only regular files are >>> overwritten, other types of files are not. >> >> Summary: it is very hard to tell whether -P works, even when you think you >> know what all the subsystems are doing. > > All this discussion leads me to the conclusion that we should just remove > the -P functionality and add a remark to the man page that that was done > because it isn't guaranteed to work on all file systems. > > Why give users a false sense of security? If they're concerned about data > security then they should use geli or something similar. I'm not sure I entirely agree with this conclusion: there are times when -P can be quite effective at removing data from a system, and not having it available when it could work might also be problematic. Part of the problem here is that we have successfully abstracted away a lot of information going up the storage stack. One possibly solution to this problem is to add ways for that information to propagate better -- in the same way that the end-to-end argument in network design is moderated by the reality that performance can be dramatically improved if information gathering can be done with an awareness of lower layers (for example, PMTU discovery), even if decisions about how to use that information are at the endpoints only. For example, you could imagine a pathconf() call that asks the file system if overwriting a file is likely to result in the data going away -- UFS could answer "yes" unless it's snapshotting the file system, and ZFS could simply answer "no". In FreeBSD 9, we're going to have two common file system configurations: ZFS and UFS+SUJ; the latter will do overwriting of files just fine on most current media. Robert From owner-svn-src-head@FreeBSD.ORG Thu Oct 28 18:15:52 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 724261065693; Thu, 28 Oct 2010 18:15:52 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 40A348FC1D; Thu, 28 Oct 2010 18:15:52 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id CE70A46B49; Thu, 28 Oct 2010 14:15:51 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 8D0E78A029; Thu, 28 Oct 2010 14:15:50 -0400 (EDT) From: John Baldwin To: Attilio Rao Date: Thu, 28 Oct 2010 14:11:40 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100819; KDE/4.4.5; amd64; ; ) References: <201010281631.o9SGVdtZ014923@svn.freebsd.org> <201010281257.05481.jhb@freebsd.org> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201010281411.40423.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Thu, 28 Oct 2010 14:15:50 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.96.3 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-1.9 required=4.2 tests=BAYES_00 autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r214457 - in head/sys: amd64/amd64 conf i386/i386 x86/x86 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 18:15:52 -0000 On Thursday, October 28, 2010 1:21:34 pm Attilio Rao wrote: > 2010/10/28 John Baldwin : > > On Thursday, October 28, 2010 12:31:39 pm Attilio Rao wrote: > >> Author: attilio > >> Date: Thu Oct 28 16:31:39 2010 > >> New Revision: 214457 > >> URL: http://svn.freebsd.org/changeset/base/214457 > >> > >> Log: > >> Merge nexus.c from amd64 and i386 to x86 subtree. > >> > >> Sponsored by: Sandvine Incorporated > >> Tested by: gianni > >> > > > > It would be better to merge these two routines. The loader now passes the > > smap to i386 kernels as well, so ram_attach() should probably be changed to > > try the amd64 approach first and if that fails fall back to using the > > phys_avail[] array instead. > > What do you think about this patch?: > Index: nexus.c > =================================================================== > --- nexus.c (revision 214457) > +++ nexus.c (working copy) > @@ -52,9 +52,7 @@ > #include > #include > #include > -#ifdef __amd64__ > #include > -#endif > #include > #include > #include > @@ -67,12 +65,10 @@ > #include > #include > > -#ifdef __amd64__ > #include > -#include > -#endif > #include > #include > +#include > > #ifdef DEV_APIC > #include "pcib_if.h" > @@ -89,11 +85,13 @@ > #include > > #ifdef __amd64__ > -#define RMAN_BUS_SPACE_IO AMD64_BUS_SPACE_IO > -#define RMAN_BUS_SPACE_MEM AMD64_BUS_SPACE_MEM > +#define X86_BUS_SPACE_IO AMD64_BUS_SPACE_IO > +#define X86_BUS_SPACE_MEM AMD64_BUS_SPACE_MEM > +#define ELF_KERN_STR "elf64 kernel" > #else > -#define RMAN_BUS_SPACE_IO I386_BUS_SPACE_IO > -#define RMAN_BUS_SPACE_MEM I386_BUS_SPACE_MEM > +#define X86_BUS_SPACE_IO I386_BUS_SPACE_IO > +#define X86_BUS_SPACE_MEM I386_BUS_SPACE_MEM > +#define ELF_KERN_STR "elf32 kernel" > #endif I would not do this. What I meant is that amd64 and i386 should be changed to both use X86_BUS_SPACE_* and {AMD64,I386}_BUS_SPACE_* should be retired. This would involve changing the bus space code itself slightly, but it could perhaps be shared as a result. Alternatively as bde@ notes we could just drop the MD prefix entirely and have BUS_SPACE_* instead. However, I wouldn't make any changes to just nexus.c for the BUS_SPACE_* stuff. > @@ -668,20 +666,20 @@ > return (0); > } > > -#ifdef __amd64__ > static int > ram_attach(device_t dev) > { > struct bios_smap *smapbase, *smap, *smapend; > struct resource *res; > + vm_paddr_t *p; > caddr_t kmdp; > uint32_t smapsize; > - int error, rid; > + int error, i, rid; > > /* Retrieve the system memory map from the loader. */ > kmdp = preload_search_by_type("elf kernel"); > if (kmdp == NULL) > - kmdp = preload_search_by_type("elf64 kernel"); > + kmdp = preload_search_by_type(ELF_KERN_STR); > smapbase = (struct bios_smap *)preload_search_info(kmdp, > MODINFO_METADATA | MODINFOMD_SMAP); > smapsize = *((u_int32_t *)smapbase - 1); It would be nice if ELF_KERN_STR could be autogenerated as something like: "elf ## __ELF_WORD_SIZE ## kernel" instead of needing an #ifdef. > @@ -701,16 +699,11 @@ > panic("ram_attach: resource %d failed to attach", rid); > rid++; > } > - return (0); > -} > -#else > -static int > -ram_attach(device_t dev) > -{ > - struct resource *res; > - vm_paddr_t *p; > - int error, i, rid; > > + /* If at least one smap attached, return. */ > + if (rid != 0) > + return (0); > + Perhaps this instead: /* If we found an SMAP, return. */ if (smapbase != NULL) return (0); > /* > * We use the dump_avail[] array rather than phys_avail[] for > * the memory map as phys_avail[] contains holes for kernel > @@ -724,7 +717,7 @@ > */ > for (i = 0, p = dump_avail; p[1] != 0; i++, p += 2) { > rid = i; > -#ifdef PAE > +#if !defined(__amd64__) && defined(PAE) > /* > * Resources use long's to track resources, so we can't > * include memory regions above 4GB. No need for this bit, PAE is never true on amd64, so it can just be used directly in x86 code. > @@ -743,7 +736,6 @@ > } > return (0); > } > -#endif > > static device_method_t ram_methods[] = { > /* Device interface */ > -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Thu Oct 28 18:22:19 2010 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: by hub.freebsd.org (Postfix, from userid 1233) id 5B2D5106566B; Thu, 28 Oct 2010 18:22:19 +0000 (UTC) Date: Thu, 28 Oct 2010 18:22:19 +0000 From: Alexander Best To: Robert Watson Message-ID: <20101028182219.GA36559@freebsd.org> References: <201010271848.o9RImNSR019344@svn.freebsd.org> <20101027212601.GA78062@freebsd.org> <4CC899C3.7040107@FreeBSD.org> <20101027214822.GA82697@freebsd.org> <4CC8A89D.5070909@delphij.net> <20101028152418.A916@besplex.bde.org> <20101028095538.24147119@ernst.jennejohn.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Cc: Doug Barton , d@delphij.net, svn-src-all@FreeBSD.org, Gary Jennejohn , src-committers@FreeBSD.org, Bruce Evans , svn-src-head@FreeBSD.org, Dag-Erling Smorgrav Subject: Re: svn commit: r214431 - head/bin/rm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 18:22:19 -0000 On Thu Oct 28 10, Robert Watson wrote: > On Thu, 28 Oct 2010, Gary Jennejohn wrote: > > >>>The -P option assumes that the underlying storage overwrites file block > >>>when data is written on existing offset. Several factors including the > >>>file system and its backing store could defeat the assumption, this > >>>includes, but is not limited to file systems that uses Copy-On-Write > >>>strategy (e.g. ZFS or UFS when snapshot is being used), or backing > >>>datastore that does journaling, etc. In addition, only regular files > >>>are overwritten, other types of files are not. > >> > >>Summary: it is very hard to tell whether -P works, even when you think > >>you know what all the subsystems are doing. > > > >All this discussion leads me to the conclusion that we should just remove > >the -P functionality and add a remark to the man page that that was done > >because it isn't guaranteed to work on all file systems. > > > >Why give users a false sense of security? If they're concerned about data > >security then they should use geli or something similar. > > I'm not sure I entirely agree with this conclusion: there are times when -P > can be quite effective at removing data from a system, and not having it > available when it could work might also be problematic. > > Part of the problem here is that we have successfully abstracted away a lot > of information going up the storage stack. One possibly solution to this > problem is to add ways for that information to propagate better -- in the > same way that the end-to-end argument in network design is moderated by the > reality that performance can be dramatically improved if information > gathering can be done with an awareness of lower layers (for example, PMTU > discovery), even if decisions about how to use that information are at the > endpoints only. > > For example, you could imagine a pathconf() call that asks the file system > if overwriting a file is likely to result in the data going away -- UFS > could answer "yes" unless it's snapshotting the file system, and ZFS could > simply answer "no". > > In FreeBSD 9, we're going to have two common file system configurations: > ZFS and UFS+SUJ; the latter will do overwriting of files just fine on most > current media. i agree. however from this discussion it's become quite obvious that securely deleting any data on a certain media is a very complex topic. when the -P option got implemented into rm, securely deleting files was quite an easy and intuitive task. this has clearly changed. so the question arises, if securely removing data (maybe also directory entries) shouldn't be handled by a specially designed utility? the pathconf() idea looks very primising. should the return values ("yes" or "no") simply be hardcoded for every fs? or should they be returned by a routine which actually veryfies on the fly if overwriting files is possible? alex ps: please keep in mind that an import of fusefs might happen in the next few months, so the fs situation on freebsd might change. > > Robert -- a13x From owner-svn-src-head@FreeBSD.ORG Thu Oct 28 18:25:58 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7B15A106566C; Thu, 28 Oct 2010 18:25:58 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-yw0-f54.google.com (mail-yw0-f54.google.com [209.85.213.54]) by mx1.freebsd.org (Postfix) with ESMTP id BC8F88FC14; Thu, 28 Oct 2010 18:25:57 +0000 (UTC) Received: by ywh2 with SMTP id 2so944866ywh.13 for ; Thu, 28 Oct 2010 11:25:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=USqmfz5pyg4LRhfjlRX/iFtf1NkV6+htDtwxH4Aa2r8=; b=ANEr67uGaOrmNnBEf6FR7SnPm8GD0I0QvrXTP3C/JuVNu1lFggfW7SkD4alc+Oggwa PMSoDELb4erchPMjTjTUeDX76Nh4BTxxbRBrqmvRsd59lEmR1i0Oi52K0/o71sK0YUz2 rsntpB9xmP12c1uPqHjycCfv8QrBwdoI5CGdc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=gQn906XuvC5DvjF6sA/vmy8TC3xe7aPKdjdyvDbJFgg73MmL6PueGIEObOE4hmZqDh vhQrdm9GH3Fm0I64m+ex4cgZe7X9e+QD+DO/4hQsGkeM/X4jGtstkwvlCixQD/EsH4e+ TV36bPOJKR7FOknJxCW9+MsVzBKVQ0Tu2N/Eo= MIME-Version: 1.0 Received: by 10.90.2.20 with SMTP id 20mr3194500agb.69.1288290357129; Thu, 28 Oct 2010 11:25:57 -0700 (PDT) Sender: yanegomi@gmail.com Received: by 10.90.70.19 with HTTP; Thu, 28 Oct 2010 11:25:57 -0700 (PDT) In-Reply-To: <4CC9483C.7050507@freebsd.org> References: <201010270232.o9R2Wsu3084553@svn.freebsd.org> <4CC803A8.3040602@freebsd.org> <20101027082122.GD1848@garage.freebsd.pl> <4CC85552.2020100@freebsd.org> <20101027133307.GQ2392@deviant.kiev.zoral.com.ua> <4CC851CC.80509@freebsd.org> <4CC9483C.7050507@freebsd.org> Date: Thu, 28 Oct 2010 11:25:57 -0700 X-Google-Sender-Auth: -ipgJtTNOwM53RqE-A2F3pPkK8A Message-ID: From: Garrett Cooper To: David Xu Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: src-committers@freebsd.org, Pawel Jakub Dawidek , svn-src-all@freebsd.org, Andriy Gapon , svn-src-head@freebsd.org, Kostik Belousov Subject: Re: svn commit: r214409 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 18:25:58 -0000 On Thu, Oct 28, 2010 at 2:54 AM, David Xu wrote: > Garrett Cooper wrote: >> >> On Wed, Oct 27, 2010 at 9:22 AM, Andriy Gapon wrote: >>> >>> [patch attachment was lost] >> >> Ugh... Mailman hates me I guess :(... >> >>> on 27/10/2010 19:07 Garrett Cooper said the following: >>>> >>>> =A0 =A0How about this patch? I implemented this as a readonly tunable = and >>> >>> I don't think that it's correct to call it a tunable or use >>> CTLFLAG_RDTUN. >>> As I understand it is a read-only sysctl. >> >> Converted to CTLFLAG_RD. >> >>>> sysconf tunable, because (AFAIK) the value that is being tested >>>> shouldn't change during runtime after the system has been booted up, >>>> and figuring that the value wasn't going to change it was better to >>>> lose 4/8 bytes on the kernel stack instead of having to recompute the >>>> value every time in a function call, with the associated lost heap / >>>> stack memory in the process, as the assumption is that this libcall >>>> was going to be called frequently by some programs. > > The patch looks fine to me. ;-) If no one opposes the change, could you please commit the patch for me Davi= d? Thanks! -Garrett From owner-svn-src-head@FreeBSD.ORG Thu Oct 28 18:57:44 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0F97E106566C; Thu, 28 Oct 2010 18:57:44 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id D25338FC21; Thu, 28 Oct 2010 18:57:43 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 3398946B09; Thu, 28 Oct 2010 14:57:43 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 441778A009; Thu, 28 Oct 2010 14:57:42 -0400 (EDT) From: John Baldwin To: Attilio Rao Date: Thu, 28 Oct 2010 14:57:19 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100819; KDE/4.4.5; amd64; ; ) References: <201010281631.o9SGVdtZ014923@svn.freebsd.org> <201010281411.40423.jhb@freebsd.org> In-Reply-To: <201010281411.40423.jhb@freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201010281457.19804.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Thu, 28 Oct 2010 14:57:42 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.96.3 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-1.9 required=4.2 tests=BAYES_00 autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r214457 - in head/sys: amd64/amd64 conf i386/i386 x86/x86 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 18:57:44 -0000 On Thursday, October 28, 2010 2:11:40 pm John Baldwin wrote: > On Thursday, October 28, 2010 1:21:34 pm Attilio Rao wrote: > > + vm_paddr_t *p; > > caddr_t kmdp; > > uint32_t smapsize; > > - int error, rid; > > + int error, i, rid; > > > > /* Retrieve the system memory map from the loader. */ > > kmdp = preload_search_by_type("elf kernel"); > > if (kmdp == NULL) > > - kmdp = preload_search_by_type("elf64 kernel"); > > + kmdp = preload_search_by_type(ELF_KERN_STR); > > smapbase = (struct bios_smap *)preload_search_info(kmdp, > > MODINFO_METADATA | MODINFOMD_SMAP); > > smapsize = *((u_int32_t *)smapbase - 1); > > It would be nice if ELF_KERN_STR could be autogenerated as something like: > > "elf ## __ELF_WORD_SIZE ## kernel" instead of needing an #ifdef. This works in my testing: #include #include int main(void) { printf("%s\n", "elf" __XSTRING(__ELF_WORD_SIZE) " kernel"); return (0); } -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Thu Oct 28 19:06:17 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D598E106564A; Thu, 28 Oct 2010 19:06:17 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C17B48FC1D; Thu, 28 Oct 2010 19:06:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9SJ6HV1025590; Thu, 28 Oct 2010 19:06:17 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9SJ6HM3025571; Thu, 28 Oct 2010 19:06:17 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201010281906.o9SJ6HM3025571@svn.freebsd.org> From: Rui Paulo Date: Thu, 28 Oct 2010 19:06:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214478 - in head/contrib/tcpdump: . lbl missing tests win32 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 19:06:17 -0000 Author: rpaulo Date: Thu Oct 28 19:06:17 2010 New Revision: 214478 URL: http://svn.freebsd.org/changeset/base/214478 Log: Merge tcpdump-4.1.1. Added: head/contrib/tcpdump/Makefile-devel-adds - copied unchanged from r214475, vendor/tcpdump/dist/Makefile-devel-adds head/contrib/tcpdump/Readme.Win32 - copied unchanged from r214475, vendor/tcpdump/dist/Readme.Win32 head/contrib/tcpdump/forces.h - copied unchanged from r214475, vendor/tcpdump/dist/forces.h head/contrib/tcpdump/ipnet.h - copied unchanged from r214475, vendor/tcpdump/dist/ipnet.h head/contrib/tcpdump/print-forces.c - copied unchanged from r214475, vendor/tcpdump/dist/print-forces.c head/contrib/tcpdump/print-ipnet.c - copied unchanged from r214475, vendor/tcpdump/dist/print-ipnet.c head/contrib/tcpdump/print-usb.c - copied unchanged from r214475, vendor/tcpdump/dist/print-usb.c head/contrib/tcpdump/signature.c - copied unchanged from r214475, vendor/tcpdump/dist/signature.c head/contrib/tcpdump/signature.h - copied unchanged from r214475, vendor/tcpdump/dist/signature.h head/contrib/tcpdump/tcpdump.1.in - copied unchanged from r214475, vendor/tcpdump/dist/tcpdump.1.in head/contrib/tcpdump/tests/ - copied from r214475, vendor/tcpdump/dist/tests/ head/contrib/tcpdump/win32/ - copied from r214475, vendor/tcpdump/dist/win32/ Deleted: head/contrib/tcpdump/missing/getaddrinfo.c head/contrib/tcpdump/tcpdump.1 Modified: head/contrib/tcpdump/CHANGES head/contrib/tcpdump/CREDITS head/contrib/tcpdump/INSTALL.txt head/contrib/tcpdump/Makefile.in head/contrib/tcpdump/README head/contrib/tcpdump/VERSION head/contrib/tcpdump/acconfig.h head/contrib/tcpdump/addrtoname.c head/contrib/tcpdump/af.c head/contrib/tcpdump/af.h head/contrib/tcpdump/atmuni31.h head/contrib/tcpdump/bootp.h head/contrib/tcpdump/bpf_dump.c head/contrib/tcpdump/checksum.c head/contrib/tcpdump/config.guess head/contrib/tcpdump/config.h.in head/contrib/tcpdump/config.sub head/contrib/tcpdump/configure head/contrib/tcpdump/configure.in head/contrib/tcpdump/ethertype.h head/contrib/tcpdump/gmpls.c head/contrib/tcpdump/gmpls.h head/contrib/tcpdump/gmt2local.h head/contrib/tcpdump/icmp6.h head/contrib/tcpdump/ieee802_11.h head/contrib/tcpdump/ieee802_11_radio.h head/contrib/tcpdump/interface.h head/contrib/tcpdump/ip6.h head/contrib/tcpdump/ipproto.c head/contrib/tcpdump/ipproto.h head/contrib/tcpdump/isakmp.h head/contrib/tcpdump/l2vpn.c head/contrib/tcpdump/l2vpn.h head/contrib/tcpdump/lbl/os-sunos4.h head/contrib/tcpdump/lbl/os-ultrix4.h head/contrib/tcpdump/missing/addrinfo.h head/contrib/tcpdump/netdissect.h head/contrib/tcpdump/nfs.h head/contrib/tcpdump/nlpid.c head/contrib/tcpdump/nlpid.h head/contrib/tcpdump/oui.c head/contrib/tcpdump/oui.h head/contrib/tcpdump/print-802_11.c head/contrib/tcpdump/print-ap1394.c head/contrib/tcpdump/print-arcnet.c head/contrib/tcpdump/print-atm.c head/contrib/tcpdump/print-bfd.c head/contrib/tcpdump/print-bgp.c head/contrib/tcpdump/print-bootp.c head/contrib/tcpdump/print-bt.c head/contrib/tcpdump/print-cdp.c head/contrib/tcpdump/print-cfm.c head/contrib/tcpdump/print-dccp.c head/contrib/tcpdump/print-dhcp6.c head/contrib/tcpdump/print-domain.c head/contrib/tcpdump/print-enc.c head/contrib/tcpdump/print-esp.c head/contrib/tcpdump/print-ether.c head/contrib/tcpdump/print-fr.c head/contrib/tcpdump/print-gre.c head/contrib/tcpdump/print-icmp6.c head/contrib/tcpdump/print-ip.c head/contrib/tcpdump/print-ip6.c head/contrib/tcpdump/print-isakmp.c head/contrib/tcpdump/print-isoclns.c head/contrib/tcpdump/print-juniper.c head/contrib/tcpdump/print-l2tp.c head/contrib/tcpdump/print-lane.c head/contrib/tcpdump/print-llc.c head/contrib/tcpdump/print-lldp.c head/contrib/tcpdump/print-lspping.c head/contrib/tcpdump/print-nfs.c head/contrib/tcpdump/print-ntp.c head/contrib/tcpdump/print-olsr.c head/contrib/tcpdump/print-ospf.c head/contrib/tcpdump/print-pflog.c head/contrib/tcpdump/print-pim.c head/contrib/tcpdump/print-ppp.c head/contrib/tcpdump/print-rrcp.c head/contrib/tcpdump/print-rsvp.c head/contrib/tcpdump/print-rx.c head/contrib/tcpdump/print-sctp.c head/contrib/tcpdump/print-sip.c head/contrib/tcpdump/print-sll.c head/contrib/tcpdump/print-smb.c head/contrib/tcpdump/print-sunrpc.c head/contrib/tcpdump/print-symantec.c head/contrib/tcpdump/print-tcp.c head/contrib/tcpdump/print-tftp.c head/contrib/tcpdump/print-token.c head/contrib/tcpdump/print-udp.c head/contrib/tcpdump/setsignal.h head/contrib/tcpdump/sll.h head/contrib/tcpdump/smbutil.c head/contrib/tcpdump/strcasecmp.c head/contrib/tcpdump/tcp.h head/contrib/tcpdump/tcpdump-stdinc.h head/contrib/tcpdump/tcpdump.c head/contrib/tcpdump/tftp.h head/contrib/tcpdump/timed.h head/contrib/tcpdump/token.h head/contrib/tcpdump/util.c Directory Properties: head/contrib/tcpdump/ (props changed) Modified: head/contrib/tcpdump/CHANGES ============================================================================== --- head/contrib/tcpdump/CHANGES Thu Oct 28 19:05:21 2010 (r214477) +++ head/contrib/tcpdump/CHANGES Thu Oct 28 19:06:17 2010 (r214478) @@ -1,4 +1,45 @@ -$Header: /tcpdump/master/tcpdump/CHANGES,v 1.98.2.2 2008-10-15 23:26:30 ken Exp $ +Thu. April 1, 2010. guy@alum.mit.edu. + Summary for 4.1.1 tcpdump release + Fix build on systems with PF, such as FreeBSD and OpenBSD. + Don't blow up if a zero-length link-layer address is passed to + linkaddr_string(). + +Thu. March 11, 2010. ken@netfunctional.ca/guy@alum.mit.edu. + Summary for 4.1.0 tcpdump release + Fix printing of MAC addresses for VLAN frames with a length + field + Add some additional bounds checks and use the EXTRACT_ macros + more + Add a -b flag to print the AS number in BGP packets in ASDOT + notation rather than ASPLAIN notation + Add ICMPv6 RFC 5006 support + Decode the access flags in NFS access requests + Handle the new DLT_ for memory-mapped USB captures on Linux + Make the default snapshot (-s) the maximum + Print name of device (when -L is used) + Support for OpenSolaris (and SXCE build 125 and later) + Print new TCP flags + Add support for RPL DIO + Add support for TCP User Timeout (UTO) + Add support for non-standard Ethertypes used by 3com PPPoE gear + Add support for 802.11n and 802.11s + Add support for Transparent Ethernet Bridge ethertype in GRE + Add 4 byte AS support for BGP printer + Add support for the MDT SAFI 66 BG printer + Add basic IPv6 support to print-olsr + Add USB printer + Add printer for ForCES + Handle frames with an FCS + Handle 802.11n Control Wrapper, Block Acq Req and Block Ack frames + Fix TCP sequence number printing + Report 802.2 packets as 802.2 instead of 802.3 + Don't include -L/usr/lib in LDFLAGS + On x86_64 Linux, look in lib64 directory too + Lots of code clean ups + Autoconf clean ups + Update testcases to make output changes + Fix compiling with/out smi (--with{,out}-smi) + Fix compiling without IPv6 support (--disable-ipv6) Mon. October 27, 2008. ken@netfunctional.ca. Summary for 4.0.0 tcpdump release Add support for Bluetooth Sniffing Modified: head/contrib/tcpdump/CREDITS ============================================================================== --- head/contrib/tcpdump/CREDITS Thu Oct 28 19:05:21 2010 (r214477) +++ head/contrib/tcpdump/CREDITS Thu Oct 28 19:06:17 2010 (r214478) @@ -27,6 +27,7 @@ Additional people who have contributed p Ben Byer Atsushi Onoe Ben Smithurst + Bert Vermeulen Bjoern A. Zeeb Brent L. Bates Brian Ginsbach @@ -44,11 +45,15 @@ Additional people who have contributed p Daniel Hagerty Darren Reed David Binderman + David Horn David Smith David Young Don Ebright Eddie Kohler + Elmar Kirchner + Fang Wang Florent Drouin + Florian Forster Francis Dupont Francisco Matias Cuenca-Acuna Francois-Xavier Le Bail @@ -68,8 +73,10 @@ Additional people who have contributed p Heinz-Ado Arnolds Hendrik Scholz Ian McDonald - Jacek Tobiasz + Ilpo Järvinen + Jacek Tobiasz Jakob Schlyter + Jamal Hadi Salim Jan Oravec Jason R. Thorpe Jefferson Ogata @@ -78,10 +85,12 @@ Additional people who have contributed p Jim Hutchins Jonathan Heusser Tatuya Jinmei + João Medeiros Joerg Mayer - Jørgen Thomsen + Jørgen Thomsen Julian Cowley Kaarthik Sivakumar + Karl Norby Kazushi Sugyo Kelly Carmichael Ken Hornstein @@ -92,7 +101,8 @@ Additional people who have contributed p Larry Lile Lennert Buytenhek Loris Degioanni - Love Hörnquist-Åstrand + Love Hörnquist-Ã…strand + Lucas C. Villa Real Luis Martin Garcia Maciej W. Rozycki Manu Pathak @@ -100,12 +110,13 @@ Additional people who have contributed p Marc A. Lehmann Mark Ellzey Thomas Marko Kiiskila - Markus Schöpflin + Markus Schöpflin Marshall Rose Martin Husemann Max Laier Michael A. Meffie III Michael Madore + Michael Riepe Michael Shalayeff Michael Shields Michael T. Stolarchuk @@ -132,13 +143,16 @@ Additional people who have contributed p Peter Fales Peter Jeremy + Peter Volkov Phil Wood Rafal Maszkowski + Randy Sofia Raphael Raimbault Rick Cheng Rick Jones Rick Watson Rob Braun + Robert Edmonds Roderick Schertler Sagun Shakya Sami Farin @@ -155,11 +169,14 @@ Additional people who have contributed p Terry Kennedy Timo Koskiahde Tony Li + Toshihiro Kanda Uns Lider Victor Oppleman Wesley Griffin + Wesley Shields Wilbert de Graaf - Will Drewry + Will Drewry + William J. Hulley Yen Yen Lim Yoshifumi Nishida Modified: head/contrib/tcpdump/INSTALL.txt ============================================================================== --- head/contrib/tcpdump/INSTALL.txt Thu Oct 28 19:05:21 2010 (r214477) +++ head/contrib/tcpdump/INSTALL.txt Thu Oct 28 19:06:17 2010 (r214478) @@ -1,4 +1,4 @@ -@(#) $Header: /tcpdump/master/tcpdump/INSTALL.txt,v 1.1.2.1 2008-02-06 10:49:22 guy Exp $ (LBL) +@(#) $Header: /tcpdump/master/tcpdump/INSTALL.txt,v 1.2 2008-02-06 10:47:53 guy Exp $ (LBL) If you have not built libpcap, and your system does not have libpcap installed, install libpcap first. Your system might provide a version @@ -221,6 +221,7 @@ print-tftp.c - Trivial File Transfer Pro print-timed.c - BSD time daemon protocol printer routines print-token.c - Token Ring printer routines print-udp.c - UDP printer routines +print-usb.c - USB printer routines print-vjc.c - PPP Van Jacobson compression (RFC1144) printer routines print-vrrp.c - Virtual Router Redundancy Protocol print-wb.c - White Board printer routines Copied: head/contrib/tcpdump/Makefile-devel-adds (from r214475, vendor/tcpdump/dist/Makefile-devel-adds) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/tcpdump/Makefile-devel-adds Thu Oct 28 19:06:17 2010 (r214478, copy of r214475, vendor/tcpdump/dist/Makefile-devel-adds) @@ -0,0 +1,22 @@ +# +# Auto-regenerate configure script or Makefile when things change. +# From autoconf.info . Works best with GNU Make. +# +${srcdir}/configure: configure.in + cd ${srcdir} && autoconf + +# autoheader might not change config.h.in, so touch a stamp file. +${srcdir}/config.h.in: ${srcdir}/stamp-h.in +${srcdir}/stamp-h.in: configure.in acconfig.h + cd ${srcdir} && autoheader + echo timestamp > ${srcdir}/stamp-h.in + +config.h: stamp-h +stamp-h: ${srcdir}/config.h.in config.status + ./config.status + +Makefile: Makefile.in config.status + ./config.status + +config.status: ${srcdir}/configure + ./config.status --recheck Modified: head/contrib/tcpdump/Makefile.in ============================================================================== --- head/contrib/tcpdump/Makefile.in Thu Oct 28 19:05:21 2010 (r214477) +++ head/contrib/tcpdump/Makefile.in Thu Oct 28 19:06:17 2010 (r214478) @@ -17,7 +17,7 @@ # WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. # -# @(#) $Header: /tcpdump/master/tcpdump/Makefile.in,v 1.317.2.4 2008-05-27 07:14:26 guy Exp $ (LBL) +# @(#) $Header: /tcpdump/master/tcpdump/Makefile.in,v 1.325 2008-11-21 23:17:26 guy Exp $ (LBL) # # Various configurable paths (remember to edit Makefile.in, not Makefile) @@ -77,7 +77,7 @@ CSRC = addrtoname.c af.c checksum.c cpac print-eap.c print-eigrp.c\ print-esp.c print-ether.c print-fddi.c print-fr.c \ print-gre.c print-hsrp.c print-icmp.c print-igmp.c \ - print-igrp.c print-ip.c print-ipcomp.c print-ipfc.c \ + print-igrp.c print-ip.c print-ipcomp.c print-ipfc.c print-ipnet.c \ print-ipx.c print-isoclns.c print-juniper.c print-krb.c \ print-l2tp.c print-lane.c print-ldp.c print-lldp.c print-llc.c \ print-lmp.c print-lspping.c print-lwapp.c \ @@ -88,9 +88,9 @@ CSRC = addrtoname.c af.c checksum.c cpac print-rx.c print-sctp.c print-sflow.c print-sip.c print-sl.c print-sll.c \ print-slow.c print-snmp.c print-stp.c print-sunatm.c print-sunrpc.c \ print-symantec.c print-syslog.c print-tcp.c print-telnet.c print-tftp.c \ - print-timed.c print-token.c print-udld.c print-udp.c \ - print-vjc.c print-vqp.c print-vrrp.c print-vtp.c \ - print-wb.c print-zephyr.c setsignal.c tcpdump.c util.c + print-timed.c print-token.c print-udld.c print-udp.c print-usb.c \ + print-vjc.c print-vqp.c print-vrrp.c print-vtp.c print-forces.c \ + print-wb.c print-zephyr.c signature.c setsignal.c tcpdump.c util.c LIBNETDISSECT_SRC=print-isakmp.c LIBNETDISSECT_OBJ=$(LIBNETDISSECT_SRC:.c=.o) @@ -128,6 +128,7 @@ HDR = \ ethertype.h \ extract.h \ fddi.h \ + forces.h \ gmpls.h \ gmt2local.h \ icmp6.h \ @@ -139,6 +140,7 @@ HDR = \ ip.h \ ip6.h \ ipfc.h \ + ipnet.h \ ipproto.h \ ipsec_doi.h \ ipx.h \ @@ -171,6 +173,7 @@ HDR = \ sctpConstants.h \ sctpHeader.h \ setsignal.h \ + signature.h \ slcompress.h \ slip.h \ sll.h \ @@ -204,6 +207,7 @@ EXTRA_DIST = \ INSTALL.txt \ LICENSE \ Makefile.in \ + Makefile-devel-adds \ README \ Readme.Win32 \ VERSION \ @@ -226,7 +230,6 @@ EXTRA_DIST = \ missing/bittypes.h \ missing/dlnames.c \ missing/datalinks.c \ - missing/getaddrinfo.c \ missing/getnameinfo.c \ missing/inet_aton.c \ missing/inet_ntop.c \ @@ -258,7 +261,83 @@ EXTRA_DIST = \ smbutil.c \ stime.awk \ strcasecmp.c \ - tcpdump.1 \ + tcpdump.1.in \ + tests/02-sunrise-sunset-esp.puu \ + tests/08-sunrise-sunset-aes.puu \ + tests/08-sunrise-sunset-esp2.puu \ + tests/TESTLIST \ + tests/TESTonce \ + tests/TESTrun.sh \ + tests/bgp-infinite-loop.pcap \ + tests/bgp_vpn_attrset.out \ + tests/bgp_vpn_attrset.pcap \ + tests/chdlc-slarp-short.pcap \ + tests/chdlc-slarp.pcap \ + tests/dio.out \ + tests/dio.pcap \ + tests/e1000g.out \ + tests/e1000g.pcap \ + tests/eapon1.gdbinit \ + tests/eapon1.out \ + tests/eapon1.puu \ + tests/eapon2.puu \ + tests/esp-secrets.txt \ + tests/esp0.out \ + tests/esp1.gdbinit \ + tests/esp1.out \ + tests/esp2.gdbinit \ + tests/esp2.out \ + tests/esp3.gdbinit \ + tests/esp4.gdbinit \ + tests/esp5.gdbinit \ + tests/esp5.out \ + tests/espudp1.out \ + tests/espudp1.puu \ + tests/forces1.out \ + tests/forces1.pcap \ + tests/forces1vvv.out \ + tests/forces1vvvv.out \ + tests/forces2.out \ + tests/forces2.pcap \ + tests/forces2v.out \ + tests/forces2vv.out \ + tests/ikev2.puu \ + tests/ikev2four.out \ + tests/ikev2four.puu \ + tests/ikev2fourv.out \ + tests/ikev2fourv4.out \ + tests/ikev2pI2-secrets.txt \ + tests/ikev2pI2.out \ + tests/ikev2pI2.puu \ + tests/isakmp-delete-segfault.puu \ + tests/isakmp-identification-segfault.puu \ + tests/isakmp-pointer-loop.puu \ + tests/isakmp1.out \ + tests/isakmp2.out \ + tests/isakmp3.out \ + tests/isakmp4.out \ + tests/isakmp4500.puu \ + tests/isis-infinite-loop.pcap \ + tests/ldp-infinite-loop.pcap \ + tests/lmp.out \ + tests/lmp.puu \ + tests/lmp.sh \ + tests/lspping-fec-ldp.pcap \ + tests/lspping-fec-rsvp.pcap \ + tests/mpls-ldp-hello.out \ + tests/mpls-ldp-hello.puu \ + tests/mpls-traceroute.pcap \ + tests/ospf-gmpls.out \ + tests/ospf-gmpls.puu \ + tests/print-A.out \ + tests/print-AA.out \ + tests/print-capX.out \ + tests/print-capXX.out \ + tests/print-flags.puu \ + tests/print-flags.sh \ + tests/print-x.out \ + tests/print-xx.out \ + tests/rsvp-infinite-loop.pcap \ vfprintf.c \ win32/Include/Arpa/tftp.h \ win32/Include/errno.h \ @@ -312,14 +391,13 @@ version.o: version.c version.c: $(srcdir)/VERSION @rm -f $@ - if grep CVS ${srcdir}/VERSION >/dev/null; then \ + if grep GIT ${srcdir}/VERSION >/dev/null; then \ read ver <${srcdir}/VERSION; \ echo $$ver | tr -d '\012'; \ date +_%Y_%m_%d; \ else \ cat ${srcdir}/VERSION; \ - fi | sed -e 's/.*/char version[] = "&";/' > $@ - + fi | sed -e 's/.*/const char version[] = "&";/' > $@ install: all [ -d $(DESTDIR)$(sbindir) ] || \ @@ -328,7 +406,7 @@ install: all $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(sbindir)/$(PROG).`cat ${srcdir}/VERSION` [ -d $(DESTDIR)$(mandir)/man1 ] || \ (mkdir -p $(DESTDIR)$(mandir)/man1; chmod 755 $(DESTDIR)$(mandir)/man1) - $(INSTALL_DATA) $(srcdir)/$(PROG).1 $(DESTDIR)$(mandir)/man1/$(PROG).1 + $(INSTALL_DATA) $(PROG).1 $(DESTDIR)$(mandir)/man1/$(PROG).1 uninstall: rm -f $(DESTDIR)$(sbindir)/$(PROG) @@ -340,11 +418,15 @@ lint: $(GENSRC) grep -v 'possible pointer alignment problem' clean: - rm -f $(CLEANFILES) + rm -f $(CLEANFILES) $(PROG)-`cat VERSION`.tar.gz distclean: rm -f $(CLEANFILES) Makefile config.cache config.log config.status \ - config.h gnuc.h os-proto.h stamp-h stamp-h.in + config.h gnuc.h os-proto.h stamp-h stamp-h.in $(PROG).1 + +check: tcpdump + uudecode --help || (echo "No uudecode program found, not running tests"; echo "apt-get/rpm install sharutils?"; exit 1) + (cd tests && ./TESTrun.sh) tags: $(TAGFILES) ctags -wtd $(TAGFILES) Modified: head/contrib/tcpdump/README ============================================================================== --- head/contrib/tcpdump/README Thu Oct 28 19:05:21 2010 (r214477) +++ head/contrib/tcpdump/README Thu Oct 28 19:06:17 2010 (r214478) @@ -1,19 +1,17 @@ -@(#) $Header: /tcpdump/master/tcpdump/README,v 1.66.2.1 2008-05-30 01:38:20 guy Exp $ (LBL) +@(#) $Header: /tcpdump/master/tcpdump/README,v 1.68 2008-12-15 00:05:27 guy Exp $ (LBL) -TCPDUMP 3.9 +TCPDUMP 4.x.y Now maintained by "The Tcpdump Group" See www.tcpdump.org Please send inquiries/comments/reports to: tcpdump-workers@lists.tcpdump.org -Anonymous CVS is available via: - cvs -d :pserver:cvs.tcpdump.org:/tcpdump/master login - (password "anoncvs") - cvs -d :pserver:cvs.tcpdump.org:/tcpdump/master checkout tcpdump +Anonymous Git is available via: + git clone git://bpf.tcpdump.org/tcpdump -Version 3.9 of TCPDUMP can be retrieved with the CVS tag "tcpdump_3_9rel1": - cvs -d :pserver:cvs.tcpdump.org:/tcpdump/master checkout -r tcpdump_3_9rel1 tcpdump +Version 4.x.y of TCPDUMP can be retrieved with the CVS tag "tcpdump_4_xrely": + cvs -d :pserver:cvs.tcpdump.org:/tcpdump/master checkout -r tcpdump_4_xrely tcpdump Please submit patches against the master copy to the tcpdump project on sourceforge.net. Copied: head/contrib/tcpdump/Readme.Win32 (from r214475, vendor/tcpdump/dist/Readme.Win32) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/tcpdump/Readme.Win32 Thu Oct 28 19:06:17 2010 (r214478, copy of r214475, vendor/tcpdump/dist/Readme.Win32) @@ -0,0 +1,24 @@ +To build tcpdump under Windows, you need: + +- version 6 (or higher) of Microsoft Visual Studio or the Cygnus gnu +C compiler. +- The November 2001 (or later) edition of Microsoft Platform +Software Development Kit (SDK), that contains some necessary includes +for IPv6 support. You can download it from http://www.microsoft.com/sdk +- the WinPcap source code, that includes libpcap for win32. Download it +from http://winpcap.polito.it or download libpcap sources from +http://www.tcpdump.org and follow the instructions in the README.Win32 +file. + +First, extract tcpdump and WinPcap in the same folder, and build WinPcap. + +The Visual Studio project and the cygwin makefile are in the Win32\prj +folder. + +From Visual Studio, open windump.dsw and build the program. The release +version of the WinDump.exe executable file will be created in the +windump\win32\prj\release directory . The debug version will be generated +in windump\win32\prj\debug. + +From cygnus, go to windump\win32\prj\ and type "make". WinDump.exe will be +created in the same directory. \ No newline at end of file Modified: head/contrib/tcpdump/VERSION ============================================================================== --- head/contrib/tcpdump/VERSION Thu Oct 28 19:05:21 2010 (r214477) +++ head/contrib/tcpdump/VERSION Thu Oct 28 19:06:17 2010 (r214478) @@ -1 +1 @@ -4.0.0 +4.1.1 Modified: head/contrib/tcpdump/acconfig.h ============================================================================== --- head/contrib/tcpdump/acconfig.h Thu Oct 28 19:05:21 2010 (r214477) +++ head/contrib/tcpdump/acconfig.h Thu Oct 28 19:06:17 2010 (r214478) @@ -2,32 +2,18 @@ * make them to acconfig.h and rerun autoheader */ @TOP@ -/* Define if you have SSLeay 0.9.0b with the buggy cast128. */ -#undef HAVE_BUGGY_CAST128 - /* Define if you enable IPv6 support */ #undef INET6 /* Define if you enable support for the libsmi. */ #undef LIBSMI -/* Define if you have the header file. */ -#undef HAVE_SMI_H - /* define if you have struct __res_state_ext */ #undef HAVE_RES_STATE_EXT /* define if your struct __res_state has the nsort member */ #undef HAVE_NEW_RES_STATE -/* - * define if struct ether_header.ether_dhost is a struct with ether_addr_octet - */ -#undef ETHER_HEADER_HAS_EA - -/* define if struct ether_arp contains arp_xsha */ -#undef ETHER_ARP_HAS_X - /* define if you have the addrinfo function. */ #undef HAVE_ADDRINFO @@ -43,18 +29,9 @@ /* define if INADDRSZ is defined (XXX not used!) */ #undef HAVE_INADDRSZ -/* define if this is a development version, to use additional prototypes. */ -#undef HAVE_OS_PROTO_H - -/* define if defines __P() */ -#undef HAVE_PORTABLE_PROTOTYPE - /* define if RES_USE_INET6 is defined */ #undef HAVE_RES_USE_INET6 -/* define if struct sockaddr has the sa_len member */ -#undef HAVE_SOCKADDR_SA_LEN - /* define if you have struct sockaddr_storage */ #undef HAVE_SOCKADDR_STORAGE @@ -91,18 +68,6 @@ /* define if you have getrpcbynumber() */ #undef HAVE_GETRPCBYNUMBER -/* define if unaligned memory accesses fail */ -#undef LBL_ALIGN - -/* The successful return value from signal (?)XXX */ -#undef RETSIGVAL - -/* Define this on IRIX */ -#undef _BSD_SIGNALS - -/* For HP/UX ANSI compiler? */ -#undef _HPUX_SOURCE - /* AIX hack. */ #undef _SUN @@ -115,14 +80,6 @@ /* Whether or not to include the possibly-buggy SMB printer */ #undef TCPDUMP_DO_SMB -/* Long story short: aclocal.m4 depends on autoconf 2.13 - * implementation details wrt "const"; newer versions - * have different implementation details so for now we - * put "const" here. This may cause duplicate definitions - * in config.h but that should be OK since they're the same. - */ -#undef const - /* Define if you have the dnet_htoa function. */ #undef HAVE_DNET_HTOA Modified: head/contrib/tcpdump/addrtoname.c ============================================================================== --- head/contrib/tcpdump/addrtoname.c Thu Oct 28 19:05:21 2010 (r214477) +++ head/contrib/tcpdump/addrtoname.c Thu Oct 28 19:06:17 2010 (r214478) @@ -88,12 +88,12 @@ struct hnamemem { struct hnamemem *nxt; }; -struct hnamemem hnametable[HASHNAMESIZE]; -struct hnamemem tporttable[HASHNAMESIZE]; -struct hnamemem uporttable[HASHNAMESIZE]; -struct hnamemem eprototable[HASHNAMESIZE]; -struct hnamemem dnaddrtable[HASHNAMESIZE]; -struct hnamemem ipxsaptable[HASHNAMESIZE]; +static struct hnamemem hnametable[HASHNAMESIZE]; +static struct hnamemem tporttable[HASHNAMESIZE]; +static struct hnamemem uporttable[HASHNAMESIZE]; +static struct hnamemem eprototable[HASHNAMESIZE]; +static struct hnamemem dnaddrtable[HASHNAMESIZE]; +static struct hnamemem ipxsaptable[HASHNAMESIZE]; #if defined(INET6) && defined(WIN32) /* @@ -142,7 +142,7 @@ struct h6namemem { struct h6namemem *nxt; }; -struct h6namemem h6nametable[HASHNAMESIZE]; +static struct h6namemem h6nametable[HASHNAMESIZE]; #endif /* INET6 */ struct enamemem { @@ -155,9 +155,9 @@ struct enamemem { struct enamemem *e_nxt; }; -struct enamemem enametable[HASHNAMESIZE]; -struct enamemem nsaptable[HASHNAMESIZE]; -struct enamemem bytestringtable[HASHNAMESIZE]; +static struct enamemem enametable[HASHNAMESIZE]; +static struct enamemem nsaptable[HASHNAMESIZE]; +static struct enamemem bytestringtable[HASHNAMESIZE]; struct protoidmem { u_int32_t p_oui; @@ -166,7 +166,7 @@ struct protoidmem { struct protoidmem *p_nxt; }; -struct protoidmem protoidtable[HASHNAMESIZE]; +static struct protoidmem protoidtable[HASHNAMESIZE]; /* * A faster replacement for inet_ntoa(). @@ -313,7 +313,7 @@ getname6(const u_char *ap) } #endif /* INET6 */ -static char hex[] = "0123456789abcdef"; +static const char hex[] = "0123456789abcdef"; /* Find the hash node that corresponds the ether address 'ep' */ @@ -516,13 +516,14 @@ linkaddr_string(const u_char *ep, const register char *cp; register struct enamemem *tp; - if (type == LINKADDR_ETHER && len == ETHER_ADDR_LEN) { - return etheraddr_string(ep); - } - - if (type == LINKADDR_FRELAY) { - return q922_string(ep); - } + if (len == 0) + return (""); + + if (type == LINKADDR_ETHER && len == ETHER_ADDR_LEN) + return (etheraddr_string(ep)); + + if (type == LINKADDR_FRELAY) + return (q922_string(ep)); tp = lookup_bytestring(ep, len); if (tp->e_name) @@ -749,7 +750,7 @@ init_eprotoarray(void) } } -static struct protoidlist { +static const struct protoidlist { const u_char protoid[5]; const char *name; } protoidlist[] = { @@ -770,7 +771,7 @@ init_protoidarray(void) { register int i; register struct protoidmem *tp; - struct protoidlist *pl; + const struct protoidlist *pl; u_char protoid[5]; protoid[0] = 0; @@ -794,7 +795,7 @@ init_protoidarray(void) } } -static struct etherlist { +static const struct etherlist { const u_char addr[6]; const char *name; } etherlist[] = { @@ -819,7 +820,7 @@ static struct etherlist { static void init_etherarray(void) { - register struct etherlist *el; + register const struct etherlist *el; register struct enamemem *tp; #ifdef USE_ETHER_NTOHOST char name[256]; @@ -863,7 +864,7 @@ init_etherarray(void) } } -static struct tok ipxsap_db[] = { +static const struct tok ipxsap_db[] = { { 0x0000, "Unknown" }, { 0x0001, "User" }, { 0x0002, "User Group" }, Modified: head/contrib/tcpdump/af.c ============================================================================== --- head/contrib/tcpdump/af.c Thu Oct 28 19:05:21 2010 (r214477) +++ head/contrib/tcpdump/af.c Thu Oct 28 19:06:17 2010 (r214478) @@ -28,7 +28,7 @@ static const char rcsid[] _U_ = #include "interface.h" #include "af.h" -struct tok af_values[] = { +const struct tok af_values[] = { { 0, "Reserved"}, { AFNUM_INET, "IPv4"}, { AFNUM_INET6, "IPv6"}, @@ -50,7 +50,7 @@ struct tok af_values[] = { { 0, NULL}, }; -struct tok bsd_af_values[] = { +const struct tok bsd_af_values[] = { { BSD_AFNUM_INET, "IPv4" }, { BSD_AFNUM_NS, "NS" }, { BSD_AFNUM_ISO, "ISO" }, Modified: head/contrib/tcpdump/af.h ============================================================================== --- head/contrib/tcpdump/af.h Thu Oct 28 19:05:21 2010 (r214477) +++ head/contrib/tcpdump/af.h Thu Oct 28 19:06:17 2010 (r214478) @@ -17,8 +17,8 @@ * Original code by Hannes Gredler (hannes@juniper.net) */ -extern struct tok af_values[]; -extern struct tok bsd_af_values[]; +extern const struct tok af_values[]; +extern const struct tok bsd_af_values[]; /* RFC1700 address family numbers */ #define AFNUM_INET 1 Modified: head/contrib/tcpdump/atmuni31.h ============================================================================== --- head/contrib/tcpdump/atmuni31.h Thu Oct 28 19:05:21 2010 (r214477) +++ head/contrib/tcpdump/atmuni31.h Thu Oct 28 19:06:17 2010 (r214478) @@ -29,7 +29,7 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * @(#) $Header: /tcpdump/master/tcpdump/atmuni31.h,v 1.2.6.1 2007-10-22 19:39:12 guy Exp $ (LBL) + * @(#) $Header: /tcpdump/master/tcpdump/atmuni31.h,v 1.3 2007-10-22 19:37:51 guy Exp $ (LBL) */ /* Based on UNI3.1 standard by ATM Forum */ Modified: head/contrib/tcpdump/bootp.h ============================================================================== --- head/contrib/tcpdump/bootp.h Thu Oct 28 19:05:21 2010 (r214477) +++ head/contrib/tcpdump/bootp.h Thu Oct 28 19:06:17 2010 (r214478) @@ -1,4 +1,4 @@ -/* @(#) $Header: /tcpdump/master/tcpdump/bootp.h,v 1.18 2007-08-21 21:59:11 guy Exp $ (LBL) */ +/* @(#) $Header: /tcpdump/master/tcpdump/bootp.h,v 1.19 2008-04-22 09:46:03 hannes Exp $ (LBL) */ /* * Bootstrap Protocol (BOOTP). RFC951 and RFC1048. * @@ -27,7 +27,8 @@ struct bootp { u_int8_t bp_hops; /* gateway hops */ u_int32_t bp_xid; /* transaction ID */ u_int16_t bp_secs; /* seconds since boot began */ - u_int16_t bp_flags; /* flags - see bootp_flag_values[] in print-bootp.c */ + u_int16_t bp_flags; /* flags - see bootp_flag_values[] + in print-bootp.c */ struct in_addr bp_ciaddr; /* client IP address */ struct in_addr bp_yiaddr; /* 'your' IP address */ struct in_addr bp_siaddr; /* server IP address */ Modified: head/contrib/tcpdump/bpf_dump.c ============================================================================== --- head/contrib/tcpdump/bpf_dump.c Thu Oct 28 19:05:21 2010 (r214477) +++ head/contrib/tcpdump/bpf_dump.c Thu Oct 28 19:06:17 2010 (r214478) @@ -20,7 +20,7 @@ */ #ifndef lint static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/tcpdump/bpf_dump.c,v 1.16.4.1 2008-02-14 20:54:53 guy Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/bpf_dump.c,v 1.17 2008-02-14 20:53:49 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H Modified: head/contrib/tcpdump/checksum.c ============================================================================== --- head/contrib/tcpdump/checksum.c Thu Oct 28 19:05:21 2010 (r214477) +++ head/contrib/tcpdump/checksum.c Thu Oct 28 19:06:17 2010 (r214478) @@ -31,17 +31,73 @@ static const char rcsid[] _U_ = #include #include #include +#include #include "interface.h" -#define CRC10_POLYNOMIAL 0x633 -static u_int16_t crc10_table[256]; +/* + * CRC-10 table generated using the following Python snippet: + +import sys + +crc_table = [] +for i in range(256): + accum = i << 2 + for j in range(8): + accum <<= 1 + if accum & 0x400: + accum ^= 0x633 + crc_table.append(accum) + +for i in range(len(crc_table)/8): + for j in range(8): + sys.stdout.write("0x%04x, " % crc_table[i*8+j]) + sys.stdout.write("\n") + + */ +static const u_int16_t crc10_table[256] = +{ + 0x0000, 0x0233, 0x0255, 0x0066, 0x0299, 0x00aa, 0x00cc, 0x02ff, + 0x0301, 0x0132, 0x0154, 0x0367, 0x0198, 0x03ab, 0x03cd, 0x01fe, + 0x0031, 0x0202, 0x0264, 0x0057, 0x02a8, 0x009b, 0x00fd, 0x02ce, + 0x0330, 0x0103, 0x0165, 0x0356, 0x01a9, 0x039a, 0x03fc, 0x01cf, + 0x0062, 0x0251, 0x0237, 0x0004, 0x02fb, 0x00c8, 0x00ae, 0x029d, + 0x0363, 0x0150, 0x0136, 0x0305, 0x01fa, 0x03c9, 0x03af, 0x019c, + 0x0053, 0x0260, 0x0206, 0x0035, 0x02ca, 0x00f9, 0x009f, 0x02ac, + 0x0352, 0x0161, 0x0107, 0x0334, 0x01cb, 0x03f8, 0x039e, 0x01ad, + 0x00c4, 0x02f7, 0x0291, 0x00a2, 0x025d, 0x006e, 0x0008, 0x023b, + 0x03c5, 0x01f6, 0x0190, 0x03a3, 0x015c, 0x036f, 0x0309, 0x013a, + 0x00f5, 0x02c6, 0x02a0, 0x0093, 0x026c, 0x005f, 0x0039, 0x020a, + 0x03f4, 0x01c7, 0x01a1, 0x0392, 0x016d, 0x035e, 0x0338, 0x010b, + 0x00a6, 0x0295, 0x02f3, 0x00c0, 0x023f, 0x000c, 0x006a, 0x0259, + 0x03a7, 0x0194, 0x01f2, 0x03c1, 0x013e, 0x030d, 0x036b, 0x0158, + 0x0097, 0x02a4, 0x02c2, 0x00f1, 0x020e, 0x003d, 0x005b, 0x0268, + 0x0396, 0x01a5, 0x01c3, 0x03f0, 0x010f, 0x033c, 0x035a, 0x0169, + 0x0188, 0x03bb, 0x03dd, 0x01ee, 0x0311, 0x0122, 0x0144, 0x0377, + 0x0289, 0x00ba, 0x00dc, 0x02ef, 0x0010, 0x0223, 0x0245, 0x0076, + 0x01b9, 0x038a, 0x03ec, 0x01df, 0x0320, 0x0113, 0x0175, 0x0346, + 0x02b8, 0x008b, 0x00ed, 0x02de, 0x0021, 0x0212, 0x0274, 0x0047, + 0x01ea, 0x03d9, 0x03bf, 0x018c, 0x0373, 0x0140, 0x0126, 0x0315, + 0x02eb, 0x00d8, 0x00be, 0x028d, 0x0072, 0x0241, 0x0227, 0x0014, + 0x01db, 0x03e8, 0x038e, 0x01bd, 0x0342, 0x0171, 0x0117, 0x0324, + 0x02da, 0x00e9, 0x008f, 0x02bc, 0x0043, 0x0270, 0x0216, 0x0025, + 0x014c, 0x037f, 0x0319, 0x012a, 0x03d5, 0x01e6, 0x0180, 0x03b3, + 0x024d, 0x007e, 0x0018, 0x022b, 0x00d4, 0x02e7, 0x0281, 0x00b2, + 0x017d, 0x034e, 0x0328, 0x011b, 0x03e4, 0x01d7, 0x01b1, 0x0382, + 0x027c, 0x004f, 0x0029, 0x021a, 0x00e5, 0x02d6, 0x02b0, 0x0083, + 0x012e, 0x031d, 0x037b, 0x0148, 0x03b7, 0x0184, 0x01e2, 0x03d1, + 0x022f, 0x001c, 0x007a, 0x0249, 0x00b6, 0x0285, 0x02e3, 0x00d0, + 0x011f, 0x032c, 0x034a, 0x0179, 0x0386, 0x01b5, 0x01d3, 0x03e0, + 0x021e, 0x002d, 0x004b, 0x0278, 0x0087, 0x02b4, 0x02d2, 0x00e1 +}; static void init_crc10_table(void) { +#define CRC10_POLYNOMIAL 0x633 register int i, j; register u_int16_t accum; + u_int16_t verify_crc10_table[256]; for ( i = 0; i < 256; i++ ) { @@ -50,9 +106,12 @@ init_crc10_table(void) { if ((accum <<= 1) & 0x400) accum ^= CRC10_POLYNOMIAL; } - crc10_table[i] = accum; + verify_crc10_table[i] = accum; } - return; + assert(memcmp(verify_crc10_table, + crc10_table, + sizeof(verify_crc10_table)) == 0); +#undef CRC10_POLYNOMIAL } u_int16_t Modified: head/contrib/tcpdump/config.guess ============================================================================== --- head/contrib/tcpdump/config.guess Thu Oct 28 19:05:21 2010 (r214477) +++ head/contrib/tcpdump/config.guess Thu Oct 28 19:06:17 2010 (r214478) @@ -1,9 +1,10 @@ #! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 +# Free Software Foundation, Inc. -timestamp='2003-10-16' +timestamp='2009-12-30' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -17,23 +18,25 @@ timestamp='2003-10-16' # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. -# Originally written by Per Bothner . -# Please send patches to . Submit a context -# diff and a properly formatted ChangeLog entry. + +# Originally written by Per Bothner. Please send patches (context +# diff format) to and include a ChangeLog +# entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # -# The plan is that this can be called by configure scripts if you -# don't specify an explicit build system type. +# You can get the latest version of this script from: +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD me=`echo "$0" | sed -e 's,.*/,,'` @@ -53,8 +56,9 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 -Free Software Foundation, Inc. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, +2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free +Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -66,11 +70,11 @@ Try \`$me --help' for more information." while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) - echo "$timestamp" ; exit 0 ;; + echo "$timestamp" ; exit ;; --version | -v ) - echo "$version" ; exit 0 ;; + echo "$version" ; exit ;; --help | --h* | -h ) - echo "$usage"; exit 0 ;; + echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. @@ -104,7 +108,7 @@ set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; - { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; @@ -123,7 +127,7 @@ case $CC_FOR_BUILD,$HOST_CC,$CC in ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac ;' +esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) @@ -158,6 +162,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:$ arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; + sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched @@ -166,7 +171,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:$ arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep __ELF__ >/dev/null + | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? @@ -196,53 +201,32 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:$ # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" - exit 0 ;; - amiga:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - arc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - hp300:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mac68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - macppc:OpenBSD:*:*) - echo powerpc-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme88k:OpenBSD:*:*) - echo m88k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvmeppc:OpenBSD:*:*) - echo powerpc-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - pegasos:OpenBSD:*:*) - echo powerpc-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - pmax:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sgi:OpenBSD:*:*) - echo mipseb-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sun3:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - wgrisc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; + exit ;; *:OpenBSD:*:*) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Thu Oct 28 19:08:56 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8D27910657E7; Thu, 28 Oct 2010 19:08:56 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 78B4C8FC0A; Thu, 28 Oct 2010 19:08:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9SJ8uuL025830; Thu, 28 Oct 2010 19:08:56 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9SJ8u3K025827; Thu, 28 Oct 2010 19:08:56 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201010281908.o9SJ8u3K025827@svn.freebsd.org> From: Rui Paulo Date: Thu, 28 Oct 2010 19:08:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214481 - head/usr.sbin/tcpdump/tcpdump X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 19:08:56 -0000 Author: rpaulo Date: Thu Oct 28 19:08:56 2010 New Revision: 214481 URL: http://svn.freebsd.org/changeset/base/214481 Log: Update for the new tcpdump 4.1.1. The man page is a result of running tcpdump's autoconf on FreeBSD. Added: head/usr.sbin/tcpdump/tcpdump/tcpdump.1 (contents, props changed) Modified: head/usr.sbin/tcpdump/tcpdump/Makefile Modified: head/usr.sbin/tcpdump/tcpdump/Makefile ============================================================================== --- head/usr.sbin/tcpdump/tcpdump/Makefile Thu Oct 28 19:08:50 2010 (r214480) +++ head/usr.sbin/tcpdump/tcpdump/Makefile Thu Oct 28 19:08:56 2010 (r214481) @@ -15,7 +15,7 @@ SRCS = addrtoname.c af.c checksum.c cpac print-cfm.c print-chdlc.c print-cip.c print-cnfp.c print-dccp.c \ print-decnet.c print-domain.c print-dtp.c print-dvmrp.c print-enc.c \ print-egp.c print-eap.c print-eigrp.c \ - print-esp.c print-ether.c print-fddi.c print-fr.c \ + print-esp.c print-ether.c print-fddi.c print-forces.c print-fr.c \ print-gre.c print-hsrp.c print-icmp.c print-igmp.c \ print-igrp.c print-ip.c print-ipcomp.c print-ipfc.c \ print-ipx.c print-isakmp.c print-isoclns.c print-juniper.c print-krb.c \ @@ -33,7 +33,7 @@ SRCS = addrtoname.c af.c checksum.c cpac print-timed.c print-token.c print-udld.c print-udp.c print-vjc.c \ print-vqp.c print-vrrp.c print-vtp.c \ print-wb.c print-zephyr.c setsignal.c tcpdump.c util.c \ - print-smb.c smbutil.c \ + print-smb.c signature.c smbutil.c \ version.c CLEANFILES+= version.c Added: head/usr.sbin/tcpdump/tcpdump/tcpdump.1 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/tcpdump/tcpdump/tcpdump.1 Thu Oct 28 19:08:56 2010 (r214481) @@ -0,0 +1,1722 @@ +.\" $FreeBSD$ +.\" @(#) $Header: /tcpdump/master/tcpdump/tcpdump.1.in,v 1.2 2008-11-09 23:35:03 mcr Exp $ (LBL) +.\" +.\" $NetBSD: tcpdump.8,v 1.9 2003/03/31 00:18:17 perry Exp $ +.\" +.\" Copyright (c) 1987, 1988, 1989, 1990, 1991, 1992, 1994, 1995, 1996, 1997 +.\" The Regents of the University of California. All rights reserved. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that: (1) source code distributions +.\" retain the above copyright notice and this paragraph in its entirety, (2) +.\" distributions including binary code include the above copyright notice and +.\" this paragraph in its entirety in the documentation or other materials +.\" provided with the distribution, and (3) all advertising materials mentioning +.\" features or use of this software display the following acknowledgement: +.\" ``This product includes software developed by the University of California, +.\" Lawrence Berkeley Laboratory and its contributors.'' 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 ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED +.\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF +.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +.\" +.TH TCPDUMP 1 "05 March 2009" +.SH NAME +tcpdump \- dump traffic on a network +.SH SYNOPSIS +.na +.B tcpdump +[ +.B \-AbdDefIKlLnNOpqRStuUvxX +] [ +.B \-B +.I buffer_size +] [ +.B \-c +.I count +] +.br +.ti +8 +[ +.B \-C +.I file_size +] [ +.B \-G +.I rotate_seconds +] [ +.B \-F +.I file +] +.br +.ti +8 +[ +.B \-i +.I interface +] +[ +.B \-m +.I module +] +[ +.B \-M +.I secret +] +.br +.ti +8 +[ +.B \-r +.I file +] +[ +.B \-s +.I snaplen +] +[ +.B \-T +.I type +] +[ +.B \-w +.I file +] +.br +.ti +8 +[ +.B \-W +.I filecount +] +.br +.ti +8 +[ +.B \-E +.I spi@ipaddr algo:secret,... +] +.br +.ti +8 +[ +.B \-y +.I datalinktype +] +[ +.B \-z +.I postrotate-command +] +[ +.B \-Z +.I user +] +.ti +8 +[ +.I expression +] +.br +.ad +.SH DESCRIPTION +.LP +\fITcpdump\fP prints out a description of the contents of packets on a +network interface that match the boolean \fIexpression\fP. It can also +be run with the +.B \-w +flag, which causes it to save the packet data to a file for later +analysis, and/or with the +.B \-r +flag, which causes it to read from a saved packet file rather than to +read packets from a network interface. In all cases, only packets that +match +.I expression +will be processed by +.IR tcpdump . +.LP +.I Tcpdump +will, if not run with the +.B \-c +flag, continue capturing packets until it is interrupted by a SIGINT +signal (generated, for example, by typing your interrupt character, +typically control-C) or a SIGTERM signal (typically generated with the +.BR kill (1) +command); if run with the +.B \-c +flag, it will capture packets until it is interrupted by a SIGINT or +SIGTERM signal or the specified number of packets have been processed. +.LP +When +.I tcpdump +finishes capturing packets, it will report counts of: +.IP +packets ``captured'' (this is the number of packets that +.I tcpdump +has received and processed); +.IP +packets ``received by filter'' (the meaning of this depends on the OS on +which you're running +.IR tcpdump , +and possibly on the way the OS was configured - if a filter was +specified on the command line, on some OSes it counts packets regardless +of whether they were matched by the filter expression and, even if they +were matched by the filter expression, regardless of whether +.I tcpdump +has read and processed them yet, on other OSes it counts only packets that were +matched by the filter expression regardless of whether +.I tcpdump +has read and processed them yet, and on other OSes it counts only +packets that were matched by the filter expression and were processed by +.IR tcpdump ); +.IP +packets ``dropped by kernel'' (this is the number of packets that were +dropped, due to a lack of buffer space, by the packet capture mechanism +in the OS on which +.I tcpdump +is running, if the OS reports that information to applications; if not, +it will be reported as 0). +.LP +On platforms that support the SIGINFO signal, such as most BSDs +(including Mac OS X) and Digital/Tru64 UNIX, it will report those counts +when it receives a SIGINFO signal (generated, for example, by typing +your ``status'' character, typically control-T, although on some +platforms, such as Mac OS X, the ``status'' character is not set by +default, so you must set it with +.BR stty (1) +in order to use it) and will continue capturing packets. +.LP +Reading packets from a network interface may require that you have +special privileges; see the +.B pcap (3PCAP) +man page for details. Reading a saved packet file doesn't require +special privileges. +.SH OPTIONS +.TP +.B \-A +Print each packet (minus its link level header) in ASCII. Handy for +capturing web pages. +.TP +.B \-b +Print the AS number in BGP packets in ASDOT notation rather than ASPLAIN +notation. +.TP +.B \-B +Set the operating system capture buffer size to \fIbuffer_size\fP. +.TP +.B \-c +Exit after receiving \fIcount\fP packets. +.TP +.B \-C +Before writing a raw packet to a savefile, check whether the file is +currently larger than \fIfile_size\fP and, if so, close the current +savefile and open a new one. Savefiles after the first savefile will +have the name specified with the +.B \-w +flag, with a number after it, starting at 1 and continuing upward. +The units of \fIfile_size\fP are millions of bytes (1,000,000 bytes, +not 1,048,576 bytes). +.TP +.B \-d +Dump the compiled packet-matching code in a human readable form to +standard output and stop. +.TP +.B \-dd +Dump packet-matching code as a +.B C +program fragment. +.TP +.B \-ddd +Dump packet-matching code as decimal numbers (preceded with a count). +.TP +.B \-D +Print the list of the network interfaces available on the system and on +which +.I tcpdump +can capture packets. For each network interface, a number and an +interface name, possibly followed by a text description of the +interface, is printed. The interface name or the number can be supplied +to the +.B \-i +flag to specify an interface on which to capture. +.IP +This can be useful on systems that don't have a command to list them +(e.g., Windows systems, or UNIX systems lacking +.BR "ifconfig \-a" ); +the number can be useful on Windows 2000 and later systems, where the +interface name is a somewhat complex string. +.IP +The +.B \-D +flag will not be supported if +.I tcpdump +was built with an older version of +.I libpcap +that lacks the +.B pcap_findalldevs() +function. +.TP +.B \-e +Print the link-level header on each dump line. +.TP +.B \-E +Use \fIspi@ipaddr algo:secret\fP for decrypting IPsec ESP packets that +are addressed to \fIaddr\fP and contain Security Parameter Index value +\fIspi\fP. This combination may be repeated with comma or newline seperation. +.IP +Note that setting the secret for IPv4 ESP packets is supported at this time. +.IP +Algorithms may be +\fBdes-cbc\fP, +\fB3des-cbc\fP, +\fBblowfish-cbc\fP, +\fBrc3-cbc\fP, +\fBcast128-cbc\fP, or +\fBnone\fP. +The default is \fBdes-cbc\fP. +The ability to decrypt packets is only present if \fItcpdump\fP was compiled +with cryptography enabled. +.IP +\fIsecret\fP is the ASCII text for ESP secret key. +If preceeded by 0x, then a hex value will be read. +.IP +The option assumes RFC2406 ESP, not RFC1827 ESP. +The option is only for debugging purposes, and +the use of this option with a true `secret' key is discouraged. +By presenting IPsec secret key onto command line +you make it visible to others, via +.IR ps (1) +and other occasions. +.IP +In addition to the above syntax, the syntax \fIfile name\fP may be used +to have tcpdump read the provided file in. The file is opened upon +receiving the first ESP packet, so any special permissions that tcpdump +may have been given should already have been given up. +.TP +.B \-f +Print `foreign' IPv4 addresses numerically rather than symbolically +(this option is intended to get around serious brain damage in +Sun's NIS server \(em usually it hangs forever translating non-local +internet numbers). +.IP +The test for `foreign' IPv4 addresses is done using the IPv4 address and +netmask of the interface on which capture is being done. If that +address or netmask are not available, available, either because the +interface on which capture is being done has no address or netmask or +because the capture is being done on the Linux "any" interface, which +can capture on more than one interface, this option will not work +correctly. +.TP +.B \-F +Use \fIfile\fP as input for the filter expression. +An additional expression given on the command line is ignored. +.TP +.B \-G +If specified, rotates the dump file specified with the +.B \-w +option every \fIrotate_seconds\fP seconds. +Savefiles will have the name specified by +.B \-w +which should include a time format as defined by +.BR strftime (3). +If no time format is specified, each new file will overwrite the previous. +.IP +If used in conjunction with the +.B \-C +option, filenames will take the form of `\fIfile\fP'. +.TP +.B \-i +Listen on \fIinterface\fP. +If unspecified, \fItcpdump\fP searches the system interface list for the +lowest numbered, configured up interface (excluding loopback). +Ties are broken by choosing the earliest match. +.IP +On Linux systems with 2.2 or later kernels, an +.I interface +argument of ``any'' can be used to capture packets from all interfaces. +Note that captures on the ``any'' device will not be done in promiscuous +mode. +.IP +If the +.B \-D +flag is supported, an interface number as printed by that flag can be +used as the +.I interface +argument. +.TP +.B \-I +Put the interface in "monitor mode"; this is supported only on IEEE +802.11 Wi-Fi interfaces, and supported only on some operating systems. +.IP +Note that in monitor mode the adapter might disassociate from the +network with which it's associated, so that you will not be able to use +any wireless networks with that adapter. This could prevent accessing +files on a network server, or resolving host names or network addresses, +if you are capturing in monitor mode and are not connected to another +network with another adapter. +.IP +This flag will affect the output of the +.B \-L +flag. If +.B \-I +isn't specified, only those link-layer types available when not in +monitor mode will be shown; if +.B \-I +is specified, only those link-layer types available when in monitor mode +will be shown. +.TP +.B \-K +Don't attempt to verify IP, TCP, or UDP checksums. This is useful for +interfaces that perform some or all of those checksum calculation in +hardware; otherwise, all outgoing TCP checksums will be flagged as bad. +.TP +.B \-l +Make stdout line buffered. +Useful if you want to see the data +while capturing it. +E.g., +.br +``tcpdump\ \ \-l\ \ |\ \ tee dat'' or +``tcpdump\ \ \-l \ \ > dat\ \ &\ \ tail\ \ \-f\ \ dat''. +.TP +.B \-L +List the known data link types for the interface, in the specified mode, +and exit. The list of known data link types may be dependent on the +specified mode; for example, on some platforms, a Wi-Fi interface might +support one set of data link types when not in monitor mode (for +example, it might support only fake Ethernet headers, or might support +802.11 headers but not support 802.11 headers with radio information) +and another set of data link types when in monitor mode (for example, it +might support 802.11 headers, or 802.11 headers with radio information, +only in monitor mode). +.TP +.B \-m +Load SMI MIB module definitions from file \fImodule\fR. +This option +can be used several times to load several MIB modules into \fItcpdump\fP. +.TP +.B \-M +Use \fIsecret\fP as a shared secret for validating the digests found in +TCP segments with the TCP-MD5 option (RFC 2385), if present. +.TP +.B \-n +Don't convert addresses (i.e., host addresses, port numbers, etc.) to names. +.TP +.B \-N +Don't print domain name qualification of host names. +E.g., +if you give this flag then \fItcpdump\fP will print ``nic'' +instead of ``nic.ddn.mil''. +.TP +.B \-O +Do not run the packet-matching code optimizer. +This is useful only +if you suspect a bug in the optimizer. +.TP +.B \-p +\fIDon't\fP put the interface +into promiscuous mode. +Note that the interface might be in promiscuous +mode for some other reason; hence, `-p' cannot be used as an abbreviation for +`ether host {local-hw-addr} or ether broadcast'. +.TP +.B \-q +Quick (quiet?) output. +Print less protocol information so output +lines are shorter. +.TP +.B \-R +Assume ESP/AH packets to be based on old specification (RFC1825 to RFC1829). +If specified, \fItcpdump\fP will not print replay prevention field. +Since there is no protocol version field in ESP/AH specification, +\fItcpdump\fP cannot deduce the version of ESP/AH protocol. +.TP +.B \-r +Read packets from \fIfile\fR (which was created with the +.B \-w +option). +Standard input is used if \fIfile\fR is ``-''. +.TP +.B \-S +Print absolute, rather than relative, TCP sequence numbers. +.TP +.B \-s +Snarf \fIsnaplen\fP bytes of data from each packet rather than the +default of 65535 bytes. +Packets truncated because of a limited snapshot +are indicated in the output with ``[|\fIproto\fP]'', where \fIproto\fP +is the name of the protocol level at which the truncation has occurred. +Note that taking larger snapshots both increases +the amount of time it takes to process packets and, effectively, +decreases the amount of packet buffering. +This may cause packets to be +lost. +You should limit \fIsnaplen\fP to the smallest number that will +capture the protocol information you're interested in. +Setting +\fIsnaplen\fP to 0 sets it to the default of 65535, +for backwards compatibility with recent older versions of +.IR tcpdump . +.TP +.B \-T +Force packets selected by "\fIexpression\fP" to be interpreted the +specified \fItype\fR. +Currently known types are +\fBaodv\fR (Ad-hoc On-demand Distance Vector protocol), +\fBcnfp\fR (Cisco NetFlow protocol), +\fBrpc\fR (Remote Procedure Call), +\fBrtp\fR (Real-Time Applications protocol), +\fBrtcp\fR (Real-Time Applications control protocol), +\fBsnmp\fR (Simple Network Management Protocol), +\fBtftp\fR (Trivial File Transfer Protocol), +\fBvat\fR (Visual Audio Tool), +and +\fBwb\fR (distributed White Board). +.TP +.B \-t +\fIDon't\fP print a timestamp on each dump line. +.TP +.B \-tt +Print an unformatted timestamp on each dump line. +.TP +.B \-ttt +Print a delta (micro-second resolution) between current and previous line +on each dump line. +.TP +.B \-tttt +Print a timestamp in default format proceeded by date on each dump line. +.TP +.B \-ttttt +Print a delta (micro-second resolution) between current and first line +on each dump line. +.TP +.B \-u +Print undecoded NFS handles. +.TP +.B \-U +Make output saved via the +.B \-w +option ``packet-buffered''; i.e., as each packet is saved, it will be +written to the output file, rather than being written only when the +output buffer fills. +.IP +The +.B \-U +flag will not be supported if +.I tcpdump +was built with an older version of +.I libpcap +that lacks the +.B pcap_dump_flush() +function. +.TP +.B \-v +When parsing and printing, produce (slightly more) verbose output. +For example, the time to live, +identification, total length and options in an IP packet are printed. +Also enables additional packet integrity checks such as verifying the +IP and ICMP header checksum. +.IP +When writing to a file with the +.B \-w +option, report, every 10 seconds, the number of packets captured. +.TP +.B \-vv +Even more verbose output. +For example, additional fields are +printed from NFS reply packets, and SMB packets are fully decoded. +.TP +.B \-vvv +Even more verbose output. +For example, +telnet \fBSB\fP ... \fBSE\fP options +are printed in full. +With +.B \-X +Telnet options are printed in hex as well. +.TP +.B \-w +Write the raw packets to \fIfile\fR rather than parsing and printing +them out. +They can later be printed with the \-r option. +Standard output is used if \fIfile\fR is ``-''. +See +.BR pcap-savefile (5) +for a description of the file format. +.TP +.B \-W +Used in conjunction with the +.B \-C +option, this will limit the number +of files created to the specified number, and begin overwriting files +from the beginning, thus creating a 'rotating' buffer. +In addition, it will name +the files with enough leading 0s to support the maximum number of +files, allowing them to sort correctly. +.IP +Used in conjunction with the +.B \-G +option, this will limit the number of rotated dump files that get +created, exiting with status 0 when reaching the limit. If used with +.B \-C +as well, the behavior will result in cyclical files per timeslice. +.TP +.B \-x +When parsing and printing, +in addition to printing the headers of each packet, print the data of +each packet (minus its link level header) in hex. +The smaller of the entire packet or +.I snaplen +bytes will be printed. Note that this is the entire link-layer +packet, so for link layers that pad (e.g. Ethernet), the padding bytes +will also be printed when the higher layer packet is shorter than the +required padding. +.TP +.B \-xx +When parsing and printing, +in addition to printing the headers of each packet, print the data of +each packet, +.I including +its link level header, in hex. +.TP +.B \-X +When parsing and printing, +in addition to printing the headers of each packet, print the data of +each packet (minus its link level header) in hex and ASCII. +This is very handy for analysing new protocols. +.TP +.B \-XX +When parsing and printing, +in addition to printing the headers of each packet, print the data of +each packet, +.I including +its link level header, in hex and ASCII. +.TP +.B \-y +Set the data link type to use while capturing packets to \fIdatalinktype\fP. +.TP +.B \-z +Used in conjunction with the +.B -C +or +.B -G +options, this will make +.I tcpdump +run " +.I command file +" where +.I file +is the savefile being closed after each rotation. For example, specifying +.B \-z gzip +or +.B \-z bzip2 +will compress each savefile using gzip or bzip2. +.IP +Note that tcpdump will run the command in parallel to the capture, using +the lowest priority so that this doesn't disturb the capture process. +.IP +And in case you would like to use a command that itself takes flags or +different arguments, you can always write a shell script that will take the +savefile name as the only argument, make the flags & arguments arrangements +and execute the command that you want. +.TP +.B \-Z +Drops privileges (if root) and changes user ID to +.I user +and the group ID to the primary group of +.IR user . +.IP +This behavior can also be enabled by default at compile time. +.IP "\fI expression\fP" +.RS +selects which packets will be dumped. +If no \fIexpression\fP +is given, all packets on the net will be dumped. +Otherwise, +only packets for which \fIexpression\fP is `true' will be dumped. +.LP +For the \fIexpression\fP syntax, see +.BR pcap-filter (7). +.LP +Expression arguments can be passed to \fItcpdump\fP as either a single +argument or as multiple arguments, whichever is more convenient. +Generally, if the expression contains Shell metacharacters, it is +easier to pass it as a single, quoted argument. +Multiple arguments are concatenated with spaces before being parsed. +.SH EXAMPLES +.LP +To print all packets arriving at or departing from \fIsundown\fP: +.RS +.nf +\fBtcpdump host sundown\fP +.fi +.RE +.LP +To print traffic between \fIhelios\fR and either \fIhot\fR or \fIace\fR: +.RS +.nf +\fBtcpdump host helios and \\( hot or ace \\)\fP +.fi +.RE +.LP +To print all IP packets between \fIace\fR and any host except \fIhelios\fR: +.RS +.nf +\fBtcpdump ip host ace and not helios\fP +.fi +.RE +.LP +To print all traffic between local hosts and hosts at Berkeley: +.RS +.nf +.B +tcpdump net ucb-ether +.fi +.RE +.LP +To print all ftp traffic through internet gateway \fIsnup\fP: +(note that the expression is quoted to prevent the shell from +(mis-)interpreting the parentheses): +.RS +.nf +.B +tcpdump 'gateway snup and (port ftp or ftp-data)' +.fi +.RE +.LP +To print traffic neither sourced from nor destined for local hosts +(if you gateway to one other net, this stuff should never make it +onto your local net). +.RS +.nf +.B +tcpdump ip and not net \fIlocalnet\fP +.fi +.RE +.LP +To print the start and end packets (the SYN and FIN packets) of each +TCP conversation that involves a non-local host. +.RS +.nf +.B +tcpdump 'tcp[tcpflags] & (tcp-syn|tcp-fin) != 0 and not src and dst net \fIlocalnet\fP' +.fi +.RE +.LP +To print all IPv4 HTTP packets to and from port 80, i.e. print only +packets that contain data, not, for example, SYN and FIN packets and +ACK-only packets. (IPv6 is left as an exercise for the reader.) +.RS +.nf +.B +tcpdump 'tcp port 80 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)' +.fi +.RE +.LP +To print IP packets longer than 576 bytes sent through gateway \fIsnup\fP: +.RS +.nf +.B +tcpdump 'gateway snup and ip[2:2] > 576' +.fi +.RE +.LP +To print IP broadcast or multicast packets that were +.I not +sent via Ethernet broadcast or multicast: +.RS +.nf +.B +tcpdump 'ether[0] & 1 = 0 and ip[16] >= 224' +.fi +.RE +.LP +To print all ICMP packets that are not echo requests/replies (i.e., not +ping packets): +.RS +.nf +.B +tcpdump 'icmp[icmptype] != icmp-echo and icmp[icmptype] != icmp-echoreply' +.fi +.RE +.SH OUTPUT FORMAT +.LP +The output of \fItcpdump\fP is protocol dependent. +The following +gives a brief description and examples of most of the formats. +.de HD +.sp 1.5 +.B +.. +.HD +Link Level Headers +.LP +If the '-e' option is given, the link level header is printed out. +On Ethernets, the source and destination addresses, protocol, +and packet length are printed. +.LP +On FDDI networks, the '-e' option causes \fItcpdump\fP to print +the `frame control' field, the source and destination addresses, +and the packet length. +(The `frame control' field governs the +interpretation of the rest of the packet. +Normal packets (such +as those containing IP datagrams) are `async' packets, with a priority +value between 0 and 7; for example, `\fBasync4\fR'. +Such packets +are assumed to contain an 802.2 Logical Link Control (LLC) packet; +the LLC header is printed if it is \fInot\fR an ISO datagram or a +so-called SNAP packet. +.LP +On Token Ring networks, the '-e' option causes \fItcpdump\fP to print +the `access control' and `frame control' fields, the source and +destination addresses, and the packet length. +As on FDDI networks, +packets are assumed to contain an LLC packet. +Regardless of whether +the '-e' option is specified or not, the source routing information is +printed for source-routed packets. +.LP +On 802.11 networks, the '-e' option causes \fItcpdump\fP to print +the `frame control' fields, all of the addresses in the 802.11 header, +and the packet length. +As on FDDI networks, +packets are assumed to contain an LLC packet. +.LP +\fI(N.B.: The following description assumes familiarity with +the SLIP compression algorithm described in RFC-1144.)\fP +.LP +On SLIP links, a direction indicator (``I'' for inbound, ``O'' for outbound), +packet type, and compression information are printed out. +The packet type is printed first. +The three types are \fIip\fP, \fIutcp\fP, and \fIctcp\fP. +No further link information is printed for \fIip\fR packets. +For TCP packets, the connection identifier is printed following the type. +If the packet is compressed, its encoded header is printed out. +The special cases are printed out as +\fB*S+\fIn\fR and \fB*SA+\fIn\fR, where \fIn\fR is the amount by which +the sequence number (or sequence number and ack) has changed. +If it is not a special case, +zero or more changes are printed. +A change is indicated by U (urgent pointer), W (window), A (ack), +S (sequence number), and I (packet ID), followed by a delta (+n or -n), +or a new value (=n). +Finally, the amount of data in the packet and compressed header length +are printed. +.LP +For example, the following line shows an outbound compressed TCP packet, +with an implicit connection identifier; the ack has changed by 6, +the sequence number by 49, and the packet ID by 6; there are 3 bytes of +data and 6 bytes of compressed header: +.RS +.nf +\fBO ctcp * A+6 S+49 I+6 3 (6)\fP +.fi +.RE +.HD +ARP/RARP Packets +.LP +Arp/rarp output shows the type of request and its arguments. +The +format is intended to be self explanatory. +Here is a short sample taken from the start of an `rlogin' from +host \fIrtsg\fP to host \fIcsam\fP: +.RS +.nf +.sp .5 +\f(CWarp who-has csam tell rtsg +arp reply csam is-at CSAM\fR +.sp .5 +.fi +.RE +The first line says that rtsg sent an arp packet asking +for the Ethernet address of internet host csam. +Csam +replies with its Ethernet address (in this example, Ethernet addresses +are in caps and internet addresses in lower case). +.LP +This would look less redundant if we had done \fItcpdump \-n\fP: +.RS +.nf +.sp .5 +\f(CWarp who-has 128.3.254.6 tell 128.3.254.68 +arp reply 128.3.254.6 is-at 02:07:01:00:01:c4\fP +.fi +.RE +.LP +If we had done \fItcpdump \-e\fP, the fact that the first packet is +broadcast and the second is point-to-point would be visible: +.RS +.nf +.sp .5 +\f(CWRTSG Broadcast 0806 64: arp who-has csam tell rtsg +CSAM RTSG 0806 64: arp reply csam is-at CSAM\fR +.sp .5 +.fi +.RE +For the first packet this says the Ethernet source address is RTSG, the +destination is the Ethernet broadcast address, the type field +contained hex 0806 (type ETHER_ARP) and the total length was 64 bytes. +.HD +TCP Packets +.LP +\fI(N.B.:The following description assumes familiarity with +the TCP protocol described in RFC-793. +If you are not familiar +with the protocol, neither this description nor \fItcpdump\fP will +be of much use to you.)\fP +.LP +The general format of a tcp protocol line is: +.RS +.nf +.sp .5 +\fIsrc > dst: flags data-seqno ack window urgent options\fP +.sp .5 +.fi +.RE +\fISrc\fP and \fIdst\fP are the source and destination IP +addresses and ports. +\fIFlags\fP are some combination of S (SYN), +F (FIN), P (PUSH), R (RST), W (ECN CWR) or E (ECN-Echo), or a single +`.' (no flags). +\fIData-seqno\fP describes the portion of sequence space covered +by the data in this packet (see example below). +\fIAck\fP is sequence number of the next data expected the other +direction on this connection. +\fIWindow\fP is the number of bytes of receive buffer space available +the other direction on this connection. +\fIUrg\fP indicates there is `urgent' data in the packet. +\fIOptions\fP are tcp options enclosed in angle brackets (e.g., ). +.LP +\fISrc, dst\fP and \fIflags\fP are always present. +The other fields +depend on the contents of the packet's tcp protocol header and +are output only if appropriate. +.LP +Here is the opening portion of an rlogin from host \fIrtsg\fP to +host \fIcsam\fP. +.RS +.nf +.sp .5 +\s-2\f(CWrtsg.1023 > csam.login: S 768512:768512(0) win 4096 +csam.login > rtsg.1023: S 947648:947648(0) ack 768513 win 4096 +rtsg.1023 > csam.login: . ack 1 win 4096 +rtsg.1023 > csam.login: P 1:2(1) ack 1 win 4096 +csam.login > rtsg.1023: . ack 2 win 4096 +rtsg.1023 > csam.login: P 2:21(19) ack 1 win 4096 +csam.login > rtsg.1023: P 1:2(1) ack 21 win 4077 +csam.login > rtsg.1023: P 2:3(1) ack 21 win 4077 urg 1 +csam.login > rtsg.1023: P 3:4(1) ack 21 win 4077 urg 1\fR\s+2 +.sp .5 +.fi +.RE +The first line says that tcp port 1023 on rtsg sent a packet +to port \fIlogin\fP +on csam. +The \fBS\fP indicates that the \fISYN\fP flag was set. +The packet sequence number was 768512 and it contained no data. +(The notation is `first:last(nbytes)' which means `sequence +numbers \fIfirst\fP +up to but not including \fIlast\fP which is \fInbytes\fP bytes of user data'.) +There was no piggy-backed ack, the available receive window was 4096 +bytes and there was a max-segment-size option requesting an mss of +1024 bytes. +.LP +Csam replies with a similar packet except it includes a piggy-backed +ack for rtsg's SYN. +Rtsg then acks csam's SYN. +The `.' means no +flags were set. +The packet contained no data so there is no data sequence number. +Note that the ack sequence +number is a small integer (1). +The first time \fItcpdump\fP sees a +tcp `conversation', it prints the sequence number from the packet. +On subsequent packets of the conversation, the difference between +the current packet's sequence number and this initial sequence number +is printed. +This means that sequence numbers after the +first can be interpreted +as relative byte positions in the conversation's data stream (with the +first data byte each direction being `1'). +`-S' will override this +feature, causing the original sequence numbers to be output. +.LP +On the 6th line, rtsg sends csam 19 bytes of data (bytes 2 through 20 +in the rtsg \(-> csam side of the conversation). +The PUSH flag is set in the packet. +On the 7th line, csam says it's received data sent by rtsg up to +but not including byte 21. +Most of this data is apparently sitting in the +socket buffer since csam's receive window has gotten 19 bytes smaller. +Csam also sends one byte of data to rtsg in this packet. +On the 8th and 9th lines, +csam sends two bytes of urgent, pushed data to rtsg. +.LP +If the snapshot was small enough that \fItcpdump\fP didn't capture +the full TCP header, it interprets as much of the header as it can +and then reports ``[|\fItcp\fP]'' to indicate the remainder could not +be interpreted. +If the header contains a bogus option (one with a length +that's either too small or beyond the end of the header), \fItcpdump\fP +reports it as ``[\fIbad opt\fP]'' and does not interpret any further +options (since it's impossible to tell where they start). +If the header +length indicates options are present but the IP datagram length is not +long enough for the options to actually be there, \fItcpdump\fP reports +it as ``[\fIbad hdr length\fP]''. +.HD +.B Capturing TCP packets with particular flag combinations (SYN-ACK, URG-ACK, etc.) +.PP +There are 8 bits in the control bits section of the TCP header: +.IP +.I CWR | ECE | URG | ACK | PSH | RST | SYN | FIN +.PP +Let's assume that we want to watch packets used in establishing +a TCP connection. +Recall that TCP uses a 3-way handshake protocol +when it initializes a new connection; the connection sequence with +regard to the TCP control bits is +.PP +.RS +1) Caller sends SYN *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Thu Oct 28 19:10:15 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C52ED1065670; Thu, 28 Oct 2010 19:10:15 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 98BCA8FC1E; Thu, 28 Oct 2010 19:10:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9SJAFdE025941; Thu, 28 Oct 2010 19:10:15 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9SJAFF6025940; Thu, 28 Oct 2010 19:10:15 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201010281910.o9SJAFF6025940@svn.freebsd.org> From: Rui Paulo Date: Thu, 28 Oct 2010 19:10:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214482 - in head/contrib/tcpdump: . win32 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 19:10:15 -0000 Author: rpaulo Date: Thu Oct 28 19:10:15 2010 New Revision: 214482 URL: http://svn.freebsd.org/changeset/base/214482 Log: Remove useless stuff. Deleted: head/contrib/tcpdump/FREEBSD-Xlist head/contrib/tcpdump/FREEBSD-upgrade head/contrib/tcpdump/Readme.Win32 head/contrib/tcpdump/win32/ From owner-svn-src-head@FreeBSD.ORG Thu Oct 28 19:27:03 2010 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3E50C1065670; Thu, 28 Oct 2010 19:27:03 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id E5E3E8FC08; Thu, 28 Oct 2010 19:27:02 +0000 (UTC) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 6E20946B09; Thu, 28 Oct 2010 15:26:59 -0400 (EDT) Date: Thu, 28 Oct 2010 20:26:59 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Alexander Best In-Reply-To: <20101028182219.GA36559@freebsd.org> Message-ID: References: <201010271848.o9RImNSR019344@svn.freebsd.org> <20101027212601.GA78062@freebsd.org> <4CC899C3.7040107@FreeBSD.org> <20101027214822.GA82697@freebsd.org> <4CC8A89D.5070909@delphij.net> <20101028152418.A916@besplex.bde.org> <20101028095538.24147119@ernst.jennejohn.org> <20101028182219.GA36559@freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: Doug Barton , d@delphij.net, svn-src-all@FreeBSD.org, Gary Jennejohn , src-committers@FreeBSD.org, Bruce Evans , svn-src-head@FreeBSD.org, Dag-Erling Smorgrav Subject: Re: svn commit: r214431 - head/bin/rm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 19:27:03 -0000 On Thu, 28 Oct 2010, Alexander Best wrote: >> For example, you could imagine a pathconf() call that asks the file system >> if overwriting a file is likely to result in the data going away -- UFS >> could answer "yes" unless it's snapshotting the file system, and ZFS could >> simply answer "no". >> >> In FreeBSD 9, we're going to have two common file system configurations: >> ZFS and UFS+SUJ; the latter will do overwriting of files just fine on most >> current media. > > i agree. however from this discussion it's become quite obvious that > securely deleting any data on a certain media is a very complex topic. when > the -P option got implemented into rm, securely deleting files was quite an > easy and intuitive task. this has clearly changed. so the question arises, > if securely removing data (maybe also directory entries) shouldn't be > handled by a specially designed utility? > > the pathconf() idea looks very primising. should the return values ("yes" or > "no") simply be hardcoded for every fs? or should they be returned by a > routine which actually veryfies on the fly if overwriting files is possible? Deleting data wasn't simple when rm -P was implemented -- in fact, if I recall, there was significant information available even then that overwrite patterns didn't fully remove file system data from magnetic media in such a way that a qualified attacker couldn't recover it. Bad block relocation in software and hardware is also relevant, and wear-levelling has been used in certain storage devices for quite a while now as well. Today the story has gotten even more complicated: file system snapshot features, copy-on-write file systems, block device-level snapshot features, widespread use of wear-levelling, full data journalling, etc. But that doesn't mean that rm -P still isn't useful :-). I see the point of the new pathconf() being to indicate whether trying to overwrite file data is fundamentally useless. That information could be used in one of two ways: (1) to warn the user that the requested overwrite is unlikely to have helped and (2) to cause the removal to fail if it couldn't possibly have worked. I find (1) more appealing but can see arguments for (2); possibly both should be supported in some or another form. Since there's a whole spectrum of confidence possible in whether an overwrite succeeded, any mechanism like the one I've suggested is necessarily going to involve fairly arbitrary heuristics. In a first generation implementation, I suggest that rm -P should generate a warning only in the following case: - An attempt to overwrite a file on a file system actively performing copy-on-write that would affect the file, such as ZFS, or UFS when there's an active snapshot. After some further cogitation, and if people remain interested, the following further case seems reasonable as well: - An attempt to overwrite a file on a file system is mounted from a geom stack in which at least one component in the stack is performing copy-on-write that would affect the file. The warning should read something along the lines of: rm: /foo/bar: file system may not support data overwrite (-P Or similar. However, rm should still perform the overwrite. To be honest, I'm also fine with there just being a nice caveat in the rm(1) man page. :-) Robert From owner-svn-src-head@FreeBSD.ORG Thu Oct 28 20:18:26 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5C7CC106564A; Thu, 28 Oct 2010 20:18:26 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 48FCE8FC22; Thu, 28 Oct 2010 20:18:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9SKIQ88029484; Thu, 28 Oct 2010 20:18:26 GMT (envelope-from uqs@svn.freebsd.org) Received: (from uqs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9SKIQHU029482; Thu, 28 Oct 2010 20:18:26 GMT (envelope-from uqs@svn.freebsd.org) Message-Id: <201010282018.o9SKIQHU029482@svn.freebsd.org> From: Ulrich Spoerlein Date: Thu, 28 Oct 2010 20:18:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214489 - head/usr.sbin/bsnmpd/modules/snmp_hostres X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 20:18:26 -0000 Author: uqs Date: Thu Oct 28 20:18:26 2010 New Revision: 214489 URL: http://svn.freebsd.org/changeset/base/214489 Log: Fix CPU load reporting independent of scheduler used. - Sample CPU usage data from kern.cp_times, this makes for a far more accurate and scheduler independent algorithm. - Rip out the process list scraping that is no longer required. - Don't update CPU usage sampling on every request, but every 15s instead. This makes it impossible for an attacker to hide the CPU load by triggering 4 samplings in short succession when the system is idle. - After reaching the steady-state, the system will always report the average CPU load of the last 60 sampled seconds. - Untangling of call graph. PR: kern/130222 Tested by: Julian Dunn Gustau Pérez Jürgen Weiß MFC after: 2 weeks I'm unsure if some MIB standard states this must be the load average for, eg. 300s, it looks like net-snmp isn't even bothering to implement the CPU load reporting at all. Modified: head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_processor_tbl.c Modified: head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_processor_tbl.c ============================================================================== --- head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_processor_tbl.c Thu Oct 28 19:18:54 2010 (r214488) +++ head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_processor_tbl.c Thu Oct 28 20:18:26 2010 (r214489) @@ -56,19 +56,15 @@ struct processor_entry { int32_t index; const struct asn_oid *frwId; - int32_t load; + int32_t load; /* average cpu usage */ + int32_t sample_cnt; /* number of usage samples */ + int32_t cur_sample_idx; /* current valid sample */ TAILQ_ENTRY(processor_entry) link; u_char cpu_no; /* which cpu, counted from 0 */ - pid_t idle_pid; /* PID of idle process for this CPU */ /* the samples from the last minute, as required by MIB */ double samples[MAX_CPU_SAMPLES]; - - /* current sample to fill in next time, must be < MAX_CPU_SAMPLES */ - uint32_t cur_sample_idx; - - /* number of useful samples */ - uint32_t sample_cnt; + long states[MAX_CPU_SAMPLES][CPUSTATES]; }; TAILQ_HEAD(processor_tbl, processor_entry); @@ -82,65 +78,78 @@ static int32_t detected_processor_count; /* sysctlbyname(hw.ncpu) */ static int hw_ncpu; -/* sysctlbyname(kern.{ccpu,fscale}) */ -static fixpt_t ccpu; -static int fscale; - -/* tick of PDU where we have refreshed the processor table last */ -static uint64_t proctbl_tick; +/* sysctlbyname(kern.cp_times) */ +static int cpmib[2]; +static size_t cplen; /* periodic timer used to get cpu load stats */ static void *cpus_load_timer; -/* - * Average the samples. The entire algorithm seems to be wrong XXX. +/** + * Returns the CPU usage of a given processor entry. + * + * It needs at least two cp_times "tick" samples to calculate a delta and + * thus, the usage over the sampling period. */ static int get_avg_load(struct processor_entry *e) { - u_int i; - double sum = 0.0; + u_int i, oldest; + long delta = 0; + double usage = 0.0; assert(e != NULL); - if (e->sample_cnt == 0) + /* Need two samples to perform delta calculation. */ + if (e->sample_cnt <= 1) return (0); - for (i = 0; i < e->sample_cnt; i++) - sum += e->samples[i]; - - return ((int)floor((double)sum/(double)e->sample_cnt)); -} - -/* - * Stolen from /usr/src/bin/ps/print.c. The idle process should never - * be swapped out :-) - */ -static double -processor_getpcpu(struct kinfo_proc *ki_p) -{ - - if (ccpu == 0 || fscale == 0) - return (0.0); - -#define fxtofl(fixpt) ((double)(fixpt) / fscale) - return (100.0 * fxtofl(ki_p->ki_pctcpu) / - (1.0 - exp(ki_p->ki_swtime * log(fxtofl(ccpu))))); + /* Oldest usable index, we wrap around. */ + if (e->sample_cnt == MAX_CPU_SAMPLES) + oldest = (e->cur_sample_idx + 1) % MAX_CPU_SAMPLES; + else + oldest = 0; + + /* Sum delta for all states. */ + for (i = 0; i < CPUSTATES; i++) { + delta += e->states[e->cur_sample_idx][i]; + delta -= e->states[oldest][i]; + } + if (delta == 0) + return 0; + + /* Take idle time from the last element and convert to + * percent usage by contrasting with total ticks delta. */ + usage = (double)(e->states[e->cur_sample_idx][CPUSTATES-1] - + e->states[oldest][CPUSTATES-1]) / delta; + usage = 100 - (usage * 100); + HRDBG("CPU no. %d, delta ticks %ld, pct usage %.2f", e->cpu_no, + delta, usage); + + return ((int)(usage)); } /** - * Save a new sample + * Save a new sample to proc entry and get the average usage. + * + * Samples are stored in a ringbuffer from 0..(MAX_CPU_SAMPLES-1) */ static void -save_sample(struct processor_entry *e, struct kinfo_proc *kp) +save_sample(struct processor_entry *e, long *cp_times) { + int i; - e->samples[e->cur_sample_idx] = 100.0 - processor_getpcpu(kp); - e->load = get_avg_load(e); e->cur_sample_idx = (e->cur_sample_idx + 1) % MAX_CPU_SAMPLES; + for (i = 0; cp_times != NULL && i < CPUSTATES; i++) + e->states[e->cur_sample_idx][i] = cp_times[i]; - if (++e->sample_cnt > MAX_CPU_SAMPLES) + e->sample_cnt++; + if (e->sample_cnt > MAX_CPU_SAMPLES) e->sample_cnt = MAX_CPU_SAMPLES; + + HRDBG("sample count for CPU no. %d went to %d", e->cpu_no, e->sample_cnt); + e->load = get_avg_load(e); + } /** @@ -178,8 +187,9 @@ proc_create_entry(u_int cpu_no, struct d entry->index = map->hrIndex; entry->load = 0; + entry->sample_cnt = 0; + entry->cur_sample_idx = -1; entry->cpu_no = (u_char)cpu_no; - entry->idle_pid = 0; entry->frwId = &oid_zeroDotZero; /* unknown id FIXME */ INSERT_OBJECT_INT(entry, &processor_tbl); @@ -191,64 +201,11 @@ proc_create_entry(u_int cpu_no, struct d } /** - * Get the PIDs for the idle processes of the CPUs. - */ -static void -processor_get_pids(void) -{ - struct kinfo_proc *plist, *kp; - int i; - int nproc; - int cpu; - int nchars; - struct processor_entry *entry; - - plist = kvm_getprocs(hr_kd, KERN_PROC_ALL, 0, &nproc); - if (plist == NULL || nproc < 0) { - syslog(LOG_ERR, "hrProcessor: kvm_getprocs() failed: %m"); - return; - } - - for (i = 0, kp = plist; i < nproc; i++, kp++) { - if (!IS_KERNPROC(kp)) - continue; - - if (strcmp(kp->ki_comm, "idle") == 0) { - /* single processor system */ - cpu = 0; - } else if (sscanf(kp->ki_comm, "idle: cpu%d%n", &cpu, &nchars) - == 1 && (u_int)nchars == strlen(kp->ki_comm)) { - /* MP system */ - } else - /* not an idle process */ - continue; - - HRDBG("'%s' proc with pid %d is on CPU #%d (last on #%d)", - kp->ki_comm, kp->ki_pid, kp->ki_oncpu, kp->ki_lastcpu); - - TAILQ_FOREACH(entry, &processor_tbl, link) - if (entry->cpu_no == kp->ki_lastcpu) - break; - - if (entry == NULL) { - /* create entry on non-ACPI systems */ - if ((entry = proc_create_entry(cpu, NULL)) == NULL) - continue; - - detected_processor_count++; - } - - entry->idle_pid = kp->ki_pid; - HRDBG("CPU no. %d with SNMP index=%d has idle PID %d", - entry->cpu_no, entry->index, entry->idle_pid); - - save_sample(entry, kp); - } -} - -/** * Scan the device map table for CPUs and create an entry into the - * processor table for each CPU. Then fetch the idle PIDs for all CPUs. + * processor table for each CPU. + * + * Make sure that the number of processors announced by the kernel hw.ncpu + * is equal to the number of processors we have found in the device table. */ static void create_proc_table(void) @@ -256,6 +213,7 @@ create_proc_table(void) struct device_map_entry *map; struct processor_entry *entry; int cpu_no; + size_t len; detected_processor_count = 0; @@ -265,7 +223,7 @@ create_proc_table(void) * If not, no entries will be present in the hrProcessor Table. * * For non-ACPI system the processors are not in the device table, - * therefor insert them when getting the idle pids. XXX + * therefore insert them after checking hw.ncpu. */ STAILQ_FOREACH(map, &device_map, link) if (strncmp(map->name_key, "cpu", strlen("cpu")) == 0 && @@ -283,9 +241,34 @@ create_proc_table(void) detected_processor_count++; } - HRDBG("%d CPUs detected", detected_processor_count); + len = sizeof(hw_ncpu); + if (sysctlbyname("hw.ncpu", &hw_ncpu, &len, NULL, 0) == -1 || + len != sizeof(hw_ncpu)) { + syslog(LOG_ERR, "hrProcessorTable: sysctl(hw.ncpu) failed"); + hw_ncpu = 0; + } + + HRDBG("%d CPUs detected via device table; hw.ncpu is %d", + detected_processor_count, hw_ncpu); + + /* XXX Can happen on non-ACPI systems? Create entries by hand. */ + for (; detected_processor_count < hw_ncpu; detected_processor_count++) + proc_create_entry(detected_processor_count, NULL); + + len = 2; + if (sysctlnametomib("kern.cp_times", cpmib, &len)) { + syslog(LOG_ERR, "hrProcessorTable: sysctlnametomib(kern.cp_times) failed"); + cpmib[0] = 0; + cpmib[1] = 0; + cplen = 0; + } else if (sysctl(cpmib, 2, NULL, &len, NULL, 0)) { + syslog(LOG_ERR, "hrProcessorTable: sysctl(kern.cp_times) length query failed"); + cplen = 0; + } else { + cplen = len / sizeof(long); + } + HRDBG("%zu entries for kern.cp_times", cplen); - processor_get_pids(); } /** @@ -307,78 +290,6 @@ free_proc_table(void) } /** - * Init the things for hrProcessorTable. - * Scan the device table for processor entries. - */ -void -init_processor_tbl(void) -{ - size_t len; - - /* get various parameters from the kernel */ - len = sizeof(ccpu); - if (sysctlbyname("kern.ccpu", &ccpu, &len, NULL, 0) == -1) { - syslog(LOG_ERR, "hrProcessorTable: sysctl(kern.ccpu) failed"); - ccpu = 0; - } - - len = sizeof(fscale); - if (sysctlbyname("kern.fscale", &fscale, &len, NULL, 0) == -1) { - syslog(LOG_ERR, "hrProcessorTable: sysctl(kern.fscale) failed"); - fscale = 0; - } - - /* create the initial processor table */ - create_proc_table(); -} - -/** - * Finalization routine for hrProcessorTable. - * It destroys the lists and frees any allocated heap memory. - */ -void -fini_processor_tbl(void) -{ - - if (cpus_load_timer != NULL) { - timer_stop(cpus_load_timer); - cpus_load_timer = NULL; - } - - free_proc_table(); -} - -/** - * Make sure that the number of processors announced by the kernel hw.ncpu - * is equal to the number of processors we have found in the device table. - * If they differ rescan the device table. - */ -static void -processor_refill_tbl(void) -{ - - HRDBG("hw_ncpu=%d detected_processor_count=%d", hw_ncpu, - detected_processor_count); - - if (hw_ncpu <= 0) { - size_t size = sizeof(hw_ncpu); - - if (sysctlbyname("hw.ncpu", &hw_ncpu, &size, NULL, 0) == -1 || - size != sizeof(hw_ncpu)) { - syslog(LOG_ERR, "hrProcessorTable: " - "sysctl(hw.ncpu) failed: %m"); - hw_ncpu = 0; - return; - } - } - - if (hw_ncpu != detected_processor_count) { - free_proc_table(); - create_proc_table(); - } -} - -/** * Refresh all values in the processor table. We call this once for * every PDU that accesses the table. */ @@ -386,37 +297,23 @@ static void refresh_processor_tbl(void) { struct processor_entry *entry; - int need_pids; - struct kinfo_proc *plist; - int nproc; + size_t size; - processor_refill_tbl(); + long pcpu_cp_times[cplen]; + memset(pcpu_cp_times, 0, sizeof(pcpu_cp_times)); - need_pids = 0; - TAILQ_FOREACH(entry, &processor_tbl, link) { - if (entry->idle_pid <= 0) { - need_pids = 1; - continue; - } + size = cplen * sizeof(long); + if (sysctl(cpmib, 2, pcpu_cp_times, &size, NULL, 0) == -1 && + !(errno == ENOMEM && size >= cplen * sizeof(long))) { + syslog(LOG_ERR, "hrProcessorTable: sysctl(kern.cp_times) failed"); + return; + } + TAILQ_FOREACH(entry, &processor_tbl, link) { assert(hr_kd != NULL); - - plist = kvm_getprocs(hr_kd, KERN_PROC_PID, - entry->idle_pid, &nproc); - if (plist == NULL || nproc != 1) { - syslog(LOG_ERR, "%s: missing item with " - "PID = %d for CPU #%d\n ", __func__, - entry->idle_pid, entry->cpu_no); - need_pids = 1; - continue; - } - save_sample(entry, plist); + save_sample(entry, &pcpu_cp_times[entry->cpu_no * CPUSTATES]); } - if (need_pids == 1) - processor_get_pids(); - - proctbl_tick = this_tick; } /** @@ -451,6 +348,36 @@ start_processor_tbl(struct lmodule *mod) } /** + * Init the things for hrProcessorTable. + * Scan the device table for processor entries. + */ +void +init_processor_tbl(void) +{ + + /* create the initial processor table */ + create_proc_table(); + /* and get first samples */ + refresh_processor_tbl(); +} + +/** + * Finalization routine for hrProcessorTable. + * It destroys the lists and frees any allocated heap memory. + */ +void +fini_processor_tbl(void) +{ + + if (cpus_load_timer != NULL) { + timer_stop(cpus_load_timer); + cpus_load_timer = NULL; + } + + free_proc_table(); +} + +/** * Access routine for the processor table. */ int @@ -460,9 +387,6 @@ op_hrProcessorTable(struct snmp_context { struct processor_entry *entry; - if (this_tick != proctbl_tick) - refresh_processor_tbl(); - switch (curr_op) { case SNMP_OP_GETNEXT: From owner-svn-src-head@FreeBSD.ORG Thu Oct 28 20:22:31 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 79D0E1065674; Thu, 28 Oct 2010 20:22:31 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-qy0-f175.google.com (mail-qy0-f175.google.com [209.85.216.175]) by mx1.freebsd.org (Postfix) with ESMTP id E9D9A8FC18; Thu, 28 Oct 2010 20:22:30 +0000 (UTC) Received: by qyk7 with SMTP id 7so5216348qyk.13 for ; Thu, 28 Oct 2010 13:22:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=1dHHUczArvnQpcDNRnWj3ozEhhcX3ZkeEmvfJepUQwg=; b=aj5nLWFCd0A1r0aFyIh3pa2FjOY5WL3U9H4LLSjK9VhQ6Ze99RJVnTqEQdVq2/BnuO TZl0IiEwBPa4r0iIOD5F3U66+u9oGWMuajDnYKXNE6fkcFKcVzi9jQM+k1sjNJQk5VNw x6IL3aOTui4EDotE+pr1qKLWWdpoguKqrATgI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=h4FJIvnufdxkbovIbVwzOKAyyJXfJjHydAw1HZpwn0QUu/35UVbafj1B7He8tMzlY+ XCgQGYRjYp+fJapAS0UoVbk9LU3E6Pt4QMEeyLPuPe3+Ib+rdMZRt2ojYpRKr5VpM1W1 vld/3DwvqFLnmpIadJD1FTU/DeKoKjYL/orbM= MIME-Version: 1.0 Received: by 10.229.225.199 with SMTP id it7mr7739395qcb.33.1288297350162; Thu, 28 Oct 2010 13:22:30 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.229.237.9 with HTTP; Thu, 28 Oct 2010 13:22:30 -0700 (PDT) In-Reply-To: <201010281457.19804.jhb@freebsd.org> References: <201010281631.o9SGVdtZ014923@svn.freebsd.org> <201010281411.40423.jhb@freebsd.org> <201010281457.19804.jhb@freebsd.org> Date: Thu, 28 Oct 2010 22:22:30 +0200 X-Google-Sender-Auth: opzY_CSl9yq94DvUUIoGyY64z_U Message-ID: From: Attilio Rao To: John Baldwin Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r214457 - in head/sys: amd64/amd64 conf i386/i386 x86/x86 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 20:22:31 -0000 2010/10/28 John Baldwin : > On Thursday, October 28, 2010 2:11:40 pm John Baldwin wrote: >> On Thursday, October 28, 2010 1:21:34 pm Attilio Rao wrote: >> > + =C2=A0 =C2=A0 =C2=A0 vm_paddr_t *p; >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 caddr_t kmdp; >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 uint32_t smapsize; >> > - =C2=A0 =C2=A0 =C2=A0 int error, rid; >> > + =C2=A0 =C2=A0 =C2=A0 int error, i, rid; >> > >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* Retrieve the system memory map from the= loader. */ >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 kmdp =3D preload_search_by_type("elf kerne= l"); >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (kmdp =3D=3D NULL) >> > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 kmdp =3D preload_se= arch_by_type("elf64 kernel"); >> > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 kmdp =3D preload_se= arch_by_type(ELF_KERN_STR); >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 smapbase =3D (struct bios_smap *)preload_s= earch_info(kmdp, >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 MODINFO_METADATA | MODINFOMD= _SMAP); >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 smapsize =3D *((u_int32_t *)smapbase - 1); >> >> It would be nice if ELF_KERN_STR could be autogenerated as something lik= e: >> >> "elf ## __ELF_WORD_SIZE ## kernel" instead of needing an #ifdef. > > This works in my testing: > > #include > #include > > int > main(void) > { > =C2=A0 =C2=A0 =C2=A0 =C2=A0printf("%s\n", "elf" __XSTRING(__ELF_WORD_SIZE= ) " kernel"); > =C2=A0 =C2=A0 =C2=A0 =C2=A0return (0); > } > I'm not entirely sure we might use this because in general it is an 'embedded' string for the other cases, but I don't have a strong opinion about it, so I'm fine with auto-generation. Attilio --=20 Peace can only be achieved by understanding - A. Einstein From owner-svn-src-head@FreeBSD.ORG Thu Oct 28 20:25:20 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 80DA4106564A; Thu, 28 Oct 2010 20:25:20 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-qw0-f54.google.com (mail-qw0-f54.google.com [209.85.216.54]) by mx1.freebsd.org (Postfix) with ESMTP id E2C208FC21; Thu, 28 Oct 2010 20:25:19 +0000 (UTC) Received: by qwg8 with SMTP id 8so299397qwg.13 for ; Thu, 28 Oct 2010 13:25:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=0hJxW8jomt850pShRSug/ive/uKNF4q68gkp3XV+xP0=; b=vOsA66hfybKgJeKtwpBBgVfj9rkxMj2W6VlR49+lC2RUzLwJuOm7blltyZ4Oz32H6M 0DXz/k64tuXZCYmWtt/L8LzESrqI0KRNb31keqmlunHGwkApJWZqKnL4Hrsr14sjXt/Y n2h3bD9ArmdEvZFpivjE8SvZbUttGIEnmcWtk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=vq/WK43/10FNSyAVu6nw9+PUuIy24X7TomBwYW1tXJz9HhlW/HPQuvpmprcsUR8/xN S6xpPwdwHnWQrSdJQab2NWVn9ovkgT4MLmPvfRs8zTNfi01FAzfmwpIkhuxwafyjPxvI pQHtyeNbajsIG0mcFrDDJicpuJ7UGQSP2kjAY= MIME-Version: 1.0 Received: by 10.224.180.84 with SMTP id bt20mr4236443qab.293.1288297518505; Thu, 28 Oct 2010 13:25:18 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.229.237.9 with HTTP; Thu, 28 Oct 2010 13:25:18 -0700 (PDT) In-Reply-To: <201010281411.40423.jhb@freebsd.org> References: <201010281631.o9SGVdtZ014923@svn.freebsd.org> <201010281257.05481.jhb@freebsd.org> <201010281411.40423.jhb@freebsd.org> Date: Thu, 28 Oct 2010 22:25:18 +0200 X-Google-Sender-Auth: MxqZ-qECLbQuDhHnf3zQdtASOvA Message-ID: From: Attilio Rao To: John Baldwin Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r214457 - in head/sys: amd64/amd64 conf i386/i386 x86/x86 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 20:25:20 -0000 2010/10/28 John Baldwin : > On Thursday, October 28, 2010 1:21:34 pm Attilio Rao wrote: >> 2010/10/28 John Baldwin : >> > On Thursday, October 28, 2010 12:31:39 pm Attilio Rao wrote: >> >> Author: attilio >> >> Date: Thu Oct 28 16:31:39 2010 >> >> New Revision: 214457 >> >> URL: http://svn.freebsd.org/changeset/base/214457 >> >> >> >> Log: >> >> =C2=A0 Merge nexus.c from amd64 and i386 to x86 subtree. >> >> >> >> =C2=A0 Sponsored by: =C2=A0 =C2=A0 =C2=A0 Sandvine Incorporated >> >> =C2=A0 Tested by: =C2=A0gianni >> >> >> > >> > It would be better to merge these two routines. =C2=A0The loader now p= asses the >> > smap to i386 kernels as well, so ram_attach() should probably be chang= ed to >> > try the amd64 approach first and if that fails fall back to using the >> > phys_avail[] array instead. >> >> What do you think about this patch?: >> Index: nexus.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> --- nexus.c =C2=A0 =C2=A0 (revision 214457) >> +++ nexus.c =C2=A0 =C2=A0 (working copy) >> @@ -52,9 +52,7 @@ >> =C2=A0#include >> =C2=A0#include >> =C2=A0#include >> -#ifdef __amd64__ >> =C2=A0#include >> -#endif >> =C2=A0#include >> =C2=A0#include >> =C2=A0#include >> @@ -67,12 +65,10 @@ >> =C2=A0#include >> =C2=A0#include >> >> -#ifdef __amd64__ >> =C2=A0#include >> -#include >> -#endif >> =C2=A0#include >> =C2=A0#include >> +#include >> >> =C2=A0#ifdef DEV_APIC >> =C2=A0#include "pcib_if.h" >> @@ -89,11 +85,13 @@ >> =C2=A0#include >> >> =C2=A0#ifdef __amd64__ >> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0RMAN_BUS_SPACE_IO =C2=A0 =C2=A0 =C2= =A0 AMD64_BUS_SPACE_IO >> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0RMAN_BUS_SPACE_MEM =C2=A0 =C2=A0 =C2= =A0AMD64_BUS_SPACE_MEM >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0X86_BUS_SPACE_IO =C2=A0 =C2=A0 =C2= =A0 =C2=A0AMD64_BUS_SPACE_IO >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0X86_BUS_SPACE_MEM =C2=A0 =C2=A0 =C2= =A0 AMD64_BUS_SPACE_MEM >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0ELF_KERN_STR =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0"elf64 kernel" >> =C2=A0#else >> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0RMAN_BUS_SPACE_IO =C2=A0 =C2=A0 =C2= =A0 I386_BUS_SPACE_IO >> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0RMAN_BUS_SPACE_MEM =C2=A0 =C2=A0 =C2= =A0I386_BUS_SPACE_MEM >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0X86_BUS_SPACE_IO =C2=A0 =C2=A0 =C2= =A0 =C2=A0I386_BUS_SPACE_IO >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0X86_BUS_SPACE_MEM =C2=A0 =C2=A0 =C2= =A0 I386_BUS_SPACE_MEM >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0ELF_KERN_STR =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0"elf32 kernel" >> =C2=A0#endif > > I would not do this. =C2=A0What I meant is that amd64 and i386 should be > changed to both use X86_BUS_SPACE_* and {AMD64,I386}_BUS_SPACE_* should b= e > retired. =C2=A0This would involve changing the bus space code itself slig= htly, > but it could perhaps be shared as a result. =C2=A0Alternatively as bde@ n= otes > we could just drop the MD prefix entirely and have BUS_SPACE_* instead. > > However, I wouldn't make any changes to just nexus.c for the BUS_SPACE_* > stuff. Ok, as long as you and bde seem to prefer it, I'd just drop the X86_* prefix for the moment and working on the overhaul later, as time permits. Thanks, Attilio --=20 Peace can only be achieved by understanding - A. Einstein From owner-svn-src-head@FreeBSD.ORG Thu Oct 28 20:28:14 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D9A441065670; Thu, 28 Oct 2010 20:28:13 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-qw0-f54.google.com (mail-qw0-f54.google.com [209.85.216.54]) by mx1.freebsd.org (Postfix) with ESMTP id 403538FC20; Thu, 28 Oct 2010 20:28:12 +0000 (UTC) Received: by qwg8 with SMTP id 8so301832qwg.13 for ; Thu, 28 Oct 2010 13:28:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=aB0md5GdOD4Wvi92m/KZ41c66stnlBM6MK7RMI83plI=; b=q+7ZaPgyhxYbFr/bCZ8nT7aTSDZGJ8Na8wxKrUa5fmlr9YUIQEXGsIka+gqu2WJf5T eLkmvpFhq5wNNlSfnt66i1vDlM1XXPlL5dt/MHrr966u7m9bO1Z5dQGO5a/mzd9H3WGW urB5JoOtWsjD8R5S36pnGOOZt7uMlmvvqERRI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=HpDLfNwriUFEzBNlmNdD9cfdykxorbJcHR/IJf2YIS3DA17MTf0dSeV/C83lVqFj+I ppZsPLMFIQz4SSyMnaUTZhNiknDSNdNg9+YF+lnFMx7ZBXHf8P2L/pDFrSaJdgjjxkKw 9cQMeQ5QZC2E564XdGKwE/CzosQcZsCt1rjKk= MIME-Version: 1.0 Received: by 10.229.184.68 with SMTP id cj4mr10725871qcb.48.1288297692198; Thu, 28 Oct 2010 13:28:12 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.229.237.9 with HTTP; Thu, 28 Oct 2010 13:28:12 -0700 (PDT) In-Reply-To: <201010281411.40423.jhb@freebsd.org> References: <201010281631.o9SGVdtZ014923@svn.freebsd.org> <201010281257.05481.jhb@freebsd.org> <201010281411.40423.jhb@freebsd.org> Date: Thu, 28 Oct 2010 22:28:12 +0200 X-Google-Sender-Auth: SXHMdAtITRrUCaoPVZw-iLX7vMU Message-ID: From: Attilio Rao To: John Baldwin Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r214457 - in head/sys: amd64/amd64 conf i386/i386 x86/x86 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 20:28:14 -0000 2010/10/28 John Baldwin : > On Thursday, October 28, 2010 1:21:34 pm Attilio Rao wrote: >> 2010/10/28 John Baldwin : >> > On Thursday, October 28, 2010 12:31:39 pm Attilio Rao wrote: >> >> Author: attilio >> >> Date: Thu Oct 28 16:31:39 2010 >> >> New Revision: 214457 >> >> URL: http://svn.freebsd.org/changeset/base/214457 >> >> >> >> Log: >> >> =C2=A0 Merge nexus.c from amd64 and i386 to x86 subtree. >> >> >> >> =C2=A0 Sponsored by: =C2=A0 =C2=A0 =C2=A0 Sandvine Incorporated >> >> =C2=A0 Tested by: =C2=A0gianni >> >> >> > >> > It would be better to merge these two routines. =C2=A0The loader now p= asses the >> > smap to i386 kernels as well, so ram_attach() should probably be chang= ed to >> > try the amd64 approach first and if that fails fall back to using the >> > phys_avail[] array instead. >> >> What do you think about this patch?: >> Index: nexus.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> --- nexus.c =C2=A0 =C2=A0 (revision 214457) >> +++ nexus.c =C2=A0 =C2=A0 (working copy) >> @@ -52,9 +52,7 @@ >> =C2=A0#include >> =C2=A0#include >> =C2=A0#include >> -#ifdef __amd64__ >> =C2=A0#include >> -#endif >> =C2=A0#include >> =C2=A0#include >> =C2=A0#include >> @@ -67,12 +65,10 @@ >> =C2=A0#include >> =C2=A0#include >> >> -#ifdef __amd64__ >> =C2=A0#include >> -#include >> -#endif >> =C2=A0#include >> =C2=A0#include >> +#include >> >> =C2=A0#ifdef DEV_APIC >> =C2=A0#include "pcib_if.h" >> @@ -89,11 +85,13 @@ >> =C2=A0#include >> >> =C2=A0#ifdef __amd64__ >> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0RMAN_BUS_SPACE_IO =C2=A0 =C2=A0 =C2= =A0 AMD64_BUS_SPACE_IO >> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0RMAN_BUS_SPACE_MEM =C2=A0 =C2=A0 =C2= =A0AMD64_BUS_SPACE_MEM >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0X86_BUS_SPACE_IO =C2=A0 =C2=A0 =C2= =A0 =C2=A0AMD64_BUS_SPACE_IO >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0X86_BUS_SPACE_MEM =C2=A0 =C2=A0 =C2= =A0 AMD64_BUS_SPACE_MEM >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0ELF_KERN_STR =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0"elf64 kernel" >> =C2=A0#else >> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0RMAN_BUS_SPACE_IO =C2=A0 =C2=A0 =C2= =A0 I386_BUS_SPACE_IO >> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0RMAN_BUS_SPACE_MEM =C2=A0 =C2=A0 =C2= =A0I386_BUS_SPACE_MEM >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0X86_BUS_SPACE_IO =C2=A0 =C2=A0 =C2= =A0 =C2=A0I386_BUS_SPACE_IO >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0X86_BUS_SPACE_MEM =C2=A0 =C2=A0 =C2= =A0 I386_BUS_SPACE_MEM >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0ELF_KERN_STR =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0"elf32 kernel" >> =C2=A0#endif >> @@ -701,16 +699,11 @@ >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 panic("ram_attach: resource %d failed to attach", rid); >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 rid++; >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 } >> - =C2=A0 =C2=A0 =C2=A0 return (0); >> -} >> -#else >> -static int >> -ram_attach(device_t dev) >> -{ >> - =C2=A0 =C2=A0 =C2=A0 struct resource *res; >> - =C2=A0 =C2=A0 =C2=A0 vm_paddr_t *p; >> - =C2=A0 =C2=A0 =C2=A0 int error, i, rid; >> >> + =C2=A0 =C2=A0 =C2=A0 /* If at least one smap attached, return. */ >> + =C2=A0 =C2=A0 =C2=A0 if (rid !=3D 0) >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return (0); >> + > > Perhaps this instead: > > =C2=A0 =C2=A0 =C2=A0 =C2=A0/* If we found an SMAP, return. */ > =C2=A0 =C2=A0 =C2=A0 =C2=A0if (smapbase !=3D NULL) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return (0); No, I don't think this check is right, smapbase will always be !=3D NULL (otherwise the code panics). Attilio --=20 Peace can only be achieved by understanding - A. Einstein From owner-svn-src-head@FreeBSD.ORG Thu Oct 28 20:51:57 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 945FA1065670; Thu, 28 Oct 2010 20:51:57 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 505D78FC20; Thu, 28 Oct 2010 20:51:57 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id CAAF746B03; Thu, 28 Oct 2010 16:51:56 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 8CA5A8A01D; Thu, 28 Oct 2010 16:51:55 -0400 (EDT) From: John Baldwin To: Attilio Rao Date: Thu, 28 Oct 2010 16:38:13 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100819; KDE/4.4.5; amd64; ; ) References: <201010281631.o9SGVdtZ014923@svn.freebsd.org> <201010281411.40423.jhb@freebsd.org> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201010281638.14043.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Thu, 28 Oct 2010 16:51:55 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.96.3 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-1.9 required=4.2 tests=BAYES_00 autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r214457 - in head/sys: amd64/amd64 conf i386/i386 x86/x86 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 20:51:57 -0000 On Thursday, October 28, 2010 4:28:12 pm Attilio Rao wrote: > 2010/10/28 John Baldwin : > > On Thursday, October 28, 2010 1:21:34 pm Attilio Rao wrote: > >> 2010/10/28 John Baldwin : > >> > On Thursday, October 28, 2010 12:31:39 pm Attilio Rao wrote: > >> >> Author: attilio > >> >> Date: Thu Oct 28 16:31:39 2010 > >> >> New Revision: 214457 > >> >> URL: http://svn.freebsd.org/changeset/base/214457 > >> >> > >> >> Log: > >> >> Merge nexus.c from amd64 and i386 to x86 subtree. > >> >> > >> >> Sponsored by: Sandvine Incorporated > >> >> Tested by: gianni > >> >> > >> > > >> > It would be better to merge these two routines. The loader now passes the > >> > smap to i386 kernels as well, so ram_attach() should probably be changed to > >> > try the amd64 approach first and if that fails fall back to using the > >> > phys_avail[] array instead. > >> > >> What do you think about this patch?: > >> Index: nexus.c > >> =================================================================== > >> --- nexus.c (revision 214457) > >> +++ nexus.c (working copy) > >> @@ -52,9 +52,7 @@ > >> #include > >> #include > >> #include > >> -#ifdef __amd64__ > >> #include > >> -#endif > >> #include > >> #include > >> #include > >> @@ -67,12 +65,10 @@ > >> #include > >> #include > >> > >> -#ifdef __amd64__ > >> #include > >> -#include > >> -#endif > >> #include > >> #include > >> +#include > >> > >> #ifdef DEV_APIC > >> #include "pcib_if.h" > >> @@ -89,11 +85,13 @@ > >> #include > >> > >> #ifdef __amd64__ > >> -#define RMAN_BUS_SPACE_IO AMD64_BUS_SPACE_IO > >> -#define RMAN_BUS_SPACE_MEM AMD64_BUS_SPACE_MEM > >> +#define X86_BUS_SPACE_IO AMD64_BUS_SPACE_IO > >> +#define X86_BUS_SPACE_MEM AMD64_BUS_SPACE_MEM > >> +#define ELF_KERN_STR "elf64 kernel" > >> #else > >> -#define RMAN_BUS_SPACE_IO I386_BUS_SPACE_IO > >> -#define RMAN_BUS_SPACE_MEM I386_BUS_SPACE_MEM > >> +#define X86_BUS_SPACE_IO I386_BUS_SPACE_IO > >> +#define X86_BUS_SPACE_MEM I386_BUS_SPACE_MEM > >> +#define ELF_KERN_STR "elf32 kernel" > >> #endif > >> @@ -701,16 +699,11 @@ > >> panic("ram_attach: resource %d failed to attach", rid); > >> rid++; > >> } > >> - return (0); > >> -} > >> -#else > >> -static int > >> -ram_attach(device_t dev) > >> -{ > >> - struct resource *res; > >> - vm_paddr_t *p; > >> - int error, i, rid; > >> > >> + /* If at least one smap attached, return. */ > >> + if (rid != 0) > >> + return (0); > >> + > > > > Perhaps this instead: > > > > /* If we found an SMAP, return. */ > > if (smapbase != NULL) > > return (0); > > No, I don't think this check is right, smapbase will always be != NULL > (otherwise the code panics). Oh, that needs to be fixed then. It can be NULL on i386 with an old loader (or on a really old machine without an SMAP). The amd64 nexus code could assume it would never be NULL, but i386 cannot. It should probably more closely match what i386 does during the memory probe which is: kmdp = search("elf kernel"); if (kmdp == NULL) kmdp = search("elfXX kernel"); if (kmdp != NULL) smapbase = preload_search(...); else smapbase = NULL; if (smapbase != NULL) { for (smap = ...) { } return (0); } /* fall through to old i386 code using phys_avail[] */ -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Thu Oct 28 21:51:14 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E4C3E106566B; Thu, 28 Oct 2010 21:51:14 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D2F0B8FC0A; Thu, 28 Oct 2010 21:51:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9SLpECf034118; Thu, 28 Oct 2010 21:51:14 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9SLpE7l034115; Thu, 28 Oct 2010 21:51:14 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201010282151.o9SLpE7l034115@svn.freebsd.org> From: Jilles Tjoelker Date: Thu, 28 Oct 2010 21:51:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214490 - in head: bin/sh tools/regression/bin/sh/expansion X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 21:51:15 -0000 Author: jilles Date: Thu Oct 28 21:51:14 2010 New Revision: 214490 URL: http://svn.freebsd.org/changeset/base/214490 Log: sh: Make double-quotes quote a '}' inside ${v#...} and ${v%...}. Exp-run done by: pav (with some other sh(1) changes) PR: bin/57554 Added: head/tools/regression/bin/sh/expansion/trim5.0 (contents, props changed) Modified: head/bin/sh/parser.c Modified: head/bin/sh/parser.c ============================================================================== --- head/bin/sh/parser.c Thu Oct 28 20:18:26 2010 (r214489) +++ head/bin/sh/parser.c Thu Oct 28 21:51:14 2010 (r214490) @@ -1234,7 +1234,8 @@ readtoken1(int firstc, char const *initi case CENDVAR: /* '}' */ if (level > 0 && (state[level].category == TSTATE_VAR_OLD || - state[level].category == TSTATE_VAR_NEW)) { + (state[level].category == TSTATE_VAR_NEW && + state[level].syntax == BASESYNTAX))) { if (state[level].category == TSTATE_VAR_OLD) state[level - 1].syntax = state[level].syntax; else Added: head/tools/regression/bin/sh/expansion/trim5.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/expansion/trim5.0 Thu Oct 28 21:51:14 2010 (r214490) @@ -0,0 +1,28 @@ +# $FreeBSD$ + +e= q='?' a='*' t=texttext s='ast*que?non' p='/et[c]/' w='a b c' b='{{(#)}}' +h='##' +failures='' +ok='' + +testcase() { + code="$1" + expected="$2" + oIFS="$IFS" + eval "$code" + IFS='|' + result="$#|$*" + IFS="$oIFS" + if [ "x$result" = "x$expected" ]; then + ok=x$ok + else + failures=x$failures + echo "For $code, expected $expected actual $result" + fi +} + +testcase 'set -- "${b%'\'}\''}"' '1|{{(#)}' +testcase 'set -- ${b%"}"}' '1|{{(#)}' +testcase 'set -- "${b%"}"}"' '1|{{(#)}' + +test "x$failures" = x From owner-svn-src-head@FreeBSD.ORG Thu Oct 28 22:28:45 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BED011065673; Thu, 28 Oct 2010 22:28:45 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AE4518FC18; Thu, 28 Oct 2010 22:28:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9SMSjrd035787; Thu, 28 Oct 2010 22:28:45 GMT (envelope-from uqs@svn.freebsd.org) Received: (from uqs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9SMSj19035785; Thu, 28 Oct 2010 22:28:45 GMT (envelope-from uqs@svn.freebsd.org) Message-Id: <201010282228.o9SMSj19035785@svn.freebsd.org> From: Ulrich Spoerlein Date: Thu, 28 Oct 2010 22:28:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214491 - head/usr.sbin/rtadvd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 22:28:45 -0000 Author: uqs Date: Thu Oct 28 22:28:45 2010 New Revision: 214491 URL: http://svn.freebsd.org/changeset/base/214491 Log: Fix another "string" typo. MFC after: 3 days Modified: head/usr.sbin/rtadvd/rtadvd.conf.5 Modified: head/usr.sbin/rtadvd/rtadvd.conf.5 ============================================================================== --- head/usr.sbin/rtadvd/rtadvd.conf.5 Thu Oct 28 21:51:14 2010 (r214490) +++ head/usr.sbin/rtadvd/rtadvd.conf.5 Thu Oct 28 22:28:45 2010 (r214491) @@ -201,7 +201,7 @@ The default value is 64. (str or num) A 8-bit flags field in prefix information option. This field can be specified either as a case-sensitive string or as an integer. -A sting consists of characters each of which corresponds to a +A string consists of characters each of which corresponds to a particular flag bit(s). An integer should be the logical OR of all enabled bits. Bit 7 From owner-svn-src-head@FreeBSD.ORG Thu Oct 28 22:34:49 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C4A541065672; Thu, 28 Oct 2010 22:34:49 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 990858FC1A; Thu, 28 Oct 2010 22:34:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9SMYnqF036407; Thu, 28 Oct 2010 22:34:49 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9SMYn6f036403; Thu, 28 Oct 2010 22:34:49 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201010282234.o9SMYn6f036403@svn.freebsd.org> From: Jilles Tjoelker Date: Thu, 28 Oct 2010 22:34:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214492 - in head: bin/sh tools/regression/bin/sh/expansion X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 22:34:49 -0000 Author: jilles Date: Thu Oct 28 22:34:49 2010 New Revision: 214492 URL: http://svn.freebsd.org/changeset/base/214492 Log: sh: Only accept a '}' inside ${v+-=?...} if double-quote state matches. If double-quote state does not match, treat the '}' literally. This ensures double-quote state remains the same before and after a ${v+-=?...} which helps with expand.c. It makes things like ${foo+"\${bar}"} which I have seen in the wild work as expected. Exp-run done by: pav (with some other sh(1) changes) Added: head/tools/regression/bin/sh/expansion/plus-minus5.0 (contents, props changed) Modified: head/bin/sh/parser.c Modified: head/bin/sh/parser.c ============================================================================== --- head/bin/sh/parser.c Thu Oct 28 22:28:45 2010 (r214491) +++ head/bin/sh/parser.c Thu Oct 28 22:34:49 2010 (r214492) @@ -1233,12 +1233,12 @@ readtoken1(int firstc, char const *initi break; case CENDVAR: /* '}' */ if (level > 0 && - (state[level].category == TSTATE_VAR_OLD || + ((state[level].category == TSTATE_VAR_OLD && + state[level].syntax == + state[level - 1].syntax) || (state[level].category == TSTATE_VAR_NEW && state[level].syntax == BASESYNTAX))) { - if (state[level].category == TSTATE_VAR_OLD) - state[level - 1].syntax = state[level].syntax; - else + if (state[level].category == TSTATE_VAR_NEW) newvarnest--; level--; USTPUTC(CTLENDVAR, out); Added: head/tools/regression/bin/sh/expansion/plus-minus5.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/expansion/plus-minus5.0 Thu Oct 28 22:34:49 2010 (r214492) @@ -0,0 +1,31 @@ +# $FreeBSD$ + +e= q='?' a='*' t=texttext s='ast*que?non' p='/et[c]/' w='a b c' b='{{(#)}}' +h='##' +failures='' +ok='' + +testcase() { + code="$1" + expected="$2" + oIFS="$IFS" + eval "$code" + IFS='|' + result="$#|$*" + IFS="$oIFS" + if [ "x$result" = "x$expected" ]; then + ok=x$ok + else + failures=x$failures + echo "For $code, expected $expected actual $result" + fi +} + +testcase 'set -- ${e:-"{x}"}' '1|{x}' +testcase 'set -- "${e:-"{x}"}"' '1|{x}' +testcase 'set -- ${h+"{x}"}' '1|{x}' +testcase 'set -- "${h+"{x}"}"' '1|{x}' +testcase 'set -- ${h:-"{x}"}' '1|##' +testcase 'set -- "${h:-"{x}"}"' '1|##' + +test "x$failures" = x From owner-svn-src-head@FreeBSD.ORG Thu Oct 28 23:46:05 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D85721065675; Thu, 28 Oct 2010 23:46:05 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C6F938FC0A; Thu, 28 Oct 2010 23:46:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9SNk5cC042725; Thu, 28 Oct 2010 23:46:05 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9SNk5Fg042721; Thu, 28 Oct 2010 23:46:05 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201010282346.o9SNk5Fg042721@svn.freebsd.org> From: Nathan Whitehorn Date: Thu, 28 Oct 2010 23:46:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214493 - in head/sys/boot/ofw: common libofw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 23:46:06 -0000 Author: nwhitehorn Date: Thu Oct 28 23:46:05 2010 New Revision: 214493 URL: http://svn.freebsd.org/changeset/base/214493 Log: Fix some memory management issues discovered when trying to boot the PPC OF loader on systems where address cells and size cells are both 2 (the Mambo simulator) and fix an error where cons_probe() was called before init_heap() but used malloc() to set environment variables. MFC after: 1 month Modified: head/sys/boot/ofw/common/main.c head/sys/boot/ofw/libofw/ofw_memory.c head/sys/boot/ofw/libofw/openfirm.c Modified: head/sys/boot/ofw/common/main.c ============================================================================== --- head/sys/boot/ofw/common/main.c Thu Oct 28 22:34:49 2010 (r214492) +++ head/sys/boot/ofw/common/main.c Thu Oct 28 23:46:05 2010 (r214493) @@ -41,7 +41,7 @@ extern char bootprog_rev[]; extern char bootprog_date[]; extern char bootprog_maker[]; -u_int32_t acells; +u_int32_t acells, scells; static char bootargs[128]; @@ -64,25 +64,20 @@ uint64_t memsize(void) { phandle_t memoryp; - struct ofw_reg reg[4]; - struct ofw_reg2 reg2[8]; - int i; - u_int64_t sz, memsz; + cell_t reg[24]; + int i, sz; + u_int64_t memsz; + memsz = 0; memoryp = OF_instance_to_package(memory); - if (acells == 1) { - sz = OF_getprop(memoryp, "reg", ®, sizeof(reg)); - sz /= sizeof(struct ofw_reg); - - for (i = 0, memsz = 0; i < sz; i++) - memsz += reg[i].size; - } else if (acells == 2) { - sz = OF_getprop(memoryp, "reg", ®2, sizeof(reg2)); - sz /= sizeof(struct ofw_reg2); + sz = OF_getprop(memoryp, "reg", ®, sizeof(reg)); + sz /= sizeof(reg[0]); - for (i = 0, memsz = 0; i < sz; i++) - memsz += reg2[i].size; + for (i = 0; i < sz; i += (acells + scells)) { + if (scells > 1) + memsz += (uint64_t)reg[i + acells] << 32; + memsz += reg[i + acells + scells - 1]; } return (memsz); @@ -105,13 +100,9 @@ main(int (*openfirm)(void *)) root = OF_finddevice("/"); - acells = 1; + scells = acells = 1; OF_getprop(root, "#address-cells", &acells, sizeof(acells)); - - /* - * Set up console. - */ - cons_probe(); + OF_getprop(root, "#size-cells", &scells, sizeof(scells)); /* * Initialise the heap as early as possible. Once this is done, @@ -121,6 +112,11 @@ main(int (*openfirm)(void *)) init_heap(); /* + * Set up console. + */ + cons_probe(); + + /* * March through the device switch probing for things. */ for (i = 0; devsw[i] != NULL; i++) Modified: head/sys/boot/ofw/libofw/ofw_memory.c ============================================================================== --- head/sys/boot/ofw/libofw/ofw_memory.c Thu Oct 28 22:34:49 2010 (r214492) +++ head/sys/boot/ofw/libofw/ofw_memory.c Thu Oct 28 23:46:05 2010 (r214493) @@ -118,13 +118,19 @@ ofw_memmap(int acells) void * ofw_alloc_heap(unsigned int size) { - phandle_t memoryp; - struct ofw_reg available; + phandle_t memoryp, root; + cell_t available[4]; + cell_t acells; + + root = OF_finddevice("/"); + acells = 1; + OF_getprop(root, "#address-cells", &acells, sizeof(acells)); memoryp = OF_instance_to_package(memory); - OF_getprop(memoryp, "available", &available, sizeof(available)); + OF_getprop(memoryp, "available", available, sizeof(available)); - heap_base = OF_claim((void *)available.base, size, sizeof(register_t)); + heap_base = OF_claim((void *)available[acells-1], size, + sizeof(register_t)); if (heap_base != (void *)-1) { heap_size = size; Modified: head/sys/boot/ofw/libofw/openfirm.c ============================================================================== --- head/sys/boot/ofw/libofw/openfirm.c Thu Oct 28 22:34:49 2010 (r214492) +++ head/sys/boot/ofw/libofw/openfirm.c Thu Oct 28 23:46:05 2010 (r214493) @@ -80,8 +80,13 @@ OF_init(int (*openfirm)(void *)) if ((chosen = OF_finddevice("/chosen")) == -1) OF_exit(); - if (OF_getprop(chosen, "memory", &memory, sizeof(memory)) == -1) - OF_exit(); + if (OF_getprop(chosen, "memory", &memory, sizeof(memory)) == -1) { + memory = OF_open("/memory"); + if (memory == -1) + memory = OF_open("/memory@0"); + if (memory == -1) + OF_exit(); + } if (OF_getprop(chosen, "mmu", &mmu, sizeof(mmu)) == -1) OF_exit(); } From owner-svn-src-head@FreeBSD.ORG Fri Oct 29 00:25:40 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8D90D106566B; Fri, 29 Oct 2010 00:25:40 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-qy0-f182.google.com (mail-qy0-f182.google.com [209.85.216.182]) by mx1.freebsd.org (Postfix) with ESMTP id 055E48FC16; Fri, 29 Oct 2010 00:25:39 +0000 (UTC) Received: by qyk2 with SMTP id 2so1489143qyk.13 for ; Thu, 28 Oct 2010 17:25:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=whewNNwn2HnYAYuK/0O1Pire8NYbPUCfa5vxLPZEdjc=; b=N5g4IxbY/mSGU0HrQSlnC+bGy2ugi1hEsc/59/p74Soyp7h4v87pdzz9wjlmAUf1Q7 +AQi5pJoYmIzS9m3SQQeg5bePcEoP9CPuea3Lke8r43dIY/S29zFFNngoKsH4ne8ygKd DYm6NNCh8nd1/skEZbptNfsAOSh/qSW3t/ZF4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=kyDqZXvXd5EQtwFLkbZUS8C5rzxAeIR59ulQV9LFCK+uEXYTGj3qWOvqAEddC/VjKA gX12MAUsEuUvvMHApBn00AtAtz9mJkqLG9ZmuSTiDoc4w3YLu83C5OU2ZRpFkyGUoKPM SZd1+RzLFZVTYC+krid+we2kU5SlTxJr7qxiM= MIME-Version: 1.0 Received: by 10.229.240.213 with SMTP id lb21mr10981155qcb.185.1288311938949; Thu, 28 Oct 2010 17:25:38 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.229.237.9 with HTTP; Thu, 28 Oct 2010 17:25:38 -0700 (PDT) In-Reply-To: <201010281638.14043.jhb@freebsd.org> References: <201010281631.o9SGVdtZ014923@svn.freebsd.org> <201010281411.40423.jhb@freebsd.org> <201010281638.14043.jhb@freebsd.org> Date: Fri, 29 Oct 2010 02:25:38 +0200 X-Google-Sender-Auth: oG3tpCBB9PL1eAhfyPujVlIzJQU Message-ID: From: Attilio Rao To: John Baldwin Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r214457 - in head/sys: amd64/amd64 conf i386/i386 x86/x86 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 00:25:40 -0000 2010/10/28 John Baldwin : > On Thursday, October 28, 2010 4:28:12 pm Attilio Rao wrote: >> 2010/10/28 John Baldwin : >> > On Thursday, October 28, 2010 1:21:34 pm Attilio Rao wrote: >> >> 2010/10/28 John Baldwin : >> >> > On Thursday, October 28, 2010 12:31:39 pm Attilio Rao wrote: >> >> >> Author: attilio >> >> >> Date: Thu Oct 28 16:31:39 2010 >> >> >> New Revision: 214457 >> >> >> URL: http://svn.freebsd.org/changeset/base/214457 >> >> >> >> >> >> Log: >> >> >> =C2=A0 Merge nexus.c from amd64 and i386 to x86 subtree. >> >> >> >> >> >> =C2=A0 Sponsored by: =C2=A0 =C2=A0 =C2=A0 Sandvine Incorporated >> >> >> =C2=A0 Tested by: =C2=A0gianni >> >> >> >> >> > >> >> > It would be better to merge these two routines. =C2=A0The loader no= w passes > the >> >> > smap to i386 kernels as well, so ram_attach() should probably be > changed to >> >> > try the amd64 approach first and if that fails fall back to using t= he >> >> > phys_avail[] array instead. >> >> >> >> What do you think about this patch?: >> >> Index: nexus.c >> >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> >> --- nexus.c =C2=A0 =C2=A0 (revision 214457) >> >> +++ nexus.c =C2=A0 =C2=A0 (working copy) >> >> @@ -52,9 +52,7 @@ >> >> =C2=A0#include >> >> =C2=A0#include >> >> =C2=A0#include >> >> -#ifdef __amd64__ >> >> =C2=A0#include >> >> -#endif >> >> =C2=A0#include >> >> =C2=A0#include >> >> =C2=A0#include >> >> @@ -67,12 +65,10 @@ >> >> =C2=A0#include >> >> =C2=A0#include >> >> >> >> -#ifdef __amd64__ >> >> =C2=A0#include >> >> -#include >> >> -#endif >> >> =C2=A0#include >> >> =C2=A0#include >> >> +#include >> >> >> >> =C2=A0#ifdef DEV_APIC >> >> =C2=A0#include "pcib_if.h" >> >> @@ -89,11 +85,13 @@ >> >> =C2=A0#include >> >> >> >> =C2=A0#ifdef __amd64__ >> >> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0RMAN_BUS_SPACE_IO =C2=A0 =C2=A0 = =C2=A0 AMD64_BUS_SPACE_IO >> >> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0RMAN_BUS_SPACE_MEM =C2=A0 =C2=A0 = =C2=A0AMD64_BUS_SPACE_MEM >> >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0X86_BUS_SPACE_IO =C2=A0 =C2=A0 = =C2=A0 =C2=A0AMD64_BUS_SPACE_IO >> >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0X86_BUS_SPACE_MEM =C2=A0 =C2=A0 = =C2=A0 AMD64_BUS_SPACE_MEM >> >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0ELF_KERN_STR =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0"elf64 kernel" >> >> =C2=A0#else >> >> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0RMAN_BUS_SPACE_IO =C2=A0 =C2=A0 = =C2=A0 I386_BUS_SPACE_IO >> >> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0RMAN_BUS_SPACE_MEM =C2=A0 =C2=A0 = =C2=A0I386_BUS_SPACE_MEM >> >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0X86_BUS_SPACE_IO =C2=A0 =C2=A0 = =C2=A0 =C2=A0I386_BUS_SPACE_IO >> >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0X86_BUS_SPACE_MEM =C2=A0 =C2=A0 = =C2=A0 I386_BUS_SPACE_MEM >> >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0ELF_KERN_STR =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0"elf32 kernel" >> >> =C2=A0#endif >> >> @@ -701,16 +699,11 @@ >> >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 panic("ram_attach: resource %d failed to attach", > rid); >> >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 rid++; >> >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 } >> >> - =C2=A0 =C2=A0 =C2=A0 return (0); >> >> -} >> >> -#else >> >> -static int >> >> -ram_attach(device_t dev) >> >> -{ >> >> - =C2=A0 =C2=A0 =C2=A0 struct resource *res; >> >> - =C2=A0 =C2=A0 =C2=A0 vm_paddr_t *p; >> >> - =C2=A0 =C2=A0 =C2=A0 int error, i, rid; >> >> >> >> + =C2=A0 =C2=A0 =C2=A0 /* If at least one smap attached, return. */ >> >> + =C2=A0 =C2=A0 =C2=A0 if (rid !=3D 0) >> >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return (0); >> >> + >> > >> > Perhaps this instead: >> > >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0/* If we found an SMAP, return. */ >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0if (smapbase !=3D NULL) >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return (0); >> >> No, I don't think this check is right, smapbase will always be !=3D NULL >> (otherwise the code panics). > > Oh, that needs to be fixed then. =C2=A0It can be NULL on i386 with an old= loader > (or on a really old machine without an SMAP). =C2=A0The amd64 nexus code = could > assume it would never be NULL, but i386 cannot. > > It should probably more closely match what i386 does during the memory pr= obe > which is: > > =C2=A0 =C2=A0 =C2=A0 =C2=A0kmdp =3D search("elf kernel"); > =C2=A0 =C2=A0 =C2=A0 =C2=A0if (kmdp =3D=3D NULL) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0kmdp =3D search("e= lfXX kernel"); > =C2=A0 =C2=A0 =C2=A0 =C2=A0if (kmdp !=3D NULL) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0smapbase =3D prelo= ad_search(...); > =C2=A0 =C2=A0 =C2=A0 =C2=A0else > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0smapbase =3D NULL; > =C2=A0 =C2=A0 =C2=A0 =C2=A0if (smapbase !=3D NULL) { > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0for (smap =3D ...)= { > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0} > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return (0); > =C2=A0 =C2=A0 =C2=A0 =C2=A0} > > =C2=A0 =C2=A0 =C2=A0 =C2=A0/* fall through to old i386 code using phys_av= ail[] */ This further patch should address your concerns about nexus.c: Index: nexus.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- nexus.c (revision 214457) +++ nexus.c (working copy) @@ -52,9 +52,7 @@ #include #include #include -#ifdef __amd64__ #include -#endif #include #include #include @@ -67,12 +65,10 @@ #include #include -#ifdef __amd64__ #include -#include -#endif #include #include +#include #ifdef DEV_APIC #include "pcib_if.h" @@ -89,13 +85,15 @@ #include #ifdef __amd64__ -#define RMAN_BUS_SPACE_IO AMD64_BUS_SPACE_IO -#define RMAN_BUS_SPACE_MEM AMD64_BUS_SPACE_MEM +#define BUS_SPACE_IO AMD64_BUS_SPACE_IO +#define BUS_SPACE_MEM AMD64_BUS_SPACE_MEM #else -#define RMAN_BUS_SPACE_IO I386_BUS_SPACE_IO -#define RMAN_BUS_SPACE_MEM I386_BUS_SPACE_MEM +#define BUS_SPACE_IO I386_BUS_SPACE_IO +#define BUS_SPACE_MEM I386_BUS_SPACE_MEM #endif +#define ELF_KERN_STR ("elf"__XSTRING(__ELF_WORD_SIZE)" kernel") + static MALLOC_DEFINE(M_NEXUSDEV, "nexusdev", "Nexus device"); #define DEVTONX(dev) ((struct nexus_device *)device_get_ivars(dev)) @@ -435,7 +433,7 @@ #else rman_set_bushandle(r, rman_get_start(r)); #endif - rman_set_bustag(r, RMAN_BUS_SPACE_IO); + rman_set_bustag(r, BUS_SPACE_IO); break; case SYS_RES_MEMORY: #ifdef PC98 @@ -446,7 +444,7 @@ #endif vaddr =3D pmap_mapdev(rman_get_start(r), rman_get_size(r)); rman_set_virtual(r, vaddr); - rman_set_bustag(r, RMAN_BUS_SPACE_MEM); + rman_set_bustag(r, BUS_SPACE_MEM); #ifdef PC98 /* PC-98: the type of bus_space_handle_t is the structure. = */ bh->bsh_base =3D (bus_addr_t) vaddr; @@ -668,48 +666,45 @@ return (0); } -#ifdef __amd64__ static int ram_attach(device_t dev) { struct bios_smap *smapbase, *smap, *smapend; struct resource *res; + vm_paddr_t *p; caddr_t kmdp; uint32_t smapsize; - int error, rid; + int error, i, rid; /* Retrieve the system memory map from the loader. */ kmdp =3D preload_search_by_type("elf kernel"); if (kmdp =3D=3D NULL) - kmdp =3D preload_search_by_type("elf64 kernel"); - smapbase =3D (struct bios_smap *)preload_search_info(kmdp, - MODINFO_METADATA | MODINFOMD_SMAP); - smapsize =3D *((u_int32_t *)smapbase - 1); - smapend =3D (struct bios_smap *)((uintptr_t)smapbase + smapsize); + kmdp =3D preload_search_by_type(ELF_KERN_STR); + if (kmdp !=3D NULL) { + smapbase =3D (struct bios_smap *)preload_search_info(kmdp, + MODINFO_METADATA | MODINFOMD_SMAP); + smapsize =3D *((u_int32_t *)smapbase - 1); + smapend =3D (struct bios_smap *)((uintptr_t)smapbase + smap= size); - rid =3D 0; - for (smap =3D smapbase; smap < smapend; smap++) { - if (smap->type !=3D SMAP_TYPE_MEMORY || smap->length =3D=3D= 0) - continue; - error =3D bus_set_resource(dev, SYS_RES_MEMORY, rid, smap->= base, - smap->length); - if (error) - panic("ram_attach: resource %d failed set with %d",= rid, - error); - res =3D bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, 0= ); - if (res =3D=3D NULL) - panic("ram_attach: resource %d failed to attach", r= id); - rid++; + rid =3D 0; + for (smap =3D smapbase; smap < smapend; smap++) { + if (smap->type !=3D SMAP_TYPE_MEMORY || + smap->length =3D=3D 0) + continue; + error =3D bus_set_resource(dev, SYS_RES_MEMORY, rid= , + smap->base, smap->length); + if (error) + panic("ram_attach: resource %d failed set with %d", + rid, error); + res =3D bus_alloc_resource_any(dev, SYS_RES_MEMORY,= &rid, + 0); + if (res =3D=3D NULL) + panic("ram_attach: resource %d failed to attach", + rid); + rid++; + } + return (0); } - return (0); -} -#else -static int -ram_attach(device_t dev) -{ - struct resource *res; - vm_paddr_t *p; - int error, i, rid; /* * We use the dump_avail[] array rather than phys_avail[] for @@ -743,7 +738,6 @@ } return (0); } -#endif static device_method_t ram_methods[] =3D { /* Device interface */ From owner-svn-src-head@FreeBSD.ORG Fri Oct 29 00:36:44 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C0EB71065672; Fri, 29 Oct 2010 00:36:44 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AFE648FC1A; Fri, 29 Oct 2010 00:36:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9T0aikf047102; Fri, 29 Oct 2010 00:36:44 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9T0aidm047100; Fri, 29 Oct 2010 00:36:44 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201010290036.o9T0aidm047100@svn.freebsd.org> From: Nathan Whitehorn Date: Fri, 29 Oct 2010 00:36:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214494 - head/sys/boot/ofw/libofw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 00:36:44 -0000 Author: nwhitehorn Date: Fri Oct 29 00:36:44 2010 New Revision: 214494 URL: http://svn.freebsd.org/changeset/base/214494 Log: Fix netboot on some Apple machines on which calling dma-free on the network device can hang the machine. This causes the loss of 64 KB of accessible memory on netbooted machines. Modified: head/sys/boot/ofw/libofw/ofw_net.c Modified: head/sys/boot/ofw/libofw/ofw_net.c ============================================================================== --- head/sys/boot/ofw/libofw/ofw_net.c Thu Oct 28 23:46:05 2010 (r214493) +++ head/sys/boot/ofw/libofw/ofw_net.c Fri Oct 29 00:36:44 2010 (r214494) @@ -230,7 +230,10 @@ punt: static void ofwn_end(struct netif *nif) { +#ifdef BROKEN + /* dma-free freezes at least some Apple ethernet controllers */ OF_call_method("dma-free", netinstance, 2, 0, dmabuf, MAXPHYS); +#endif OF_close(netinstance); } From owner-svn-src-head@FreeBSD.ORG Fri Oct 29 00:37:36 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 15AB51065693; Fri, 29 Oct 2010 00:37:36 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 04D048FC0C; Fri, 29 Oct 2010 00:37:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9T0bZdt047199; Fri, 29 Oct 2010 00:37:35 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9T0bZei047197; Fri, 29 Oct 2010 00:37:35 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201010290037.o9T0bZei047197@svn.freebsd.org> From: Nathan Whitehorn Date: Fri, 29 Oct 2010 00:37:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214495 - head/sys/boot/ofw/common X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 00:37:36 -0000 Author: nwhitehorn Date: Fri Oct 29 00:37:35 2010 New Revision: 214495 URL: http://svn.freebsd.org/changeset/base/214495 Log: Fix the printf() in init_heap so that it can run before the console is up. Pointed out by: marius Modified: head/sys/boot/ofw/common/main.c Modified: head/sys/boot/ofw/common/main.c ============================================================================== --- head/sys/boot/ofw/common/main.c Fri Oct 29 00:36:44 2010 (r214494) +++ head/sys/boot/ofw/common/main.c Fri Oct 29 00:37:35 2010 (r214495) @@ -47,13 +47,17 @@ static char bootargs[128]; #define HEAP_SIZE 0x80000 +#define OF_puts(fd, text) OF_write(fd, text, strlen(text)) + void init_heap(void) { void *base; + ihandle_t stdout; if ((base = ofw_alloc_heap(HEAP_SIZE)) == (void *)0xffffffff) { - printf("Heap memory claim failed!\n"); + OF_getprop(chosen, "stdout", &stdout, sizeof(stdout)); + OF_puts(stdout, "Heap memory claim failed!\n"); OF_enter(); } From owner-svn-src-head@FreeBSD.ORG Fri Oct 29 01:39:36 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AD414106564A for ; Fri, 29 Oct 2010 01:39:36 +0000 (UTC) (envelope-from denis@berlin.ccc.de) Received: from mail.h3q.com (mail.h3q.com [213.73.89.199]) by mx1.freebsd.org (Postfix) with ESMTP id EBD698FC1C for ; Fri, 29 Oct 2010 01:39:35 +0000 (UTC) Received: (qmail 22353 invoked from network); 29 Oct 2010 01:11:30 -0000 Received: from mail.h3q.com (HELO mail.h3q.com) (denis) by mail.h3q.com with AES128-SHA encrypted SMTP; 29 Oct 2010 01:11:30 -0000 From: Denis Ahrens Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Date: Fri, 29 Oct 2010 03:11:27 +0200 Message-Id: <0C099B90-AFB9-422F-AB75-AFC138A36D20@berlin.ccc.de> To: svn-src-head@freebsd.org Mime-Version: 1.0 (Apple Message framework v1081) X-Mailer: Apple Mail (2.1081) Cc: bz@FreeBSD.org, =?iso-8859-1?Q?Philipp_W=FCnsche?= Subject: pending em0 commits for FreeBSD 8.1 STABLE X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 01:39:36 -0000 Hi Jack It seems that I am also victim to some strange bug which is possibly the fault of the em0 code. After some research I have seen that you have changed that code awhile ago which could possibly have fixed my problems already. The code changes: = http://lists.freebsd.org/pipermail/svn-src-head/2010-September/020313.html= = http://lists.freebsd.org/pipermail/svn-src-head/2010-September/020314.html= = http://lists.freebsd.org/pipermail/svn-src-head/2010-September/021027.html= The last one even had an MFC of one week. But it was never committed to STABLE. It would be nice if you could commit that so I can update my code and = see if the problem still occurs. My problems are looking like this one: = http://lists.freebsd.org/pipermail/freebsd-stable/2010-October/059618.html= My FreeBSD STABLE codebase is from 29. September 2010 dmesg: em0: port 0xdc00-0xdc1f mem = 0xfe9e0000-0xfe9fffff,0xfe9dc000-0xfe9dffff irq 16 at device 0.0 on pci2 em0: Using MSI interrupt em0: [FILTER] em0: Ethernet address: 00:25:90:04:f2:90 pciconf -v -l: em0@pci0:2:0:0: class=3D0x020000 card=3D0x060a15d9 chip=3D0x10d38086 = rev=3D0x00 hdr=3D0x00 vendor =3D 'Intel Corporation' device =3D 'Intel 82574L Gigabit Ethernet Controller (82574L)' class =3D network subclass =3D ethernet Denis Ahrens From owner-svn-src-head@FreeBSD.ORG Fri Oct 29 01:40:08 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7A777106566C for ; Fri, 29 Oct 2010 01:40:08 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mail.cksoft.de (mail.cksoft.de [IPv6:2001:4068:10::3]) by mx1.freebsd.org (Postfix) with ESMTP id 0421E8FC18 for ; Fri, 29 Oct 2010 01:40:08 +0000 (UTC) Received: from localhost (amavis.fra.cksoft.de [192.168.74.71]) by mail.cksoft.de (Postfix) with ESMTP id F113C41C711; Fri, 29 Oct 2010 03:40:06 +0200 (CEST) X-Virus-Scanned: amavisd-new at cksoft.de Received: from mail.cksoft.de ([192.168.74.103]) by localhost (amavis.fra.cksoft.de [192.168.74.71]) (amavisd-new, port 10024) with ESMTP id M+EaqFklMPKD; Fri, 29 Oct 2010 03:40:05 +0200 (CEST) Received: by mail.cksoft.de (Postfix, from userid 66) id ACF5E41C71D; Fri, 29 Oct 2010 03:40:05 +0200 (CEST) Received: from maildrop.int.zabbadoz.net (maildrop.int.zabbadoz.net [10.111.66.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.int.zabbadoz.net (Postfix) with ESMTP id C4C7E4448F3; Fri, 29 Oct 2010 01:39:25 +0000 (UTC) Date: Fri, 29 Oct 2010 01:39:25 +0000 (UTC) From: "Bjoern A. Zeeb" X-X-Sender: bz@maildrop.int.zabbadoz.net To: Denis Ahrens In-Reply-To: <0C099B90-AFB9-422F-AB75-AFC138A36D20@berlin.ccc.de> Message-ID: <20101029013606.I66242@maildrop.int.zabbadoz.net> References: <0C099B90-AFB9-422F-AB75-AFC138A36D20@berlin.ccc.de> X-OpenPGP-Key: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, Randy Bush , =?ISO-8859-1?Q?Philipp_W=FCnsche?= , Mike Tancsa Subject: Re: pending em0 commits for FreeBSD 8.1 STABLE X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 01:40:08 -0000 On Fri, 29 Oct 2010, Denis Ahrens wrote: > Hi Jack > > It seems that I am also victim to some strange bug which is > possibly the fault of the em0 code. > > After some research I have seen that you have changed that > code awhile ago which could possibly have fixed my problems > already. > > The code changes: > > http://lists.freebsd.org/pipermail/svn-src-head/2010-September/020313.html > http://lists.freebsd.org/pipermail/svn-src-head/2010-September/020314.html > http://lists.freebsd.org/pipermail/svn-src-head/2010-September/021027.html > > The last one even had an MFC of one week. But it was never committed to > STABLE. > > It would be nice if you could commit that so I can update my code and see > if the problem still occurs. Especially the first two seem to be interesting. You should actually be able to take the e1000 directory from HEAD and compile it on stable/8; I would assume that would be possible atm., or try to merge/apply the three commit from above locally. > My problems are looking like this one: > > http://lists.freebsd.org/pipermail/freebsd-stable/2010-October/059618.html > > My FreeBSD STABLE codebase is from 29. September 2010 > > dmesg: > > em0: port 0xdc00-0xdc1f mem 0xfe9e0000-0xfe9fffff,0xfe9dc000-0xfe9dffff irq 16 at device 0.0 on pci2 > em0: Using MSI interrupt > em0: [FILTER] > em0: Ethernet address: 00:25:90:04:f2:90 > > pciconf -v -l: > > em0@pci0:2:0:0: class=0x020000 card=0x060a15d9 chip=0x10d38086 rev=0x00 hdr=0x00 > vendor = 'Intel Corporation' > device = 'Intel 82574L Gigabit Ethernet Controller (82574L)' > class = network > subclass = ethernet > > Denis Ahrens > -- Bjoern A. Zeeb Welcome a new stage of life. Going to jail sucks -- All my daemons like it! http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/jails.html From owner-svn-src-head@FreeBSD.ORG Fri Oct 29 02:06:28 2010 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8B48F106566B; Fri, 29 Oct 2010 02:06:28 +0000 (UTC) (envelope-from mike@sentex.net) Received: from smarthost2.sentex.ca (smarthost2-6.sentex.ca [IPv6:2607:f3e0:80:80::2]) by mx1.freebsd.org (Postfix) with ESMTP id DF8BD8FC08; Fri, 29 Oct 2010 02:06:27 +0000 (UTC) Received: from lava.sentex.ca (pyroxene.sentex.ca [199.212.134.18]) by smarthost2.sentex.ca (8.14.4/8.14.4) with ESMTP id o9T26JkR007616 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 28 Oct 2010 22:06:19 -0400 (EDT) (envelope-from mike@sentex.net) Received: from mdt-xp.sentex.net (simeon.sentex.ca [192.168.43.27]) by lava.sentex.ca (8.14.4/8.14.4) with ESMTP id o9T26IDV057936; Thu, 28 Oct 2010 22:06:18 -0400 (EDT) (envelope-from mike@sentex.net) Message-Id: <201010290206.o9T26IDV057936@lava.sentex.ca> X-Mailer: QUALCOMM Windows Eudora Version 7.1.0.9 Date: Thu, 28 Oct 2010 22:06:10 -0400 To: "Bjoern A. Zeeb" , Denis Ahrens From: Mike Tancsa In-Reply-To: <20101029013606.I66242@maildrop.int.zabbadoz.net> References: <0C099B90-AFB9-422F-AB75-AFC138A36D20@berlin.ccc.de> <20101029013606.I66242@maildrop.int.zabbadoz.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-Scanned-By: MIMEDefang 2.67 on 205.211.164.50 Cc: svn-src-head@FreeBSD.org, Randy Bush , Philipp =?iso-8859-1?Q?W=FCnsche?= Subject: Re: pending em0 commits for FreeBSD 8.1 STABLE X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 02:06:28 -0000 At 09:39 PM 10/28/2010, Bjoern A. Zeeb wrote: >On Fri, 29 Oct 2010, Denis Ahrens wrote: > >>Hi Jack >> >>It seems that I am also victim to some strange bug which is >>possibly the fault of the em0 code. >> >>After some research I have seen that you have changed that >>code awhile ago which could possibly have fixed my problems >>already. >> >>The code changes: >> >>http://lists.freebsd.org/pipermail/svn-src-head/2010-September/020313.html >>http://lists.freebsd.org/pipermail/svn-src-head/2010-September/020314.html >>http://lists.freebsd.org/pipermail/svn-src-head/2010-September/021027.html >> >>The last one even had an MFC of one week. But it was never committed to >>STABLE. >> >>It would be nice if you could commit that so I can update my code and see >>if the problem still occurs. > >Especially the first two seem to be interesting. I am testing 7.1.5 on cvsup.sentex.ca, which was locking up the nic and crashing a few weeks ago under specific loads the box sees on weekends. Swapping in a bge nic solved the problem. I had changed out all the other hardware, so I dont think its an issue with the em nics themselves. I have changed back to the em nic and it will take a good week to see if it solves that problem or not. em1@pci0:10:0:0: class=0x020000 card=0x34ec8086 chip=0x10d38086 rev=0x00 hdr=0x00 vendor = 'Intel Corporation' device = 'Intel 82574L Gigabit Ethernet Controller (82574L)' class = network subclass = ethernet cap 01[c8] = powerspec 2 supports D0 D3 current D0 cap 05[d0] = MSI supports 1 message, 64 bit cap 10[e0] = PCI-Express 1 endpoint max data 128(256) link x1(x1) cap 11[a0] = MSI-X supports 5 messages in map 0x1c enabled ecap 0001[100] = AER 1 0 fatal 0 non-fatal 0 corrected ecap 0003[140] = Serial 1 001517ffffed68a4 I am also testing the driver on a couple of test motherboards and for some reason, it does not want to boot RELENG_8 on one of them. The same hardware boots HEAD. On RELENG_8, the last thing to appear is em0: port 0xf040-0xf05f mem 0xfe400000-0xfe41ffff,0xfe428000-0xfe428fff irq 20 at device 25.0 on pci0 em0: attempting to allocate 1 MSI vectors (1 supported) msi: routing MSI IRQ 256 to local APIC 0 vector 50 em0: using IRQ 256 for MSI em0: Using an MSI interrupt Its an oddball nic so I am not sure why it on RELENG_8 has issues. The stock RELENG_8 driver works em0@pci0:0:25:0: class=0x020000 card=0x00368086 chip=0x10f08086 rev=0x06 hdr=0x00 vendor = 'Intel Corporation' class = network subclass = ethernet cap 01[c8] = powerspec 2 supports D0 D3 current D0 cap 05[d0] = MSI supports 1 message, 64 bit enabled with 1 message cap 13[e0] = PCI Advanced Features: FLR TP >>My problems are looking like this one: >> >>http://lists.freebsd.org/pipermail/freebsd-stable/2010-October/059618.html >> >>My FreeBSD STABLE codebase is from 29. September 2010 I will give it a try. I was able to recreate the issue with the stock RELENG_8 driver. I will try with the version from HEAD ---Mike -------------------------------------------------------------------- Mike Tancsa, tel +1 519 651 3400 Sentex Communications, mike@sentex.net Providing Internet since 1994 www.sentex.net Cambridge, Ontario Canada www.sentex.net/mike From owner-svn-src-head@FreeBSD.ORG Fri Oct 29 05:04:51 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F06721065672; Fri, 29 Oct 2010 05:04:51 +0000 (UTC) (envelope-from davidxu@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id B9CB78FC18; Fri, 29 Oct 2010 05:04:51 +0000 (UTC) Received: from xyf.my.dom (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id o9T54n2P000958; Fri, 29 Oct 2010 05:04:49 GMT (envelope-from davidxu@freebsd.org) Message-ID: <4CCAC673.7070307@freebsd.org> Date: Fri, 29 Oct 2010 13:04:51 +0000 From: David Xu User-Agent: Thunderbird 2.0.0.24 (X11/20100630) MIME-Version: 1.0 To: Garrett Cooper References: <201010270232.o9R2Wsu3084553@svn.freebsd.org> <4CC803A8.3040602@freebsd.org> <20101027082122.GD1848@garage.freebsd.pl> <4CC85552.2020100@freebsd.org> <20101027133307.GQ2392@deviant.kiev.zoral.com.ua> <4CC851CC.80509@freebsd.org> <4CC9483C.7050507@freebsd.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: src-committers@freebsd.org, Pawel Jakub Dawidek , svn-src-all@freebsd.org, Andriy Gapon , svn-src-head@freebsd.org, Kostik Belousov Subject: Re: svn commit: r214409 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 05:04:52 -0000 Garrett Cooper wrote: > On Thu, Oct 28, 2010 at 2:54 AM, David Xu wrote: >> Garrett Cooper wrote: >>> On Wed, Oct 27, 2010 at 9:22 AM, Andriy Gapon wrote: >>>> [patch attachment was lost] >>> Ugh... Mailman hates me I guess :(... >>> >>>> on 27/10/2010 19:07 Garrett Cooper said the following: >>>>> How about this patch? I implemented this as a readonly tunable and >>>> I don't think that it's correct to call it a tunable or use >>>> CTLFLAG_RDTUN. >>>> As I understand it is a read-only sysctl. >>> Converted to CTLFLAG_RD. >>> >>>>> sysconf tunable, because (AFAIK) the value that is being tested >>>>> shouldn't change during runtime after the system has been booted up, >>>>> and figuring that the value wasn't going to change it was better to >>>>> lose 4/8 bytes on the kernel stack instead of having to recompute the >>>>> value every time in a function call, with the associated lost heap / >>>>> stack memory in the process, as the assumption is that this libcall >>>>> was going to be called frequently by some programs. >> The patch looks fine to me. ;-) > > If no one opposes the change, could you please commit the patch for me David? > Thanks! > -Garrett > The SC_XXX constants are in rather odd order! > #define _SC_XOPEN_XCU_VERSION 117 /* user */ > #endif > > #if __BSD_VISIBLE > #define _SC_NPROCESSORS_CONF 57 > #define _SC_NPROCESSORS_ONLN 58 > #endif Does someone just want to save some typing for __BSD_VISIBLE ? It is wrong if it this true. Regards, David Xu From owner-svn-src-head@FreeBSD.ORG Fri Oct 29 07:04:45 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CE6AE1065694; Fri, 29 Oct 2010 07:04:45 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BBD5D8FC16; Fri, 29 Oct 2010 07:04:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9T74jph066902; Fri, 29 Oct 2010 07:04:45 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9T74j5r066900; Fri, 29 Oct 2010 07:04:45 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201010290704.o9T74j5r066900@svn.freebsd.org> From: David Xu Date: Fri, 29 Oct 2010 07:04:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214500 - head/lib/libthr/thread X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 07:04:45 -0000 Author: davidxu Date: Fri Oct 29 07:04:45 2010 New Revision: 214500 URL: http://svn.freebsd.org/changeset/base/214500 Log: Remove local variable 'first', instead check signal number in memory, because the variable can be in register, second checking the variable may still return true, however this is unexpected. Modified: head/lib/libthr/thread/thr_sig.c Modified: head/lib/libthr/thread/thr_sig.c ============================================================================== --- head/lib/libthr/thread/thr_sig.c Fri Oct 29 02:12:36 2010 (r214499) +++ head/lib/libthr/thread/thr_sig.c Fri Oct 29 07:04:45 2010 (r214500) @@ -317,14 +317,11 @@ check_deferred_signal(struct pthread *cu ucontext_t uc; struct sigaction act; siginfo_t info; - volatile int first; if (__predict_true(curthread->deferred_siginfo.si_signo == 0)) return; - first = 1; getcontext(&uc); - if (first) { - first = 0; + if (curthread->deferred_siginfo.si_signo == 0) { act = curthread->deferred_sigact; uc.uc_sigmask = curthread->deferred_sigmask; memcpy(&info, &curthread->deferred_siginfo, sizeof(siginfo_t)); From owner-svn-src-head@FreeBSD.ORG Fri Oct 29 08:08:10 2010 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 88296106564A; Fri, 29 Oct 2010 08:08:10 +0000 (UTC) (envelope-from peterjeremy@acm.org) Received: from mail16.syd.optusnet.com.au (mail16.syd.optusnet.com.au [211.29.132.197]) by mx1.freebsd.org (Postfix) with ESMTP id EE4278FC27; Fri, 29 Oct 2010 08:08:09 +0000 (UTC) Received: from server.vk2pj.dyndns.org (c220-239-116-103.belrs4.nsw.optusnet.com.au [220.239.116.103]) by mail16.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id o9T886eG007109 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 29 Oct 2010 19:08:07 +1100 X-Bogosity: Ham, spamicity=0.000000 Received: from server.vk2pj.dyndns.org (localhost.vk2pj.dyndns.org [127.0.0.1]) by server.vk2pj.dyndns.org (8.14.4/8.14.4) with ESMTP id o9T885o5034786; Fri, 29 Oct 2010 19:08:05 +1100 (EST) (envelope-from peter@server.vk2pj.dyndns.org) Received: (from peter@localhost) by server.vk2pj.dyndns.org (8.14.4/8.14.4/Submit) id o9T88578034785; Fri, 29 Oct 2010 19:08:05 +1100 (EST) (envelope-from peter) Date: Fri, 29 Oct 2010 19:08:05 +1100 From: Peter Jeremy To: Ulrich Spoerlein Message-ID: <20101029080805.GA33527@server.vk2pj.dyndns.org> References: <201010282018.o9SKIQHU029482@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="1yeeQ81UyVL57Vl7" Content-Disposition: inline In-Reply-To: <201010282018.o9SKIQHU029482@svn.freebsd.org> X-PGP-Key: http://members.optusnet.com.au/peterjeremy/pubkey.asc User-Agent: Mutt/1.5.20 (2009-06-14) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r214489 - head/usr.sbin/bsnmpd/modules/snmp_hostres X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 08:08:10 -0000 --1yeeQ81UyVL57Vl7 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2010-Oct-28 20:18:26 +0000, Ulrich Spoerlein wrote: > Fix CPU load reporting independent of scheduler used. That's good. > I'm unsure if some MIB standard states this must be the load average > for, eg. 300s, it looks like net-snmp isn't even bothering to implement > the CPU load reporting at all. I'd be very surprised if there was because (eg) HP Tru64 uses different load average times. --=20 Peter Jeremy --1yeeQ81UyVL57Vl7 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.15 (FreeBSD) iEYEARECAAYFAkzKgOUACgkQ/opHv/APuIfCwwCgorRt+536y6buG12TFqf0JXc5 xn8An3r53Y+xX7A03ilv83vlfiX/7GHR =Xli2 -----END PGP SIGNATURE----- --1yeeQ81UyVL57Vl7-- From owner-svn-src-head@FreeBSD.ORG Fri Oct 29 09:35:37 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 530671065670; Fri, 29 Oct 2010 09:35:37 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 419858FC1F; Fri, 29 Oct 2010 09:35:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9T9ZbXJ089954; Fri, 29 Oct 2010 09:35:37 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9T9ZbXH089952; Fri, 29 Oct 2010 09:35:37 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201010290935.o9T9ZbXH089952@svn.freebsd.org> From: David Xu Date: Fri, 29 Oct 2010 09:35:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214506 - head/lib/libthr/thread X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 09:35:37 -0000 Author: davidxu Date: Fri Oct 29 09:35:36 2010 New Revision: 214506 URL: http://svn.freebsd.org/changeset/base/214506 Log: Return previous sigaction correctly. Submitted by: avg Modified: head/lib/libthr/thread/thr_sig.c Modified: head/lib/libthr/thread/thr_sig.c ============================================================================== --- head/lib/libthr/thread/thr_sig.c Fri Oct 29 09:23:26 2010 (r214505) +++ head/lib/libthr/thread/thr_sig.c Fri Oct 29 09:35:36 2010 (r214506) @@ -547,7 +547,10 @@ _sigaction(int sig, const struct sigacti if (oldact.sa_handler != SIG_DFL && oldact.sa_handler != SIG_IGN) { - oldact = _thr_sigact[sig-1].sigact; + if (act != NULL) + oldact = oldact2; + else if (oact != NULL) + oldact = _thr_sigact[sig-1].sigact; } _thr_rwl_unlock(&_thr_sigact[sig-1].lock); From owner-svn-src-head@FreeBSD.ORG Fri Oct 29 10:57:18 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9A998106564A; Fri, 29 Oct 2010 10:57:18 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8913F8FC16; Fri, 29 Oct 2010 10:57:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9TAvI1b011020; Fri, 29 Oct 2010 10:57:18 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9TAvIHK011017; Fri, 29 Oct 2010 10:57:18 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201010291057.o9TAvIHK011017@svn.freebsd.org> From: Gleb Smirnoff Date: Fri, 29 Oct 2010 10:57:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214508 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 10:57:18 -0000 Author: glebius Date: Fri Oct 29 10:57:18 2010 New Revision: 214508 URL: http://svn.freebsd.org/changeset/base/214508 Log: Revert a small part of the r198301, that is entirely unrelated to the r198301 itself. It also broke the logic of not sending more than one ARP request per second, that consequently lead to a potential problem of flooding network with broadcast packets. MFC after: 1 week Modified: head/sys/netinet/if_ether.c Modified: head/sys/netinet/if_ether.c ============================================================================== --- head/sys/netinet/if_ether.c Fri Oct 29 09:50:28 2010 (r214507) +++ head/sys/netinet/if_ether.c Fri Oct 29 10:57:18 2010 (r214508) @@ -381,7 +381,7 @@ retry: int canceled; LLE_ADDREF(la); - la->la_expire = time_second + V_arpt_down; + la->la_expire = time_second; canceled = callout_reset(&la->la_timer, hz * V_arpt_down, arptimer, la); if (canceled) From owner-svn-src-head@FreeBSD.ORG Fri Oct 29 11:13:42 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CAFF7106564A; Fri, 29 Oct 2010 11:13:42 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B93048FC13; Fri, 29 Oct 2010 11:13:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9TBDgDm014835; Fri, 29 Oct 2010 11:13:42 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9TBDgZZ014833; Fri, 29 Oct 2010 11:13:42 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201010291113.o9TBDgZZ014833@svn.freebsd.org> From: Gleb Smirnoff Date: Fri, 29 Oct 2010 11:13:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214509 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 11:13:42 -0000 Author: glebius Date: Fri Oct 29 11:13:42 2010 New Revision: 214509 URL: http://svn.freebsd.org/changeset/base/214509 Log: Remove meaningless XXXXX, that is a remain of comment, removed in r186200. Modified: head/sys/netinet/if_ether.c Modified: head/sys/netinet/if_ether.c ============================================================================== --- head/sys/netinet/if_ether.c Fri Oct 29 10:57:18 2010 (r214508) +++ head/sys/netinet/if_ether.c Fri Oct 29 11:13:42 2010 (r214509) @@ -291,8 +291,6 @@ arpresolve(struct ifnet *ifp, struct rte return (0); } } - /* XXXXX - */ retry: IF_AFDATA_RLOCK(ifp); la = lla_lookup(LLTABLE(ifp), flags, dst); From owner-svn-src-head@FreeBSD.ORG Fri Oct 29 11:00:25 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E8E041065673; Fri, 29 Oct 2010 11:00:25 +0000 (UTC) (envelope-from bruce@cran.org.uk) Received: from muon.cran.org.uk (muon.cran.org.uk [IPv6:2a01:348:0:15:5d59:5c40:0:1]) by mx1.freebsd.org (Postfix) with ESMTP id 767268FC17; Fri, 29 Oct 2010 11:00:25 +0000 (UTC) Received: from muon.cran.org.uk (localhost [127.0.0.1]) by muon.cran.org.uk (Postfix) with ESMTP id BCDFFE7746; Fri, 29 Oct 2010 12:00:24 +0100 (BST) Received: from unknown (client-81-107-142-135.midd.adsl.virginmedia.com [81.107.142.135]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by muon.cran.org.uk (Postfix) with ESMTPSA; Fri, 29 Oct 2010 12:00:23 +0100 (BST) Date: Fri, 29 Oct 2010 12:00:17 +0100 From: Bruce Cran To: Garrett Cooper Message-ID: <20101029120017.00003c98@unknown> In-Reply-To: References: <20101027212601.GA78062@freebsd.org> <4CC899C3.7040107@FreeBSD.org> <20101027214822.GA82697@freebsd.org> <4CC8A89D.5070909@delphij.net> <20101028152418.A916@besplex.bde.org> <20101028095538.24147119@ernst.jennejohn.org> <20101028182219.GA36559@freebsd.org> <20101028204849.GE46314@acme.spoerlein.net> X-Mailer: Claws Mail 3.7.6 (GTK+ 2.16.6; i586-pc-mingw32msvc) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Fri, 29 Oct 2010 11:23:29 +0000 Cc: Doug Barton , d@delphij.net, Ulrich =?ISO-8859-1?Q?Sp=F6rlein?= , Gary Jennejohn , src-committers@freebsd.org, Robert Watson , Bruce Evans , svn-src-head@freebsd.org, Alexander Best , svn-src-all@freebsd.org, Dag-Erling Smorgrav Subject: Re: svn commit: r214431 - head/bin/rm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 11:00:26 -0000 On Thu, 28 Oct 2010 14:11:14 -0700 Garrett Cooper wrote: > Unfortunately it's implied superficially by the 3 pass tort; but as > most people who understand magnetic disks know, unless you completely > obliterate a disk, wipe over it with random data enough times, > whatever, the content is still on the disk and retrievable via various > methods... I agree that this advice should be placed near the flag > itself so that people completely understand the implications of the > feature. I believe the only method 10-15 years ago would have been a scanning electron microscope, but that probably isn't possible with today's disks. Simply writing zeros once is enough to obliterate all the data (except for any remapped sectors). -- Bruce Cran From owner-svn-src-head@FreeBSD.ORG Fri Oct 29 11:10:19 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5D151106566C; Fri, 29 Oct 2010 11:10:19 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 26EDF8FC13; Fri, 29 Oct 2010 11:10:19 +0000 (UTC) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 9C41B46B0C; Fri, 29 Oct 2010 07:10:18 -0400 (EDT) Date: Fri, 29 Oct 2010 12:10:18 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Bruce Cran In-Reply-To: <20101029120017.00003c98@unknown> Message-ID: References: <20101027212601.GA78062@freebsd.org> <4CC899C3.7040107@FreeBSD.org> <20101027214822.GA82697@freebsd.org> <4CC8A89D.5070909@delphij.net> <20101028152418.A916@besplex.bde.org> <20101028095538.24147119@ernst.jennejohn.org> <20101028182219.GA36559@freebsd.org> <20101028204849.GE46314@acme.spoerlein.net> <20101029120017.00003c98@unknown> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Mailman-Approved-At: Fri, 29 Oct 2010 11:23:30 +0000 Cc: Doug Barton , d@delphij.net, =?ISO-8859-15?Q?Ulrich_Sp=F6rlein?= , Garrett Cooper , src-committers@freebsd.org, Bruce Evans , svn-src-head@freebsd.org, Alexander Best , Gary Jennejohn , svn-src-all@freebsd.org, Dag-Erling Smorgrav Subject: Re: svn commit: r214431 - head/bin/rm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 11:10:19 -0000 On Fri, 29 Oct 2010, Bruce Cran wrote: > On Thu, 28 Oct 2010 14:11:14 -0700 Garrett Cooper > wrote: > >> Unfortunately it's implied superficially by the 3 pass tort; but as most >> people who understand magnetic disks know, unless you completely obliterate >> a disk, wipe over it with random data enough times, whatever, the content >> is still on the disk and retrievable via various methods... I agree that >> this advice should be placed near the flag itself so that people completely >> understand the implications of the feature. > > I believe the only method 10-15 years ago would have been a scanning > electron microscope, but that probably isn't possible with today's disks. > Simply writing zeros once is enough to obliterate all the data (except for > any remapped sectors). Especially given modern magnetic disk densities. However, the problem with flash memory is quite interesting -- because of device wear-leveling. People who really care about forensic extraction of flash disks bypass the normal interface in order to (a) follow best practices on not powering on devices and (b) bypass the wear-levelling abstraction, revealing the underlying disk blocks and wear-levelling meta-data. As a result, they often have access to large numbers of believed-deleted and even believed-overwritten blocks (although how much depends on the algorithm, fill ratio, usage patterns, etc). Robert From owner-svn-src-head@FreeBSD.ORG Fri Oct 29 10:41:17 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CC2BE106564A; Fri, 29 Oct 2010 10:41:17 +0000 (UTC) (envelope-from alexander@leidinger.net) Received: from mail.ebusiness-leidinger.de (mail.ebusiness-leidinger.de [217.11.53.44]) by mx1.freebsd.org (Postfix) with ESMTP id 3D4138FC08; Fri, 29 Oct 2010 10:41:16 +0000 (UTC) Received: from outgoing.leidinger.net (p57B3A5FE.dip.t-dialin.net [87.179.165.254]) by mail.ebusiness-leidinger.de (Postfix) with ESMTPSA id C8E2C84400D; Fri, 29 Oct 2010 12:41:12 +0200 (CEST) Received: from webmail.leidinger.net (unknown [IPv6:fd73:10c7:2053:1::2:102]) by outgoing.leidinger.net (Postfix) with ESMTP id AE8C92403; Fri, 29 Oct 2010 12:41:04 +0200 (CEST) Received: (from www@localhost) by webmail.leidinger.net (8.14.4/8.13.8/Submit) id o9TAeI50090426; Fri, 29 Oct 2010 12:40:18 +0200 (CEST) (envelope-from Alexander@Leidinger.net) Received: from pslux.ec.europa.eu (pslux.ec.europa.eu [158.169.9.14]) by webmail.leidinger.net (Horde Framework) with HTTP; Fri, 29 Oct 2010 12:40:18 +0200 Message-ID: <20101029124018.584213anttm848lc@webmail.leidinger.net> Date: Fri, 29 Oct 2010 12:40:18 +0200 From: Alexander Leidinger To: Garrett Cooper References: <20101027212601.GA78062@freebsd.org> <4CC899C3.7040107@FreeBSD.org> <20101027214822.GA82697@freebsd.org> <4CC8A89D.5070909@delphij.net> <20101028152418.A916@besplex.bde.org> <20101028095538.24147119@ernst.jennejohn.org> <20101028182219.GA36559@freebsd.org> <20101028204849.GE46314@acme.spoerlein.net> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; DelSp="Yes"; format="flowed" Content-Disposition: inline Content-Transfer-Encoding: 7bit User-Agent: Dynamic Internet Messaging Program (DIMP) H3 (1.1.4) X-EBL-MailScanner-Information: Please contact the ISP for more information X-EBL-MailScanner-ID: C8E2C84400D.A9C7F X-EBL-MailScanner: Found to be clean X-EBL-MailScanner-SpamCheck: not spam, spamhaus-ZEN, SpamAssassin (not cached, score=1.351, required 6, autolearn=disabled, RDNS_NONE 1.27, TW_SV 0.08) X-EBL-MailScanner-SpamScore: s X-EBL-MailScanner-From: alexander@leidinger.net X-EBL-MailScanner-Watermark: 1288953674.03558@07xK7Cb12xpE8YCyOOTOWw X-EBL-Spam-Status: No X-Mailman-Approved-At: Fri, 29 Oct 2010 12:10:01 +0000 Cc: Doug Barton , d@delphij.net, Ulrich =?utf-8?b?U3DDtnJsZWlu?= , Gary Jennejohn , src-committers@FreeBSD.org, Robert Watson , Bruce Evans , svn-src-head@FreeBSD.org, Alexander Best , svn-src-all@FreeBSD.org, Dag-Erling Smorgrav Subject: Re: svn commit: r214431 - head/bin/rm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 10:41:18 -0000 Quoting Garrett Cooper (from Thu, 28 Oct 2010 14:11:14 -0700): > Unfortunately it's implied superficially by the 3 pass tort; but as > most people who understand magnetic disks know, unless you completely > obliterate a disk, wipe over it with random data enough times, > whatever, the content is still on the disk and retrievable via various > methods... Can you please elaborate? I've read somewhere that someone (some kind of computer magazine) made a test of this (yes, to much somewhere and someone, sorry). They took a full harddisk with random data (random as in pictures, music, ...) and overwrote it once with zeros and gave it to one (or several) data rescue companies. The result was that for a price which makes still sense to pay for a business (like a bank), only a fraction of data (as in non-zero bytes) was recoverable, and that none of the original files, and no useful sequence of data, was recovered. For myself I kept the info that I've did not read it at an untrusty place and that for any normal person (even with some malicious intent to remove traces of the existence of something) overwritting a harddisk one time completely is enough. Bye, Alexander. -- Christ died for our sins, so let's not disappoint Him. http://www.Leidinger.net Alexander @ Leidinger.net: PGP ID = B0063FE7 http://www.FreeBSD.org netchild @ FreeBSD.org : PGP ID = 72077137 From owner-svn-src-head@FreeBSD.ORG Fri Oct 29 13:31:11 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3A01E1065670; Fri, 29 Oct 2010 13:31:11 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0D5948FC16; Fri, 29 Oct 2010 13:31:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9TDVA9S027026; Fri, 29 Oct 2010 13:31:10 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9TDVAtm027022; Fri, 29 Oct 2010 13:31:10 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201010291331.o9TDVAtm027022@svn.freebsd.org> From: David Xu Date: Fri, 29 Oct 2010 13:31:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214510 - in head: include lib/libc/gen sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 13:31:11 -0000 Author: davidxu Date: Fri Oct 29 13:31:10 2010 New Revision: 214510 URL: http://svn.freebsd.org/changeset/base/214510 Log: Add sysctl kern.sched.cpusetsize to export the size of kernel cpuset, also add sysconf() key _SC_CPUSET_SIZE to get sysctl value. Submitted by: gcooper Modified: head/include/unistd.h head/lib/libc/gen/sysconf.c head/sys/kern/sched_ule.c Modified: head/include/unistd.h ============================================================================== --- head/include/unistd.h Fri Oct 29 11:13:42 2010 (r214509) +++ head/include/unistd.h Fri Oct 29 13:31:10 2010 (r214510) @@ -288,6 +288,7 @@ typedef __useconds_t useconds_t; #if __BSD_VISIBLE #define _SC_NPROCESSORS_CONF 57 #define _SC_NPROCESSORS_ONLN 58 +#define _SC_CPUSET_SIZE 122 #endif /* Extensions found in Solaris and Linux. */ Modified: head/lib/libc/gen/sysconf.c ============================================================================== --- head/lib/libc/gen/sysconf.c Fri Oct 29 11:13:42 2010 (r214509) +++ head/lib/libc/gen/sysconf.c Fri Oct 29 13:31:10 2010 (r214510) @@ -597,6 +597,15 @@ yesno: return (lvalue); #endif +#ifdef _SC_CPUSET_SIZE + case _SC_CPUSET_SIZE: + len = sizeof(lvalue); + if (sysctlbyname("kern.sched.cpusetsize", &lvalue, &len, NULL, + 0) == -1) + return (-1); + return (lvalue); +#endif + default: errno = EINVAL; return (-1); Modified: head/sys/kern/sched_ule.c ============================================================================== --- head/sys/kern/sched_ule.c Fri Oct 29 11:13:42 2010 (r214509) +++ head/sys/kern/sched_ule.c Fri Oct 29 13:31:10 2010 (r214510) @@ -2712,6 +2712,8 @@ sysctl_kern_sched_topology_spec(SYSCTL_H sbuf_delete(topo); return (err); } + +static size_t _kern_cpuset_size = sizeof(cpuset_t); #endif SYSCTL_NODE(_kern, OID_AUTO, sched, CTLFLAG_RW, 0, "Scheduler"); @@ -2748,6 +2750,15 @@ SYSCTL_INT(_kern_sched, OID_AUTO, steal_ SYSCTL_PROC(_kern_sched, OID_AUTO, topology_spec, CTLTYPE_STRING | CTLFLAG_RD, NULL, 0, sysctl_kern_sched_topology_spec, "A", "XML dump of detected CPU topology"); + +/* + * Return the size of cpuset_t at the kernel level + * + * XXX (gcooper): replace ULONG with SIZE once CTLTYPE_SIZE is implemented. + */ +SYSCTL_ULONG(_kern_sched, OID_AUTO, cpusetsize, CTLFLAG_RD, + &_kern_cpuset_size, 0, "Kernel-level cpuset_t struct size"); + #endif /* ps compat. All cpu percentages from ULE are weighted. */ From owner-svn-src-head@FreeBSD.ORG Fri Oct 29 13:34:57 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E51631065698; Fri, 29 Oct 2010 13:34:57 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D338A8FC2B; Fri, 29 Oct 2010 13:34:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9TDYvsN027313; Fri, 29 Oct 2010 13:34:57 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9TDYvG0027311; Fri, 29 Oct 2010 13:34:57 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201010291334.o9TDYvG0027311@svn.freebsd.org> From: Rick Macklem Date: Fri, 29 Oct 2010 13:34:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214511 - head/sys/fs/nfsclient X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 13:34:58 -0000 Author: rmacklem Date: Fri Oct 29 13:34:57 2010 New Revision: 214511 URL: http://svn.freebsd.org/changeset/base/214511 Log: Add a call for nfsrpc_close() to ncl_reclaim() in the experimental NFSv4 client, since the call in ncl_inactive() might be missed because VOP_INACTIVE() is not guaranteed to be called before VOP_RECLAIM(). MFC after: 1 week Modified: head/sys/fs/nfsclient/nfs_clnode.c Modified: head/sys/fs/nfsclient/nfs_clnode.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clnode.c Fri Oct 29 13:31:10 2010 (r214510) +++ head/sys/fs/nfsclient/nfs_clnode.c Fri Oct 29 13:34:57 2010 (r214511) @@ -236,6 +236,15 @@ ncl_reclaim(struct vop_reclaim_args *ap) if (prtactive && vrefcnt(vp) != 0) vprint("ncl_reclaim: pushing active", vp); + if (NFS_ISV4(vp) && vp->v_type == VREG) + /* + * Since mmap()'d files do I/O after VOP_CLOSE(), the NFSv4 + * Close operations are delayed until ncl_inactive(). + * However, since VOP_INACTIVE() is not guaranteed to be + * called, we need to do it again here. + */ + (void) nfsrpc_close(vp, 1, ap->a_td); + /* * If the NLM is running, give it a chance to abort pending * locks. From owner-svn-src-head@FreeBSD.ORG Fri Oct 29 13:42:19 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 68D88106564A; Fri, 29 Oct 2010 13:42:19 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 55D2E8FC12; Fri, 29 Oct 2010 13:42:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9TDgJIJ027787; Fri, 29 Oct 2010 13:42:19 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9TDgJnZ027780; Fri, 29 Oct 2010 13:42:19 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201010291342.o9TDgJnZ027780@svn.freebsd.org> From: Jilles Tjoelker Date: Fri, 29 Oct 2010 13:42:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214512 - in head: bin/sh tools/regression/bin/sh/expansion X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 13:42:19 -0000 Author: jilles Date: Fri Oct 29 13:42:18 2010 New Revision: 214512 URL: http://svn.freebsd.org/changeset/base/214512 Log: sh: Do IFS splitting on word in ${v+word} and ${v-word}. The code is inspired by NetBSD sh somewhat, but different because we preserve the old Almquist/Bourne/Korn ability to have an unquoted part in a quoted ${v+word}. For example, "${v-"*"}" expands to $v as a single field if v is set, but generates filenames otherwise. Note that this is the only place where we split text literally from the script (the similar ${v=word} assigns to v and then expands $v). The parser must now add additional markers to allow the expansion code to know whether arbitrary characters in substitutions are quoted. Example: for i in ${$+a b c}; do echo $i; done Exp-run done by: pav (with some other sh(1) changes) Added: head/tools/regression/bin/sh/expansion/plus-minus6.0 (contents, props changed) Modified: head/bin/sh/expand.c head/bin/sh/expand.h head/bin/sh/mksyntax.c head/bin/sh/parser.c head/bin/sh/parser.h Modified: head/bin/sh/expand.c ============================================================================== --- head/bin/sh/expand.c Fri Oct 29 13:34:57 2010 (r214511) +++ head/bin/sh/expand.c Fri Oct 29 13:42:18 2010 (r214512) @@ -216,7 +216,12 @@ argstr(char *p, int flag) char c; int quotes = flag & (EXP_FULL | EXP_CASE | EXP_REDIR); /* do CTLESC */ int firsteq = 1; + int split_lit; + int lit_quoted; + split_lit = flag & EXP_SPLIT_LIT; + lit_quoted = flag & EXP_LIT_QUOTED; + flag &= ~(EXP_SPLIT_LIT | EXP_LIT_QUOTED); if (*p == '~' && (flag & (EXP_TILDE | EXP_VARTILDE))) p = exptilde(p, flag); for (;;) { @@ -225,17 +230,25 @@ argstr(char *p, int flag) case CTLENDVAR: goto breakloop; case CTLQUOTEMARK: + lit_quoted = 1; /* "$@" syntax adherence hack */ if (p[0] == CTLVAR && p[2] == '@' && p[3] == '=') break; if ((flag & EXP_FULL) != 0) STPUTC(c, expdest); break; + case CTLQUOTEEND: + lit_quoted = 0; + break; case CTLESC: if (quotes) STPUTC(c, expdest); c = *p++; STPUTC(c, expdest); + if (split_lit && !lit_quoted) + recordregion(expdest - stackblock() - + (quotes ? 2 : 1), + expdest - stackblock(), 0); break; case CTLVAR: p = evalvar(p, flag); @@ -255,18 +268,21 @@ argstr(char *p, int flag) * assignments (after the first '=' and after ':'s). */ STPUTC(c, expdest); - if (flag & EXP_VARTILDE && *p == '~') { - if (c == '=') { - if (firsteq) - firsteq = 0; - else - break; - } + if (split_lit && !lit_quoted) + recordregion(expdest - stackblock() - 1, + expdest - stackblock(), 0); + if (flag & EXP_VARTILDE && *p == '~' && + (c != '=' || firsteq)) { + if (c == '=') + firsteq = 0; p = exptilde(p, flag); } break; default: STPUTC(c, expdest); + if (split_lit && !lit_quoted) + recordregion(expdest - stackblock() - 1, + expdest - stackblock(), 0); } } breakloop:; @@ -742,7 +758,8 @@ record: case VSPLUS: case VSMINUS: if (!set) { - argstr(p, flag); + argstr(p, flag | (flag & EXP_FULL ? EXP_SPLIT_LIT : 0) | + (varflags & VSQUOTE ? EXP_LIT_QUOTED : 0)); break; } if (easy) @@ -1495,13 +1512,13 @@ rmescapes(char *str) char *p, *q; p = str; - while (*p != CTLESC && *p != CTLQUOTEMARK) { + while (*p != CTLESC && *p != CTLQUOTEMARK && *p != CTLQUOTEEND) { if (*p++ == '\0') return; } q = p; while (*p) { - if (*p == CTLQUOTEMARK) { + if (*p == CTLQUOTEMARK || *p == CTLQUOTEEND) { p++; continue; } Modified: head/bin/sh/expand.h ============================================================================== --- head/bin/sh/expand.h Fri Oct 29 13:34:57 2010 (r214511) +++ head/bin/sh/expand.h Fri Oct 29 13:42:18 2010 (r214512) @@ -52,6 +52,8 @@ struct arglist { #define EXP_VARTILDE 0x4 /* expand tildes in an assignment */ #define EXP_REDIR 0x8 /* file glob for a redirection (1 match only) */ #define EXP_CASE 0x10 /* keeps quotes around for CASE pattern */ +#define EXP_SPLIT_LIT 0x20 /* IFS split literal text ${v+-a b c} */ +#define EXP_LIT_QUOTED 0x40 /* for EXP_SPLIT_LIT, start off quoted */ union node; Modified: head/bin/sh/mksyntax.c ============================================================================== --- head/bin/sh/mksyntax.c Fri Oct 29 13:34:57 2010 (r214511) +++ head/bin/sh/mksyntax.c Fri Oct 29 13:42:18 2010 (r214512) @@ -285,6 +285,7 @@ init(void) syntax[base + CTLARI] = "CCTL"; syntax[base + CTLENDARI] = "CCTL"; syntax[base + CTLQUOTEMARK] = "CCTL"; + syntax[base + CTLQUOTEEND] = "CCTL"; } Modified: head/bin/sh/parser.c ============================================================================== --- head/bin/sh/parser.c Fri Oct 29 13:34:57 2010 (r214511) +++ head/bin/sh/parser.c Fri Oct 29 13:42:18 2010 (r214512) @@ -1161,7 +1161,7 @@ readtoken1(int firstc, char const *initi loop: { /* for each line, until end of word */ CHECKEND(); /* set c to PEOF if at end of here document */ for (;;) { /* until end of line or end of word */ - CHECKSTRSPACE(3, out); /* permit 3 calls to USTPUTC */ + CHECKSTRSPACE(4, out); /* permit 4 calls to USTPUTC */ synentry = state[level].syntax[c]; @@ -1203,12 +1203,18 @@ readtoken1(int firstc, char const *initi newvarnest == 0)) && (c != '}' || state[level].category != TSTATE_VAR_OLD)) USTPUTC('\\', out); + if ((eofmark == NULL || + newvarnest > 0) && + state[level].syntax == BASESYNTAX) + USTPUTC(CTLQUOTEMARK, out); if (SQSYNTAX[c] == CCTL) USTPUTC(CTLESC, out); - else if (eofmark == NULL || - newvarnest > 0) - USTPUTC(CTLQUOTEMARK, out); USTPUTC(c, out); + if ((eofmark == NULL || + newvarnest > 0) && + state[level].syntax == BASESYNTAX && + state[level].category == TSTATE_VAR_OLD) + USTPUTC(CTLQUOTEEND, out); quotef++; } break; @@ -1224,6 +1230,8 @@ readtoken1(int firstc, char const *initi if (eofmark != NULL && newvarnest == 0) USTPUTC(c, out); else { + if (state[level].category == TSTATE_VAR_OLD) + USTPUTC(CTLQUOTEEND, out); state[level].syntax = BASESYNTAX; quotef++; } Modified: head/bin/sh/parser.h ============================================================================== --- head/bin/sh/parser.h Fri Oct 29 13:34:57 2010 (r214511) +++ head/bin/sh/parser.h Fri Oct 29 13:42:18 2010 (r214512) @@ -43,6 +43,7 @@ #define CTLARI '\206' #define CTLENDARI '\207' #define CTLQUOTEMARK '\210' +#define CTLQUOTEEND '\211' /* only for ${v+-...} */ /* variable substitution byte (follows CTLVAR) */ #define VSTYPE 0x0f /* type of variable substitution */ Added: head/tools/regression/bin/sh/expansion/plus-minus6.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/expansion/plus-minus6.0 Fri Oct 29 13:42:18 2010 (r214512) @@ -0,0 +1,34 @@ +# $FreeBSD$ + +failures=0 +unset LC_ALL +export LC_CTYPE=en_US.ISO8859-1 +nl=' +' +i=1 +set -f +while [ "$i" -le 255 ]; do + # A different byte still in the range 1..255. + i2=$((i^2+(i==2))) + # Add a character to work around command substitution's removal of + # final newlines, then remove it again. + c=$(printf \\"$(printf %o@ "$i")") + c=${c%@} + c2=$(printf \\"$(printf %o@ "$i2")") + c2=${c2%@} + case $c in + [\'$nl'$}();&|\"`']) c=M + esac + case $c2 in + [\'$nl'$}();&|\"`']) c2=N + esac + IFS=$c + command eval "set -- \${\$+$c2$c$c2$c$c2}" + if [ "$#" -ne 3 ] || [ "$1" != "$c2" ] || [ "$2" != "$c2" ] || + [ "$3" != "$c2" ]; then + echo "Bad results for separator $i (word $i2)" >&2 + : $((failures += 1)) + fi + i=$((i+1)) +done +exit $((failures > 0)) From owner-svn-src-head@FreeBSD.ORG Fri Oct 29 13:42:53 2010 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A88BC106566C; Fri, 29 Oct 2010 13:42:53 +0000 (UTC) (envelope-from mike@sentex.net) Received: from smarthost2.sentex.ca (smarthost2-6.sentex.ca [IPv6:2607:f3e0:80:80::2]) by mx1.freebsd.org (Postfix) with ESMTP id 93DC58FC20; Fri, 29 Oct 2010 13:42:52 +0000 (UTC) Received: from lava.sentex.ca (pyroxene.sentex.ca [199.212.134.18]) by smarthost2.sentex.ca (8.14.4/8.14.4) with ESMTP id o9TDgiYQ039344 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 29 Oct 2010 09:42:44 -0400 (EDT) (envelope-from mike@sentex.net) Received: from mdt-xp.sentex.net (simeon.sentex.ca [192.168.43.27]) by lava.sentex.ca (8.14.4/8.14.4) with ESMTP id o9TDggVQ062469; Fri, 29 Oct 2010 09:42:42 -0400 (EDT) (envelope-from mike@sentex.net) Message-Id: <201010291342.o9TDggVQ062469@lava.sentex.ca> X-Mailer: QUALCOMM Windows Eudora Version 7.1.0.9 Date: Fri, 29 Oct 2010 09:42:34 -0400 To: "Bjoern A. Zeeb" , Denis Ahrens From: Mike Tancsa In-Reply-To: <20101029013606.I66242@maildrop.int.zabbadoz.net> References: <0C099B90-AFB9-422F-AB75-AFC138A36D20@berlin.ccc.de> <20101029013606.I66242@maildrop.int.zabbadoz.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-Scanned-By: MIMEDefang 2.67 on 205.211.164.50 Cc: svn-src-head@FreeBSD.org, Randy Bush , Philipp =?iso-8859-1?Q?W=FCnsche?= Subject: Re: pending em0 commits for FreeBSD 8.1 STABLE X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 13:42:53 -0000 Actually, I dont think its an em bug as I can trigger this crash with the igb nic. Perhaps these are 2 different issues being hit ? Anyways, I tried with igb from HEAD in case there is some common code path between em and igb (2.0.1 vs 2.0.4). But the issue is still there In the netperf cluster its trivial to trigger this bug. Try this on camel and leopard1. Note bear1 is still on the console debugger as well in case you want to compare 2 different machines. camel1# route add -inet6 2607:f3e0:0:80::290 2607:f3e0:9::107 add host 2607:f3e0:0:80::290: gateway 2607:f3e0:9::107 camel1# Then start a ping on camel1. Then, with the ping is going, on leopard1 do an ifconfig em0 down. A few seconds later, the panic below camel1# ping6 offsite.sentex.ca PING6(56=40+8+8 bytes) 2607:f3e0:9::113 --> 2607:f3e0:0:80::290 16 bytes from 2607:f3e0:0:80::290, icmp_seq=0 hlim=60 time=3.988 ms 16 bytes from 2607:f3e0:0:80::290, icmp_seq=1 hlim=60 time=3.321 ms 16 bytes from 2607:f3e0:0:80::290, icmp_seq=2 hlim=60 time=3.834 ms 16 bytes from 2607:f3e0:0:80::290, icmp_seq=3 hlim=60 time=3.206 ms 16 bytes from 2607:f3e0:0:80::290, icmp_seq=4 hlim=60 time=3.076 ms 16 bytes from 2607:f3e0:0:80::290, icmp_seq=5 hlim=60 time=5.182 ms 16 bytes from 2607:f3e0:0:80::290, icmp_seq=6 hlim=60 time=3.437 ms 16 bytes from 2607:f3e0:0:80::290, icmp_seq=7 hlim=60 time=3.308 ms 16 bytes from 2607:f3e0:0:80::290, icmp_seq=8 hlim=60 time=3.555 ms 16 bytes from 2607:f3e0:0:80::290, icmp_seq=9 hlim=60 time=2.929 ms 16 bytes from 2607:f3e0:0:80::290, icmp_seq=10 hlim=60 time=3.903 ms 16 bytes from 2607:f3e0:0:80::290, icmp_seq=11 hlim=60 time=5.421 ms Fatal trap 9: general protection fault while in kernel mode cpuid = 0; apic id = 00 instruction pointer = 0x20:0xffffffff808950c6 stack pointer = 0x28:0xffffff800006e950 frame pointer = 0x28:0xffffff800006e9a0 code segment = base 0x0, limit 0xfffff, type 0x1b = DPL 0, pres 1, long 1, def32 0, gran 1 processor eflags = interrupt enabled, resume, IOPL = 0 current process = 12 (swi1: netisr 0) [thread pid 12 tid 100011 ] Stopped at bcopy+0x16: repe movsq (%rsi),%es:(%rdi) db> bt Tracing pid 12 tid 100011 td 0xffffff00024fd3e0 bcopy() at bcopy+0x16 ip6_input() at ip6_input+0x28f swi_net() at swi_net+0x151 intr_event_execute_handlers() at intr_event_execute_handlers+0x66 ithread_loop() at ithread_loop+0xb2 fork_exit() at fork_exit+0x12a fork_trampoline() at fork_trampoline+0xe --- trap 0, rip = 0, rsp = 0xffffff800006ed30, rbp = 0 --- db> and using the igb driver from HEAD Fatal trap 9: general protection fault while in kernel mode cpuid = 2; apic id = 06 instruction pointer = 0x20:0xffffffff80881506 stack pointer = 0x28:0xffffff800006e950 frame pointer = 0x28:0xffffff800006e9a0 code segment = base 0x0, limit 0xfffff, type 0x1b = DPL 0, pres 1, long 1, def32 0, gran 1 processor eflags = interrupt enabled, resume, IOPL = 0 current process = 12 (swi1: netisr 0) [thread pid 12 tid 100011 ] Stopped at bcopy+0x16: repe movsq (%rsi),%es:(%rdi) db> bt Tracing pid 12 tid 100011 td 0xffffff00024fd3e0 bcopy() at bcopy+0x16 ip6_input() at ip6_input+0x28f swi_net() at swi_net+0x151 intr_event_execute_handlers() at intr_event_execute_handlers+0x66 ithread_loop() at ithread_loop+0xb2 fork_exit() at fork_exit+0x12a fork_trampoline() at fork_trampoline+0xe --- trap 0, rip = 0, rsp = 0xffffff800006ed30, rbp = 0 --- db> -------------------------------------------------------------------- Mike Tancsa, tel +1 519 651 3400 Sentex Communications, mike@sentex.net Providing Internet since 1994 www.sentex.net Cambridge, Ontario Canada www.sentex.net/mike From owner-svn-src-head@FreeBSD.ORG Fri Oct 29 13:45:16 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 35BA710657BC; Fri, 29 Oct 2010 13:45:15 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 73CE18FC08; Fri, 29 Oct 2010 13:45:03 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 19DDA46B52; Fri, 29 Oct 2010 09:45:03 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id A7BE68A01D; Fri, 29 Oct 2010 09:45:00 -0400 (EDT) From: John Baldwin To: Attilio Rao Date: Fri, 29 Oct 2010 09:44:53 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100819; KDE/4.4.5; amd64; ; ) References: <201010281631.o9SGVdtZ014923@svn.freebsd.org> <201010281638.14043.jhb@freebsd.org> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201010290944.53628.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Fri, 29 Oct 2010 09:45:01 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.96.3 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-1.9 required=4.2 tests=BAYES_00 autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r214457 - in head/sys: amd64/amd64 conf i386/i386 x86/x86 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 13:45:16 -0000 On Thursday, October 28, 2010 8:25:38 pm Attilio Rao wrote: > 2010/10/28 John Baldwin : > > On Thursday, October 28, 2010 4:28:12 pm Attilio Rao wrote: > >> 2010/10/28 John Baldwin : > >> > On Thursday, October 28, 2010 1:21:34 pm Attilio Rao wrote: > >> >> 2010/10/28 John Baldwin : > >> >> > On Thursday, October 28, 2010 12:31:39 pm Attilio Rao wrote: > >> >> >> Author: attilio > >> >> >> Date: Thu Oct 28 16:31:39 2010 > >> >> >> New Revision: 214457 > >> >> >> URL: http://svn.freebsd.org/changeset/base/214457 > >> >> >> > >> >> >> Log: > >> >> >> Merge nexus.c from amd64 and i386 to x86 subtree. > >> >> >> > >> >> >> Sponsored by: Sandvine Incorporated > >> >> >> Tested by: gianni > >> >> >> > >> >> > > >> >> > It would be better to merge these two routines. The loader now passes > > the > >> >> > smap to i386 kernels as well, so ram_attach() should probably be > > changed to > >> >> > try the amd64 approach first and if that fails fall back to using the > >> >> > phys_avail[] array instead. > >> >> > >> >> What do you think about this patch?: > >> >> Index: nexus.c > >> >> =================================================================== > >> >> --- nexus.c (revision 214457) > >> >> +++ nexus.c (working copy) > >> >> @@ -52,9 +52,7 @@ > >> >> #include > >> >> #include > >> >> #include > >> >> -#ifdef __amd64__ > >> >> #include > >> >> -#endif > >> >> #include > >> >> #include > >> >> #include > >> >> @@ -67,12 +65,10 @@ > >> >> #include > >> >> #include > >> >> > >> >> -#ifdef __amd64__ > >> >> #include > >> >> -#include > >> >> -#endif > >> >> #include > >> >> #include > >> >> +#include > >> >> > >> >> #ifdef DEV_APIC > >> >> #include "pcib_if.h" > >> >> @@ -89,11 +85,13 @@ > >> >> #include > >> >> > >> >> #ifdef __amd64__ > >> >> -#define RMAN_BUS_SPACE_IO AMD64_BUS_SPACE_IO > >> >> -#define RMAN_BUS_SPACE_MEM AMD64_BUS_SPACE_MEM > >> >> +#define X86_BUS_SPACE_IO AMD64_BUS_SPACE_IO > >> >> +#define X86_BUS_SPACE_MEM AMD64_BUS_SPACE_MEM > >> >> +#define ELF_KERN_STR "elf64 kernel" > >> >> #else > >> >> -#define RMAN_BUS_SPACE_IO I386_BUS_SPACE_IO > >> >> -#define RMAN_BUS_SPACE_MEM I386_BUS_SPACE_MEM > >> >> +#define X86_BUS_SPACE_IO I386_BUS_SPACE_IO > >> >> +#define X86_BUS_SPACE_MEM I386_BUS_SPACE_MEM > >> >> +#define ELF_KERN_STR "elf32 kernel" > >> >> #endif > >> >> @@ -701,16 +699,11 @@ > >> >> panic("ram_attach: resource %d failed to attach", > > rid); > >> >> rid++; > >> >> } > >> >> - return (0); > >> >> -} > >> >> -#else > >> >> -static int > >> >> -ram_attach(device_t dev) > >> >> -{ > >> >> - struct resource *res; > >> >> - vm_paddr_t *p; > >> >> - int error, i, rid; > >> >> > >> >> + /* If at least one smap attached, return. */ > >> >> + if (rid != 0) > >> >> + return (0); > >> >> + > >> > > >> > Perhaps this instead: > >> > > >> > /* If we found an SMAP, return. */ > >> > if (smapbase != NULL) > >> > return (0); > >> > >> No, I don't think this check is right, smapbase will always be != NULL > >> (otherwise the code panics). > > > > Oh, that needs to be fixed then. It can be NULL on i386 with an old loader > > (or on a really old machine without an SMAP). The amd64 nexus code could > > assume it would never be NULL, but i386 cannot. > > > > It should probably more closely match what i386 does during the memory probe > > which is: > > > > kmdp = search("elf kernel"); > > if (kmdp == NULL) > > kmdp = search("elfXX kernel"); > > if (kmdp != NULL) > > smapbase = preload_search(...); > > else > > smapbase = NULL; > > if (smapbase != NULL) { > > for (smap = ...) { > > } > > > > return (0); > > } > > > > /* fall through to old i386 code using phys_avail[] */ > > This further patch should address your concerns about nexus.c: > Index: nexus.c > =================================================================== > --- nexus.c (revision 214457) > +++ nexus.c (working copy) > @@ -52,9 +52,7 @@ > #include > #include > #include > -#ifdef __amd64__ > #include > -#endif > #include > #include > #include > @@ -67,12 +65,10 @@ > #include > #include > > -#ifdef __amd64__ > #include > -#include > -#endif > #include > #include > +#include > > #ifdef DEV_APIC > #include "pcib_if.h" > @@ -89,13 +85,15 @@ > #include > > #ifdef __amd64__ > -#define RMAN_BUS_SPACE_IO AMD64_BUS_SPACE_IO > -#define RMAN_BUS_SPACE_MEM AMD64_BUS_SPACE_MEM > +#define BUS_SPACE_IO AMD64_BUS_SPACE_IO > +#define BUS_SPACE_MEM AMD64_BUS_SPACE_MEM > #else > -#define RMAN_BUS_SPACE_IO I386_BUS_SPACE_IO > -#define RMAN_BUS_SPACE_MEM I386_BUS_SPACE_MEM > +#define BUS_SPACE_IO I386_BUS_SPACE_IO > +#define BUS_SPACE_MEM I386_BUS_SPACE_MEM > #endif > > +#define ELF_KERN_STR ("elf"__XSTRING(__ELF_WORD_SIZE)" kernel") > + > static MALLOC_DEFINE(M_NEXUSDEV, "nexusdev", "Nexus device"); > > #define DEVTONX(dev) ((struct nexus_device *)device_get_ivars(dev)) > @@ -435,7 +433,7 @@ > #else > rman_set_bushandle(r, rman_get_start(r)); > #endif > - rman_set_bustag(r, RMAN_BUS_SPACE_IO); > + rman_set_bustag(r, BUS_SPACE_IO); > break; > case SYS_RES_MEMORY: > #ifdef PC98 > @@ -446,7 +444,7 @@ > #endif > vaddr = pmap_mapdev(rman_get_start(r), rman_get_size(r)); > rman_set_virtual(r, vaddr); > - rman_set_bustag(r, RMAN_BUS_SPACE_MEM); > + rman_set_bustag(r, BUS_SPACE_MEM); > #ifdef PC98 > /* PC-98: the type of bus_space_handle_t is the structure. */ > bh->bsh_base = (bus_addr_t) vaddr; > @@ -668,48 +666,45 @@ > return (0); > } > > -#ifdef __amd64__ > static int > ram_attach(device_t dev) > { > struct bios_smap *smapbase, *smap, *smapend; > struct resource *res; > + vm_paddr_t *p; > caddr_t kmdp; > uint32_t smapsize; > - int error, rid; > + int error, i, rid; > > /* Retrieve the system memory map from the loader. */ > kmdp = preload_search_by_type("elf kernel"); > if (kmdp == NULL) > - kmdp = preload_search_by_type("elf64 kernel"); > - smapbase = (struct bios_smap *)preload_search_info(kmdp, > - MODINFO_METADATA | MODINFOMD_SMAP); > - smapsize = *((u_int32_t *)smapbase - 1); > - smapend = (struct bios_smap *)((uintptr_t)smapbase + smapsize); > + kmdp = preload_search_by_type(ELF_KERN_STR); > + if (kmdp != NULL) { > + smapbase = (struct bios_smap *)preload_search_info(kmdp, > + MODINFO_METADATA | MODINFOMD_SMAP); > + smapsize = *((u_int32_t *)smapbase - 1); > + smapend = (struct bios_smap *)((uintptr_t)smapbase + smapsize); I think this doesn't check for the case that smapbase is NULL. I would expect kmdp to always be non-NULL in practice (it just means we have a kernel). However, the preload_search_info() can fail when booting on an old machine without an SMAP or an old loader that doesn't pass the SMAP to i386. Hence the i386 approach of: if (kmdp! = NULL) smapbase = preload_search_info(); else smapbase = NULL; if (smapbase != NULL) { ... } You could do this as: if (kmdp != NULL) { smapbase = preload_search_info(); if (smapbase != NULL) { smapsize = ...; ... } } It just causes the code to indent further. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Fri Oct 29 13:46:21 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D20961065698; Fri, 29 Oct 2010 13:46:21 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BFC668FC16; Fri, 29 Oct 2010 13:46:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9TDkLIc028097; Fri, 29 Oct 2010 13:46:21 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9TDkLrM028095; Fri, 29 Oct 2010 13:46:21 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201010291346.o9TDkLrM028095@svn.freebsd.org> From: Rick Macklem Date: Fri, 29 Oct 2010 13:46:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214513 - head/sys/fs/nfsclient X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 13:46:22 -0000 Author: rmacklem Date: Fri Oct 29 13:46:21 2010 New Revision: 214513 URL: http://svn.freebsd.org/changeset/base/214513 Log: Modify nfs_open() in the experimental NFS client to be compatible with the regular NFS client. Also, fix a couple of mutex lock issues. MFC after: 1 week Modified: head/sys/fs/nfsclient/nfs_clvnops.c Modified: head/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clvnops.c Fri Oct 29 13:42:18 2010 (r214512) +++ head/sys/fs/nfsclient/nfs_clvnops.c Fri Oct 29 13:46:21 2010 (r214513) @@ -494,24 +494,46 @@ nfs_open(struct vop_open_args *ap) * Now, if this Open will be doing reading, re-validate/flush the * cache, so that Close/Open coherency is maintained. */ - if ((fmode & FREAD) != 0 && - (!NFS_ISV4(vp) || nfscl_mustflush(vp) != 0)) { + mtx_lock(&np->n_mtx); + if (np->n_flag & NMODIFIED) { + mtx_unlock(&np->n_mtx); + error = ncl_vinvalbuf(vp, V_SAVE, ap->a_td, 1); + if (error == EINTR || error == EIO) { + if (NFS_ISV4(vp)) + (void) nfsrpc_close(vp, 0, ap->a_td); + return (error); + } mtx_lock(&np->n_mtx); - if (np->n_flag & NMODIFIED) { - mtx_unlock(&np->n_mtx); - error = ncl_vinvalbuf(vp, V_SAVE, ap->a_td, 1); - if (error == EINTR || error == EIO) { - if (NFS_ISV4(vp)) - (void) nfsrpc_close(vp, 0, ap->a_td); - return (error); - } - mtx_lock(&np->n_mtx); - np->n_attrstamp = 0; + np->n_attrstamp = 0; + if (vp->v_type == VDIR) + np->n_direofoffset = 0; + mtx_unlock(&np->n_mtx); + error = VOP_GETATTR(vp, &vattr, ap->a_cred); + if (error) { + if (NFS_ISV4(vp)) + (void) nfsrpc_close(vp, 0, ap->a_td); + return (error); + } + mtx_lock(&np->n_mtx); + np->n_mtime = vattr.va_mtime; + if (NFS_ISV4(vp)) + np->n_change = vattr.va_filerev; + } else { + mtx_unlock(&np->n_mtx); + error = VOP_GETATTR(vp, &vattr, ap->a_cred); + if (error) { + if (NFS_ISV4(vp)) + (void) nfsrpc_close(vp, 0, ap->a_td); + return (error); + } + mtx_lock(&np->n_mtx); + if ((NFS_ISV4(vp) && np->n_change != vattr.va_filerev) || + NFS_TIMESPEC_COMPARE(&np->n_mtime, &vattr.va_mtime)) { if (vp->v_type == VDIR) np->n_direofoffset = 0; mtx_unlock(&np->n_mtx); - error = VOP_GETATTR(vp, &vattr, ap->a_cred); - if (error) { + error = ncl_vinvalbuf(vp, V_SAVE, ap->a_td, 1); + if (error == EINTR || error == EIO) { if (NFS_ISV4(vp)) (void) nfsrpc_close(vp, 0, ap->a_td); return (error); @@ -520,42 +542,16 @@ nfs_open(struct vop_open_args *ap) np->n_mtime = vattr.va_mtime; if (NFS_ISV4(vp)) np->n_change = vattr.va_filerev; - mtx_unlock(&np->n_mtx); - } else { - mtx_unlock(&np->n_mtx); - error = VOP_GETATTR(vp, &vattr, ap->a_cred); - if (error) { - if (NFS_ISV4(vp)) - (void) nfsrpc_close(vp, 0, ap->a_td); - return (error); - } - mtx_lock(&np->n_mtx); - if ((NFS_ISV4(vp) && np->n_change != vattr.va_filerev) || - NFS_TIMESPEC_COMPARE(&np->n_mtime, &vattr.va_mtime)) { - if (vp->v_type == VDIR) - np->n_direofoffset = 0; - mtx_unlock(&np->n_mtx); - error = ncl_vinvalbuf(vp, V_SAVE, ap->a_td, 1); - if (error == EINTR || error == EIO) { - if (NFS_ISV4(vp)) - (void) nfsrpc_close(vp, 0, - ap->a_td); - return (error); - } - mtx_lock(&np->n_mtx); - np->n_mtime = vattr.va_mtime; - if (NFS_ISV4(vp)) - np->n_change = vattr.va_filerev; - } - mtx_unlock(&np->n_mtx); } } /* * If the object has >= 1 O_DIRECT active opens, we disable caching. */ - if (newnfs_directio_enable && (fmode & O_DIRECT) && (vp->v_type == VREG)) { + if (newnfs_directio_enable && (fmode & O_DIRECT) && + (vp->v_type == VREG)) { if (np->n_directio_opens == 0) { + mtx_unlock(&np->n_mtx); error = ncl_vinvalbuf(vp, V_SAVE, ap->a_td, 1); if (error) { if (NFS_ISV4(vp)) @@ -564,12 +560,10 @@ nfs_open(struct vop_open_args *ap) } mtx_lock(&np->n_mtx); np->n_flag |= NNONCACHE; - } else { - mtx_lock(&np->n_mtx); } np->n_directio_opens++; - mtx_unlock(&np->n_mtx); } + mtx_unlock(&np->n_mtx); vnode_create_vobject(vp, vattr.va_size, ap->a_td); return (0); } From owner-svn-src-head@FreeBSD.ORG Fri Oct 29 14:10:07 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1EF241065672 for ; Fri, 29 Oct 2010 14:10:07 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mail.cksoft.de (mail.cksoft.de [IPv6:2001:4068:10::3]) by mx1.freebsd.org (Postfix) with ESMTP id 98DD18FC16 for ; Fri, 29 Oct 2010 14:10:06 +0000 (UTC) Received: from localhost (amavis.fra.cksoft.de [192.168.74.71]) by mail.cksoft.de (Postfix) with ESMTP id 986C241C7CB; Fri, 29 Oct 2010 16:10:05 +0200 (CEST) X-Virus-Scanned: amavisd-new at cksoft.de Received: from mail.cksoft.de ([192.168.74.103]) by localhost (amavis.fra.cksoft.de [192.168.74.71]) (amavisd-new, port 10024) with ESMTP id nssX-RrwcSvb; Fri, 29 Oct 2010 16:10:05 +0200 (CEST) Received: by mail.cksoft.de (Postfix, from userid 66) id 31DE841C7C9; Fri, 29 Oct 2010 16:10:05 +0200 (CEST) Received: from maildrop.int.zabbadoz.net (maildrop.int.zabbadoz.net [10.111.66.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.int.zabbadoz.net (Postfix) with ESMTP id 5AC5D4448F3; Fri, 29 Oct 2010 14:06:25 +0000 (UTC) Date: Fri, 29 Oct 2010 14:06:24 +0000 (UTC) From: "Bjoern A. Zeeb" X-X-Sender: bz@maildrop.int.zabbadoz.net To: Mike Tancsa In-Reply-To: <201010291342.o9TDggVQ062469@lava.sentex.ca> Message-ID: <20101029135858.E66242@maildrop.int.zabbadoz.net> References: <0C099B90-AFB9-422F-AB75-AFC138A36D20@berlin.ccc.de> <20101029013606.I66242@maildrop.int.zabbadoz.net> <201010291342.o9TDggVQ062469@lava.sentex.ca> X-OpenPGP-Key: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: Denis Ahrens , svn-src-head@FreeBSD.org, Philipp =?iso-8859-1?Q?W=FCnsche?= , Randy Bush Subject: Re: pending em0 commits for FreeBSD 8.1 STABLE X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 14:10:07 -0000 On Fri, 29 Oct 2010, Mike Tancsa wrote: Hi Mike, > Actually, > I dont think its an em bug as I can trigger this crash with the igb > nic. Perhaps these are 2 different issues being hit ? Anyways, I tried with Yes what you have down there looks *sigh* hopefully like a different issue thought it mbuf fiddling again but way further up the stack. Could you please concentrate on only reproducing the if: discard frame w/o packet header issue rather than breaking things left and right as well? ;-) > igb from HEAD in case there is some common code path between em and igb > (2.0.1 vs 2.0.4). But the issue is still there > > In the netperf cluster its trivial to trigger this bug. Try this on camel and > leopard1. Note bear1 is still on the console debugger as well in case you > want to compare 2 different machines. I shall when returning home tonight. > camel1# route add -inet6 2607:f3e0:0:80::290 2607:f3e0:9::107 > add host 2607:f3e0:0:80::290: gateway 2607:f3e0:9::107 > camel1# > > Then start a ping on camel1. Then, with the ping is going, on leopard1 do an > ifconfig em0 down. A few seconds later, the panic below just to confirm, it's camel1 that paniced in this test, right? > ip6_input() at ip6_input+0x28f Could you look that up? feel free to reboot camel1. I would guess it's the MCLGET() in the code with the "L2 bridge ..." comment on top? Probably a m_clget() call if you look it up in gdb. /bz -- Bjoern A. Zeeb Welcome a new stage of life. Going to jail sucks -- All my daemons like it! http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/jails.html From owner-svn-src-head@FreeBSD.ORG Fri Oct 29 14:17:24 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D42291065672; Fri, 29 Oct 2010 14:17:24 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-qy0-f182.google.com (mail-qy0-f182.google.com [209.85.216.182]) by mx1.freebsd.org (Postfix) with ESMTP id 42E2B8FC12; Fri, 29 Oct 2010 14:17:23 +0000 (UTC) Received: by qyk2 with SMTP id 2so2110490qyk.13 for ; Fri, 29 Oct 2010 07:17:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=KdEu707QFwEZVYQJHFIjZ0jvM6iiLVY9Qub9ZjCi7lw=; b=UNWrHjafRAdV5F6+y7Fy9A0XlBTGgdXfgyd4Vf0+FRpUbrAI/ihXpCSkmQtU/TTnfV Vo3ZxViEbqRCqbA++dM1b84TpKcmU5GSBMtgpjgffG/Kr1EzMoyK1FWxlsw5QpRfd9cr ocsMKN1DdgTfnRyPalnTYohEa34eT59RxfMeE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=B9ZF1HYUwjIaCwcj5YYE313s8lZ3capCnOTQh286VHwoD6o7CUXAsdrQ/TCNz6yhyK GdIPkwan2uXFm4r6xkMDKZrm2vprQG+2FYQRwoqrQ9evDYKqU5ECY0a11GG366wt2NCm dM5QROebiy5qLnV0LF9xwb+TeC0YYIpKc+DJQ= MIME-Version: 1.0 Received: by 10.229.240.213 with SMTP id lb21mr11753797qcb.185.1288361843381; Fri, 29 Oct 2010 07:17:23 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.229.237.9 with HTTP; Fri, 29 Oct 2010 07:17:23 -0700 (PDT) In-Reply-To: <201010290944.53628.jhb@freebsd.org> References: <201010281631.o9SGVdtZ014923@svn.freebsd.org> <201010281638.14043.jhb@freebsd.org> <201010290944.53628.jhb@freebsd.org> Date: Fri, 29 Oct 2010 16:17:23 +0200 X-Google-Sender-Auth: _fNL_4Q-S5v50NB8uHPlnX_6f7U Message-ID: From: Attilio Rao To: John Baldwin Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r214457 - in head/sys: amd64/amd64 conf i386/i386 x86/x86 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 14:17:24 -0000 2010/10/29 John Baldwin : > On Thursday, October 28, 2010 8:25:38 pm Attilio Rao wrote: >> 2010/10/28 John Baldwin : >> > On Thursday, October 28, 2010 4:28:12 pm Attilio Rao wrote: >> >> 2010/10/28 John Baldwin : >> >> > On Thursday, October 28, 2010 1:21:34 pm Attilio Rao wrote: >> >> >> 2010/10/28 John Baldwin : >> >> >> > On Thursday, October 28, 2010 12:31:39 pm Attilio Rao wrote: >> >> >> >> Author: attilio >> >> >> >> Date: Thu Oct 28 16:31:39 2010 >> >> >> >> New Revision: 214457 >> >> >> >> URL: http://svn.freebsd.org/changeset/base/214457 >> >> >> >> >> >> >> >> Log: >> >> >> >> =C2=A0 Merge nexus.c from amd64 and i386 to x86 subtree. >> >> >> >> >> >> >> >> =C2=A0 Sponsored by: =C2=A0 =C2=A0 =C2=A0 Sandvine Incorporated >> >> >> >> =C2=A0 Tested by: =C2=A0gianni >> >> >> >> >> >> >> > >> >> >> > It would be better to merge these two routines. =C2=A0The loader= now passes >> > the >> >> >> > smap to i386 kernels as well, so ram_attach() should probably be >> > changed to >> >> >> > try the amd64 approach first and if that fails fall back to usin= g the >> >> >> > phys_avail[] array instead. >> >> >> >> >> >> What do you think about this patch?: >> >> >> Index: nexus.c >> >> >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> >> >> --- nexus.c =C2=A0 =C2=A0 (revision 214457) >> >> >> +++ nexus.c =C2=A0 =C2=A0 (working copy) >> >> >> @@ -52,9 +52,7 @@ >> >> >> =C2=A0#include >> >> >> =C2=A0#include >> >> >> =C2=A0#include >> >> >> -#ifdef __amd64__ >> >> >> =C2=A0#include >> >> >> -#endif >> >> >> =C2=A0#include >> >> >> =C2=A0#include >> >> >> =C2=A0#include >> >> >> @@ -67,12 +65,10 @@ >> >> >> =C2=A0#include >> >> >> =C2=A0#include >> >> >> >> >> >> -#ifdef __amd64__ >> >> >> =C2=A0#include >> >> >> -#include >> >> >> -#endif >> >> >> =C2=A0#include >> >> >> =C2=A0#include >> >> >> +#include >> >> >> >> >> >> =C2=A0#ifdef DEV_APIC >> >> >> =C2=A0#include "pcib_if.h" >> >> >> @@ -89,11 +85,13 @@ >> >> >> =C2=A0#include >> >> >> >> >> >> =C2=A0#ifdef __amd64__ >> >> >> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0RMAN_BUS_SPACE_IO =C2=A0 =C2= =A0 =C2=A0 AMD64_BUS_SPACE_IO >> >> >> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0RMAN_BUS_SPACE_MEM =C2=A0 =C2= =A0 =C2=A0AMD64_BUS_SPACE_MEM >> >> >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0X86_BUS_SPACE_IO =C2=A0 =C2=A0= =C2=A0 =C2=A0AMD64_BUS_SPACE_IO >> >> >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0X86_BUS_SPACE_MEM =C2=A0 =C2= =A0 =C2=A0 AMD64_BUS_SPACE_MEM >> >> >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0ELF_KERN_STR =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0"elf64 kernel" >> >> >> =C2=A0#else >> >> >> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0RMAN_BUS_SPACE_IO =C2=A0 =C2= =A0 =C2=A0 I386_BUS_SPACE_IO >> >> >> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0RMAN_BUS_SPACE_MEM =C2=A0 =C2= =A0 =C2=A0I386_BUS_SPACE_MEM >> >> >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0X86_BUS_SPACE_IO =C2=A0 =C2=A0= =C2=A0 =C2=A0I386_BUS_SPACE_IO >> >> >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0X86_BUS_SPACE_MEM =C2=A0 =C2= =A0 =C2=A0 I386_BUS_SPACE_MEM >> >> >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0ELF_KERN_STR =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0"elf32 kernel" >> >> >> =C2=A0#endif >> >> >> @@ -701,16 +699,11 @@ >> >> >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 panic("ram_attach: resource %d failed to attach", >> > rid); >> >> >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 rid++; >> >> >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 } >> >> >> - =C2=A0 =C2=A0 =C2=A0 return (0); >> >> >> -} >> >> >> -#else >> >> >> -static int >> >> >> -ram_attach(device_t dev) >> >> >> -{ >> >> >> - =C2=A0 =C2=A0 =C2=A0 struct resource *res; >> >> >> - =C2=A0 =C2=A0 =C2=A0 vm_paddr_t *p; >> >> >> - =C2=A0 =C2=A0 =C2=A0 int error, i, rid; >> >> >> >> >> >> + =C2=A0 =C2=A0 =C2=A0 /* If at least one smap attached, return. *= / >> >> >> + =C2=A0 =C2=A0 =C2=A0 if (rid !=3D 0) >> >> >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return (0); >> >> >> + >> >> > >> >> > Perhaps this instead: >> >> > >> >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0/* If we found an SMAP, return. */ >> >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0if (smapbase !=3D NULL) >> >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return (0); >> >> >> >> No, I don't think this check is right, smapbase will always be !=3D N= ULL >> >> (otherwise the code panics). >> > >> > Oh, that needs to be fixed then. =C2=A0It can be NULL on i386 with an = old loader >> > (or on a really old machine without an SMAP). =C2=A0The amd64 nexus co= de could >> > assume it would never be NULL, but i386 cannot. >> > >> > It should probably more closely match what i386 does during the memory= probe >> > which is: >> > >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0kmdp =3D search("elf kernel"); >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0if (kmdp =3D=3D NULL) >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0kmdp =3D search= ("elfXX kernel"); >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0if (kmdp !=3D NULL) >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0smapbase =3D pr= eload_search(...); >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0else >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0smapbase =3D NU= LL; >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0if (smapbase !=3D NULL) { >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0for (smap =3D .= ..) { >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0} >> > >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return (0); >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0} >> > >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0/* fall through to old i386 code using phys= _avail[] */ >> >> This further patch should address your concerns about nexus.c: >> Index: nexus.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> --- nexus.c =C2=A0 =C2=A0 (revision 214457) >> +++ nexus.c =C2=A0 =C2=A0 (working copy) >> @@ -52,9 +52,7 @@ >> =C2=A0#include >> =C2=A0#include >> =C2=A0#include >> -#ifdef __amd64__ >> =C2=A0#include >> -#endif >> =C2=A0#include >> =C2=A0#include >> =C2=A0#include >> @@ -67,12 +65,10 @@ >> =C2=A0#include >> =C2=A0#include >> >> -#ifdef __amd64__ >> =C2=A0#include >> -#include >> -#endif >> =C2=A0#include >> =C2=A0#include >> +#include >> >> =C2=A0#ifdef DEV_APIC >> =C2=A0#include "pcib_if.h" >> @@ -89,13 +85,15 @@ >> =C2=A0#include >> >> =C2=A0#ifdef __amd64__ >> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0RMAN_BUS_SPACE_IO =C2=A0 =C2=A0 =C2= =A0 AMD64_BUS_SPACE_IO >> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0RMAN_BUS_SPACE_MEM =C2=A0 =C2=A0 =C2= =A0AMD64_BUS_SPACE_MEM >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0BUS_SPACE_IO =C2=A0 =C2=A0AMD64_BUS_= SPACE_IO >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0BUS_SPACE_MEM =C2=A0 AMD64_BUS_SPACE= _MEM >> =C2=A0#else >> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0RMAN_BUS_SPACE_IO =C2=A0 =C2=A0 =C2= =A0 I386_BUS_SPACE_IO >> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0RMAN_BUS_SPACE_MEM =C2=A0 =C2=A0 =C2= =A0I386_BUS_SPACE_MEM >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0BUS_SPACE_IO =C2=A0 =C2=A0I386_BUS_S= PACE_IO >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0BUS_SPACE_MEM =C2=A0 I386_BUS_SPACE_= MEM >> =C2=A0#endif >> >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0ELF_KERN_STR =C2=A0 =C2=A0("elf"__XS= TRING(__ELF_WORD_SIZE)" kernel") >> + >> =C2=A0static MALLOC_DEFINE(M_NEXUSDEV, "nexusdev", "Nexus device"); >> >> =C2=A0#define DEVTONX(dev) =C2=A0 ((struct nexus_device *)device_get_iva= rs(dev)) >> @@ -435,7 +433,7 @@ >> =C2=A0#else >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 rman_set_bushand= le(r, rman_get_start(r)); >> =C2=A0#endif >> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 rman_set_bustag(r, RM= AN_BUS_SPACE_IO); >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 rman_set_bustag(r, BU= S_SPACE_IO); >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 break; >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 case SYS_RES_MEMORY: >> =C2=A0#ifdef PC98 >> @@ -446,7 +444,7 @@ >> =C2=A0#endif >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 vaddr =3D pmap_m= apdev(rman_get_start(r), rman_get_size(r)); >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 rman_set_virtual= (r, vaddr); >> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 rman_set_bustag(r, RM= AN_BUS_SPACE_MEM); >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 rman_set_bustag(r, BU= S_SPACE_MEM); >> =C2=A0#ifdef PC98 >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* PC-98: the ty= pe of bus_space_handle_t is the structure. */ >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 bh->bsh_base =3D= (bus_addr_t) vaddr; >> @@ -668,48 +666,45 @@ >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 return (0); >> =C2=A0} >> >> -#ifdef __amd64__ >> =C2=A0static int >> =C2=A0ram_attach(device_t dev) >> =C2=A0{ >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 struct bios_smap *smapbase, *smap, *smapend; >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 struct resource *res; >> + =C2=A0 =C2=A0 =C2=A0 vm_paddr_t *p; >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 caddr_t kmdp; >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 uint32_t smapsize; >> - =C2=A0 =C2=A0 =C2=A0 int error, rid; >> + =C2=A0 =C2=A0 =C2=A0 int error, i, rid; >> >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* Retrieve the system memory map from the l= oader. */ >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 kmdp =3D preload_search_by_type("elf kernel"= ); >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (kmdp =3D=3D NULL) >> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 kmdp =3D preload_sear= ch_by_type("elf64 kernel"); >> - =C2=A0 =C2=A0 =C2=A0 smapbase =3D (struct bios_smap *)preload_search_i= nfo(kmdp, >> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 MODINFO_METADATA | MODINFOMD_SMAP); >> - =C2=A0 =C2=A0 =C2=A0 smapsize =3D *((u_int32_t *)smapbase - 1); >> - =C2=A0 =C2=A0 =C2=A0 smapend =3D (struct bios_smap *)((uintptr_t)smapb= ase + smapsize); >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 kmdp =3D preload_sear= ch_by_type(ELF_KERN_STR); >> + =C2=A0 =C2=A0 =C2=A0 if (kmdp !=3D NULL) { >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 smapbase =3D (struct = bios_smap *)preload_search_info(kmdp, >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 MODINFO= _METADATA | MODINFOMD_SMAP); >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 smapsize =3D *((u_int= 32_t *)smapbase - 1); >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 smapend =3D (struct b= ios_smap *)((uintptr_t)smapbase + smapsize); > > I think this doesn't check for the case that smapbase is NULL. =C2=A0I wo= uld > expect kmdp to always be non-NULL in practice (it just means we have a > kernel). =C2=A0However, the preload_search_info() can fail when booting o= n an old > machine without an SMAP or an old loader that doesn't pass the SMAP to i3= 86. I don't understand where is the problem. smap is only used when it is consistent in that patch, otherwise it is not used and fallsthrough the physavail[] approach. It doesn't need to be set to NULL or checked. I guess that you want to patch the file and see how it looks like, will be easier to review than inline .diff, in this case. Attilio --=20 Peace can only be achieved by understanding - A. Einstein From owner-svn-src-head@FreeBSD.ORG Fri Oct 29 14:24:08 2010 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4FC6D1065672; Fri, 29 Oct 2010 14:24:08 +0000 (UTC) (envelope-from mike@sentex.net) Received: from smarthost2.sentex.ca (smarthost2-6.sentex.ca [IPv6:2607:f3e0:80:80::2]) by mx1.freebsd.org (Postfix) with ESMTP id DF1938FC0A; Fri, 29 Oct 2010 14:24:07 +0000 (UTC) Received: from lava.sentex.ca (pyroxene.sentex.ca [199.212.134.18]) by smarthost2.sentex.ca (8.14.4/8.14.4) with ESMTP id o9TENx81043800 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 29 Oct 2010 10:23:59 -0400 (EDT) (envelope-from mike@sentex.net) Received: from mdt-xp.sentex.net (simeon.sentex.ca [192.168.43.27]) by lava.sentex.ca (8.14.4/8.14.4) with ESMTP id o9TENwCi062683; Fri, 29 Oct 2010 10:23:58 -0400 (EDT) (envelope-from mike@sentex.net) Message-Id: <201010291423.o9TENwCi062683@lava.sentex.ca> X-Mailer: QUALCOMM Windows Eudora Version 7.1.0.9 Date: Fri, 29 Oct 2010 10:23:50 -0400 To: "Bjoern A. Zeeb" From: Mike Tancsa In-Reply-To: <20101029135858.E66242@maildrop.int.zabbadoz.net> References: <0C099B90-AFB9-422F-AB75-AFC138A36D20@berlin.ccc.de> <20101029013606.I66242@maildrop.int.zabbadoz.net> <201010291342.o9TDggVQ062469@lava.sentex.ca> <20101029135858.E66242@maildrop.int.zabbadoz.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-Scanned-By: MIMEDefang 2.67 on 205.211.164.50 Cc: Denis Ahrens , svn-src-head@FreeBSD.org, Philipp, =?iso-8859-1?Q?W=FCnsche?= , Randy Bush Subject: Re: pending em0 commits for FreeBSD 8.1 STABLE X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 14:24:08 -0000 At 10:06 AM 10/29/2010, Bjoern A. Zeeb wrote: >>Actually, >> I dont think its an em bug as I can trigger this crash with >> the igb nic. Perhaps these are 2 different issues being hit ? >> Anyways, I tried with > >Yes what you have down there looks *sigh* hopefully like a different >issue thought it mbuf fiddling again but way further up the stack. > >Could you please concentrate on only reproducing the > if: discard frame w/o packet header >issue rather than breaking things left and right as well? ;-) Hi Bjoern, I seem to be breaking of lot of things :( I was only able to once re-create the "discard frame w/o packet header" and unfortunately that was on zoo itself. I am going to try and setup another box so that zoo does not end up being the one to panic with that message. >just to confirm, it's camel1 that paniced in this test, right? Yes, camel1 >>ip6_input() at ip6_input+0x28f > >Could you look that up? feel free to reboot camel1. I would guess >it's the MCLGET() in the code with the "L2 bridge ..." comment on top? >Probably a m_clget() call if you look it up in gdb. > >/bz > >-- >Bjoern A. Zeeb Welcome a new stage of life. > Going to jail sucks -- All my daemons like it! > http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/jails.html -------------------------------------------------------------------- Mike Tancsa, tel +1 519 651 3400 Sentex Communications, mike@sentex.net Providing Internet since 1994 www.sentex.net Cambridge, Ontario Canada www.sentex.net/mike From owner-svn-src-head@FreeBSD.ORG Fri Oct 29 14:26:37 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4E9C1106564A; Fri, 29 Oct 2010 14:26:37 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 19B908FC23; Fri, 29 Oct 2010 14:26:37 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id B76A446B2E; Fri, 29 Oct 2010 10:26:36 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 6F5498A009; Fri, 29 Oct 2010 10:26:35 -0400 (EDT) From: John Baldwin To: Attilio Rao Date: Fri, 29 Oct 2010 10:26:19 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100819; KDE/4.4.5; amd64; ; ) References: <201010281631.o9SGVdtZ014923@svn.freebsd.org> <201010290944.53628.jhb@freebsd.org> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201010291026.20252.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Fri, 29 Oct 2010 10:26:35 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.96.3 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-1.9 required=4.2 tests=BAYES_00 autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r214457 - in head/sys: amd64/amd64 conf i386/i386 x86/x86 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 14:26:37 -0000 On Friday, October 29, 2010 10:17:23 am Attilio Rao wrote: > 2010/10/29 John Baldwin : > > On Thursday, October 28, 2010 8:25:38 pm Attilio Rao wrote: > >> 2010/10/28 John Baldwin : > >> > On Thursday, October 28, 2010 4:28:12 pm Attilio Rao wrote: > >> >> 2010/10/28 John Baldwin : > >> >> > On Thursday, October 28, 2010 1:21:34 pm Attilio Rao wrote: > >> >> >> 2010/10/28 John Baldwin : > >> >> >> > On Thursday, October 28, 2010 12:31:39 pm Attilio Rao wrote: > >> >> >> >> Author: attilio > >> >> >> >> Date: Thu Oct 28 16:31:39 2010 > >> >> >> >> New Revision: 214457 > >> >> >> >> URL: http://svn.freebsd.org/changeset/base/214457 > >> >> >> >> > >> >> >> >> Log: > >> >> >> >> Merge nexus.c from amd64 and i386 to x86 subtree. > >> >> >> >> > >> >> >> >> Sponsored by: Sandvine Incorporated > >> >> >> >> Tested by: gianni > >> >> >> >> > >> >> >> > > >> >> >> > It would be better to merge these two routines. The loader now passes > >> > the > >> >> >> > smap to i386 kernels as well, so ram_attach() should probably be > >> > changed to > >> >> >> > try the amd64 approach first and if that fails fall back to using the > >> >> >> > phys_avail[] array instead. > >> >> >> > >> >> >> What do you think about this patch?: > >> >> >> Index: nexus.c > >> >> >> =================================================================== > >> >> >> --- nexus.c (revision 214457) > >> >> >> +++ nexus.c (working copy) > >> >> >> @@ -52,9 +52,7 @@ > >> >> >> #include > >> >> >> #include > >> >> >> #include > >> >> >> -#ifdef __amd64__ > >> >> >> #include > >> >> >> -#endif > >> >> >> #include > >> >> >> #include > >> >> >> #include > >> >> >> @@ -67,12 +65,10 @@ > >> >> >> #include > >> >> >> #include > >> >> >> > >> >> >> -#ifdef __amd64__ > >> >> >> #include > >> >> >> -#include > >> >> >> -#endif > >> >> >> #include > >> >> >> #include > >> >> >> +#include > >> >> >> > >> >> >> #ifdef DEV_APIC > >> >> >> #include "pcib_if.h" > >> >> >> @@ -89,11 +85,13 @@ > >> >> >> #include > >> >> >> > >> >> >> #ifdef __amd64__ > >> >> >> -#define RMAN_BUS_SPACE_IO AMD64_BUS_SPACE_IO > >> >> >> -#define RMAN_BUS_SPACE_MEM AMD64_BUS_SPACE_MEM > >> >> >> +#define X86_BUS_SPACE_IO AMD64_BUS_SPACE_IO > >> >> >> +#define X86_BUS_SPACE_MEM AMD64_BUS_SPACE_MEM > >> >> >> +#define ELF_KERN_STR "elf64 kernel" > >> >> >> #else > >> >> >> -#define RMAN_BUS_SPACE_IO I386_BUS_SPACE_IO > >> >> >> -#define RMAN_BUS_SPACE_MEM I386_BUS_SPACE_MEM > >> >> >> +#define X86_BUS_SPACE_IO I386_BUS_SPACE_IO > >> >> >> +#define X86_BUS_SPACE_MEM I386_BUS_SPACE_MEM > >> >> >> +#define ELF_KERN_STR "elf32 kernel" > >> >> >> #endif > >> >> >> @@ -701,16 +699,11 @@ > >> >> >> panic("ram_attach: resource %d failed to attach", > >> > rid); > >> >> >> rid++; > >> >> >> } > >> >> >> - return (0); > >> >> >> -} > >> >> >> -#else > >> >> >> -static int > >> >> >> -ram_attach(device_t dev) > >> >> >> -{ > >> >> >> - struct resource *res; > >> >> >> - vm_paddr_t *p; > >> >> >> - int error, i, rid; > >> >> >> > >> >> >> + /* If at least one smap attached, return. */ > >> >> >> + if (rid != 0) > >> >> >> + return (0); > >> >> >> + > >> >> > > >> >> > Perhaps this instead: > >> >> > > >> >> > /* If we found an SMAP, return. */ > >> >> > if (smapbase != NULL) > >> >> > return (0); > >> >> > >> >> No, I don't think this check is right, smapbase will always be != NULL > >> >> (otherwise the code panics). > >> > > >> > Oh, that needs to be fixed then. It can be NULL on i386 with an old loader > >> > (or on a really old machine without an SMAP). The amd64 nexus code could > >> > assume it would never be NULL, but i386 cannot. > >> > > >> > It should probably more closely match what i386 does during the memory probe > >> > which is: > >> > > >> > kmdp = search("elf kernel"); > >> > if (kmdp == NULL) > >> > kmdp = search("elfXX kernel"); > >> > if (kmdp != NULL) > >> > smapbase = preload_search(...); > >> > else > >> > smapbase = NULL; > >> > if (smapbase != NULL) { > >> > for (smap = ...) { > >> > } > >> > > >> > return (0); > >> > } > >> > > >> > /* fall through to old i386 code using phys_avail[] */ > >> > >> This further patch should address your concerns about nexus.c: > >> Index: nexus.c > >> =================================================================== > >> --- nexus.c (revision 214457) > >> +++ nexus.c (working copy) > >> @@ -52,9 +52,7 @@ > >> #include > >> #include > >> #include > >> -#ifdef __amd64__ > >> #include > >> -#endif > >> #include > >> #include > >> #include > >> @@ -67,12 +65,10 @@ > >> #include > >> #include > >> > >> -#ifdef __amd64__ > >> #include > >> -#include > >> -#endif > >> #include > >> #include > >> +#include > >> > >> #ifdef DEV_APIC > >> #include "pcib_if.h" > >> @@ -89,13 +85,15 @@ > >> #include > >> > >> #ifdef __amd64__ > >> -#define RMAN_BUS_SPACE_IO AMD64_BUS_SPACE_IO > >> -#define RMAN_BUS_SPACE_MEM AMD64_BUS_SPACE_MEM > >> +#define BUS_SPACE_IO AMD64_BUS_SPACE_IO > >> +#define BUS_SPACE_MEM AMD64_BUS_SPACE_MEM > >> #else > >> -#define RMAN_BUS_SPACE_IO I386_BUS_SPACE_IO > >> -#define RMAN_BUS_SPACE_MEM I386_BUS_SPACE_MEM > >> +#define BUS_SPACE_IO I386_BUS_SPACE_IO > >> +#define BUS_SPACE_MEM I386_BUS_SPACE_MEM > >> #endif > >> > >> +#define ELF_KERN_STR ("elf"__XSTRING(__ELF_WORD_SIZE)" kernel") > >> + > >> static MALLOC_DEFINE(M_NEXUSDEV, "nexusdev", "Nexus device"); > >> > >> #define DEVTONX(dev) ((struct nexus_device *)device_get_ivars(dev)) > >> @@ -435,7 +433,7 @@ > >> #else > >> rman_set_bushandle(r, rman_get_start(r)); > >> #endif > >> - rman_set_bustag(r, RMAN_BUS_SPACE_IO); > >> + rman_set_bustag(r, BUS_SPACE_IO); > >> break; > >> case SYS_RES_MEMORY: > >> #ifdef PC98 > >> @@ -446,7 +444,7 @@ > >> #endif > >> vaddr = pmap_mapdev(rman_get_start(r), rman_get_size(r)); > >> rman_set_virtual(r, vaddr); > >> - rman_set_bustag(r, RMAN_BUS_SPACE_MEM); > >> + rman_set_bustag(r, BUS_SPACE_MEM); > >> #ifdef PC98 > >> /* PC-98: the type of bus_space_handle_t is the structure. */ > >> bh->bsh_base = (bus_addr_t) vaddr; > >> @@ -668,48 +666,45 @@ > >> return (0); > >> } > >> > >> -#ifdef __amd64__ > >> static int > >> ram_attach(device_t dev) > >> { > >> struct bios_smap *smapbase, *smap, *smapend; > >> struct resource *res; > >> + vm_paddr_t *p; > >> caddr_t kmdp; > >> uint32_t smapsize; > >> - int error, rid; > >> + int error, i, rid; > >> > >> /* Retrieve the system memory map from the loader. */ > >> kmdp = preload_search_by_type("elf kernel"); > >> if (kmdp == NULL) > >> - kmdp = preload_search_by_type("elf64 kernel"); > >> - smapbase = (struct bios_smap *)preload_search_info(kmdp, > >> - MODINFO_METADATA | MODINFOMD_SMAP); > >> - smapsize = *((u_int32_t *)smapbase - 1); > >> - smapend = (struct bios_smap *)((uintptr_t)smapbase + smapsize); > >> + kmdp = preload_search_by_type(ELF_KERN_STR); > >> + if (kmdp != NULL) { > >> + smapbase = (struct bios_smap *)preload_search_info(kmdp, > >> + MODINFO_METADATA | MODINFOMD_SMAP); > >> + smapsize = *((u_int32_t *)smapbase - 1); > >> + smapend = (struct bios_smap *)((uintptr_t)smapbase + smapsize); > > > > I think this doesn't check for the case that smapbase is NULL. I would > > expect kmdp to always be non-NULL in practice (it just means we have a > > kernel). However, the preload_search_info() can fail when booting on an old > > machine without an SMAP or an old loader that doesn't pass the SMAP to i386. > > I don't understand where is the problem. > smap is only used when it is consistent in that patch, otherwise it is > not used and fallsthrough the physavail[] approach. > It doesn't need to be set to NULL or checked. > > I guess that you want to patch the file and see how it looks like, > will be easier to review than inline .diff, in this case. The preload_search_info() can fail and return NULL (old machine with no SMAP or an older /boot/loader on i386). Then when you do this: smapsize = *((u_int32_t *)smapbase - 1); the kernel will panic. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Fri Oct 29 14:33:07 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0BF1D106566C; Fri, 29 Oct 2010 14:33:07 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-qy0-f175.google.com (mail-qy0-f175.google.com [209.85.216.175]) by mx1.freebsd.org (Postfix) with ESMTP id 6E5E28FC1C; Fri, 29 Oct 2010 14:33:06 +0000 (UTC) Received: by qyk7 with SMTP id 7so6047932qyk.13 for ; Fri, 29 Oct 2010 07:33:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=NysACTbN7FO+M4EyS0O/TPolq4ii6KadP0mgCfD+ChE=; b=buvDcUQeeJC7D+t1h1bet/H/vF8E2PEk3OtbHAEZ3KCRO0C22OBwKjxflQ2/Ni8/2N rxd36ag9A0t19oYPHIzKHhPJwMU5IIfXGDmEUR6GxdrgTY84a2e+sKwl/ABfjBXgE2Qi cWRGA0OTdRTK7veQnsBejm1uhasXP3x7kXjTA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=lX9V+DcxIT8s19Cdbs7DZCRgV9+qxKr7+nJhjxqonudkVEyCPgDxfx/SyhJMWlqk3o LsWeRTPVSrLwMQqkrA5npw434YCYyEwv02/Kg5lUXfCEDG9Q296Trtmmpfaa4tZzMsoi eQXJJulY3x/V26czAxYvzV8sNXF0JNk6UQ5TU= MIME-Version: 1.0 Received: by 10.229.97.68 with SMTP id k4mr11898523qcn.261.1288362785353; Fri, 29 Oct 2010 07:33:05 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.229.237.9 with HTTP; Fri, 29 Oct 2010 07:33:05 -0700 (PDT) In-Reply-To: <201010291026.20252.jhb@freebsd.org> References: <201010281631.o9SGVdtZ014923@svn.freebsd.org> <201010290944.53628.jhb@freebsd.org> <201010291026.20252.jhb@freebsd.org> Date: Fri, 29 Oct 2010 16:33:05 +0200 X-Google-Sender-Auth: VR4uMcgmy1x2_28q_oeCQktzVdg Message-ID: From: Attilio Rao To: John Baldwin Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r214457 - in head/sys: amd64/amd64 conf i386/i386 x86/x86 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 14:33:07 -0000 2010/10/29 John Baldwin : > On Friday, October 29, 2010 10:17:23 am Attilio Rao wrote: >> 2010/10/29 John Baldwin : >> > On Thursday, October 28, 2010 8:25:38 pm Attilio Rao wrote: >> >> 2010/10/28 John Baldwin : >> >> > On Thursday, October 28, 2010 4:28:12 pm Attilio Rao wrote: >> >> >> 2010/10/28 John Baldwin : >> >> >> > On Thursday, October 28, 2010 1:21:34 pm Attilio Rao wrote: >> >> >> >> 2010/10/28 John Baldwin : >> >> >> >> > On Thursday, October 28, 2010 12:31:39 pm Attilio Rao wrote: >> >> >> >> >> Author: attilio >> >> >> >> >> Date: Thu Oct 28 16:31:39 2010 >> >> >> >> >> New Revision: 214457 >> >> >> >> >> URL: http://svn.freebsd.org/changeset/base/214457 >> >> >> >> >> >> >> >> >> >> Log: >> >> >> >> >> =C2=A0 Merge nexus.c from amd64 and i386 to x86 subtree. >> >> >> >> >> >> >> >> >> >> =C2=A0 Sponsored by: =C2=A0 =C2=A0 =C2=A0 Sandvine Incorpora= ted >> >> >> >> >> =C2=A0 Tested by: =C2=A0gianni >> >> >> >> >> >> >> >> >> > >> >> >> >> > It would be better to merge these two routines. =C2=A0The loa= der now passes >> >> > the >> >> >> >> > smap to i386 kernels as well, so ram_attach() should probably= be >> >> > changed to >> >> >> >> > try the amd64 approach first and if that fails fall back to u= sing the >> >> >> >> > phys_avail[] array instead. >> >> >> >> >> >> >> >> What do you think about this patch?: >> >> >> >> Index: nexus.c >> >> >> >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> >> >> >> --- nexus.c =C2=A0 =C2=A0 (revision 214457) >> >> >> >> +++ nexus.c =C2=A0 =C2=A0 (working copy) >> >> >> >> @@ -52,9 +52,7 @@ >> >> >> >> =C2=A0#include >> >> >> >> =C2=A0#include >> >> >> >> =C2=A0#include >> >> >> >> -#ifdef __amd64__ >> >> >> >> =C2=A0#include >> >> >> >> -#endif >> >> >> >> =C2=A0#include >> >> >> >> =C2=A0#include >> >> >> >> =C2=A0#include >> >> >> >> @@ -67,12 +65,10 @@ >> >> >> >> =C2=A0#include >> >> >> >> =C2=A0#include >> >> >> >> >> >> >> >> -#ifdef __amd64__ >> >> >> >> =C2=A0#include >> >> >> >> -#include >> >> >> >> -#endif >> >> >> >> =C2=A0#include >> >> >> >> =C2=A0#include >> >> >> >> +#include >> >> >> >> >> >> >> >> =C2=A0#ifdef DEV_APIC >> >> >> >> =C2=A0#include "pcib_if.h" >> >> >> >> @@ -89,11 +85,13 @@ >> >> >> >> =C2=A0#include >> >> >> >> >> >> >> >> =C2=A0#ifdef __amd64__ >> >> >> >> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0RMAN_BUS_SPACE_IO =C2=A0 = =C2=A0 =C2=A0 AMD64_BUS_SPACE_IO >> >> >> >> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0RMAN_BUS_SPACE_MEM =C2=A0 = =C2=A0 =C2=A0AMD64_BUS_SPACE_MEM >> >> >> >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0X86_BUS_SPACE_IO =C2=A0 =C2= =A0 =C2=A0 =C2=A0AMD64_BUS_SPACE_IO >> >> >> >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0X86_BUS_SPACE_MEM =C2=A0 = =C2=A0 =C2=A0 AMD64_BUS_SPACE_MEM >> >> >> >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0ELF_KERN_STR =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0"elf64 kernel" >> >> >> >> =C2=A0#else >> >> >> >> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0RMAN_BUS_SPACE_IO =C2=A0 = =C2=A0 =C2=A0 I386_BUS_SPACE_IO >> >> >> >> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0RMAN_BUS_SPACE_MEM =C2=A0 = =C2=A0 =C2=A0I386_BUS_SPACE_MEM >> >> >> >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0X86_BUS_SPACE_IO =C2=A0 =C2= =A0 =C2=A0 =C2=A0I386_BUS_SPACE_IO >> >> >> >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0X86_BUS_SPACE_MEM =C2=A0 = =C2=A0 =C2=A0 I386_BUS_SPACE_MEM >> >> >> >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0ELF_KERN_STR =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0"elf32 kernel" >> >> >> >> =C2=A0#endif >> >> >> >> @@ -701,16 +699,11 @@ >> >> >> >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 panic("ram_attach: resource %d failed to attach", >> >> > rid); >> >> >> >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 rid++; >> >> >> >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 } >> >> >> >> - =C2=A0 =C2=A0 =C2=A0 return (0); >> >> >> >> -} >> >> >> >> -#else >> >> >> >> -static int >> >> >> >> -ram_attach(device_t dev) >> >> >> >> -{ >> >> >> >> - =C2=A0 =C2=A0 =C2=A0 struct resource *res; >> >> >> >> - =C2=A0 =C2=A0 =C2=A0 vm_paddr_t *p; >> >> >> >> - =C2=A0 =C2=A0 =C2=A0 int error, i, rid; >> >> >> >> >> >> >> >> + =C2=A0 =C2=A0 =C2=A0 /* If at least one smap attached, return= . */ >> >> >> >> + =C2=A0 =C2=A0 =C2=A0 if (rid !=3D 0) >> >> >> >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return (0); >> >> >> >> + >> >> >> > >> >> >> > Perhaps this instead: >> >> >> > >> >> >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0/* If we found an SMAP, return. */ >> >> >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0if (smapbase !=3D NULL) >> >> >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return (0= ); >> >> >> >> >> >> No, I don't think this check is right, smapbase will always be != =3D NULL >> >> >> (otherwise the code panics). >> >> > >> >> > Oh, that needs to be fixed then. =C2=A0It can be NULL on i386 with = an old loader >> >> > (or on a really old machine without an SMAP). =C2=A0The amd64 nexus= code could >> >> > assume it would never be NULL, but i386 cannot. >> >> > >> >> > It should probably more closely match what i386 does during the mem= ory probe >> >> > which is: >> >> > >> >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0kmdp =3D search("elf kernel"); >> >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0if (kmdp =3D=3D NULL) >> >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0kmdp =3D sea= rch("elfXX kernel"); >> >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0if (kmdp !=3D NULL) >> >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0smapbase =3D= preload_search(...); >> >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0else >> >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0smapbase =3D= NULL; >> >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0if (smapbase !=3D NULL) { >> >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0for (smap = =3D ...) { >> >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0} >> >> > >> >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return (0); >> >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0} >> >> > >> >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0/* fall through to old i386 code using p= hys_avail[] */ >> >> >> >> This further patch should address your concerns about nexus.c: >> >> Index: nexus.c >> >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> >> --- nexus.c =C2=A0 =C2=A0 (revision 214457) >> >> +++ nexus.c =C2=A0 =C2=A0 (working copy) >> >> @@ -52,9 +52,7 @@ >> >> =C2=A0#include >> >> =C2=A0#include >> >> =C2=A0#include >> >> -#ifdef __amd64__ >> >> =C2=A0#include >> >> -#endif >> >> =C2=A0#include >> >> =C2=A0#include >> >> =C2=A0#include >> >> @@ -67,12 +65,10 @@ >> >> =C2=A0#include >> >> =C2=A0#include >> >> >> >> -#ifdef __amd64__ >> >> =C2=A0#include >> >> -#include >> >> -#endif >> >> =C2=A0#include >> >> =C2=A0#include >> >> +#include >> >> >> >> =C2=A0#ifdef DEV_APIC >> >> =C2=A0#include "pcib_if.h" >> >> @@ -89,13 +85,15 @@ >> >> =C2=A0#include >> >> >> >> =C2=A0#ifdef __amd64__ >> >> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0RMAN_BUS_SPACE_IO =C2=A0 =C2=A0 = =C2=A0 AMD64_BUS_SPACE_IO >> >> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0RMAN_BUS_SPACE_MEM =C2=A0 =C2=A0 = =C2=A0AMD64_BUS_SPACE_MEM >> >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0BUS_SPACE_IO =C2=A0 =C2=A0AMD64_B= US_SPACE_IO >> >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0BUS_SPACE_MEM =C2=A0 AMD64_BUS_SP= ACE_MEM >> >> =C2=A0#else >> >> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0RMAN_BUS_SPACE_IO =C2=A0 =C2=A0 = =C2=A0 I386_BUS_SPACE_IO >> >> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0RMAN_BUS_SPACE_MEM =C2=A0 =C2=A0 = =C2=A0I386_BUS_SPACE_MEM >> >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0BUS_SPACE_IO =C2=A0 =C2=A0I386_BU= S_SPACE_IO >> >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0BUS_SPACE_MEM =C2=A0 I386_BUS_SPA= CE_MEM >> >> =C2=A0#endif >> >> >> >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0ELF_KERN_STR =C2=A0 =C2=A0("elf"_= _XSTRING(__ELF_WORD_SIZE)" kernel") >> >> + >> >> =C2=A0static MALLOC_DEFINE(M_NEXUSDEV, "nexusdev", "Nexus device"); >> >> >> >> =C2=A0#define DEVTONX(dev) =C2=A0 ((struct nexus_device *)device_get_= ivars(dev)) >> >> @@ -435,7 +433,7 @@ >> >> =C2=A0#else >> >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 rman_set_bush= andle(r, rman_get_start(r)); >> >> =C2=A0#endif >> >> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 rman_set_bustag(r,= RMAN_BUS_SPACE_IO); >> >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 rman_set_bustag(r,= BUS_SPACE_IO); >> >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 break; >> >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 case SYS_RES_MEMORY: >> >> =C2=A0#ifdef PC98 >> >> @@ -446,7 +444,7 @@ >> >> =C2=A0#endif >> >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 vaddr =3D pma= p_mapdev(rman_get_start(r), rman_get_size(r)); >> >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 rman_set_virt= ual(r, vaddr); >> >> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 rman_set_bustag(r,= RMAN_BUS_SPACE_MEM); >> >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 rman_set_bustag(r,= BUS_SPACE_MEM); >> >> =C2=A0#ifdef PC98 >> >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* PC-98: the= type of bus_space_handle_t is the structure. */ >> >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 bh->bsh_base = =3D (bus_addr_t) vaddr; >> >> @@ -668,48 +666,45 @@ >> >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 return (0); >> >> =C2=A0} >> >> >> >> -#ifdef __amd64__ >> >> =C2=A0static int >> >> =C2=A0ram_attach(device_t dev) >> >> =C2=A0{ >> >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 struct bios_smap *smapbase, *smap, *smape= nd; >> >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 struct resource *res; >> >> + =C2=A0 =C2=A0 =C2=A0 vm_paddr_t *p; >> >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 caddr_t kmdp; >> >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 uint32_t smapsize; >> >> - =C2=A0 =C2=A0 =C2=A0 int error, rid; >> >> + =C2=A0 =C2=A0 =C2=A0 int error, i, rid; >> >> >> >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* Retrieve the system memory map from th= e loader. */ >> >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 kmdp =3D preload_search_by_type("elf kern= el"); >> >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (kmdp =3D=3D NULL) >> >> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 kmdp =3D preload_s= earch_by_type("elf64 kernel"); >> >> - =C2=A0 =C2=A0 =C2=A0 smapbase =3D (struct bios_smap *)preload_searc= h_info(kmdp, >> >> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 MODINFO_METADATA | MODINFOMD_SMA= P); >> >> - =C2=A0 =C2=A0 =C2=A0 smapsize =3D *((u_int32_t *)smapbase - 1); >> >> - =C2=A0 =C2=A0 =C2=A0 smapend =3D (struct bios_smap *)((uintptr_t)sm= apbase + smapsize); >> >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 kmdp =3D preload_s= earch_by_type(ELF_KERN_STR); >> >> + =C2=A0 =C2=A0 =C2=A0 if (kmdp !=3D NULL) { >> >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 smapbase =3D (stru= ct bios_smap *)preload_search_info(kmdp, >> >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 MODI= NFO_METADATA | MODINFOMD_SMAP); >> >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 smapsize =3D *((u_= int32_t *)smapbase - 1); >> >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 smapend =3D (struc= t bios_smap *)((uintptr_t)smapbase + smapsize); >> > >> > I think this doesn't check for the case that smapbase is NULL. =C2=A0I= would >> > expect kmdp to always be non-NULL in practice (it just means we have a >> > kernel). =C2=A0However, the preload_search_info() can fail when bootin= g on an old >> > machine without an SMAP or an old loader that doesn't pass the SMAP to= i386. >> >> I don't understand where is the problem. >> smap is only used when it is consistent in that patch, otherwise it is >> not used and fallsthrough the physavail[] approach. >> It doesn't need to be set to NULL or checked. >> >> I guess that you want to patch the file and see how it looks like, >> will be easier to review than inline .diff, in this case. > > The preload_search_info() can fail and return NULL (old machine with no S= MAP > or an older /boot/loader on i386). =C2=A0Then when you do this: > > =C2=A0 =C2=A0 =C2=A0 =C2=A0smapsize =3D *((u_int32_t *)smapbase - 1); > > the kernel will panic. Ah, I thought that it could be failing only with a NULL kmdp. That patch should fix it then: Index: nexus.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- nexus.c (revision 214457) +++ nexus.c (working copy) @@ -52,9 +52,7 @@ #include #include #include -#ifdef __amd64__ #include -#endif #include #include #include @@ -67,12 +65,10 @@ #include #include -#ifdef __amd64__ #include -#include -#endif #include #include +#include #ifdef DEV_APIC #include "pcib_if.h" @@ -89,13 +85,15 @@ #include #ifdef __amd64__ -#define RMAN_BUS_SPACE_IO AMD64_BUS_SPACE_IO -#define RMAN_BUS_SPACE_MEM AMD64_BUS_SPACE_MEM +#define BUS_SPACE_IO AMD64_BUS_SPACE_IO +#define BUS_SPACE_MEM AMD64_BUS_SPACE_MEM #else -#define RMAN_BUS_SPACE_IO I386_BUS_SPACE_IO -#define RMAN_BUS_SPACE_MEM I386_BUS_SPACE_MEM +#define BUS_SPACE_IO I386_BUS_SPACE_IO +#define BUS_SPACE_MEM I386_BUS_SPACE_MEM #endif +#define ELF_KERN_STR ("elf"__XSTRING(__ELF_WORD_SIZE)" kernel") + static MALLOC_DEFINE(M_NEXUSDEV, "nexusdev", "Nexus device"); #define DEVTONX(dev) ((struct nexus_device *)device_get_ivars(dev)) @@ -435,7 +433,7 @@ #else rman_set_bushandle(r, rman_get_start(r)); #endif - rman_set_bustag(r, RMAN_BUS_SPACE_IO); + rman_set_bustag(r, BUS_SPACE_IO); break; case SYS_RES_MEMORY: #ifdef PC98 @@ -446,7 +444,7 @@ #endif vaddr =3D pmap_mapdev(rman_get_start(r), rman_get_size(r)); rman_set_virtual(r, vaddr); - rman_set_bustag(r, RMAN_BUS_SPACE_MEM); + rman_set_bustag(r, BUS_SPACE_MEM); #ifdef PC98 /* PC-98: the type of bus_space_handle_t is the structure. = */ bh->bsh_base =3D (bus_addr_t) vaddr; @@ -668,48 +666,48 @@ return (0); } -#ifdef __amd64__ static int ram_attach(device_t dev) { struct bios_smap *smapbase, *smap, *smapend; struct resource *res; + vm_paddr_t *p; caddr_t kmdp; uint32_t smapsize; - int error, rid; + int error, i, rid; /* Retrieve the system memory map from the loader. */ kmdp =3D preload_search_by_type("elf kernel"); if (kmdp =3D=3D NULL) - kmdp =3D preload_search_by_type("elf64 kernel"); - smapbase =3D (struct bios_smap *)preload_search_info(kmdp, - MODINFO_METADATA | MODINFOMD_SMAP); - smapsize =3D *((u_int32_t *)smapbase - 1); - smapend =3D (struct bios_smap *)((uintptr_t)smapbase + smapsize); + kmdp =3D preload_search_by_type(ELF_KERN_STR); + if (kmdp !=3D NULL) + smapbase =3D (struct bios_smap *)preload_search_info(kmdp, + MODINFO_METADATA | MODINFOMD_SMAP); + else + smapbase =3D NULL; + if (smapbase !=3D NULL) { + smapsize =3D *((u_int32_t *)smapbase - 1); + smapend =3D (struct bios_smap *)((uintptr_t)smapbase + smap= size); - rid =3D 0; - for (smap =3D smapbase; smap < smapend; smap++) { - if (smap->type !=3D SMAP_TYPE_MEMORY || smap->length =3D=3D= 0) - continue; - error =3D bus_set_resource(dev, SYS_RES_MEMORY, rid, smap->= base, - smap->length); - if (error) - panic("ram_attach: resource %d failed set with %d",= rid, - error); - res =3D bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, 0= ); - if (res =3D=3D NULL) - panic("ram_attach: resource %d failed to attach", r= id); - rid++; + rid =3D 0; + for (smap =3D smapbase; smap < smapend; smap++) { + if (smap->type !=3D SMAP_TYPE_MEMORY || + smap->length =3D=3D 0) + continue; + error =3D bus_set_resource(dev, SYS_RES_MEMORY, rid= , + smap->base, smap->length); + if (error) + panic("ram_attach: resource %d failed set with %d", + rid, error); + res =3D bus_alloc_resource_any(dev, SYS_RES_MEMORY,= &rid, + 0); + if (res =3D=3D NULL) + panic("ram_attach: resource %d failed to attach", + rid); + rid++; + } + return (0); } - return (0); -} -#else -static int -ram_attach(device_t dev) -{ - struct resource *res; - vm_paddr_t *p; - int error, i, rid; /* * We use the dump_avail[] array rather than phys_avail[] for @@ -743,7 +741,6 @@ } return (0); } -#endif static device_method_t ram_methods[] =3D { /* Device interface */ From owner-svn-src-head@FreeBSD.ORG Fri Oct 29 15:03:29 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CF7E3106566B; Fri, 29 Oct 2010 15:03:29 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BDA668FC17; Fri, 29 Oct 2010 15:03:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9TF3T1Y034168; Fri, 29 Oct 2010 15:03:29 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9TF3T7I034166; Fri, 29 Oct 2010 15:03:29 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201010291503.o9TF3T7I034166@svn.freebsd.org> From: Jaakko Heinonen Date: Fri, 29 Oct 2010 15:03:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214514 - head/lib/libc/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 15:03:29 -0000 Author: jh Date: Fri Oct 29 15:03:29 2010 New Revision: 214514 URL: http://svn.freebsd.org/changeset/base/214514 Log: - Note that non-superusers are not allowed to set the SF_ARCHIVED flag. [1] - Note that also fchflags(2) will return EPERM for attempts to set or unset the SF_SNAPSHOT flag. Submitted by: Garrett Cooper [1] MFC after: 1 week Modified: head/lib/libc/sys/chflags.2 Modified: head/lib/libc/sys/chflags.2 ============================================================================== --- head/lib/libc/sys/chflags.2 Fri Oct 29 13:46:21 2010 (r214513) +++ head/lib/libc/sys/chflags.2 Fri Oct 29 15:03:29 2010 (r214514) @@ -28,7 +28,7 @@ .\" @(#)chflags.2 8.3 (Berkeley) 5/2/95 .\" $FreeBSD$ .\" -.Dd May 16, 2006 +.Dd Oct 29, 2010 .Dt CHFLAGS 2 .Os .Sh NAME @@ -155,7 +155,7 @@ is set and the user is either not the su securelevel is greater than 0. .It Bq Er EPERM A non-super-user tries to set one of -.Dv SF_IMMUTABLE , SF_APPEND , +.Dv SF_ARCHIVED , SF_IMMUTABLE , SF_APPEND , or .Dv SF_NOUNLINK . .It Bq Er EPERM @@ -200,9 +200,13 @@ is set and the user is either not the su securelevel is greater than 0. .It Bq Er EPERM A non-super-user tries to set one of -.Dv SF_IMMUTABLE , SF_APPEND , +.Dv SF_ARCHIVED , SF_IMMUTABLE , SF_APPEND , or .Dv SF_NOUNLINK . +.It Bq Er EPERM +User tries to set or remove the +.Dv SF_SNAPSHOT +flag. .It Bq Er EROFS The file resides on a read-only file system. .It Bq Er EIO From owner-svn-src-head@FreeBSD.ORG Fri Oct 29 17:06:01 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C89EF1065675; Fri, 29 Oct 2010 17:06:01 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 852BE8FC19; Fri, 29 Oct 2010 17:06:01 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 0879D46B37; Fri, 29 Oct 2010 13:06:01 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id BD5EB8A009; Fri, 29 Oct 2010 13:05:59 -0400 (EDT) From: John Baldwin To: Attilio Rao Date: Fri, 29 Oct 2010 13:02:08 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100819; KDE/4.4.5; amd64; ; ) References: <201010281631.o9SGVdtZ014923@svn.freebsd.org> <201010291026.20252.jhb@freebsd.org> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201010291302.08687.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Fri, 29 Oct 2010 13:05:59 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.96.3 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-1.9 required=4.2 tests=BAYES_00 autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r214457 - in head/sys: amd64/amd64 conf i386/i386 x86/x86 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 17:06:01 -0000 On Friday, October 29, 2010 10:33:05 am Attilio Rao wrote: > 2010/10/29 John Baldwin : > > On Friday, October 29, 2010 10:17:23 am Attilio Rao wrote: > >> 2010/10/29 John Baldwin : > >> > On Thursday, October 28, 2010 8:25:38 pm Attilio Rao wrote: > >> >> 2010/10/28 John Baldwin : > >> >> > On Thursday, October 28, 2010 4:28:12 pm Attilio Rao wrote: > >> >> >> 2010/10/28 John Baldwin : > >> >> >> > On Thursday, October 28, 2010 1:21:34 pm Attilio Rao wrote: > >> >> >> >> 2010/10/28 John Baldwin : > >> >> >> >> > On Thursday, October 28, 2010 12:31:39 pm Attilio Rao wrote: > >> >> >> >> >> Author: attilio > >> >> >> >> >> Date: Thu Oct 28 16:31:39 2010 > >> >> >> >> >> New Revision: 214457 > >> >> >> >> >> URL: http://svn.freebsd.org/changeset/base/214457 > >> >> >> >> >> > >> >> >> >> >> Log: > >> >> >> >> >> Merge nexus.c from amd64 and i386 to x86 subtree. > >> >> >> >> >> > >> >> >> >> >> Sponsored by: Sandvine Incorporated > >> >> >> >> >> Tested by: gianni > >> >> >> >> >> > >> >> >> >> > > >> >> >> >> > It would be better to merge these two routines. The loader now passes > >> >> > the > >> >> >> >> > smap to i386 kernels as well, so ram_attach() should probably be > >> >> > changed to > >> >> >> >> > try the amd64 approach first and if that fails fall back to using the > >> >> >> >> > phys_avail[] array instead. > >> >> >> >> > >> >> >> >> What do you think about this patch?: > >> >> >> >> Index: nexus.c > >> >> >> >> =================================================================== > >> >> >> >> --- nexus.c (revision 214457) > >> >> >> >> +++ nexus.c (working copy) > >> >> >> >> @@ -52,9 +52,7 @@ > >> >> >> >> #include > >> >> >> >> #include > >> >> >> >> #include > >> >> >> >> -#ifdef __amd64__ > >> >> >> >> #include > >> >> >> >> -#endif > >> >> >> >> #include > >> >> >> >> #include > >> >> >> >> #include > >> >> >> >> @@ -67,12 +65,10 @@ > >> >> >> >> #include > >> >> >> >> #include > >> >> >> >> > >> >> >> >> -#ifdef __amd64__ > >> >> >> >> #include > >> >> >> >> -#include > >> >> >> >> -#endif > >> >> >> >> #include > >> >> >> >> #include > >> >> >> >> +#include > >> >> >> >> > >> >> >> >> #ifdef DEV_APIC > >> >> >> >> #include "pcib_if.h" > >> >> >> >> @@ -89,11 +85,13 @@ > >> >> >> >> #include > >> >> >> >> > >> >> >> >> #ifdef __amd64__ > >> >> >> >> -#define RMAN_BUS_SPACE_IO AMD64_BUS_SPACE_IO > >> >> >> >> -#define RMAN_BUS_SPACE_MEM AMD64_BUS_SPACE_MEM > >> >> >> >> +#define X86_BUS_SPACE_IO AMD64_BUS_SPACE_IO > >> >> >> >> +#define X86_BUS_SPACE_MEM AMD64_BUS_SPACE_MEM > >> >> >> >> +#define ELF_KERN_STR "elf64 kernel" > >> >> >> >> #else > >> >> >> >> -#define RMAN_BUS_SPACE_IO I386_BUS_SPACE_IO > >> >> >> >> -#define RMAN_BUS_SPACE_MEM I386_BUS_SPACE_MEM > >> >> >> >> +#define X86_BUS_SPACE_IO I386_BUS_SPACE_IO > >> >> >> >> +#define X86_BUS_SPACE_MEM I386_BUS_SPACE_MEM > >> >> >> >> +#define ELF_KERN_STR "elf32 kernel" > >> >> >> >> #endif > >> >> >> >> @@ -701,16 +699,11 @@ > >> >> >> >> panic("ram_attach: resource %d failed to attach", > >> >> > rid); > >> >> >> >> rid++; > >> >> >> >> } > >> >> >> >> - return (0); > >> >> >> >> -} > >> >> >> >> -#else > >> >> >> >> -static int > >> >> >> >> -ram_attach(device_t dev) > >> >> >> >> -{ > >> >> >> >> - struct resource *res; > >> >> >> >> - vm_paddr_t *p; > >> >> >> >> - int error, i, rid; > >> >> >> >> > >> >> >> >> + /* If at least one smap attached, return. */ > >> >> >> >> + if (rid != 0) > >> >> >> >> + return (0); > >> >> >> >> + > >> >> >> > > >> >> >> > Perhaps this instead: > >> >> >> > > >> >> >> > /* If we found an SMAP, return. */ > >> >> >> > if (smapbase != NULL) > >> >> >> > return (0); > >> >> >> > >> >> >> No, I don't think this check is right, smapbase will always be != NULL > >> >> >> (otherwise the code panics). > >> >> > > >> >> > Oh, that needs to be fixed then. It can be NULL on i386 with an old loader > >> >> > (or on a really old machine without an SMAP). The amd64 nexus code could > >> >> > assume it would never be NULL, but i386 cannot. > >> >> > > >> >> > It should probably more closely match what i386 does during the memory probe > >> >> > which is: > >> >> > > >> >> > kmdp = search("elf kernel"); > >> >> > if (kmdp == NULL) > >> >> > kmdp = search("elfXX kernel"); > >> >> > if (kmdp != NULL) > >> >> > smapbase = preload_search(...); > >> >> > else > >> >> > smapbase = NULL; > >> >> > if (smapbase != NULL) { > >> >> > for (smap = ...) { > >> >> > } > >> >> > > >> >> > return (0); > >> >> > } > >> >> > > >> >> > /* fall through to old i386 code using phys_avail[] */ > >> >> > >> >> This further patch should address your concerns about nexus.c: > >> >> Index: nexus.c > >> >> =================================================================== > >> >> --- nexus.c (revision 214457) > >> >> +++ nexus.c (working copy) > >> >> @@ -52,9 +52,7 @@ > >> >> #include > >> >> #include > >> >> #include > >> >> -#ifdef __amd64__ > >> >> #include > >> >> -#endif > >> >> #include > >> >> #include > >> >> #include > >> >> @@ -67,12 +65,10 @@ > >> >> #include > >> >> #include > >> >> > >> >> -#ifdef __amd64__ > >> >> #include > >> >> -#include > >> >> -#endif > >> >> #include > >> >> #include > >> >> +#include > >> >> > >> >> #ifdef DEV_APIC > >> >> #include "pcib_if.h" > >> >> @@ -89,13 +85,15 @@ > >> >> #include > >> >> > >> >> #ifdef __amd64__ > >> >> -#define RMAN_BUS_SPACE_IO AMD64_BUS_SPACE_IO > >> >> -#define RMAN_BUS_SPACE_MEM AMD64_BUS_SPACE_MEM > >> >> +#define BUS_SPACE_IO AMD64_BUS_SPACE_IO > >> >> +#define BUS_SPACE_MEM AMD64_BUS_SPACE_MEM > >> >> #else > >> >> -#define RMAN_BUS_SPACE_IO I386_BUS_SPACE_IO > >> >> -#define RMAN_BUS_SPACE_MEM I386_BUS_SPACE_MEM > >> >> +#define BUS_SPACE_IO I386_BUS_SPACE_IO > >> >> +#define BUS_SPACE_MEM I386_BUS_SPACE_MEM > >> >> #endif > >> >> > >> >> +#define ELF_KERN_STR ("elf"__XSTRING(__ELF_WORD_SIZE)" kernel") > >> >> + > >> >> static MALLOC_DEFINE(M_NEXUSDEV, "nexusdev", "Nexus device"); > >> >> > >> >> #define DEVTONX(dev) ((struct nexus_device *)device_get_ivars(dev)) > >> >> @@ -435,7 +433,7 @@ > >> >> #else > >> >> rman_set_bushandle(r, rman_get_start(r)); > >> >> #endif > >> >> - rman_set_bustag(r, RMAN_BUS_SPACE_IO); > >> >> + rman_set_bustag(r, BUS_SPACE_IO); > >> >> break; > >> >> case SYS_RES_MEMORY: > >> >> #ifdef PC98 > >> >> @@ -446,7 +444,7 @@ > >> >> #endif > >> >> vaddr = pmap_mapdev(rman_get_start(r), rman_get_size(r)); > >> >> rman_set_virtual(r, vaddr); > >> >> - rman_set_bustag(r, RMAN_BUS_SPACE_MEM); > >> >> + rman_set_bustag(r, BUS_SPACE_MEM); > >> >> #ifdef PC98 > >> >> /* PC-98: the type of bus_space_handle_t is the structure. */ > >> >> bh->bsh_base = (bus_addr_t) vaddr; > >> >> @@ -668,48 +666,45 @@ > >> >> return (0); > >> >> } > >> >> > >> >> -#ifdef __amd64__ > >> >> static int > >> >> ram_attach(device_t dev) > >> >> { > >> >> struct bios_smap *smapbase, *smap, *smapend; > >> >> struct resource *res; > >> >> + vm_paddr_t *p; > >> >> caddr_t kmdp; > >> >> uint32_t smapsize; > >> >> - int error, rid; > >> >> + int error, i, rid; > >> >> > >> >> /* Retrieve the system memory map from the loader. */ > >> >> kmdp = preload_search_by_type("elf kernel"); > >> >> if (kmdp == NULL) > >> >> - kmdp = preload_search_by_type("elf64 kernel"); > >> >> - smapbase = (struct bios_smap *)preload_search_info(kmdp, > >> >> - MODINFO_METADATA | MODINFOMD_SMAP); > >> >> - smapsize = *((u_int32_t *)smapbase - 1); > >> >> - smapend = (struct bios_smap *)((uintptr_t)smapbase + smapsize); > >> >> + kmdp = preload_search_by_type(ELF_KERN_STR); > >> >> + if (kmdp != NULL) { > >> >> + smapbase = (struct bios_smap *)preload_search_info(kmdp, > >> >> + MODINFO_METADATA | MODINFOMD_SMAP); > >> >> + smapsize = *((u_int32_t *)smapbase - 1); > >> >> + smapend = (struct bios_smap *)((uintptr_t)smapbase + smapsize); > >> > > >> > I think this doesn't check for the case that smapbase is NULL. I would > >> > expect kmdp to always be non-NULL in practice (it just means we have a > >> > kernel). However, the preload_search_info() can fail when booting on an old > >> > machine without an SMAP or an old loader that doesn't pass the SMAP to i386. > >> > >> I don't understand where is the problem. > >> smap is only used when it is consistent in that patch, otherwise it is > >> not used and fallsthrough the physavail[] approach. > >> It doesn't need to be set to NULL or checked. > >> > >> I guess that you want to patch the file and see how it looks like, > >> will be easier to review than inline .diff, in this case. > > > > The preload_search_info() can fail and return NULL (old machine with no SMAP > > or an older /boot/loader on i386). Then when you do this: > > > > smapsize = *((u_int32_t *)smapbase - 1); > > > > the kernel will panic. > > Ah, I thought that it could be failing only with a NULL kmdp. > That patch should fix it then: I think this looks fine, but I haven't tested it. :) -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Fri Oct 29 17:39:37 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from [127.0.0.1] (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by hub.freebsd.org (Postfix) with ESMTP id 8C964106566B; Fri, 29 Oct 2010 17:39:36 +0000 (UTC) (envelope-from jkim@FreeBSD.org) From: Jung-uk Kim To: src-committers@FreeBSD.org Date: Fri, 29 Oct 2010 13:39:13 -0400 User-Agent: KMail/1.6.2 References: <201010280758.o9S7w6Vj069186@svn.freebsd.org> In-Reply-To: <201010280758.o9S7w6Vj069186@svn.freebsd.org> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201010291339.18565.jkim@FreeBSD.org> Cc: Attilio Rao , svn-src-head@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r214446 - in head/sys: amd64/amd64 conf i386/i386 x86/x86 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 17:39:37 -0000 On Thursday 28 October 2010 03:58 am, Attilio Rao wrote: > Author: attilio > Date: Thu Oct 28 07:58:06 2010 > New Revision: 214446 > URL: http://svn.freebsd.org/changeset/base/214446 > > Log: > Merge the mptable support from MD bits to x86 subtree. > > Sponsored by: Sandvine Incorporated > Discussed with: jhb This commit broke amd64 build with "device mptable". I had to do the following to fix sys/x86/x86/mptable.c: @@ -27,7 +27,9 @@ #include __FBSDID("$FreeBSD$"); +#ifdef __i386__ #include "opt_mptable_force_htt.h" +#endif #include #include #include Alternatively, you may add "MPTABLE_FORCE_HTT" in sys/conf/options.amd64 but I am not sure this option is useful for amd64. Jung-uk Kim From owner-svn-src-head@FreeBSD.ORG Fri Oct 29 18:29:27 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9FC64106564A; Fri, 29 Oct 2010 18:29:27 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-qy0-f182.google.com (mail-qy0-f182.google.com [209.85.216.182]) by mx1.freebsd.org (Postfix) with ESMTP id 280A48FC19; Fri, 29 Oct 2010 18:29:26 +0000 (UTC) Received: by qyk2 with SMTP id 2so2336809qyk.13 for ; Fri, 29 Oct 2010 11:29:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=Z4qz/ApwvUCTgBPkUx036AtHDueSc1ivXqnn8SBpFOA=; b=YvU/ntooXPTMqBx+y2yS1fn930j3h/ZhHvKSeJJk77fgk9xQYZ7x8RTiRyc4/W5khH AsWA+Ukd6YH8wNNoQX6zHEBJI55Sz/JpqjhAPs5A19qA0zKemPQY8+qgvDnQ8dHSo2N3 zHjQdQxb7r8BFMozsfs8DjMqNcknnxTPnX78s= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=Rp+JJEOiinyYNv92jrlNZrD6hnGGp01gsrMWy+oH2s/EuUP00FGfwhZU9+gxLGC+c6 1cnVeoYGQNo1pqKcuXaEyURGM7GnLhrrCYWEY6RTtd7BDupX7cUgpTwrBDAEAHs+3CdC BK2uG9ad9NaA6otewzenEVM075mZ/SzI6pFKI= MIME-Version: 1.0 Received: by 10.229.97.68 with SMTP id k4mr12122457qcn.261.1288376965793; Fri, 29 Oct 2010 11:29:25 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.229.237.9 with HTTP; Fri, 29 Oct 2010 11:29:25 -0700 (PDT) In-Reply-To: <201010291339.18565.jkim@FreeBSD.org> References: <201010280758.o9S7w6Vj069186@svn.freebsd.org> <201010291339.18565.jkim@FreeBSD.org> Date: Fri, 29 Oct 2010 20:29:25 +0200 X-Google-Sender-Auth: bE3mvVxgr4fLi2tOXJTRf4nXa1Y Message-ID: From: Attilio Rao To: Jung-uk Kim Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r214446 - in head/sys: amd64/amd64 conf i386/i386 x86/x86 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 18:29:27 -0000 2010/10/29 Jung-uk Kim : > On Thursday 28 October 2010 03:58 am, Attilio Rao wrote: >> Author: attilio >> Date: Thu Oct 28 07:58:06 2010 >> New Revision: 214446 >> URL: http://svn.freebsd.org/changeset/base/214446 >> >> Log: >> =C2=A0 Merge the mptable support from MD bits to x86 subtree. >> >> =C2=A0 Sponsored by: =C2=A0 =C2=A0 =C2=A0 Sandvine Incorporated >> =C2=A0 Discussed with: =C2=A0 =C2=A0 jhb > > This commit broke amd64 build with "device mptable". =C2=A0I had to do th= e > following to fix sys/x86/x86/mptable.c: > > @@ -27,7 +27,9 @@ > =C2=A0#include > =C2=A0__FBSDID("$FreeBSD$"); > > +#ifdef __i386__ > =C2=A0#include "opt_mptable_force_htt.h" > +#endif > =C2=A0#include > =C2=A0#include > =C2=A0#include > > Alternatively, you may add "MPTABLE_FORCE_HTT" in > sys/conf/options.amd64 but I am not sure this option is useful for > amd64. Gosh, I left it out. Yes, I think this should be the right fix. Thanks, Attilio --=20 Peace can only be achieved by understanding - A. Einstein From owner-svn-src-head@FreeBSD.ORG Fri Oct 29 18:33:44 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 04D81106564A; Fri, 29 Oct 2010 18:33:44 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E6A6F8FC13; Fri, 29 Oct 2010 18:33:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9TIXhdj048830; Fri, 29 Oct 2010 18:33:43 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9TIXhZo048828; Fri, 29 Oct 2010 18:33:43 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201010291833.o9TIXhZo048828@svn.freebsd.org> From: Attilio Rao Date: Fri, 29 Oct 2010 18:33:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214515 - head/sys/x86/x86 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 18:33:44 -0000 Author: attilio Date: Fri Oct 29 18:33:43 2010 New Revision: 214515 URL: http://svn.freebsd.org/changeset/base/214515 Log: - Merge ram_attach() implementation for i386 and amd64 - Rename RES_BUS_SPACE_* into BUS_SPACE_* for consistency - Trim out an unnecessary checking condition Sponsored by: Sandvine Incorporated Requested and reviewed by: jhb Modified: head/sys/x86/x86/nexus.c Modified: head/sys/x86/x86/nexus.c ============================================================================== --- head/sys/x86/x86/nexus.c Fri Oct 29 15:03:29 2010 (r214514) +++ head/sys/x86/x86/nexus.c Fri Oct 29 18:33:43 2010 (r214515) @@ -52,9 +52,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#ifdef __amd64__ #include -#endif #include #include #include @@ -67,12 +65,10 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef __amd64__ #include -#include -#endif #include #include +#include #ifdef DEV_APIC #include "pcib_if.h" @@ -89,13 +85,15 @@ __FBSDID("$FreeBSD$"); #include #ifdef __amd64__ -#define RMAN_BUS_SPACE_IO AMD64_BUS_SPACE_IO -#define RMAN_BUS_SPACE_MEM AMD64_BUS_SPACE_MEM +#define BUS_SPACE_IO AMD64_BUS_SPACE_IO +#define BUS_SPACE_MEM AMD64_BUS_SPACE_MEM #else -#define RMAN_BUS_SPACE_IO I386_BUS_SPACE_IO -#define RMAN_BUS_SPACE_MEM I386_BUS_SPACE_MEM +#define BUS_SPACE_IO I386_BUS_SPACE_IO +#define BUS_SPACE_MEM I386_BUS_SPACE_MEM #endif +#define ELF_KERN_STR ("elf"__XSTRING(__ELF_WORD_SIZE)" kernel") + static MALLOC_DEFINE(M_NEXUSDEV, "nexusdev", "Nexus device"); #define DEVTONX(dev) ((struct nexus_device *)device_get_ivars(dev)) @@ -435,7 +433,7 @@ nexus_activate_resource(device_t bus, de #else rman_set_bushandle(r, rman_get_start(r)); #endif - rman_set_bustag(r, RMAN_BUS_SPACE_IO); + rman_set_bustag(r, BUS_SPACE_IO); break; case SYS_RES_MEMORY: #ifdef PC98 @@ -446,7 +444,7 @@ nexus_activate_resource(device_t bus, de #endif vaddr = pmap_mapdev(rman_get_start(r), rman_get_size(r)); rman_set_virtual(r, vaddr); - rman_set_bustag(r, RMAN_BUS_SPACE_MEM); + rman_set_bustag(r, BUS_SPACE_MEM); #ifdef PC98 /* PC-98: the type of bus_space_handle_t is the structure. */ bh->bsh_base = (bus_addr_t) vaddr; @@ -668,48 +666,48 @@ ram_probe(device_t dev) return (0); } -#ifdef __amd64__ static int ram_attach(device_t dev) { struct bios_smap *smapbase, *smap, *smapend; struct resource *res; + vm_paddr_t *p; caddr_t kmdp; uint32_t smapsize; - int error, rid; + int error, i, rid; /* Retrieve the system memory map from the loader. */ kmdp = preload_search_by_type("elf kernel"); if (kmdp == NULL) - kmdp = preload_search_by_type("elf64 kernel"); - smapbase = (struct bios_smap *)preload_search_info(kmdp, - MODINFO_METADATA | MODINFOMD_SMAP); - smapsize = *((u_int32_t *)smapbase - 1); - smapend = (struct bios_smap *)((uintptr_t)smapbase + smapsize); - - rid = 0; - for (smap = smapbase; smap < smapend; smap++) { - if (smap->type != SMAP_TYPE_MEMORY || smap->length == 0) - continue; - error = bus_set_resource(dev, SYS_RES_MEMORY, rid, smap->base, - smap->length); - if (error) - panic("ram_attach: resource %d failed set with %d", rid, - error); - res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, 0); - if (res == NULL) - panic("ram_attach: resource %d failed to attach", rid); - rid++; + kmdp = preload_search_by_type(ELF_KERN_STR); + if (kmdp != NULL) + smapbase = (struct bios_smap *)preload_search_info(kmdp, + MODINFO_METADATA | MODINFOMD_SMAP); + else + smapbase = NULL; + if (smapbase != NULL) { + smapsize = *((u_int32_t *)smapbase - 1); + smapend = (struct bios_smap *)((uintptr_t)smapbase + smapsize); + + rid = 0; + for (smap = smapbase; smap < smapend; smap++) { + if (smap->type != SMAP_TYPE_MEMORY || + smap->length == 0) + continue; + error = bus_set_resource(dev, SYS_RES_MEMORY, rid, + smap->base, smap->length); + if (error) + panic("ram_attach: resource %d failed set with %d", + rid, error); + res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + 0); + if (res == NULL) + panic("ram_attach: resource %d failed to attach", + rid); + rid++; + } + return (0); } - return (0); -} -#else -static int -ram_attach(device_t dev) -{ - struct resource *res; - vm_paddr_t *p; - int error, i, rid; /* * We use the dump_avail[] array rather than phys_avail[] for @@ -743,7 +741,6 @@ ram_attach(device_t dev) } return (0); } -#endif static device_method_t ram_methods[] = { /* Device interface */ From owner-svn-src-head@FreeBSD.ORG Fri Oct 29 18:38:36 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C6E91106564A; Fri, 29 Oct 2010 18:38:36 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B50698FC12; Fri, 29 Oct 2010 18:38:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9TIca0G049154; Fri, 29 Oct 2010 18:38:36 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9TIcaGd049152; Fri, 29 Oct 2010 18:38:36 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201010291838.o9TIcaGd049152@svn.freebsd.org> From: Attilio Rao Date: Fri, 29 Oct 2010 18:38:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214516 - head/sys/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 18:38:36 -0000 Author: attilio Date: Fri Oct 29 18:38:36 2010 New Revision: 214516 URL: http://svn.freebsd.org/changeset/base/214516 Log: Merging mptable under x86 left this option undefined for amd64 case. Fix that. Sponsored by: Sandvine Incorporated Reported by: jkim Modified: head/sys/conf/options.amd64 Modified: head/sys/conf/options.amd64 ============================================================================== --- head/sys/conf/options.amd64 Fri Oct 29 18:33:43 2010 (r214515) +++ head/sys/conf/options.amd64 Fri Oct 29 18:38:36 2010 (r214516) @@ -8,6 +8,7 @@ COUNT_IPIS opt_smp.h MAXMEM PERFMON PMAP_SHPGPERPROC opt_pmap.h +MPTABLE_FORCE_HTT MP_WATCHDOG # Options for emulators. These should only be used at config time, so From owner-svn-src-head@FreeBSD.ORG Fri Oct 29 18:41:09 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E1970106576C; Fri, 29 Oct 2010 18:41:09 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CF34F8FC1D; Fri, 29 Oct 2010 18:41:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9TIf9tZ049341; Fri, 29 Oct 2010 18:41:09 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9TIf9Sh049339; Fri, 29 Oct 2010 18:41:09 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201010291841.o9TIf9Sh049339@svn.freebsd.org> From: Rui Paulo Date: Fri, 29 Oct 2010 18:41:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214517 - head/sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 18:41:10 -0000 Author: rpaulo Date: Fri Oct 29 18:41:09 2010 New Revision: 214517 URL: http://svn.freebsd.org/changeset/base/214517 Log: Sync DLTs with the latest pcap version. Modified: head/sys/net/bpf.h Modified: head/sys/net/bpf.h ============================================================================== --- head/sys/net/bpf.h Fri Oct 29 18:38:36 2010 (r214516) +++ head/sys/net/bpf.h Fri Oct 29 18:41:09 2010 (r214517) @@ -844,6 +844,143 @@ struct bpf_zbuf_header { */ #define DLT_IEEE802_15_4_NONASK_PHY 215 +/* + * David Gibson requested this for + * captures from the Linux kernel /dev/input/eventN devices. This + * is used to communicate keystrokes and mouse movements from the + * Linux kernel to display systems, such as Xorg. + */ +#define DLT_LINUX_EVDEV 216 + +/* + * GSM Um and Abis interfaces, preceded by a "gsmtap" header. + * + * Requested by Harald Welte . + */ +#define DLT_GSMTAP_UM 217 +#define DLT_GSMTAP_ABIS 218 + +/* + * MPLS, with an MPLS label as the link-layer header. + * Requested by Michele Marchetto on behalf + * of OpenBSD. + */ +#define DLT_MPLS 219 + +/* + * USB packets, beginning with a Linux USB header, with the USB header + * padded to 64 bytes; required for memory-mapped access. + */ +#define DLT_USB_LINUX_MMAPPED 220 + +/* + * DECT packets, with a pseudo-header; requested by + * Matthias Wenzel . + */ +#define DLT_DECT 221 +/* + * From: "Lidwa, Eric (GSFC-582.0)[SGT INC]" + * Date: Mon, 11 May 2009 11:18:30 -0500 + * + * DLT_AOS. We need it for AOS Space Data Link Protocol. + * I have already written dissectors for but need an OK from + * legal before I can submit a patch. + * + */ +#define DLT_AOS 222 + +/* + * Wireless HART (Highway Addressable Remote Transducer) + * From the HART Communication Foundation + * IES/PAS 62591 + * + * Requested by Sam Roberts . + */ +#define DLT_WIHART 223 + +/* + * Fibre Channel FC-2 frames, beginning with a Frame_Header. + * Requested by Kahou Lei . + */ +#define DLT_FC_2 224 + +/* + * Fibre Channel FC-2 frames, beginning with an encoding of the + * SOF, and ending with an encoding of the EOF. + * + * The encodings represent the frame delimiters as 4-byte sequences + * representing the corresponding ordered sets, with K28.5 + * represented as 0xBC, and the D symbols as the corresponding + * byte values; for example, SOFi2, which is K28.5 - D21.5 - D1.2 - D21.2, + * is represented as 0xBC 0xB5 0x55 0x55. + * + * Requested by Kahou Lei . + */ +#define DLT_FC_2_WITH_FRAME_DELIMS 225 +/* + * Solaris ipnet pseudo-header; requested by Darren Reed . + * + * The pseudo-header starts with a one-byte version number; for version 2, + * the pseudo-header is: + * + * struct dl_ipnetinfo { + * u_int8_t dli_version; + * u_int8_t dli_family; + * u_int16_t dli_htype; + * u_int32_t dli_pktlen; + * u_int32_t dli_ifindex; + * u_int32_t dli_grifindex; + * u_int32_t dli_zsrc; + * u_int32_t dli_zdst; + * }; + * + * dli_version is 2 for the current version of the pseudo-header. + * + * dli_family is a Solaris address family value, so it's 2 for IPv4 + * and 26 for IPv6. + * + * dli_htype is a "hook type" - 0 for incoming packets, 1 for outgoing + * packets, and 2 for packets arriving from another zone on the same + * machine. + * + * dli_pktlen is the length of the packet data following the pseudo-header + * (so the captured length minus dli_pktlen is the length of the + * pseudo-header, assuming the entire pseudo-header was captured). + * + * dli_ifindex is the interface index of the interface on which the + * packet arrived. + * + * dli_grifindex is the group interface index number (for IPMP interfaces). + * + * dli_zsrc is the zone identifier for the source of the packet. + * + * dli_zdst is the zone identifier for the destination of the packet. + * + * A zone number of 0 is the global zone; a zone number of 0xffffffff + * means that the packet arrived from another host on the network, not + * from another zone on the same machine. + * + * An IPv4 or IPv6 datagram follows the pseudo-header; dli_family indicates + * which of those it is. + */ +#define DLT_IPNET 226 + +/* + * CAN (Controller Area Network) frames, with a pseudo-header as supplied + * by Linux SocketCAN. See Documentation/networking/can.txt in the Linux + * source. + * + * Requested by Felix Obenhuber . + */ +#define DLT_CAN_SOCKETCAN 227 + +/* + * Raw IPv4/IPv6; different from DLT_RAW in that the DLT_ value specifies + * whether it's v4 or v6. Requested by Darren Reed . + */ +#define DLT_IPV4 228 +#define DLT_IPV6 229 + /* * DLT and savefile link type values are split into a class and * a member of that class. A class value of 0 indicates a regular From owner-svn-src-head@FreeBSD.ORG Fri Oct 29 18:43:24 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1140F1065675; Fri, 29 Oct 2010 18:43:24 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F02C28FC1C; Fri, 29 Oct 2010 18:43:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9TIhNcI049501; Fri, 29 Oct 2010 18:43:23 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9TIhNQ6049491; Fri, 29 Oct 2010 18:43:23 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201010291843.o9TIhNQ6049491@svn.freebsd.org> From: Rui Paulo Date: Fri, 29 Oct 2010 18:43:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214518 - in head/contrib/libpcap: . ChmodBPF SUNOS4 Win32 bpf/net lbl missing msdos net pcap X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 18:43:24 -0000 Author: rpaulo Date: Fri Oct 29 18:43:23 2010 New Revision: 214518 URL: http://svn.freebsd.org/changeset/base/214518 Log: Merge libpcap-1.1.1. Added: head/contrib/libpcap/ChmodBPF/ - copied from r214514, vendor/libpcap/dist/ChmodBPF/ head/contrib/libpcap/README.Win32 - copied unchanged from r214514, vendor/libpcap/dist/README.Win32 head/contrib/libpcap/README.aix - copied unchanged from r214514, vendor/libpcap/dist/README.aix head/contrib/libpcap/README.dag - copied unchanged from r214514, vendor/libpcap/dist/README.dag head/contrib/libpcap/README.hpux - copied unchanged from r214514, vendor/libpcap/dist/README.hpux head/contrib/libpcap/README.linux - copied unchanged from r214514, vendor/libpcap/dist/README.linux head/contrib/libpcap/README.macosx - copied unchanged from r214514, vendor/libpcap/dist/README.macosx head/contrib/libpcap/README.septel - copied unchanged from r214514, vendor/libpcap/dist/README.septel head/contrib/libpcap/README.sita - copied unchanged from r214514, vendor/libpcap/dist/README.sita head/contrib/libpcap/README.tru64 - copied unchanged from r214514, vendor/libpcap/dist/README.tru64 head/contrib/libpcap/SUNOS4/ - copied from r214514, vendor/libpcap/dist/SUNOS4/ head/contrib/libpcap/Win32/ - copied from r214514, vendor/libpcap/dist/Win32/ head/contrib/libpcap/msdos/ - copied from r214514, vendor/libpcap/dist/msdos/ head/contrib/libpcap/opentest.c - copied unchanged from r214514, vendor/libpcap/dist/opentest.c head/contrib/libpcap/org.tcpdump.chmod_bpf.plist - copied unchanged from r214514, vendor/libpcap/dist/org.tcpdump.chmod_bpf.plist head/contrib/libpcap/pcap-can-linux.c - copied unchanged from r214514, vendor/libpcap/dist/pcap-can-linux.c head/contrib/libpcap/pcap-can-linux.h - copied unchanged from r214514, vendor/libpcap/dist/pcap-can-linux.h head/contrib/libpcap/pcap-common.c - copied unchanged from r214514, vendor/libpcap/dist/pcap-common.c head/contrib/libpcap/pcap-common.h - copied unchanged from r214514, vendor/libpcap/dist/pcap-common.h head/contrib/libpcap/pcap-snf.c - copied unchanged from r214514, vendor/libpcap/dist/pcap-snf.c head/contrib/libpcap/pcap-snf.h - copied unchanged from r214514, vendor/libpcap/dist/pcap-snf.h head/contrib/libpcap/pcap/ipnet.h - copied unchanged from r214514, vendor/libpcap/dist/pcap/ipnet.h head/contrib/libpcap/selpolltest.c - copied unchanged from r214514, vendor/libpcap/dist/selpolltest.c head/contrib/libpcap/sf-pcap-ng.c - copied unchanged from r214514, vendor/libpcap/dist/sf-pcap-ng.c head/contrib/libpcap/sf-pcap-ng.h - copied unchanged from r214514, vendor/libpcap/dist/sf-pcap-ng.h head/contrib/libpcap/sf-pcap.c - copied unchanged from r214514, vendor/libpcap/dist/sf-pcap.c head/contrib/libpcap/sf-pcap.h - copied unchanged from r214514, vendor/libpcap/dist/sf-pcap.h Deleted: head/contrib/libpcap/net/bpf_filter.c Modified: head/contrib/libpcap/CHANGES head/contrib/libpcap/CREDITS head/contrib/libpcap/INSTALL.txt head/contrib/libpcap/Makefile.in head/contrib/libpcap/README head/contrib/libpcap/TODO head/contrib/libpcap/VERSION head/contrib/libpcap/arcnet.h head/contrib/libpcap/atmuni31.h head/contrib/libpcap/bpf/net/bpf_filter.c head/contrib/libpcap/bpf_dump.c head/contrib/libpcap/bpf_image.c head/contrib/libpcap/config.guess head/contrib/libpcap/config.h.in head/contrib/libpcap/config.sub head/contrib/libpcap/configure head/contrib/libpcap/configure.in head/contrib/libpcap/dlpisubs.c head/contrib/libpcap/dlpisubs.h head/contrib/libpcap/etherent.c head/contrib/libpcap/ethertype.h head/contrib/libpcap/fad-getad.c head/contrib/libpcap/fad-gifc.c head/contrib/libpcap/fad-glifc.c head/contrib/libpcap/fad-null.c head/contrib/libpcap/fad-win32.c head/contrib/libpcap/filtertest.c head/contrib/libpcap/gencode.c head/contrib/libpcap/gencode.h head/contrib/libpcap/grammar.y head/contrib/libpcap/inet.c head/contrib/libpcap/lbl/os-aix4.h head/contrib/libpcap/lbl/os-hpux11.h head/contrib/libpcap/lbl/os-osf4.h head/contrib/libpcap/lbl/os-osf5.h head/contrib/libpcap/lbl/os-solaris2.h head/contrib/libpcap/lbl/os-sunos4.h head/contrib/libpcap/lbl/os-ultrix4.h head/contrib/libpcap/llc.h head/contrib/libpcap/missing/snprintf.c head/contrib/libpcap/nametoaddr.c head/contrib/libpcap/nlpid.h head/contrib/libpcap/optimize.c head/contrib/libpcap/pcap-bpf.c head/contrib/libpcap/pcap-bpf.h head/contrib/libpcap/pcap-bt-linux.c head/contrib/libpcap/pcap-bt-linux.h head/contrib/libpcap/pcap-config.1 head/contrib/libpcap/pcap-config.in head/contrib/libpcap/pcap-dag.c head/contrib/libpcap/pcap-dag.h head/contrib/libpcap/pcap-dlpi.c head/contrib/libpcap/pcap-dos.c head/contrib/libpcap/pcap-dos.h head/contrib/libpcap/pcap-enet.c head/contrib/libpcap/pcap-filter.manmisc.in head/contrib/libpcap/pcap-int.h head/contrib/libpcap/pcap-libdlpi.c head/contrib/libpcap/pcap-linktype.manmisc.in head/contrib/libpcap/pcap-linux.c head/contrib/libpcap/pcap-namedb.h head/contrib/libpcap/pcap-nit.c head/contrib/libpcap/pcap-null.c head/contrib/libpcap/pcap-pf.c head/contrib/libpcap/pcap-savefile.manfile.in head/contrib/libpcap/pcap-septel.c head/contrib/libpcap/pcap-septel.h head/contrib/libpcap/pcap-sita.html head/contrib/libpcap/pcap-snit.c head/contrib/libpcap/pcap-snoop.c head/contrib/libpcap/pcap-stdinc.h head/contrib/libpcap/pcap-usb-linux.c head/contrib/libpcap/pcap-usb-linux.h head/contrib/libpcap/pcap-win32.c head/contrib/libpcap/pcap.3pcap.in head/contrib/libpcap/pcap.c head/contrib/libpcap/pcap.h head/contrib/libpcap/pcap/bluetooth.h head/contrib/libpcap/pcap/bpf.h head/contrib/libpcap/pcap/namedb.h head/contrib/libpcap/pcap/pcap.h head/contrib/libpcap/pcap/sll.h head/contrib/libpcap/pcap/usb.h head/contrib/libpcap/pcap/vlan.h head/contrib/libpcap/pcap_activate.3pcap head/contrib/libpcap/pcap_breakloop.3pcap head/contrib/libpcap/pcap_can_set_rfmon.3pcap head/contrib/libpcap/pcap_close.3pcap head/contrib/libpcap/pcap_compile.3pcap.in head/contrib/libpcap/pcap_create.3pcap head/contrib/libpcap/pcap_datalink.3pcap.in head/contrib/libpcap/pcap_datalink_name_to_val.3pcap head/contrib/libpcap/pcap_datalink_val_to_name.3pcap head/contrib/libpcap/pcap_dump.3pcap head/contrib/libpcap/pcap_dump_close.3pcap head/contrib/libpcap/pcap_dump_file.3pcap head/contrib/libpcap/pcap_dump_flush.3pcap head/contrib/libpcap/pcap_dump_ftell.3pcap head/contrib/libpcap/pcap_dump_open.3pcap.in head/contrib/libpcap/pcap_file.3pcap head/contrib/libpcap/pcap_fileno.3pcap head/contrib/libpcap/pcap_findalldevs.3pcap head/contrib/libpcap/pcap_free_datalinks.3pcap head/contrib/libpcap/pcap_freealldevs.3pcap head/contrib/libpcap/pcap_freecode.3pcap head/contrib/libpcap/pcap_get_selectable_fd.3pcap head/contrib/libpcap/pcap_geterr.3pcap head/contrib/libpcap/pcap_inject.3pcap head/contrib/libpcap/pcap_is_swapped.3pcap head/contrib/libpcap/pcap_lib_version.3pcap head/contrib/libpcap/pcap_list_datalinks.3pcap.in head/contrib/libpcap/pcap_lookupdev.3pcap head/contrib/libpcap/pcap_lookupnet.3pcap head/contrib/libpcap/pcap_loop.3pcap head/contrib/libpcap/pcap_major_version.3pcap head/contrib/libpcap/pcap_next_ex.3pcap head/contrib/libpcap/pcap_offline_filter.3pcap head/contrib/libpcap/pcap_open_dead.3pcap.in head/contrib/libpcap/pcap_open_live.3pcap head/contrib/libpcap/pcap_open_offline.3pcap.in head/contrib/libpcap/pcap_set_buffer_size.3pcap head/contrib/libpcap/pcap_set_datalink.3pcap head/contrib/libpcap/pcap_set_promisc.3pcap head/contrib/libpcap/pcap_set_rfmon.3pcap head/contrib/libpcap/pcap_set_snaplen.3pcap head/contrib/libpcap/pcap_set_timeout.3pcap head/contrib/libpcap/pcap_setdirection.3pcap head/contrib/libpcap/pcap_setfilter.3pcap head/contrib/libpcap/pcap_setnonblock.3pcap head/contrib/libpcap/pcap_snapshot.3pcap head/contrib/libpcap/pcap_stats.3pcap head/contrib/libpcap/pcap_statustostr.3pcap head/contrib/libpcap/pcap_strerror.3pcap head/contrib/libpcap/ppp.h head/contrib/libpcap/runlex.sh head/contrib/libpcap/savefile.c head/contrib/libpcap/scanner.l head/contrib/libpcap/sunatmpos.h Directory Properties: head/contrib/libpcap/ (props changed) Modified: head/contrib/libpcap/CHANGES ============================================================================== --- head/contrib/libpcap/CHANGES Fri Oct 29 18:41:09 2010 (r214517) +++ head/contrib/libpcap/CHANGES Fri Oct 29 18:43:23 2010 (r214518) @@ -1,4 +1,77 @@ -@(#) $Header: /tcpdump/master/libpcap/CHANGES,v 1.67.2.4 2008-10-28 00:27:42 ken Exp $ (LBL) +Thu. April 1, 2010. guy@alum.mit.edu. +Summary for 1.1.1 libpcap release + Update CHANGES to reflect more of the changes in 1.1.0. + Fix build on RHEL5. + Fix shared library build on AIX. + +Thu. March 11, 2010. ken@netfunctional.ca/guy@alum.mit.edu. +Summary for 1.1.0 libpcap release + Add SocketCAN capture support + Add Myricom SNF API support + Update Endace DAG and ERF support + Add support for shared libraries on Solaris, HP-UX, and AIX + Build, install, and un-install shared libraries by default; + don't build/install shared libraries on platforms we don't support + Fix building from a directory other than the source directory + Fix compiler warnings and builds on some platforms + Update config.guess and config.sub + Support monitor mode on mac80211 devices on Linux + Fix USB memory-mapped capturing on Linux; it requires a new DLT_ + value + On Linux, scan /sys/class/net for devices if we have it; scan + it, or /proc/net/dev if we don't have /sys/class/net, even if + we have getifaddrs(), as it'll find interfaces with no + addresses + Add limited support for reading pcap-ng files + Fix BPF driver-loading error handling on AIX + Support getting the full-length interface description on FreeBSD + In the lexical analyzer, free up any addrinfo structure we got back + from getaddrinfo(). + Add support for BPF and libdlpi in OpenSolaris (and SXCE) + Hyphenate "link-layer" everywhere + Add /sys/kernel/debug/usb/usbmon to the list of usbmon locations + In pcap_read_linux_mmap(), if there are no frames available, call + poll() even if we're in non-blocking mode, so we pick up + errors, and check for the errors in question. + Note that poll() works on BPF devices is Snow Leopard + If an ENXIO or ENETDOWN is received, it may mean the device has + gone away. Deal with it. + For BPF, raise the default capture buffer size to from 32k to 512k + Support ps_ifdrop on Linux + Added a bunch of #ifdef directives to make wpcap.dll (WinPcap) compile + under cygwin. + Changes to Linux mmapped captures. + Fix bug where create_ring would fail for particular snaplen and + buffer size combinations + Update pcap-config so that it handles libpcap requiring + additional libraries + Add workaround for threadsafeness on Windows + Add missing mapping for DLT_ENC <-> LINKTYPE_ENC + DLT: Add DLT_CAN_SOCKETCAN + DLT: Add Solaris ipnet + Don't check for DLT_IPNET if it's not defined + Add link-layer types for Fibre Channel FC-2 + Add link-layer types for Wireless HART + Add link-layer types for AOS + Add link-layer types for DECT + Autoconf fixes (AIX, HP-UX, OSF/1, Tru64 cleanups) + Install headers unconditionally, and include vlan.h/bluetooth.h if + enabled + Autoconf fixes+cleanup + Support enabling/disabling bluetooth (--{en,dis}able-bluetooth) + Support disabling SITA support (--without-sita) + Return -1 on failure to create packet ring (if supported but + creation failed) + Fix handling of 'any' device, so that it can be opened, and no longer + attempt to open it in Monitor mode + Add support for snapshot length for USB Memory-Mapped Interface + Fix configure and build on recent Linux kernels + Fix memory-mapped Linux capture to support pcap_next() and + pcap_next_ex() + Fixes for Linux USB capture + DLT: Add DLT_LINUX_EVDEV + DLT: Add DLT_GSMTAP_UM + DLT: Add DLT_GSMTAP_ABIS Mon. October 27, 2008. ken@netfunctional.ca. Summary for 1.0.0 libpcap release Compile with IPv6 support by default @@ -12,7 +85,10 @@ Mon. October 27, 2008. ken@netfuncti Variable length 802.11 header support X2E data type support SITA ACN Interface support - see README.sita + Support for memory-mapped capture on Linux Support for zerocopy BPF on platforms that support it + Support for setting buffer size when opening devices + Support for setting monitor mode when opening 802.11 devices Better support for dealing with VLAN tagging/stripping on Linux Fix dynamic library support on OSX Return PCAP_ERROR_IFACE_NOT_UP if the interface isn't 'UP', so applications @@ -22,7 +98,7 @@ Mon. October 27, 2008. ken@netfuncti On Linux, ignore ENETDOWN so we can continue to capture packets if the interface goes down and comes back up again. On Linux, support new tpacket frame headers (2.6.27+) - On Mac OS X, add scripts for changing permissions on /dev/pbf* and launchd plist + On Mac OS X, add scripts for changing permissions on /dev/bpf* and launchd plist On Solaris, support 'passive mode' on systems that support it Fixes to autoconf and general build environment Man page reorganization + cleanup Modified: head/contrib/libpcap/CREDITS ============================================================================== --- head/contrib/libpcap/CREDITS Fri Oct 29 18:41:09 2010 (r214517) +++ head/contrib/libpcap/CREDITS Fri Oct 29 18:43:23 2010 (r214518) @@ -10,9 +10,10 @@ The current maintainers: Additional people who have contributed patches: Alan Bawden + Albert Chin Alexander 'Leo' Bergolth Alexey Kuznetsov - Albert Chin + Alon Bar-Lev Andrew Brown Antti Kantee Arien Vijn @@ -23,24 +24,28 @@ Additional people who have contributed p Charles M. Hannum Chris G. Demetriou Chris Lightfoot + Chris Maynard Chris Pepper + Christian Bell Christian Peron Daniele Orlandi - Darren Reed + Darren Reed David Kaelbling David Young Dean Gaudet Don Ebright Dug Song + Dustin Spicuzza Eric Anderson Erik de Castro Lopo + Felix Obenhuber Florent Drouin Franz Schaefer Fulko Hew + Fumiyuki Shimizu Gianluca Varenni Gilbert Hoyek Gisle Vanem - Gisle Vanem Graeme Hewson Greg Stark Greg Troxel @@ -53,11 +58,13 @@ Additional people who have contributed p Jason R. Thorpe Javier Achirica Jean Tourrilhes + Jean-Louis Charton Jefferson Ogata Jesper Peterson Joerg Mayer John Bankier Jon Lindgren + Jon Smirl Juergen Schoenwaelder Jung-uk Kim Kazushi Sugyo @@ -67,19 +74,22 @@ Additional people who have contributed p Krzysztof Halasa Lorenzo Cavallaro Loris Degioanni - Love Hörnquist-Åstrand + Love Hörnquist-Ã…strand Luis Martin Garcia Maciej W. Rozycki Marcus Felipe Pereira Mark C. Brown Mark Pizzolato + Markus Mayer Martin Husemann + Márton Németh Matthew Luckie Max Laier Mike Frysinger Mike Kershaw Mike Wiacek Monroe Williams + N. Leiten Nicolas Dade Octavian Cerna Olaf Kirch @@ -93,15 +103,20 @@ Additional people who have contributed p Pawel Pokrywka Peter Fales Peter Jeremy + Peter Volkov Phil Wood Rafal Maszkowski Richard Stearn Rick Jones + Robert Edmonds + Roberto Mariani + Romain Francoise Sagun Shakya Scott Barron Scott Gifford Sebastian Krahmer + Sebastien Roy Sepherosa Ziehau Shaun Clowes Solomon Peachy @@ -109,12 +124,16 @@ Additional people who have contributed p Stephen Donnelly Takashi Yamamoto Tanaka Shin-ya + Tobias Poschwatta Tony Li Torsten Landschoff Uns Lider Uwe Girlich + Wesley Shields Xianjie Zhang + Xin Li Yen Yen Lim + Yvan Vanhullebus Yoann Vandoorselaere The original LBL crew: Modified: head/contrib/libpcap/INSTALL.txt ============================================================================== --- head/contrib/libpcap/INSTALL.txt Fri Oct 29 18:41:09 2010 (r214517) +++ head/contrib/libpcap/INSTALL.txt Fri Oct 29 18:43:23 2010 (r214518) @@ -1,4 +1,4 @@ -@(#) $Header: /tcpdump/master/libpcap/INSTALL.txt,v 1.21.2.8 2008-06-12 20:25:38 guy Exp $ (LBL) +@(#) $Header: /tcpdump/master/libpcap/INSTALL.txt,v 1.29 2008-06-12 20:21:51 guy Exp $ (LBL) To build libpcap, run "./configure" (a shell script). The configure script will determine your system attributes and generate an Modified: head/contrib/libpcap/Makefile.in ============================================================================== --- head/contrib/libpcap/Makefile.in Fri Oct 29 18:41:09 2010 (r214517) +++ head/contrib/libpcap/Makefile.in Fri Oct 29 18:43:23 2010 (r214518) @@ -17,7 +17,7 @@ # WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. # -# @(#) $Header: /tcpdump/master/libpcap/Makefile.in,v 1.108.2.28 2008-10-23 22:13:21 guy Exp $ (LBL) +# @(#) $Header: /tcpdump/master/libpcap/Makefile.in,v 1.142 2008-11-22 17:30:24 guy Exp $ (LBL) # # Various configurable paths (remember to edit Makefile.in, not Makefile) @@ -44,14 +44,17 @@ VPATH = @srcdir@ # You shouldn't need to edit anything below. # +LD = /usr/bin/ld CC = @CC@ CCOPT = @V_CCOPT@ INCLS = -I. @V_INCLS@ DEFS = @DEFS@ @V_DEFS@ -LIBS = @V_LIBS@ -DAGLIBS = @DAGLIBS@ -DEPLIBS = @DEPLIBS@ +ADDLOBJS = @ADDLOBJS@ +ADDLARCHIVEOBJS = @ADDLARCHIVEOBJS@ +LIBS = @LIBS@ +LDFLAGS = @LDFLAGS@ DYEXT = @DYEXT@ +V_RPATH_OPT = @V_RPATH_OPT@ PROG=libpcap # Standard CFLAGS @@ -77,12 +80,13 @@ YACC = @V_YACC@ @rm -f $@ $(CC) $(CFLAGS) -c $(srcdir)/$*.c -PSRC = pcap-@V_PCAP@.c @USB_SRC@ @BT_SRC@ +PSRC = pcap-@V_PCAP@.c @USB_SRC@ @BT_SRC@ @CAN_SRC@ FSRC = fad-@V_FINDALLDEVS@.c SSRC = @SSRC@ -CSRC = pcap.c inet.c gencode.c optimize.c nametoaddr.c \ - etherent.c savefile.c bpf_filter.c bpf_image.c bpf_dump.c -GENSRC = scanner.c grammar.c version.c +CSRC = pcap.c inet.c gencode.c optimize.c nametoaddr.c etherent.c \ + savefile.c sf-pcap.c sf-pcap-ng.c pcap-common.c \ + bpf_image.c bpf_dump.c +GENSRC = scanner.c grammar.c bpf_filter.c version.c LIBOBJS = @LIBOBJS@ SRC = $(PSRC) $(FSRC) $(CSRC) $(SSRC) $(GENSRC) @@ -90,8 +94,20 @@ SRC = $(PSRC) $(FSRC) $(CSRC) $(SSRC) $( # We would like to say "OBJ = $(SRC:.c=.o)" but Ultrix's make cannot # hack the extra indirection OBJ = $(PSRC:.c=.o) $(FSRC:.c=.o) $(CSRC:.c=.o) $(SSRC:.c=.o) $(GENSRC:.c=.o) $(LIBOBJS) -HDR = \ - acconfig.h \ +PUBHDR = \ + pcap.h \ + pcap-bpf.h \ + pcap-namedb.h \ + pcap/bpf.h \ + pcap/bluetooth.h \ + pcap/ipnet.h \ + pcap/namedb.h \ + pcap/pcap.h \ + pcap/sll.h \ + pcap/vlan.h \ + pcap/usb.h + +HDR = $(PUBHDR) \ arcnet.h \ atmuni31.h \ ethertype.h \ @@ -99,30 +115,23 @@ HDR = \ ieee80211.h \ llc.h \ nlpid.h \ - pcap/bluetooth.h \ - pcap/bpf.h \ - pcap/namedb.h \ - pcap/pcap.h \ - pcap/sll.h \ - pcap/usb.h \ - pcap/vlan.h \ - pcap.h \ + pcap-common.h \ pcap-int.h \ - pcap-namedb.h \ pcap-stdinc.h \ ppp.h \ + sf-pcap.h \ + sf-pcap-ng.h \ sunatmpos.h GENHDR = \ scanner.h tokdefs.h version.h -TAGHDR = \ - pcap-bpf.h - TAGFILES = \ - $(SRC) $(HDR) $(TAGHDR) + $(SRC) $(HDR) -CLEANFILES = $(OBJ) libpcap.a $(GENSRC) $(GENHDR) lex.yy.c +CLEANFILES = $(OBJ) libpcap.* filtertest findalldevstest selpolltest \ + opentest $(PROG)-`cat $(srcdir)/VERSION`.tar.gz $(GENSRC) $(GENHDR) \ + lex.yy.c pcap-config MAN1 = pcap-config.1 @@ -254,13 +263,14 @@ EXTRA_DIST = \ msdos/pktdrvr.c \ msdos/pktdrvr.h \ msdos/readme.dos \ - net/bpf_filter.c \ + opentest.c \ org.tcpdump.chmod_bpf.plist \ packaging/pcap.spec.in \ pcap-bpf.c \ - pcap-bpf.h \ pcap-bt-linux.c \ pcap-bt-linux.h \ + pcap-can-linux.c \ + pcap-can-linux.h \ pcap-config.in \ pcap-dag.c \ pcap-dag.h \ @@ -280,6 +290,8 @@ EXTRA_DIST = \ pcap-sita.h \ pcap-sita.c \ pcap-sita.html \ + pcap-snf.c \ + pcap-snf.h \ pcap-snit.c \ pcap-snoop.c \ pcap-usb-linux.c \ @@ -287,6 +299,7 @@ EXTRA_DIST = \ pcap-win32.c \ runlex.sh \ scanner.l \ + selpolltest.c \ Win32/Include/Gnuc.h \ Win32/Include/addrinfo.h \ Win32/Include/bittypes.h \ @@ -311,42 +324,94 @@ EXTRA_DIST = \ Win32/Src/inet_net.c \ Win32/Src/inet_pton.c -all: libpcap.a pcap-config +all: libpcap.a shared pcap-config libpcap.a: $(OBJ) @rm -f $@ - $(AR) rc $@ $(OBJ) $(LIBS) + ar rc $@ $(OBJ) $(ADDLARCHIVEOBJS) $(RANLIB) $@ shared: libpcap.$(DYEXT) -# -# XXX - this works with GNU ld, but won't necessarily work with native -# ld on, for example, various SVR4-flavored platforms, or Digital UNIX. -# libpcap.so: $(OBJ) @rm -f $@ - $(CC) -shared -Wl,-soname,$@.1 -o $@.`cat $(srcdir)/VERSION` $(OBJ) $(DAGLIBS) + VER=`cat $(srcdir)/VERSION`; \ + MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \ + @V_SHLIB_CMD@ @V_SHLIB_OPT@ @V_SONAME_OPT@$@.$$MAJOR_VER $(LDFLAGS) \ + -o $@.$$VER $(OBJ) $(ADDLOBJS) $(LIBS) # # The following rule succeeds, but the result is untested. # -# XXX - OS X installs the library as "libpcap.A.dylib", with that as the -# install_name, and sets the current version to 1 as well. VERSION -# might contain a not-purely-numeric version number, but -# -current_version requires a purely numeric version, so this won't -# work with top-of-tree builds. +# In Mac OS X, the libpcap dylib has the name "libpcap.A.dylib", with +# its full path as the install_name, and with the compatibility and +# current version both set to 1. The compatibility version is set to +# 1 so that programs built with a newer version of the library will run +# against older versions; multi-platform software probably will fail if +# it uses APIs added in the newer version, but Mac OS X-specific software +# will use weak linking and check at run time whether those APIs are +# available. +# +# We also use "A" as the major version, and 1 as the compatibility version, +# but set the current version to the value in VERSION, with any non-numeric +# stuff stripped off (the compatibility and current version must be of the +# form X[.Y[.Z]], with Y and Z possibly absent, and with all components +# numeric). # libpcap.dylib: $(OBJ) rm -f libpcap*.dylib - $(CC) -dynamiclib -undefined error -o libpcap.`cat $(srcdir)/VERSION`.dylib $(OBJ) \ - -install_name $(libdir)/libpcap.A.dylib \ - -compatibility_version 1 \ - -current_version `sed 's/[^0-9.].*$$//' $(srcdir)/VERSION` + VER=`cat $(srcdir)/VERSION`; \ + MAJOR_VER=A; \ + COMPAT_VER=1; \ + CURRENT_VER=`sed 's/[^0-9.].*$$//' $(srcdir)/VERSION`; \ + $(CC) -dynamiclib -undefined error $(LDFLAGS) \ + -o libpcap.$$VER.dylib $(OBJ) $(ADDLOBJS) $(LIBS) \ + -install_name $(libdir)/libpcap.$$MAJOR_VER.dylib \ + -compatibility_version $$COMPAT_VER \ + -current_version $$CURRENT_VER + +# +# The HP-UX linker manual says that the convention for a versioned library +# is libXXX.{number}, not libXXX.sl.{number}. That appears to be the case +# on at least one HP-UX 11.00 system; libXXX.sl is a symlink to +# libXXX.{number}. +# +# The manual also says "library-level versioning" (think "sonames") was +# added in HP-UX 10.0. +# +# XXX - this assumes we're using the HP linker, rather than the GNU +# linker, even with GCC. +# +libpcap.sl: $(OBJ) + @MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \ + rm -f libpcap.$$MAJOR_VER + MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \ + ld -b $(LDFLAGS) -o libpcap.$$MAJOR_VER +h libpcap.$$MAJOR_VER \ + $(OBJ) $(ADDLOBJS) $(LIBS) + +# +# AIX is different from everybody else. A shared library is an archive +# library with one or more shared-object components. We still build a +# normal static archive library on AIX, for the benefit of the traditional +# scheme of building libpcap and tcpdump in subdirectories of the +# same directory, with tcpdump statically linked with the libpcap +# in question, but we also build a shared library as "libpcap.shareda" +# and install *it*, rather than the static library, as "libpcap.a". +# +libpcap.shareda: $(OBJ) + @rm -f $@ shr.o + $(CC) @V_SHLIB_OPT@ -o shr.o $(OBJ) $(ADDLOBJS) $(LDFLAGS) $(LIBS) + ar rc $@ shr.o + +# +# For platforms that don't support shared libraries (or on which we +# don't support shared libraries). +# +libpcap.none: scanner.c: $(srcdir)/scanner.l @rm -f $@ - ./runlex.sh $(LEX) -o$@ $< + $(srcdir)/runlex.sh $(LEX) -o$@ $< scanner.o: scanner.c tokdefs.h $(CC) $(CFLAGS) -c scanner.c @@ -372,7 +437,13 @@ snprintf.o: $(srcdir)/missing/snprintf.c version.c: $(srcdir)/VERSION @rm -f $@ - sed -e 's/.*/char pcap_version[] = "&";/' $(srcdir)/VERSION > $@ + if grep GIT ${srcdir}/VERSION >/dev/null; then \ + read ver <${srcdir}/VERSION; \ + echo $$ver | tr -d '\012'; \ + date +_%Y_%m_%d; \ + else \ + cat ${srcdir}/VERSION; \ + fi | sed -e 's/.*/char pcap_version[] = "&";/' > $@ # # NOTE: this really is supposed to be static; importing a string @@ -383,7 +454,13 @@ version.c: $(srcdir)/VERSION # version.h: $(srcdir)/VERSION @rm -f $@ - sed -e 's/.*/static const char pcap_version_string[] = "libpcap version &";/' $(srcdir)/VERSION > $@ + if grep GIT ${srcdir}/VERSION >/dev/null; then \ + read ver <${srcdir}/VERSION; \ + echo $$ver | tr -d '\012'; \ + date +_%Y_%m_%d; \ + else \ + cat ${srcdir}/VERSION; \ + fi | sed -e 's/.*/static const char pcap_version_string[] = "libpcap version &";/' > $@ bpf_filter.c: $(srcdir)/bpf/net/bpf_filter.c rm -f bpf_filter.c @@ -395,12 +472,13 @@ bpf_filter.o: bpf_filter.c # # Generate the pcap-config script. # -pcap-config: pcap-config.in Makefile +pcap-config: $(srcdir)/pcap-config.in @rm -f $@ $@.tmp sed -e 's|@includedir[@]|$(includedir)|g' \ -e 's|@libdir[@]|$(libdir)|g' \ - -e 's|@DEPLIBS[@]|$(DEPLIBS)|g' \ - pcap-config.in >$@.tmp + -e 's|@LIBS[@]|$(LIBS)|g' \ + -e 's|@V_RPATH_OPT[@]|$(V_RPATH_OPT)|g' \ + $(srcdir)/pcap-config.in >$@.tmp mv $@.tmp $@ chmod a+x $@ @@ -408,16 +486,20 @@ pcap-config: pcap-config.in Makefile # Test programs - not built by default, and not installed. # filtertest: filtertest.c libpcap.a - $(CC) $(CFLAGS) -I. -L. -o filtertest filtertest.c libpcap.a + $(CC) $(CFLAGS) -I. -L. -o filtertest $(srcdir)/filtertest.c libpcap.a $(LIBS) findalldevstest: findalldevstest.c libpcap.a - $(CC) $(CFLAGS) -I. -L. -o findalldevstest findalldevstest.c libpcap.a + $(CC) $(CFLAGS) -I. -L. -o findalldevstest $(srcdir)/findalldevstest.c libpcap.a $(LIBS) + +selpolltest: selpolltest.c libpcap.a + $(CC) $(CFLAGS) -I. -L. -o selpolltest $(srcdir)/selpolltest.c libpcap.a $(LIBS) + +opentest: opentest.c libpcap.a + $(CC) $(CFLAGS) -I. -L. -o opentest $(srcdir)/opentest.c libpcap.a $(LIBS) -install: libpcap.a pcap-config +install: install-shared install-archive pcap-config [ -d $(DESTDIR)$(libdir) ] || \ (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir)) - $(INSTALL_DATA) libpcap.a $(DESTDIR)$(libdir)/libpcap.a - $(RANLIB) $(DESTDIR)$(libdir)/libpcap.a [ -d $(DESTDIR)$(includedir) ] || \ (mkdir -p $(DESTDIR)$(includedir); chmod 755 $(DESTDIR)$(includedir)) [ -d $(DESTDIR)$(includedir)/pcap ] || \ @@ -430,91 +512,151 @@ install: libpcap.a pcap-config (mkdir -p $(DESTDIR)$(mandir)/man@MAN_FILE_FORMATS@; chmod 755 $(DESTDIR)$(mandir)/man@MAN_FILE_FORMATS@) [ -d $(DESTDIR)$(mandir)/man@MAN_MISC_INFO@ ] || \ (mkdir -p $(DESTDIR)$(mandir)/man@MAN_MISC_INFO@; chmod 755 $(DESTDIR)$(mandir)/man@MAN_MISC_INFO@) - $(INSTALL_DATA) $(srcdir)/pcap/pcap.h \ - $(DESTDIR)$(includedir)/pcap/pcap.h - $(INSTALL_DATA) $(srcdir)/pcap/bpf.h \ - $(DESTDIR)$(includedir)/pcap/bpf.h - $(INSTALL_DATA) $(srcdir)/pcap/namedb.h \ - $(DESTDIR)$(includedir)/pcap/namedb.h - $(INSTALL_DATA) $(srcdir)/pcap/sll.h \ - $(DESTDIR)$(includedir)/pcap/sll.h - $(INSTALL_DATA) $(srcdir)/pcap/usb.h \ - $(DESTDIR)$(includedir)/pcap/usb.h - $(INSTALL_DATA) $(srcdir)/pcap.h $(DESTDIR)$(includedir)/pcap.h - $(INSTALL_DATA) $(srcdir)/pcap-bpf.h \ - $(DESTDIR)$(includedir)/pcap-bpf.h - $(INSTALL_DATA) $(srcdir)/pcap-namedb.h \ - $(DESTDIR)$(includedir)/pcap-namedb.h + for i in $(PUBHDR); do \ + $(INSTALL_DATA) $(srcdir)/$$i \ + $(DESTDIR)$(includedir)/$$i; done + [ -d $(DESTDIR)$(bindir) ] || \ + (mkdir -p $(DESTDIR)$(bindir); chmod 755 $(DESTDIR)$(bindir)) $(INSTALL_PROGRAM) pcap-config $(DESTDIR)$(bindir)/pcap-config for i in $(MAN1); do \ $(INSTALL_DATA) $(srcdir)/$$i \ $(DESTDIR)$(mandir)/man1/$$i; done - for i in $(MAN3PCAP); do \ + for i in $(MAN3PCAP_NOEXPAND); do \ $(INSTALL_DATA) $(srcdir)/$$i \ $(DESTDIR)$(mandir)/man3/$$i; done + for i in $(MAN3PCAP_EXPAND:.in=); do \ + $(INSTALL_DATA) $$i \ + $(DESTDIR)$(mandir)/man3/$$i; done + rm -f $(DESTDIR)$(mandir)/man3/pcap_datalink_val_to_description.3pcap ln $(DESTDIR)$(mandir)/man3/pcap_datalink_val_to_name.3pcap \ $(DESTDIR)$(mandir)/man3/pcap_datalink_val_to_description.3pcap + rm -f $(DESTDIR)$(mandir)/man3/pcap_dump_fopen.3pcap ln $(DESTDIR)$(mandir)/man3/pcap_dump_open.3pcap \ $(DESTDIR)$(mandir)/man3/pcap_dump_fopen.3pcap + rm -f $(DESTDIR)$(mandir)/man3/pcap_perror.3pcap ln $(DESTDIR)$(mandir)/man3/pcap_geterr.3pcap \ $(DESTDIR)$(mandir)/man3/pcap_perror.3pcap + rm -f $(DESTDIR)$(mandir)/man3/pcap_sendpacket.3pcap ln $(DESTDIR)$(mandir)/man3/pcap_inject.3pcap \ $(DESTDIR)$(mandir)/man3/pcap_sendpacket.3pcap + rm -f $(DESTDIR)$(mandir)/man3/pcap_dispatch.3pcap ln $(DESTDIR)$(mandir)/man3/pcap_loop.3pcap \ $(DESTDIR)$(mandir)/man3/pcap_dispatch.3pcap + rm -f $(DESTDIR)$(mandir)/man3/pcap_minor_version.3pcap ln $(DESTDIR)$(mandir)/man3/pcap_major_version.3pcap \ $(DESTDIR)$(mandir)/man3/pcap_minor_version.3pcap + rm -f $(DESTDIR)$(mandir)/man3/pcap_next.3pcap ln $(DESTDIR)$(mandir)/man3/pcap_next_ex.3pcap \ $(DESTDIR)$(mandir)/man3/pcap_next.3pcap + rm -f $(DESTDIR)$(mandir)/man3/pcap_fopen_offline.3pcap ln $(DESTDIR)$(mandir)/man3/pcap_open_offline.3pcap \ $(DESTDIR)$(mandir)/man3/pcap_fopen_offline.3pcap + rm -f $(DESTDIR)$(mandir)/man3/pcap_getnonblock.3pcap ln $(DESTDIR)$(mandir)/man3/pcap_setnonblock.3pcap \ $(DESTDIR)$(mandir)/man3/pcap_getnonblock.3pcap for i in $(MANFILE); do \ - $(INSTALL_DATA) $(srcdir)/`echo $$i | sed 's/.manfile.in/.manfile/'` \ + $(INSTALL_DATA) `echo $$i | sed 's/.manfile.in/.manfile/'` \ $(DESTDIR)$(mandir)/man@MAN_FILE_FORMATS@/`echo $$i | sed 's/.manfile.in/.@MAN_FILE_FORMATS@/'`; done for i in $(MANMISC); do \ - $(INSTALL_DATA) $(srcdir)/`echo $$i | sed 's/.manmisc.in/.manmisc/'` \ + $(INSTALL_DATA) `echo $$i | sed 's/.manmisc.in/.manmisc/'` \ $(DESTDIR)$(mandir)/man@MAN_MISC_INFO@/`echo $$i | sed 's/.manmisc.in/.@MAN_MISC_INFO@/'`; done install-shared: install-shared-$(DYEXT) install-shared-so: libpcap.so - $(INSTALL_PROGRAM) libpcap.so.`cat VERSION` $(DESTDIR)$(libdir)/libpcap.so.`cat VERSION` + [ -d $(DESTDIR)$(libdir) ] || \ + (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir)) + VER=`cat $(srcdir)/VERSION`; \ + MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \ + $(INSTALL_PROGRAM) libpcap.so.$$VER $(DESTDIR)$(libdir)/libpcap.so.$$VER; \ + ln -sf libpcap.so.$$VER $(DESTDIR)$(libdir)/libpcap.so.$$MAJOR_VER; \ + ln -sf libpcap.so.$$MAJOR_VER $(DESTDIR)$(libdir)/libpcap.so install-shared-dylib: libpcap.dylib - $(INSTALL_PROGRAM) libpcap.`cat VERSION`.dylib $(DESTDIR)$(libdir)/libpcap.`cat VERSION`.dylib - VER=`cat VERSION`; cd $(DESTDIR)$(libdir) && ln -sf libpcap.$$VER.dylib libpcap.A.dylib; ln -sf libpcap.A.dylib libpcap.dylib + [ -d $(DESTDIR)$(libdir) ] || \ + (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir)) + VER=`cat $(srcdir)/VERSION`; \ + MAJOR_VER=A; \ + $(INSTALL_PROGRAM) libpcap.$$VER.dylib $(DESTDIR)$(libdir)/libpcap.$$VER.dylib; \ + ln -sf libpcap.$$VER.dylib $(DESTDIR)$(libdir)/libpcap.$$MAJOR_VER.dylib; \ + ln -sf libpcap.$$MAJOR_VER.dylib $(DESTDIR)$(libdir)/libpcap.dylib +install-shared-sl: libpcap.sl + [ -d $(DESTDIR)$(libdir) ] || \ + (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir)) + MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \ + $(INSTALL_PROGRAM) libpcap.$$MAJOR_VER $(DESTDIR)$(libdir) + ln -sf libpcap.$$MAJOR_VER $(DESTDIR)$(libdir)/libpcap.sl +install-shared-shareda: libpcap.shareda + # + # AIX shared libraries are weird. They're archive libraries + # with one or more shared object components. + # + [ -d $(DESTDIR)$(libdir) ] || \ + (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir)) + $(INSTALL_PROGRAM) libpcap.shareda $(DESTDIR)$(libdir)/libpcap.a +install-shared-none: -uninstall: +install-archive: install-archive-$(DYEXT) +install-archive-so install-archive-dylib install-archive-sl install-archive-none: libpcap.a + # + # Most platforms have separate suffixes for shared and + # archive libraries, so we install both. + # + [ -d $(DESTDIR)$(libdir) ] || \ + (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir)) + $(INSTALL_DATA) libpcap.a $(DESTDIR)$(libdir)/libpcap.a + $(RANLIB) $(DESTDIR)$(libdir)/libpcap.a +install-archive-shareda: + # + # AIX, however, doesn't, so we don't install the archive + # library on AIX. + # + +uninstall: uninstall-shared rm -f $(DESTDIR)$(libdir)/libpcap.a - rm -f $(DESTDIR)$(includedir)/pcap/pcap.h - rm -f $(DESTDIR)$(includedir)/pcap/bpf.h - rm -f $(DESTDIR)$(includedir)/pcap/namedb.h - rm -f $(DESTDIR)$(includedir)/pcap/sll.h - rm -f $(DESTDIR)$(includedir)/pcap/usb.h + for i in $(PUBHDR); do \ + rm -f $(DESTDIR)$(includedir)/$$i; done -rmdir $(DESTDIR)$(includedir)/pcap - rm -f $(DESTDIR)$(includedir)/pcap.h - rm -f $(DESTDIR)$(includedir)/pcap-bpf.h - rm -f $(DESTDIR)$(includedir)/pcap-namedb.h + rm -f $(DESTDIR)/$(bindir)/pcap-config for i in $(MAN1); do \ rm -f $(DESTDIR)$(mandir)/man1/$$i; done for i in $(MAN3PCAP); do \ rm -f $(DESTDIR)$(mandir)/man3/$$i; done - rm -f $(DESTDIR)$(mandir)/man3/pcap_datalink_val_to_description.3pcap - rm -f $(DESTDIR)$(mandir)/man3/pcap_dump_fopen.3pcap - rm -f $(DESTDIR)$(mandir)/man3/pcap_perror.3pcap - rm -f $(DESTDIR)$(mandir)/man3/pcap_sendpacket.3pcap - rm -f $(DESTDIR)$(mandir)/man3/pcap_dispatch.3pcap - rm -f $(DESTDIR)$(mandir)/man3/pcap_minor_version.3pcap - rm -f $(DESTDIR)$(mandir)/man3/pcap_next.3pcap - rm -f $(DESTDIR)$(mandir)/man3/pcap_fopen_offline.3pcap - rm -f $(DESTDIR)$(mandir)/man3/pcap_getnonblock.3pcap + rm -f $(DESTDIR)$(mandir)/man3/pcap_datalink_val_to_description.3pcap + rm -f $(DESTDIR)$(mandir)/man3/pcap_dump_fopen.3pcap + rm -f $(DESTDIR)$(mandir)/man3/pcap_perror.3pcap + rm -f $(DESTDIR)$(mandir)/man3/pcap_sendpacket.3pcap + rm -f $(DESTDIR)$(mandir)/man3/pcap_dispatch.3pcap + rm -f $(DESTDIR)$(mandir)/man3/pcap_minor_version.3pcap + rm -f $(DESTDIR)$(mandir)/man3/pcap_next.3pcap + rm -f $(DESTDIR)$(mandir)/man3/pcap_fopen_offline.3pcap + rm -f $(DESTDIR)$(mandir)/man3/pcap_getnonblock.3pcap for i in $(MANFILE); do \ rm -f $(DESTDIR)$(mandir)/man@MAN_FILE_FORMATS@/`echo $$i | sed 's/.manfile.in/.@MAN_FILE_FORMATS@/'`; done for i in $(MANMISC); do \ rm -f $(DESTDIR)$(mandir)/man@MAN_MISC_INFO@/`echo $$i | sed 's/.manmisc.in/.@MAN_MISC_INFO@/'`; done +uninstall-shared: uninstall-shared-$(DYEXT) +uninstall-shared-so: + VER=`cat $(srcdir)/VERSION`; \ + MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \ + rm -f $(DESTDIR)$(libdir)/libpcap.so.$$VER; \ + rm -f $(DESTDIR)$(libdir)/libpcap.so.$$MAJOR_VER; \ + rm -f $(DESTDIR)$(libdir)/libpcap.so +uninstall-shared-dylib: + VER=`cat $(srcdir)/VERSION`; \ + MAJOR_VER=A; \ + rm -f $(DESTDIR)$(libdir)/libpcap.$$VER.dylib; \ + rm -f $(DESTDIR)$(libdir)/libpcap.$$MAJOR_VER.dylib; \ + rm -f $(DESTDIR)$(libdir)/libpcap.dylib +uninstall-shared-sl: + MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \ + rm -f $(DESTDIR)$(libdir)/libpcap.$$MAJOR_VER; \ + rm -f $(DESTDIR)$(libdir)/libpcap.sl +uninstall-shared-shareda: + rm -f $(DESTDIR)$(libdir)/libpcap.a +uninstall-shared-none: + clean: - rm -f $(CLEANFILES) libpcap*.dylib libpcap.so* + rm -f $(CLEANFILES) distclean: clean rm -f Makefile config.cache config.log config.status \ @@ -530,7 +672,7 @@ packaging/pcap.spec: packaging/pcap.spec RPMVERSION=`cat VERSION | sed s/-.*//g`; \ sed -e s/@VERSION@/$$RPMVERSION/ -e s/@NAME@/libpcap-`cat VERSION`/ $< > $@ -releasetar: +releasetar: @cwd=`pwd` ; dir=`basename $$cwd` ; name=$(PROG)-`cat VERSION` ; \ mkdir $$name; \ tar cf - $(CSRC) $(HDR) $(MAN1) $(MAN3PCAP_EXPAND) \ Modified: head/contrib/libpcap/README ============================================================================== --- head/contrib/libpcap/README Fri Oct 29 18:41:09 2010 (r214517) +++ head/contrib/libpcap/README Fri Oct 29 18:43:23 2010 (r214518) @@ -1,19 +1,17 @@ -@(#) $Header: /tcpdump/master/libpcap/README,v 1.30.4.3 2008-10-17 10:39:20 ken Exp $ (LBL) +@(#) $Header: /tcpdump/master/libpcap/README,v 1.34 2008-12-14 19:44:14 guy Exp $ (LBL) -LIBPCAP 1.0.0 +LIBPCAP 1.x.y www.tcpdump.org Please send inquiries/comments/reports to: tcpdump-workers@lists.tcpdump.org -Anonymous CVS is available via: - cvs -d :pserver:tcpdump@cvs.tcpdump.org:/tcpdump/master login - (password "anoncvs") - cvs -d :pserver:tcpdump@cvs.tcpdump.org:/tcpdump/master checkout libpcap +Anonymous Git is available via: + git clone git://bpf.tcpdump.org/libpcap -Version 1.0.0 of LIBPCAP can be retrieved with the CVS tag "libpcap_1_0": - cvs -d :pserver:tcpdump@cvs.tcpdump.org:/tcpdump/master checkout -r libpcap_1_0 libpcap +Version 1.x.y of LIBPCAP can be retrieved with the CVS tag "libpcap_1_{x}rel{y}": + cvs -d :pserver:tcpdump@cvs.tcpdump.org:/tcpdump/master checkout -r libpcap_1_{x}rel{y} libpcap Please submit patches against the master copy to the libpcap project on sourceforge.net. @@ -80,10 +78,10 @@ information on configuring that option. Note to Linux distributions and *BSD systems that include libpcap: There's now a rule to make a shared library, which should work on Linux -and *BSD (and OS X). +and *BSD, among other platforms. It sets the soname of the library to "libpcap.so.1"; this is what it -should be, *NOT* libpcap.so.1.0 or libpcap.so.1.0.0 or something such as +should be, *NOT* libpcap.so.1.x or libpcap.so.1.x.y or something such as that. We've been maintaining binary compatibility between libpcap releases for Copied: head/contrib/libpcap/README.Win32 (from r214514, vendor/libpcap/dist/README.Win32) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/libpcap/README.Win32 Fri Oct 29 18:43:23 2010 (r214518, copy of r214514, vendor/libpcap/dist/README.Win32) @@ -0,0 +1,46 @@ +Under Win32, libpcap is integrated in the WinPcap packet capture system. +WinPcap provides a framework that allows libpcap to capture the packets +under Windows 95, Windows 98, Windows ME, Windows NT 4, Windows 2000 +and Windows XP. +WinPcap binaries and source code can be found at http://winpcap.polito.it: +they include also a developer's pack with all the necessary to compile +libpcap-based applications under Windows. + +How to compile libpcap with Visual Studio +----------------------------------------- + +In order to compile libpcap you will need: + +- version 6 (or higher) of Microsoft Visual Studio +- The November 2001 (or later) edition of Microsoft Platform +Software Development Kit (SDK), that contains some necessary includes +for IPv6 support. You can download it from http://www.microsoft.com/sdk +- the latest WinPcap sources from http://winpcap.polito.it/install + +The WinPcap source code already contains a recent (usually the latest +stable) version of libpcap. If you need to compile a different one, +simply download it from www.tcpdump.org and copy the sources in the +winpcap\wpcap\libpcap folder of the WinPcap distribution. If you want to +compile a libpcap source retrieved from the tcpdump.org Git, you will +have to create the scanner and the grammar by hand (with lex and yacc) +or with the cygnus makefile, since The Visual Studio project is not able +to build them. + +Open the project file winpcap\wpcap\prj\wpcap.dsw with Visual Studio and +build wpcap.dll. wpcap.lib, the library file to link with the applications, +will be generated in winpcap\wpcap\lib\. wpcap.dll will be generated in +winpcap\wpcap\prj\release or winpcap\wpcap\prj\debug depending on the type +of binary that is being created. + +How to compile libpcap with Cygnus +---------------------------------- + +To build wpcap.dll, cd to the directory WPCAP/PRJ of the WinPcap source code +distribution and type "make". libwpcap.a, the library file to link with the +applications, will be generated in winpcap\wpcap\lib\. wpcap.dll will be +generated in winpcap\wpcap\prj. + +Remember, you CANNOT use the MSVC-generated .lib files with gcc, use +libwpcap.a instead. + +"make install" installs wpcap.dll in the Windows system folder. Copied: head/contrib/libpcap/README.aix (from r214514, vendor/libpcap/dist/README.aix) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/libpcap/README.aix Fri Oct 29 18:43:23 2010 (r214518, copy of r214514, vendor/libpcap/dist/README.aix) @@ -0,0 +1,81 @@ +Using BPF: + +(1) AIX 4.x's version of BPF is undocumented and somewhat unstandard; the + current BPF support code includes changes that should work around + that; it appears to compile and work on at least one AIX 4.3.3 + machine. + + Note that the BPF driver and the "/dev/bpf" devices might not exist + on your machine; AIX's tcpdump loads the driver and creates the + devices if they don't already exist. Our libpcap should do the + same, and the configure script should detect that it's on an AIX + system and choose BPF even if the devices aren't there. + +(2) If libpcap doesn't compile on your machine when configured to use + BPF, or if the workarounds fail to make it work correctly, you + should send to tcpdump-workers@lists.tcpdump.org a detailed bug + report (if the compile fails, send us the compile error messages; + if it compiles but fails to work correctly, send us as detailed as + possible a description of the symptoms, including indications of the + network link-layer type being wrong or time stamps being wrong). + + If you fix the problems yourself, please submit a patch to + + http://sourceforge.net/projects/libpcap/ + + so we can incorporate them into the next release. + + If you don't fix the problems yourself, you can, as a workaround, + make libpcap use DLPI instead of BPF. + + This can be done by specifying the flag: + + --with-pcap=dlpi + + to the "configure" script for libpcap. + +If you use DLPI: + +(1) It is a good idea to have the latest version of the DLPI driver on + your system, since certain versions may be buggy and cause your AIX + system to crash. DLPI is included in the fileset bos.rte.tty. I + found that the DLPI driver that came with AIX 4.3.2 was buggy, and + had to upgrade to bos.rte.tty 4.3.2.4: + + lslpp -l bos.rte.tty + + bos.rte.tty 4.3.2.4 COMMITTED Base TTY Support and Commands + + Updates for AIX filesets can be obtained from: + ftp://service.software.ibm.com/aix/fixes/ + + These updates can be installed with the smit program. + +(2) After compiling libpcap, you need to make sure that the DLPI driver + is loaded. Type: + + strload -q -d dlpi + + If the result is: + + dlpi: yes + + then the DLPI driver is loaded correctly. + + If it is: + + dlpi: no + + Then you need to type: + + strload -f /etc/dlpi.conf + + Check again with strload -q -d dlpi that the dlpi driver is loaded. + + Alternatively, you can uncomment the lines for DLPI in + /etc/pse.conf and reboot the machine; this way DLPI will always + be loaded when you boot your system. + +(3) There appears to be a problem in the DLPI code in some versions of + AIX, causing a warning about DL_PROMISC_MULTI failing; this might + be responsible for DLPI not being able to capture outgoing packets. Copied: head/contrib/libpcap/README.dag (from r214514, vendor/libpcap/dist/README.dag) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/libpcap/README.dag Fri Oct 29 18:43:23 2010 (r214518, copy of r214514, vendor/libpcap/dist/README.dag) @@ -0,0 +1,114 @@ + +The following instructions apply if you have a Linux or FreeBSD platform and +want libpcap to support the DAG range of passive network monitoring cards from +Endace (http://www.endace.com, see below for further contact details). + +1) Install and build the DAG software distribution by following the +instructions supplied with that package. Current Endace customers can download +the DAG software distibution from https://www.endace.com + +2) Configure libcap. To allow the 'configure' script to locate the DAG +software distribution use the '--with-dag' option: + + ./configure --with-dag=DIR + +Where DIR is the root of the DAG software distribution, for example +/var/src/dag. If the DAG software is correctly detected 'configure' will +report: + + checking whether we have DAG API... yes + +If 'configure' reports that there is no DAG API, the directory may have been +incorrectly specified or the DAG software was not built before configuring +libpcap. + +See also the libpcap INSTALL.txt file for further libpcap configuration +options. + +Building libpcap at this stage will include support for both the native packet +capture stream (linux or bpf) and for capturing from DAG cards. To build +libpcap with only DAG support specify the capture type as 'dag' when +configuring libpcap: + + ./configure --with-dag=DIR --with-pcap=dag + +Applications built with libpcap configured in this way will only detect DAG +cards and will not capture from the native OS packet stream. + +---------------------------------------------------------------------- + +Libpcap when built for DAG cards against dag-2.5.1 or later releases: + +Timeouts are supported. pcap_dispatch() will return after to_ms milliseconds +regardless of how many packets are received. If to_ms is zero pcap_dispatch() +will block waiting for data indefinitely. + +pcap_dispatch() will block on and process a minimum of 64kB of data (before +filtering) for efficiency. This can introduce high latencies on quiet +interfaces unless a timeout value is set. The timeout expiring will override +the 64kB minimum causing pcap_dispatch() to process any available data and +return. + +pcap_setnonblock is supported. When nonblock is set, pcap_dispatch() will +check once for available data, process any data available up to count, then +return immediately. + +pcap_findalldevs() is supported, e.g. dag0, dag1... + +Some DAG cards can provide more than one 'stream' of received data. +This can be data from different physical ports, or separated by filtering +or load balancing mechanisms. Receive streams have even numbers, e.g. +dag0:0, dag0:2 etc. Specifying transmit streams for capture is not supported. + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Fri Oct 29 18:45:10 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EF2441065695; Fri, 29 Oct 2010 18:45:10 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DD7E88FC1C; Fri, 29 Oct 2010 18:45:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9TIjArt049642; Fri, 29 Oct 2010 18:45:10 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9TIjAO7049640; Fri, 29 Oct 2010 18:45:10 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201010291845.o9TIjAO7049640@svn.freebsd.org> From: Rui Paulo Date: Fri, 29 Oct 2010 18:45:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214519 - head/lib/libpcap X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 18:45:11 -0000 Author: rpaulo Date: Fri Oct 29 18:45:10 2010 New Revision: 214519 URL: http://svn.freebsd.org/changeset/base/214519 Log: Update for libpcap-1.1.1. Modified: head/lib/libpcap/Makefile Modified: head/lib/libpcap/Makefile ============================================================================== --- head/lib/libpcap/Makefile Fri Oct 29 18:43:23 2010 (r214518) +++ head/lib/libpcap/Makefile Fri Oct 29 18:45:10 2010 (r214519) @@ -9,7 +9,7 @@ LIB= pcap SRCS= grammar.y tokdefs.h version.h pcap-bpf.c \ pcap.c inet.c fad-getad.c gencode.c optimize.c nametoaddr.c \ etherent.c savefile.c bpf_filter.c bpf_image.c bpf_dump.c \ - scanner.l version.c + scanner.l sf-pcap.c sf-pcap-ng.c version.c # Old compatibility headers INCS= pcap.h pcap-int.h pcap-namedb.h pcap-bpf.h From owner-svn-src-head@FreeBSD.ORG Fri Oct 29 18:50:39 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0112E106564A; Fri, 29 Oct 2010 18:50:39 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C8C918FC1C; Fri, 29 Oct 2010 18:50:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9TIoclo049998; Fri, 29 Oct 2010 18:50:38 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9TIoc7T049997; Fri, 29 Oct 2010 18:50:38 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201010291850.o9TIoc7T049997@svn.freebsd.org> From: Rui Paulo Date: Fri, 29 Oct 2010 18:50:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214520 - in head/contrib/libpcap: . ChmodBPF SUNOS4 Win32 msdos X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 18:50:39 -0000 Author: rpaulo Date: Fri Oct 29 18:50:38 2010 New Revision: 214520 URL: http://svn.freebsd.org/changeset/base/214520 Log: Remove unused files. Deleted: head/contrib/libpcap/ChmodBPF/ head/contrib/libpcap/FREEBSD-Xlist head/contrib/libpcap/FREEBSD-upgrade head/contrib/libpcap/README.Win32 head/contrib/libpcap/README.aix head/contrib/libpcap/README.macosx head/contrib/libpcap/README.tru64 head/contrib/libpcap/SUNOS4/ head/contrib/libpcap/Win32/ head/contrib/libpcap/msdos/ head/contrib/libpcap/org.tcpdump.chmod_bpf.plist From owner-svn-src-head@FreeBSD.ORG Fri Oct 29 18:56:51 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8C945106566C; Fri, 29 Oct 2010 18:56:51 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6070A8FC1A; Fri, 29 Oct 2010 18:56:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9TIupGV050344; Fri, 29 Oct 2010 18:56:51 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9TIupEC050343; Fri, 29 Oct 2010 18:56:51 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201010291856.o9TIupEC050343@svn.freebsd.org> From: Rui Paulo Date: Fri, 29 Oct 2010 18:56:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214521 - head/contrib/libpcap X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 18:56:51 -0000 Author: rpaulo Date: Fri Oct 29 18:56:51 2010 New Revision: 214521 URL: http://svn.freebsd.org/changeset/base/214521 Log: Remove more unused files. Deleted: head/contrib/libpcap/README.dag head/contrib/libpcap/README.hpux head/contrib/libpcap/README.linux head/contrib/libpcap/README.septel head/contrib/libpcap/README.sita From owner-svn-src-head@FreeBSD.ORG Fri Oct 29 19:07:37 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4D78B106566B; Fri, 29 Oct 2010 19:07:37 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3B8D98FC0A; Fri, 29 Oct 2010 19:07:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9TJ7bQS051067; Fri, 29 Oct 2010 19:07:37 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9TJ7bTG051065; Fri, 29 Oct 2010 19:07:37 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201010291907.o9TJ7bTG051065@svn.freebsd.org> From: Edward Tomasz Napierala Date: Fri, 29 Oct 2010 19:07:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214522 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 19:07:37 -0000 Author: trasz Date: Fri Oct 29 19:07:36 2010 New Revision: 214522 URL: http://svn.freebsd.org/changeset/base/214522 Log: Fix uninitialized variable. Found with: Coverity Prevent(tm) CID: 8632 Modified: head/sys/kern/subr_acl_nfs4.c Modified: head/sys/kern/subr_acl_nfs4.c ============================================================================== --- head/sys/kern/subr_acl_nfs4.c Fri Oct 29 18:56:51 2010 (r214521) +++ head/sys/kern/subr_acl_nfs4.c Fri Oct 29 19:07:36 2010 (r214522) @@ -162,7 +162,7 @@ vaccess_acl_nfs4(enum vtype type, uid_t accmode_t priv_granted = 0; int denied, explicitly_denied, access_mask, is_directory, must_be_owner = 0; - mode_t file_mode; + mode_t file_mode = 0; KASSERT((accmode & ~(VEXEC | VWRITE | VREAD | VADMIN | VAPPEND | VEXPLICIT_DENY | VREAD_NAMED_ATTRS | VWRITE_NAMED_ATTRS | From owner-svn-src-head@FreeBSD.ORG Fri Oct 29 19:17:08 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 49D04106566C; Fri, 29 Oct 2010 19:17:08 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1D6428FC13; Fri, 29 Oct 2010 19:17:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9TJH8Rj051633; Fri, 29 Oct 2010 19:17:08 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9TJH8MU051631; Fri, 29 Oct 2010 19:17:08 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201010291917.o9TJH8MU051631@svn.freebsd.org> From: John Baldwin Date: Fri, 29 Oct 2010 19:17:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214523 - head/usr.sbin/config X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 19:17:08 -0000 Author: jhb Date: Fri Oct 29 19:17:07 2010 New Revision: 214523 URL: http://svn.freebsd.org/changeset/base/214523 Log: Remove support for creating the 'machine' symlink as well as creating the extra MACHINE_ARCH symlink for certain platforms (such as pc98). The support for creating these symlinks was added to sys/conf/kern.post.mk in changeset 152964. The intention of that commit was to remove this code from config(8), but config(8) was never updated. Approved by: imp Modified: head/usr.sbin/config/main.c Modified: head/usr.sbin/config/main.c ============================================================================== --- head/usr.sbin/config/main.c Fri Oct 29 19:07:36 2010 (r214522) +++ head/usr.sbin/config/main.c Fri Oct 29 19:17:07 2010 (r214523) @@ -108,7 +108,6 @@ main(int argc, char **argv) struct stat buf; int ch, len; char *p; - char xxx[MAXPATHLEN]; char *kernfile; int printmachine; @@ -218,32 +217,6 @@ main(int argc, char **argv) } else if (!S_ISDIR(buf.st_mode)) errx(EXIT_FAILURE, "%s isn't a directory", p); - /* - * make symbolic links in compilation directory - * for "sys" (to make genassym.c work along with #include ) - * and similarly for "machine". - */ - if (*srcdir == '\0') - (void)snprintf(xxx, sizeof(xxx), "../../include"); - else - (void)snprintf(xxx, sizeof(xxx), "%s/%s/include", - srcdir, machinename); - (void) unlink(path("machine")); - (void) symlink(xxx, path("machine")); - if (strcmp(machinename, machinearch) != 0) { - /* - * make symbolic links in compilation directory for - * machinearch, if it is different than machinename. - */ - if (*srcdir == '\0') - (void)snprintf(xxx, sizeof(xxx), "../../../%s/include", - machinearch); - else - (void)snprintf(xxx, sizeof(xxx), "%s/%s/include", - srcdir, machinearch); - (void) unlink(path(machinearch)); - (void) symlink(xxx, path(machinearch)); - } configfile(); /* put config file into kernel*/ options(); /* make options .h files */ makefile(); /* build Makefile */ From owner-svn-src-head@FreeBSD.ORG Fri Oct 29 19:34:58 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BAA38106564A; Fri, 29 Oct 2010 19:34:57 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A7A428FC0A; Fri, 29 Oct 2010 19:34:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9TJYvJD052572; Fri, 29 Oct 2010 19:34:57 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9TJYv7M052569; Fri, 29 Oct 2010 19:34:57 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201010291934.o9TJYv7M052569@svn.freebsd.org> From: Jilles Tjoelker Date: Fri, 29 Oct 2010 19:34:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214524 - in head: bin/sh tools/regression/bin/sh/expansion X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 19:34:58 -0000 Author: jilles Date: Fri Oct 29 19:34:57 2010 New Revision: 214524 URL: http://svn.freebsd.org/changeset/base/214524 Log: sh: Fix some issues with CTL* bytes and ${var#pat}. subevalvar() incorrectly assumed that CTLESC bytes were present iff the expansion was quoted. However, they are present iff various processing such as word splitting is to be done later on. Example: v=@$e@$e@$e@ y="${v##*"$e"}" echo "$y" failed if $e contained the magic CTLESC byte. Exp-run done by: pav (with some other sh(1) changes) Added: head/tools/regression/bin/sh/expansion/trim6.0 (contents, props changed) Modified: head/bin/sh/expand.c Modified: head/bin/sh/expand.c ============================================================================== --- head/bin/sh/expand.c Fri Oct 29 19:17:07 2010 (r214523) +++ head/bin/sh/expand.c Fri Oct 29 19:34:57 2010 (r214524) @@ -98,7 +98,7 @@ static struct arglist exparg; /* holds static void argstr(char *, int); static char *exptilde(char *, int); static void expbackq(union node *, int, int); -static int subevalvar(char *, char *, int, int, int, int); +static int subevalvar(char *, char *, int, int, int, int, int); static char *evalvar(char *, int); static int varisset(char *, int); static void varvalue(char *, int, int, int); @@ -526,7 +526,7 @@ expbackq(union node *cmd, int quoted, in static int subevalvar(char *p, char *str, int strloc, int subtype, int startloc, - int varflags) + int varflags, int quotes) { char *startp; char *loc = NULL; @@ -571,12 +571,12 @@ subevalvar(char *p, char *str, int strlo for (loc = startp; loc < str; loc++) { c = *loc; *loc = '\0'; - if (patmatch(str, startp, varflags & VSQUOTE)) { + if (patmatch(str, startp, quotes)) { *loc = c; goto recordleft; } *loc = c; - if ((varflags & VSQUOTE) && *loc == CTLESC) + if (quotes && *loc == CTLESC) loc++; } return 0; @@ -585,14 +585,13 @@ subevalvar(char *p, char *str, int strlo for (loc = str - 1; loc >= startp;) { c = *loc; *loc = '\0'; - if (patmatch(str, startp, varflags & VSQUOTE)) { + if (patmatch(str, startp, quotes)) { *loc = c; goto recordleft; } *loc = c; loc--; - if ((varflags & VSQUOTE) && loc > startp && - *(loc - 1) == CTLESC) { + if (quotes && loc > startp && *(loc - 1) == CTLESC) { for (q = startp; q < loc; q++) if (*q == CTLESC) q++; @@ -604,14 +603,13 @@ subevalvar(char *p, char *str, int strlo case VSTRIMRIGHT: for (loc = str - 1; loc >= startp;) { - if (patmatch(str, loc, varflags & VSQUOTE)) { + if (patmatch(str, loc, quotes)) { amount = loc - expdest; STADJUST(amount, expdest); return 1; } loc--; - if ((varflags & VSQUOTE) && loc > startp && - *(loc - 1) == CTLESC) { + if (quotes && loc > startp && *(loc - 1) == CTLESC) { for (q = startp; q < loc; q++) if (*q == CTLESC) q++; @@ -623,12 +621,12 @@ subevalvar(char *p, char *str, int strlo case VSTRIMRIGHTMAX: for (loc = startp; loc < str - 1; loc++) { - if (patmatch(str, loc, varflags & VSQUOTE)) { + if (patmatch(str, loc, quotes)) { amount = loc - expdest; STADJUST(amount, expdest); return 1; } - if ((varflags & VSQUOTE) && *loc == CTLESC) + if (quotes && *loc == CTLESC) loc++; } return 0; @@ -779,7 +777,7 @@ record: STPUTC('\0', expdest); patloc = expdest - stackblock(); if (subevalvar(p, NULL, patloc, subtype, - startloc, varflags) == 0) { + startloc, varflags, quotes) == 0) { int amount = (expdest - stackblock() - patloc) + 1; STADJUST(-amount, expdest); } @@ -790,7 +788,8 @@ record: case VSASSIGN: case VSQUESTION: if (!set) { - if (subevalvar(p, var, 0, subtype, startloc, varflags)) { + if (subevalvar(p, var, 0, subtype, startloc, varflags, + quotes)) { varflags &= ~VSNUL; /* * Remove any recorded regions beyond Added: head/tools/regression/bin/sh/expansion/trim6.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/expansion/trim6.0 Fri Oct 29 19:34:57 2010 (r214524) @@ -0,0 +1,22 @@ +# $FreeBSD$ + +e= +for i in 0 1 2 3; do + for j in 0 1 2 3 4 5 6 7; do + for k in 0 1 2 3 4 5 6 7; do + case $i$j$k in + 000) continue ;; + esac + e="$e\\$i$j$k" + done + done +done +e=$(printf "$e") +v=@$e@$e@ +y=${v##*"$e"} +yq="${v##*"$e"}" +[ "$y" = @ ] || echo "error when unquoted in non-splitting context" +[ "$yq" = @ ] || echo "error when quoted in non-splitting context" +[ "${v##*"$e"}" = @ ] || echo "error when quoted in splitting context" +IFS= +[ ${v##*"$e"} = @ ] || echo "error when unquoted in splitting context" From owner-svn-src-head@FreeBSD.ORG Fri Oct 29 19:48:45 2010 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4D449106566B; Fri, 29 Oct 2010 19:48:45 +0000 (UTC) (envelope-from mike@sentex.net) Received: from smarthost2.sentex.ca (smarthost2-6.sentex.ca [IPv6:2607:f3e0:80:80::2]) by mx1.freebsd.org (Postfix) with ESMTP id E96ED8FC13; Fri, 29 Oct 2010 19:48:43 +0000 (UTC) Received: from lava.sentex.ca (pyroxene.sentex.ca [199.212.134.18]) by smarthost2.sentex.ca (8.14.4/8.14.4) with ESMTP id o9TJmZNA075912 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 29 Oct 2010 15:48:35 -0400 (EDT) (envelope-from mike@sentex.net) Received: from mdt-xp.sentex.net (simeon.sentex.ca [192.168.43.27]) by lava.sentex.ca (8.14.4/8.14.4) with ESMTP id o9TJmX5Y064325; Fri, 29 Oct 2010 15:48:33 -0400 (EDT) (envelope-from mike@sentex.net) Message-Id: <201010291948.o9TJmX5Y064325@lava.sentex.ca> X-Mailer: QUALCOMM Windows Eudora Version 7.1.0.9 Date: Fri, 29 Oct 2010 15:48:25 -0400 To: "Bjoern A. Zeeb" From: Mike Tancsa In-Reply-To: <20101029135858.E66242@maildrop.int.zabbadoz.net> References: <0C099B90-AFB9-422F-AB75-AFC138A36D20@berlin.ccc.de> <20101029013606.I66242@maildrop.int.zabbadoz.net> <201010291342.o9TDggVQ062469@lava.sentex.ca> <20101029135858.E66242@maildrop.int.zabbadoz.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-Scanned-By: MIMEDefang 2.67 on 205.211.164.50 Cc: Denis Ahrens , svn-src-head@FreeBSD.org, Philipp, =?iso-8859-1?Q?W=FCnsche?= , Randy Bush Subject: Re: pending em0 commits for FreeBSD 8.1 STABLE X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 19:48:45 -0000 At 10:06 AM 10/29/2010, Bjoern A. Zeeb wrote: >>Actually, >> I dont think its an em bug as I can trigger this crash with >> the igb nic. Perhaps these are 2 different issues being hit ? >> Anyways, I tried with > >Yes what you have down there looks *sigh* hopefully like a different >issue thought it mbuf fiddling again but way further up the stack. > >Could you please concentrate on only reproducing the > if: discard frame w/o packet header >issue rather than breaking things left and right as well? ;-) Well, I can recreate it. But unfortunately, its on zoo itself :( 0(zoo)# tail /var/log/kernel Oct 23 00:00:00 zoo newsyslog[25247]: logfile turned over Oct 29 11:37:19 zoo kernel: cannot forward src fe80:2::230:48ff:fe67:4880, dst 2607:f3e0:0:80::290, nxt 58, rcvif em1, outif em0 Oct 29 11:37:37 zoo kernel: cannot forward src fe80:2::230:48ff:fe67:4880, dst 2607:f3e0:0:80::290, nxt 58, rcvif em1, outif em0 Oct 29 11:40:05 zoo kernel: cannot forward src fe80:2::230:48ff:fe67:4880, dst 2607:f3e0:0:80::290, nxt 58, rcvif em1, outif em0 Oct 29 12:30:06 zoo syslogd: kernel boot file is /boot/kernel/kernel Oct 29 15:20:19 zoo kernel: em1: promiscuous mode enabled Oct 29 15:20:24 zoo kernel: em1: promiscuous mode disabled Oct 29 15:43:53 zoo kernel: em1: discard frame w/o packet header Oct 29 15:44:29 zoo last message repeated 6 times Oct 29 15:46:30 zoo last message repeated 14 times 0(zoo)# Same method to make it happen as last Friday. It just takes a bit of time. ---Mike -------------------------------------------------------------------- Mike Tancsa, tel +1 519 651 3400 Sentex Communications, mike@sentex.net Providing Internet since 1994 www.sentex.net Cambridge, Ontario Canada www.sentex.net/mike From owner-svn-src-head@FreeBSD.ORG Fri Oct 29 20:23:42 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3821910656A4; Fri, 29 Oct 2010 20:23:42 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 25E9D8FC1B; Fri, 29 Oct 2010 20:23:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9TKNglF055302; Fri, 29 Oct 2010 20:23:42 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9TKNgL3055300; Fri, 29 Oct 2010 20:23:42 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201010292023.o9TKNgL3055300@svn.freebsd.org> From: Jilles Tjoelker Date: Fri, 29 Oct 2010 20:23:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214525 - head/bin/sh X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 20:23:42 -0000 Author: jilles Date: Fri Oct 29 20:23:41 2010 New Revision: 214525 URL: http://svn.freebsd.org/changeset/base/214525 Log: sh: Error out on various specials/keywords in the wrong place in backticks. Example: echo `date)` Exp-run done by: pav (with some other sh(1) changes) Obtained from: NetBSD (Christos Zoulas, NetBSD PR 11317) Modified: head/bin/sh/parser.c Modified: head/bin/sh/parser.c ============================================================================== --- head/bin/sh/parser.c Fri Oct 29 19:34:57 2010 (r214524) +++ head/bin/sh/parser.c Fri Oct 29 20:23:41 2010 (r214525) @@ -106,7 +106,7 @@ static struct parser_temp *parser_temp; static int noaliases = 0; -static union node *list(int); +static union node *list(int, int); static union node *andor(void); static union node *pipeline(void); static union node *command(void); @@ -220,12 +220,12 @@ parsecmd(int interact) if (t == TNL) return NULL; tokpushback++; - return list(1); + return list(1, 0); } static union node * -list(int nlflag) +list(int nlflag, int erflag) { union node *n1, *n2, *n3; int tok; @@ -287,7 +287,7 @@ list(int nlflag) pungetc(); /* push back EOF on input */ return n1; default: - if (nlflag) + if (nlflag || erflag) synexpect(-1); tokpushback++; return n1; @@ -398,24 +398,24 @@ command(void) case TIF: n1 = (union node *)stalloc(sizeof (struct nif)); n1->type = NIF; - if ((n1->nif.test = list(0)) == NULL) + if ((n1->nif.test = list(0, 0)) == NULL) synexpect(-1); if (readtoken() != TTHEN) synexpect(TTHEN); - n1->nif.ifpart = list(0); + n1->nif.ifpart = list(0, 0); n2 = n1; while (readtoken() == TELIF) { n2->nif.elsepart = (union node *)stalloc(sizeof (struct nif)); n2 = n2->nif.elsepart; n2->type = NIF; - if ((n2->nif.test = list(0)) == NULL) + if ((n2->nif.test = list(0, 0)) == NULL) synexpect(-1); if (readtoken() != TTHEN) synexpect(TTHEN); - n2->nif.ifpart = list(0); + n2->nif.ifpart = list(0, 0); } if (lasttoken == TELSE) - n2->nif.elsepart = list(0); + n2->nif.elsepart = list(0, 0); else { n2->nif.elsepart = NULL; tokpushback++; @@ -429,13 +429,13 @@ command(void) int got; n1 = (union node *)stalloc(sizeof (struct nbinary)); n1->type = (lasttoken == TWHILE)? NWHILE : NUNTIL; - if ((n1->nbinary.ch1 = list(0)) == NULL) + if ((n1->nbinary.ch1 = list(0, 0)) == NULL) synexpect(-1); if ((got=readtoken()) != TDO) { TRACE(("expecting DO got %s %s\n", tokname[got], got == TWORD ? wordtext : "")); synexpect(TDO); } - n1->nbinary.ch2 = list(0); + n1->nbinary.ch2 = list(0, 0); if (readtoken() != TDONE) synexpect(TDONE); checkkwd = 1; @@ -487,7 +487,7 @@ TRACE(("expecting DO got %s %s\n", tokna t = TEND; else synexpect(-1); - n1->nfor.body = list(0); + n1->nfor.body = list(0, 0); if (readtoken() != t) synexpect(t); checkkwd = 1; @@ -527,7 +527,7 @@ TRACE(("expecting DO got %s %s\n", tokna ap->narg.next = NULL; if (lasttoken != TRP) noaliases = 0, synexpect(TRP); - cp->nclist.body = list(0); + cp->nclist.body = list(0, 0); checkkwd = 2; if ((t = readtoken()) != TESAC) { @@ -545,14 +545,14 @@ TRACE(("expecting DO got %s %s\n", tokna case TLP: n1 = (union node *)stalloc(sizeof (struct nredir)); n1->type = NSUBSHELL; - n1->nredir.n = list(0); + n1->nredir.n = list(0, 0); n1->nredir.redirect = NULL; if (readtoken() != TRP) synexpect(TRP); checkkwd = 1; break; case TBEGIN: - n1 = list(0); + n1 = list(0, 0); if (readtoken() != TEND) synexpect(TEND); checkkwd = 1; @@ -1066,7 +1066,7 @@ done: doprompt = 0; } - n = list(0); + n = list(0, oldstyle); if (oldstyle) doprompt = saveprompt; From owner-svn-src-head@FreeBSD.ORG Fri Oct 29 20:42:02 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 936131065672; Fri, 29 Oct 2010 20:42:02 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 819D98FC1A; Fri, 29 Oct 2010 20:42:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9TKg2Gf056208; Fri, 29 Oct 2010 20:42:02 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9TKg2HM056206; Fri, 29 Oct 2010 20:42:02 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201010292042.o9TKg2HM056206@svn.freebsd.org> From: Marius Strobl Date: Fri, 29 Oct 2010 20:42:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214526 - head/sys/boot/sparc64/loader X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 20:42:02 -0000 Author: marius Date: Fri Oct 29 20:42:02 2010 New Revision: 214526 URL: http://svn.freebsd.org/changeset/base/214526 Log: Partially revert r203829; as it turns out what the PowerPC OFW loader did was incorrect as further down the road cons_probe() calls malloc() so the former can't be called before init_heap() has succeed. Instead just exit to the firmware in case init_heap() fails like OF_init() does when hitting a problem as we're then likely running in a very broken environment where hardly anything can be trusted to work. Modified: head/sys/boot/sparc64/loader/main.c Modified: head/sys/boot/sparc64/loader/main.c ============================================================================== --- head/sys/boot/sparc64/loader/main.c Fri Oct 29 20:23:41 2010 (r214525) +++ head/sys/boot/sparc64/loader/main.c Fri Oct 29 20:42:02 2010 (r214526) @@ -811,15 +811,15 @@ main(int (*openfirm)(void *)) archsw.arch_autoload = sparc64_autoload; archsw.arch_maphint = sparc64_maphint; + if (init_heap() == (vm_offset_t)-1) + OF_exit(); + setheap((void *)heapva, (void *)(heapva + HEAPSZ)); + /* * Probe for a console. */ cons_probe(); - if (init_heap() == (vm_offset_t)-1) - panic("%s: can't claim heap", __func__); - setheap((void *)heapva, (void *)(heapva + HEAPSZ)); - if ((root = OF_peer(0)) == -1) panic("%s: can't get root phandle", __func__); OF_getprop(root, "compatible", compatible, sizeof(compatible)); From owner-svn-src-head@FreeBSD.ORG Fri Oct 29 20:51:31 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0D43C1065679; Fri, 29 Oct 2010 20:51:31 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EF8F08FC16; Fri, 29 Oct 2010 20:51:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9TKpUo8056725; Fri, 29 Oct 2010 20:51:30 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9TKpUcb056723; Fri, 29 Oct 2010 20:51:30 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201010292051.o9TKpUcb056723@svn.freebsd.org> From: Marius Strobl Date: Fri, 29 Oct 2010 20:51:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214528 - head/sys/sparc64/sparc64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 20:51:31 -0000 Author: marius Date: Fri Oct 29 20:51:30 2010 New Revision: 214528 URL: http://svn.freebsd.org/changeset/base/214528 Log: - When resetting pm_active and pm_context of a pmap in pmap_pinit() we need locking as otherwise we may race against the other parts of the MD code which expects a consistent state of these. While at it move the resetting of the pmap before entering it in the TSB. - Spell a 0 as TLB_CTX_KERNEL. Modified: head/sys/sparc64/sparc64/pmap.c Modified: head/sys/sparc64/sparc64/pmap.c ============================================================================== --- head/sys/sparc64/sparc64/pmap.c Fri Oct 29 20:50:59 2010 (r214527) +++ head/sys/sparc64/sparc64/pmap.c Fri Oct 29 20:51:30 2010 (r214528) @@ -1065,7 +1065,7 @@ pmap_pinit0(pmap_t pm) PMAP_LOCK_INIT(pm); for (i = 0; i < MAXCPU; i++) - pm->pm_context[i] = 0; + pm->pm_context[i] = TLB_CTX_KERNEL; pm->pm_active = 0; pm->pm_tsb = NULL; pm->pm_tsb_obj = NULL; @@ -1103,6 +1103,12 @@ pmap_pinit(pmap_t pm) if (pm->pm_tsb_obj == NULL) pm->pm_tsb_obj = vm_object_allocate(OBJT_PHYS, TSB_PAGES); + mtx_lock_spin(&sched_lock); + for (i = 0; i < MAXCPU; i++) + pm->pm_context[i] = -1; + pm->pm_active = 0; + mtx_unlock_spin(&sched_lock); + VM_OBJECT_LOCK(pm->pm_tsb_obj); for (i = 0; i < TSB_PAGES; i++) { m = vm_page_grab(pm->pm_tsb_obj, i, VM_ALLOC_NOBUSY | @@ -1114,9 +1120,6 @@ pmap_pinit(pmap_t pm) VM_OBJECT_UNLOCK(pm->pm_tsb_obj); pmap_qenter((vm_offset_t)pm->pm_tsb, ma, TSB_PAGES); - for (i = 0; i < MAXCPU; i++) - pm->pm_context[i] = -1; - pm->pm_active = 0; bzero(&pm->pm_stats, sizeof(pm->pm_stats)); return (1); } From owner-svn-src-head@FreeBSD.ORG Fri Oct 29 20:54:04 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D3E79106566C; Fri, 29 Oct 2010 20:54:04 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C27AA8FC14; Fri, 29 Oct 2010 20:54:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9TKs4xO056879; Fri, 29 Oct 2010 20:54:04 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9TKs4cu056877; Fri, 29 Oct 2010 20:54:04 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201010292054.o9TKs4cu056877@svn.freebsd.org> From: Rui Paulo Date: Fri, 29 Oct 2010 20:54:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214529 - head/lib/libpcap X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 20:54:04 -0000 Author: rpaulo Date: Fri Oct 29 20:54:04 2010 New Revision: 214529 URL: http://svn.freebsd.org/changeset/base/214529 Log: add pcap-common.c. Submitted by: dim Modified: head/lib/libpcap/Makefile Modified: head/lib/libpcap/Makefile ============================================================================== --- head/lib/libpcap/Makefile Fri Oct 29 20:51:30 2010 (r214528) +++ head/lib/libpcap/Makefile Fri Oct 29 20:54:04 2010 (r214529) @@ -7,7 +7,7 @@ SHLIBDIR?= /lib LIB= pcap SRCS= grammar.y tokdefs.h version.h pcap-bpf.c \ - pcap.c inet.c fad-getad.c gencode.c optimize.c nametoaddr.c \ + pcap.c pcap-common.c inet.c fad-getad.c gencode.c optimize.c nametoaddr.c \ etherent.c savefile.c bpf_filter.c bpf_image.c bpf_dump.c \ scanner.l sf-pcap.c sf-pcap-ng.c version.c From owner-svn-src-head@FreeBSD.ORG Fri Oct 29 21:04:00 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 29124106564A; Fri, 29 Oct 2010 21:03:59 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D42178FC0C; Fri, 29 Oct 2010 21:03:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9TL3xZB057399; Fri, 29 Oct 2010 21:03:59 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9TL3x0B057397; Fri, 29 Oct 2010 21:03:59 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201010292103.o9TL3x0B057397@svn.freebsd.org> From: Rui Paulo Date: Fri, 29 Oct 2010 21:03:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214530 - head/usr.sbin/tcpdump/tcpdump X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 21:04:00 -0000 Author: rpaulo Date: Fri Oct 29 21:03:59 2010 New Revision: 214530 URL: http://svn.freebsd.org/changeset/base/214530 Log: Add print-ipnet.c Submitted by: dim Modified: head/usr.sbin/tcpdump/tcpdump/Makefile Modified: head/usr.sbin/tcpdump/tcpdump/Makefile ============================================================================== --- head/usr.sbin/tcpdump/tcpdump/Makefile Fri Oct 29 20:54:04 2010 (r214529) +++ head/usr.sbin/tcpdump/tcpdump/Makefile Fri Oct 29 21:03:59 2010 (r214530) @@ -17,7 +17,7 @@ SRCS = addrtoname.c af.c checksum.c cpac print-egp.c print-eap.c print-eigrp.c \ print-esp.c print-ether.c print-fddi.c print-forces.c print-fr.c \ print-gre.c print-hsrp.c print-icmp.c print-igmp.c \ - print-igrp.c print-ip.c print-ipcomp.c print-ipfc.c \ + print-igrp.c print-ip.c print-ipcomp.c print-ipfc.c print-ipnet.c \ print-ipx.c print-isakmp.c print-isoclns.c print-juniper.c print-krb.c \ print-l2tp.c print-lane.c print-ldp.c print-lldp.c print-llc.c \ print-lmp.c print-lspping.c \ From owner-svn-src-head@FreeBSD.ORG Fri Oct 29 21:06:58 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5686B1065696; Fri, 29 Oct 2010 21:06:58 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 447118FC0C; Fri, 29 Oct 2010 21:06:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9TL6wPL057583; Fri, 29 Oct 2010 21:06:58 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9TL6wtU057580; Fri, 29 Oct 2010 21:06:58 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201010292106.o9TL6wtU057580@svn.freebsd.org> From: Jilles Tjoelker Date: Fri, 29 Oct 2010 21:06:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214531 - in head: bin/sh tools/regression/bin/sh/errors X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 21:06:58 -0000 Author: jilles Date: Fri Oct 29 21:06:57 2010 New Revision: 214531 URL: http://svn.freebsd.org/changeset/base/214531 Log: sh: Detect various additional errors in the parser. Apart from detecting breakage earlier or at all, this also fixes a segfault in the testsuite. The "handling" of the breakage left an invalid internal representation in some cases. Examples: echo a; do echo b echo `) echo a` echo `date; do do do` Exp-run done by: pav (with some other sh(1) changes) Added: head/tools/regression/bin/sh/errors/bad-keyword1.0 (contents, props changed) Modified: head/bin/sh/parser.c Modified: head/bin/sh/parser.c ============================================================================== --- head/bin/sh/parser.c Fri Oct 29 21:03:59 2010 (r214530) +++ head/bin/sh/parser.c Fri Oct 29 21:06:57 2010 (r214531) @@ -220,7 +220,7 @@ parsecmd(int interact) if (t == TNL) return NULL; tokpushback++; - return list(1, 0); + return list(1, 1); } @@ -231,7 +231,7 @@ list(int nlflag, int erflag) int tok; checkkwd = 2; - if (nlflag == 0 && tokendlist[peektoken()]) + if (!nlflag && !erflag && tokendlist[peektoken()]) return NULL; n1 = NULL; for (;;) { @@ -277,7 +277,7 @@ list(int nlflag, int erflag) tokpushback++; } checkkwd = 2; - if (tokendlist[peektoken()]) + if (!nlflag && !erflag && tokendlist[peektoken()]) return n1; break; case TEOF: Added: head/tools/regression/bin/sh/errors/bad-keyword1.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/errors/bad-keyword1.0 Fri Oct 29 21:06:57 2010 (r214531) @@ -0,0 +1,4 @@ +# $FreeBSD$ + +echo ':; fi' | sh -n 2>/dev/null && exit 1 +exit 0 From owner-svn-src-head@FreeBSD.ORG Fri Oct 29 21:20:14 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D3FE01065672; Fri, 29 Oct 2010 21:20:14 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C2B788FC1A; Fri, 29 Oct 2010 21:20:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9TLKEaZ058581; Fri, 29 Oct 2010 21:20:14 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9TLKEhM058579; Fri, 29 Oct 2010 21:20:14 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201010292120.o9TLKEhM058579@svn.freebsd.org> From: Rui Paulo Date: Fri, 29 Oct 2010 21:20:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214533 - head/sbin/pflogd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 21:20:14 -0000 Author: rpaulo Date: Fri Oct 29 21:20:14 2010 New Revision: 214533 URL: http://svn.freebsd.org/changeset/base/214533 Log: Force include ../../libpcap/config.h since privsep.c groks pcap's internals. Modified: head/sbin/pflogd/Makefile Modified: head/sbin/pflogd/Makefile ============================================================================== --- head/sbin/pflogd/Makefile Fri Oct 29 21:12:44 2010 (r214532) +++ head/sbin/pflogd/Makefile Fri Oct 29 21:20:14 2010 (r214533) @@ -6,6 +6,8 @@ PROG= pflogd SRCS= pflogd.c pidfile.c privsep.c privsep_fdpass.c MAN= pflogd.8 +CFLAGS=-include ../../lib/libpcap/config.h + LDADD= -lpcap -lutil DPADD= ${LIBPCAP} ${LIBUTIL} From owner-svn-src-head@FreeBSD.ORG Fri Oct 29 21:20:56 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A1675106567A; Fri, 29 Oct 2010 21:20:56 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8FD258FC0C; Fri, 29 Oct 2010 21:20:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9TLKuPs058663; Fri, 29 Oct 2010 21:20:56 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9TLKuvX058661; Fri, 29 Oct 2010 21:20:56 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201010292120.o9TLKuvX058661@svn.freebsd.org> From: Jilles Tjoelker Date: Fri, 29 Oct 2010 21:20:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214534 - head/bin/sh X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 21:20:56 -0000 Author: jilles Date: Fri Oct 29 21:20:56 2010 New Revision: 214534 URL: http://svn.freebsd.org/changeset/base/214534 Log: sh: Reject function names ending in one of !%*+-=?@}~ These do something else in ksh: name=(...) is an array or compound variable assignment and the others are extended patterns. This is the last patch of the ones tested in the exp run. Exp-run done by: pav (with some other sh(1) changes) Modified: head/bin/sh/parser.c Modified: head/bin/sh/parser.c ============================================================================== --- head/bin/sh/parser.c Fri Oct 29 21:20:14 2010 (r214533) +++ head/bin/sh/parser.c Fri Oct 29 21:20:56 2010 (r214534) @@ -644,9 +644,13 @@ simplecmd(union node **rpp, union node * /* * - Require plain text. * - Functions with '/' cannot be called. + * - Reject name=(). + * - Reject ksh extended glob patterns. */ if (!noexpand(n->narg.text) || quoteflag || - strchr(n->narg.text, '/')) + strchr(n->narg.text, '/') || + strchr("!%*+-=?@}~", + n->narg.text[strlen(n->narg.text) - 1])) synerror("Bad function name"); rmescapes(n->narg.text); if (find_builtin(n->narg.text, &special) >= 0 && From owner-svn-src-head@FreeBSD.ORG Fri Oct 29 21:23:34 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 675BF1065679; Fri, 29 Oct 2010 21:23:34 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 55BDD8FC15; Fri, 29 Oct 2010 21:23:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9TLNYS1058908; Fri, 29 Oct 2010 21:23:34 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9TLNYoQ058906; Fri, 29 Oct 2010 21:23:34 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201010292123.o9TLNYoQ058906@svn.freebsd.org> From: Rui Paulo Date: Fri, 29 Oct 2010 21:23:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214535 - head/contrib/ipfilter/tools X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 21:23:34 -0000 Author: rpaulo Date: Fri Oct 29 21:23:34 2010 New Revision: 214535 URL: http://svn.freebsd.org/changeset/base/214535 Log: Use pcap's bpf header, not our own copy of it. Modified: head/contrib/ipfilter/tools/ipf_y.y Modified: head/contrib/ipfilter/tools/ipf_y.y ============================================================================== --- head/contrib/ipfilter/tools/ipf_y.y Fri Oct 29 21:20:56 2010 (r214534) +++ head/contrib/ipfilter/tools/ipf_y.y Fri Oct 29 21:23:34 2010 (r214535) @@ -10,8 +10,6 @@ #include #include #ifdef IPFILTER_BPF -# include "pcap-bpf.h" -# define _NET_BPF_H_ # include #endif #include "netinet/ip_pool.h" From owner-svn-src-head@FreeBSD.ORG Fri Oct 29 21:24:57 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 421071065670; Fri, 29 Oct 2010 21:24:57 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 30BC28FC17; Fri, 29 Oct 2010 21:24:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9TLOvtk059027; Fri, 29 Oct 2010 21:24:57 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9TLOvi7059025; Fri, 29 Oct 2010 21:24:57 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201010292124.o9TLOvi7059025@svn.freebsd.org> From: Rui Paulo Date: Fri, 29 Oct 2010 21:24:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214536 - head/sbin/pflogd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 21:24:57 -0000 Author: rpaulo Date: Fri Oct 29 21:24:56 2010 New Revision: 214536 URL: http://svn.freebsd.org/changeset/base/214536 Log: Add a ${.CURDIR} reference to the previous commit. Submitted by: dim Modified: head/sbin/pflogd/Makefile Modified: head/sbin/pflogd/Makefile ============================================================================== --- head/sbin/pflogd/Makefile Fri Oct 29 21:23:34 2010 (r214535) +++ head/sbin/pflogd/Makefile Fri Oct 29 21:24:56 2010 (r214536) @@ -6,7 +6,7 @@ PROG= pflogd SRCS= pflogd.c pidfile.c privsep.c privsep_fdpass.c MAN= pflogd.8 -CFLAGS=-include ../../lib/libpcap/config.h +CFLAGS=-include ${.CURDIR}/../../lib/libpcap/config.h LDADD= -lpcap -lutil DPADD= ${LIBPCAP} ${LIBUTIL} From owner-svn-src-head@FreeBSD.ORG Fri Oct 29 21:44:43 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B8D861065674; Fri, 29 Oct 2010 21:44:43 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8CEAC8FC1C; Fri, 29 Oct 2010 21:44:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9TLihwF060027; Fri, 29 Oct 2010 21:44:43 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9TLihVc060022; Fri, 29 Oct 2010 21:44:43 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201010292144.o9TLihVc060022@svn.freebsd.org> From: Jilles Tjoelker Date: Fri, 29 Oct 2010 21:44:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214538 - head/bin/sh X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 21:44:43 -0000 Author: jilles Date: Fri Oct 29 21:44:43 2010 New Revision: 214538 URL: http://svn.freebsd.org/changeset/base/214538 Log: sh: Tweak some string constants to reduce code size. * Reduce some needless differences. * Shorten some error messages that should not happen. Modified: head/bin/sh/eval.c head/bin/sh/histedit.c head/bin/sh/parser.c head/bin/sh/var.c Modified: head/bin/sh/eval.c ============================================================================== --- head/bin/sh/eval.c Fri Oct 29 21:29:43 2010 (r214537) +++ head/bin/sh/eval.c Fri Oct 29 21:44:43 2010 (r214538) @@ -1130,7 +1130,7 @@ commandcmd(int argc, char **argv) return typecmd_impl(2, argv - 1, cmd, path); } if (argc != 0) - error("commandcmd() called while it should not be"); + error("commandcmd bad call"); /* * Do nothing successfully if no command was specified; Modified: head/bin/sh/histedit.c ============================================================================== --- head/bin/sh/histedit.c Fri Oct 29 21:29:43 2010 (r214537) +++ head/bin/sh/histedit.c Fri Oct 29 21:44:43 2010 (r214538) @@ -297,7 +297,7 @@ histcmd(int argc, char **argv) laststr = argv[1]; break; default: - error("too many args"); + error("too many arguments"); } /* * Turn into event numbers. @@ -329,7 +329,7 @@ histcmd(int argc, char **argv) editfile = editfilestr; if ((efp = fdopen(fd, "w")) == NULL) { close(fd); - error("can't allocate stdio buffer for temp"); + error("Out of space"); } } Modified: head/bin/sh/parser.c ============================================================================== --- head/bin/sh/parser.c Fri Oct 29 21:29:43 2010 (r214537) +++ head/bin/sh/parser.c Fri Oct 29 21:44:43 2010 (r214538) @@ -1738,7 +1738,7 @@ getprompt(void *unused __unused) char *fmt; const char *pwd; int i, trim; - static char internal_error[] = ""; + static char internal_error[] = "??"; /* * Select prompt format. Modified: head/bin/sh/var.c ============================================================================== --- head/bin/sh/var.c Fri Oct 29 21:29:43 2010 (r214537) +++ head/bin/sh/var.c Fri Oct 29 21:44:43 2010 (r214538) @@ -826,7 +826,7 @@ setvarcmd(int argc, char **argv) else if (argc == 3) setvar(argv[1], argv[2], 0); else - error("List assignment not implemented"); + error("too many arguments"); return 0; } From owner-svn-src-head@FreeBSD.ORG Fri Oct 29 22:22:52 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 23DA11065670; Fri, 29 Oct 2010 22:22:52 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id BC6298FC13; Fri, 29 Oct 2010 22:22:41 +0000 (UTC) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id D0C6345CA6; Sat, 30 Oct 2010 00:22:39 +0200 (CEST) Received: from localhost (chello089073192049.chello.pl [89.73.192.49]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id 0B8F845683; Sat, 30 Oct 2010 00:22:33 +0200 (CEST) Date: Sat, 30 Oct 2010 00:21:59 +0200 From: Pawel Jakub Dawidek To: David Xu Message-ID: <20101029222159.GA2160@garage.freebsd.pl> References: <201010291331.o9TDVAtm027022@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="d6Gm4EdcadzBjdND" Content-Disposition: inline In-Reply-To: <201010291331.o9TDVAtm027022@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 9.0-CURRENT amd64 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-0.6 required=4.5 tests=BAYES_00,RCVD_IN_SORBS_DUL autolearn=no version=3.0.4 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r214510 - in head: include lib/libc/gen sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 22:22:52 -0000 --d6Gm4EdcadzBjdND Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Oct 29, 2010 at 01:31:10PM +0000, David Xu wrote: > Author: davidxu > Date: Fri Oct 29 13:31:10 2010 > New Revision: 214510 > URL: http://svn.freebsd.org/changeset/base/214510 >=20 > Log: > Add sysctl kern.sched.cpusetsize to export the size of kernel cpuset, > also add sysconf() key _SC_CPUSET_SIZE to get sysctl value. > =20 > Submitted by: gcooper [...] > +#ifdef _SC_CPUSET_SIZE > + case _SC_CPUSET_SIZE: > + len =3D sizeof(lvalue); > + if (sysctlbyname("kern.sched.cpusetsize", &lvalue, &len, NULL, > + 0) =3D=3D -1) > + return (-1); > + return (lvalue); > +#endif [...] > +static size_t _kern_cpuset_size =3D sizeof(cpuset_t); [...] > +/*=20 > + * Return the size of cpuset_t at the kernel level > + * > + * XXX (gcooper): replace ULONG with SIZE once CTLTYPE_SIZE is implement= ed. > + */ > +SYSCTL_ULONG(_kern_sched, OID_AUTO, cpusetsize, CTLFLAG_RD, > + &_kern_cpuset_size, 0, "Kernel-level cpuset_t struct size"); > + Because it is used via sysconf(3), I don't think it should be converted to CTLTYPE_SIZE at all. I even think it would be safer to make _kern_cpuset_size a long (sysconf's lvalue is long) and (just for consistency) use SYSCTL_LONG(). Also note, that on i386 long is 32bit and on amd64 long is 64bit, so 32bit process running on 64bit system won't be able to read this sysctl. Or do we detect 32bit processes on 64bit systems and convert such types in the kernel? --=20 Pawel Jakub Dawidek http://www.wheelsystems.com pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --d6Gm4EdcadzBjdND Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAkzLSQcACgkQForvXbEpPzT9zgCgu05p5kDCR6F2Jq/fLwkInLyP 0FoAoIHy+zaUSTmZ6k638am2GQyXJGHg =pnvc -----END PGP SIGNATURE----- --d6Gm4EdcadzBjdND-- From owner-svn-src-head@FreeBSD.ORG Fri Oct 29 22:26:44 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 034EA106566C; Fri, 29 Oct 2010 22:26:44 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id A07D68FC08; Fri, 29 Oct 2010 22:26:43 +0000 (UTC) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id 6146D45CA6; Sat, 30 Oct 2010 00:26:42 +0200 (CEST) Received: from localhost (chello089073192049.chello.pl [89.73.192.49]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id A84BE45683; Sat, 30 Oct 2010 00:26:36 +0200 (CEST) Date: Sat, 30 Oct 2010 00:26:02 +0200 From: Pawel Jakub Dawidek To: David Xu Message-ID: <20101029222602.GB2160@garage.freebsd.pl> References: <201010291331.o9TDVAtm027022@svn.freebsd.org> <20101029222159.GA2160@garage.freebsd.pl> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="TakKZr9L6Hm6aLOc" Content-Disposition: inline In-Reply-To: <20101029222159.GA2160@garage.freebsd.pl> User-Agent: Mutt/1.4.2.3i X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 9.0-CURRENT amd64 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-0.6 required=4.5 tests=BAYES_00,RCVD_IN_SORBS_DUL autolearn=no version=3.0.4 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r214510 - in head: include lib/libc/gen sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 22:26:44 -0000 --TakKZr9L6Hm6aLOc Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Oct 30, 2010 at 12:21:59AM +0200, Pawel Jakub Dawidek wrote: > Also note, that on i386 long is 32bit and on amd64 long is 64bit, so > 32bit process running on 64bit system won't be able to read this sysctl. > Or do we detect 32bit processes on 64bit systems and convert such types > in the kernel? We do the conversion, so ignore this part of my e-mail. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --TakKZr9L6Hm6aLOc Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAkzLSfkACgkQForvXbEpPzSuwgCg+R/zhO+SZSaT1Fcj8i2V7A+V 8WYAnjmsZ5FkbZd6ZFx+OmpyhfYuWVLi =SThl -----END PGP SIGNATURE----- --TakKZr9L6Hm6aLOc-- From owner-svn-src-head@FreeBSD.ORG Fri Oct 29 22:57:14 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 66BB3106566B; Fri, 29 Oct 2010 22:57:14 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 54E438FC0C; Fri, 29 Oct 2010 22:57:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9TMvEvN064017; Fri, 29 Oct 2010 22:57:14 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9TMvEeX064015; Fri, 29 Oct 2010 22:57:14 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201010292257.o9TMvEeX064015@svn.freebsd.org> From: Dimitry Andric Date: Fri, 29 Oct 2010 22:57:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214539 - head/lib/libpcap X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 22:57:14 -0000 Author: dim Date: Fri Oct 29 22:57:14 2010 New Revision: 214539 URL: http://svn.freebsd.org/changeset/base/214539 Log: Regenerate our lib/libpcap/config.h for libpcap 1.1.1. Modified: head/lib/libpcap/config.h Modified: head/lib/libpcap/config.h ============================================================================== --- head/lib/libpcap/config.h Fri Oct 29 21:44:43 2010 (r214538) +++ head/lib/libpcap/config.h Fri Oct 29 22:57:14 2010 (r214539) @@ -1,15 +1,8 @@ /* $FreeBSD$ */ /* This is an edited copy of the config.h generated by configure. */ -/* config.h. Generated by configure. */ +/* config.h. Generated from config.h.in by configure. */ /* config.h.in. Generated from configure.in by autoheader. */ -/* Long story short: aclocal.m4 depends on autoconf 2.13 - * implementation details wrt "const"; newer versions - * have different implementation details so for now we - * put "const" here. This may cause duplicate definitions - * in config.h but that should be OK since they're the same. - */ -/* #undef const */ /* Enable optimizer debugging */ /* #undef BDEBUG */ @@ -17,15 +10,15 @@ /* define if you have a cloning BPF device */ #define HAVE_CLONING_BPF 1 -/* define if you have dag_get_stream_erf_types() */ -/* #undef HAVE_DAG_GET_STREAM_ERF_TYPES */ - /* define if you have the DAG API */ /* #undef HAVE_DAG_API */ /* define if you have dag_get_erf_types() */ /* #undef HAVE_DAG_GET_ERF_TYPES */ +/* define if you have dag_get_stream_erf_types() */ +/* #undef HAVE_DAG_GET_STREAM_ERF_TYPES */ + /* define if you have streams capable DAG API */ /* #undef HAVE_DAG_STREAMS_API */ @@ -33,12 +26,12 @@ don't. */ #define HAVE_DECL_ETHER_HOSTTON 1 -/* if passive_req_t primitive exists */ -/* #undef HAVE_DLPI_PASSIVE */ - /* define if you have a /dev/dlpi */ /* #undef HAVE_DEV_DLPI */ +/* if passive_req_t primitive exists */ +/* #undef HAVE_DLPI_PASSIVE */ + /* Define to 1 if you have the `ether_hostton' function. */ #define HAVE_ETHER_HOSTTON 1 @@ -60,12 +53,18 @@ /* if libdlpi exists */ /* #undef HAVE_LIBDLPI */ +/* if libnl exists */ +/* #undef HAVE_LIBNL */ + /* Define to 1 if you have the header file. */ #define HAVE_LIMITS_H 1 /* if tp_vlan_tci exists */ /* #undef HAVE_LINUX_TPACKET_AUXDATA_TP_VLAN_TCI */ +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LINUX_USBDEVICE_FS_H */ + /* Define to 1 if you have the header file. */ /* #undef HAVE_LINUX_WIRELESS_H */ @@ -85,27 +84,30 @@ /* See Makefile */ /* #undef HAVE_NET_PFVAR_H */ -/* if there's an os_proto.h */ +/* if there's an os_proto.h for this platform, to use additional prototypes */ /* #undef HAVE_OS_PROTO_H */ /* Define to 1 if you have the header file. */ #define HAVE_PATHS_H 1 -/* define if you have a /proc/net/dev */ -/* #undef HAVE_PROC_NET_DEV */ +/* define if net/pfvar.h defines PF_NAT through PF_NORDR */ +#define HAVE_PF_NAT_THROUGH_PF_NORDR 1 /* define if you have a Septel API */ /* #undef HAVE_SEPTEL_API */ +/* define if you have Myricom SNF API */ +/* #undef HAVE_SNF_API */ + /* Define to 1 if you have the `snprintf' function. */ #define HAVE_SNPRINTF 1 -/* if struct sockaddr has sa_len */ +/* if struct sockaddr has the sa_len member */ #define HAVE_SOCKADDR_SA_LEN 1 /* if struct sockaddr_storage exists */ #define HAVE_SOCKADDR_STORAGE 1 - + /* define if socklen_t is defined */ #define HAVE_SOCKLEN_T 1 @@ -130,9 +132,15 @@ /* Define to 1 if you have the `strlcpy' function. */ #define HAVE_STRLCPY 1 +/* Define to 1 if the system has the type `struct BPF_TIMEVAL'. */ +/* #undef HAVE_STRUCT_BPF_TIMEVAL */ + /* Define to 1 if the system has the type `struct ether_addr'. */ /* #undef HAVE_STRUCT_ETHER_ADDR */ +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_BITYPES_H */ + /* Define to 1 if you have the header file. */ /* #undef HAVE_SYS_BUFMOD_H */ @@ -157,6 +165,9 @@ /* Define to 1 if you have the header file. */ #define HAVE_UNISTD_H 1 +/* if struct usbdevfs_ctrltransfer has bRequestType */ +/* #undef HAVE_USBDEVFS_CTRLTRANSFER_BREQUESTTYPE */ + /* define if version.h is generated in the build procedure */ #define HAVE_VERSION_H 1 @@ -170,6 +181,7 @@ #define HAVE___ATTRIBUTE__ 1 /* IPv6 */ +/* See Makefile */ /* #undef INET6 */ /* if unaligned access fails */ @@ -208,6 +220,9 @@ /* target host supports Bluetooth sniffing */ /* #undef PCAP_SUPPORT_BT */ +/* target host supports CAN sniffing */ +/* #undef PCAP_SUPPORT_CAN */ + /* target host supports USB sniffing */ /* #undef PCAP_SUPPORT_USB */ @@ -220,12 +235,12 @@ /* Enable parser debugging */ /* #undef YYDEBUG */ -/* needed on HP-UX */ -/* #undef _HPUX_SOURCE */ - /* Number of bits in a file offset, on hosts where this is settable. */ /* #undef _FILE_OFFSET_BITS */ +/* needed on HP-UX */ +/* #undef _HPUX_SOURCE */ + /* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */ /* #undef _LARGEFILE_SOURCE */ @@ -235,20 +250,35 @@ /* define on AIX to get certain functions */ /* #undef _SUN */ +/* to handle Ultrix compilers that don't support const in prototypes */ +/* #undef const */ + /* Define as token for inline if inlining supported */ #define inline inline +/* Define to `short' if int16_t not defined. */ +/* #undef int16_t */ + +/* Define to `int' if int32_t not defined. */ +/* #undef int32_t */ + +/* Define to `long long' if int64_t not defined. */ +/* #undef int64_t */ + +/* Define to `signed char' if int8_t not defined. */ +/* #undef int8_t */ + /* on sinix */ /* #undef sinix */ -/* if we have u_int16_t */ +/* Define to `unsigned short' if u_int16_t not defined. */ /* #undef u_int16_t */ -/* if we have u_int32_t */ +/* Define to `unsigned int' if u_int32_t not defined. */ /* #undef u_int32_t */ -/* if we have u_int64_t */ +/* Define to `unsigned long long' if u_int64_t not defined. */ /* #undef u_int64_t */ -/* if we have u_int8_t */ +/* Define to `unsigned char' if u_int8_t not defined. */ /* #undef u_int8_t */ From owner-svn-src-head@FreeBSD.ORG Sat Oct 30 00:52:47 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E900F1065674; Sat, 30 Oct 2010 00:52:46 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-yw0-f54.google.com (mail-yw0-f54.google.com [209.85.213.54]) by mx1.freebsd.org (Postfix) with ESMTP id 51CFE8FC0A; Sat, 30 Oct 2010 00:52:46 +0000 (UTC) Received: by ywh2 with SMTP id 2so1874534ywh.13 for ; Fri, 29 Oct 2010 17:52:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=Hm8BTEjJU+XiOFNBJ+lfI8D4n7IvJKxEUyuuDgpBNOw=; b=Axc/fxvt6uh9z48d5gJDWe5tHGyRmPGCpb0IlMF1pvYt31x8jtM5gXp1FRYWB+/QLD aEWNQKLR6h/HU04oAEsk3uNWu+7BBULEtcMilzSpYLsrDraBeVj/HV0j/78SmJGLiVxD QAkU+gIB7kgPACHByl5JQtI5B1ar+xpjaSolw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=mBraQ6b0dCVWNqZTe/urVIgJdPA7tWXDKP1xLLG2EzdcMML4rWDCVUxu6NdzCQUcct ac4scM5vCnokR5XPGh9unAt1wnxzjqhj7SZygpHnlNubtuGj5wXYRC7gXbx+LqKCXSm9 /55TJMpauBQrDYE1ycZFlv2jqA5+9t0Hyb2cI= MIME-Version: 1.0 Received: by 10.90.4.7 with SMTP id 7mr5147982agd.100.1288399965005; Fri, 29 Oct 2010 17:52:45 -0700 (PDT) Sender: yanegomi@gmail.com Received: by 10.90.70.19 with HTTP; Fri, 29 Oct 2010 17:52:43 -0700 (PDT) In-Reply-To: <20101029222159.GA2160@garage.freebsd.pl> References: <201010291331.o9TDVAtm027022@svn.freebsd.org> <20101029222159.GA2160@garage.freebsd.pl> Date: Fri, 29 Oct 2010 17:52:43 -0700 X-Google-Sender-Auth: F2Kg-kn54YmT40fyCftuhUKLr2w Message-ID: From: Garrett Cooper To: Pawel Jakub Dawidek Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, David Xu Subject: Re: svn commit: r214510 - in head: include lib/libc/gen sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Oct 2010 00:52:47 -0000 On Fri, Oct 29, 2010 at 3:21 PM, Pawel Jakub Dawidek wrot= e: > On Fri, Oct 29, 2010 at 01:31:10PM +0000, David Xu wrote: >> Author: davidxu >> Date: Fri Oct 29 13:31:10 2010 >> New Revision: 214510 >> URL: http://svn.freebsd.org/changeset/base/214510 >> >> Log: >> =A0 Add sysctl kern.sched.cpusetsize to export the size of kernel cpuset= , >> =A0 also add sysconf() key _SC_CPUSET_SIZE to get sysctl value. >> >> =A0 Submitted by: gcooper > [...] >> +#ifdef _SC_CPUSET_SIZE >> + =A0 =A0 case _SC_CPUSET_SIZE: >> + =A0 =A0 =A0 =A0 =A0 =A0 len =3D sizeof(lvalue); >> + =A0 =A0 =A0 =A0 =A0 =A0 if (sysctlbyname("kern.sched.cpusetsize", &lva= lue, &len, NULL, >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 0) =3D=3D -1) >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (-1); >> + =A0 =A0 =A0 =A0 =A0 =A0 return (lvalue); >> +#endif > [...] >> +static size_t _kern_cpuset_size =3D sizeof(cpuset_t); > [...] >> +/* >> + * Return the size of cpuset_t at the kernel level >> + * >> + * XXX (gcooper): replace ULONG with SIZE once CTLTYPE_SIZE is implemen= ted. >> + */ >> +SYSCTL_ULONG(_kern_sched, OID_AUTO, cpusetsize, CTLFLAG_RD, >> + =A0 =A0&_kern_cpuset_size, 0, "Kernel-level cpuset_t struct size"); >> + > > Because it is used via sysconf(3), I don't think it should be converted > to CTLTYPE_SIZE at all. I even think it would be safer to make > _kern_cpuset_size a long (sysconf's lvalue is long) and (just for > consistency) use SYSCTL_LONG(). size_t is synonymous with long though (minus the fact that size_t is unsigned and long is signed). cperciva came up with same question, and the thing that I noted is that SYSCTL_SIZE, etc was going to be implemented in the not so distant future (I have the tunables done; I was going to finish off the sysctl(9) analogs all in one shot to avoid having to bump __FreeBSD_version__ twice, but was waiting for all of the parts to come in for my router box so I could get my test box online, but that's a sidenote :)..). des preferred the semantics of SIZE and POINTER, etc in the tunables because of the concept it implies over a long (even though they're basically synonyms at one level or another). The comment was there as a reminder to me to get the work done quicker :). > Also note, that on i386 long is 32bit and on amd64 long is 64bit, so > 32bit process running on 64bit system won't be able to read this sysctl. > Or do we detect 32bit processes on 64bit systems and convert such types > in the kernel? There are two things I've been thinking about with this work though: 1. sysctls truncate output over 64-bit with certain datatypes, like LONGs (SIZE, POINTER, etc would apply as well in the above example). I thought this was an undesirable loss of precision, but I'd need to talk to someone else about this. 2. It might be convenient if there was a lookup table for certain types like FDSET (like Robert brought up) where userland and kernel space types can vary like with cpuset_t. Just an idea to ponder over in my free time that I might bring up to more senior folks for more thorough consideration because it would be a cleaner interface to determining datatypes widths like this. Thanks for the comments though :)! -Garrett From owner-svn-src-head@FreeBSD.ORG Sat Oct 30 01:12:55 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 423521065670; Sat, 30 Oct 2010 01:12:55 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 312748FC0C; Sat, 30 Oct 2010 01:12:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9U1Ctpk072650; Sat, 30 Oct 2010 01:12:55 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9U1CtqO072648; Sat, 30 Oct 2010 01:12:55 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201010300112.o9U1CtqO072648@svn.freebsd.org> From: Pyun YongHyeon Date: Sat, 30 Oct 2010 01:12:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214542 - head/sys/dev/alc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Oct 2010 01:12:55 -0000 Author: yongari Date: Sat Oct 30 01:12:54 2010 New Revision: 214542 URL: http://svn.freebsd.org/changeset/base/214542 Log: Don't bother to enable ASPM L1 to save more power. Even though I am not able to trigger the issue with sample boards, some users seems to suffer from freeze/lockup when system is booted without UTP cable plugged in. I'm not sure whether this is BIOS issue or controller bug. This change fixes AR8132 lockup issue seen on EEE PC. Reported by: kmoore Tested by: kmoore Modified: head/sys/dev/alc/if_alc.c Modified: head/sys/dev/alc/if_alc.c ============================================================================== --- head/sys/dev/alc/if_alc.c Sat Oct 30 00:00:54 2010 (r214541) +++ head/sys/dev/alc/if_alc.c Sat Oct 30 01:12:54 2010 (r214542) @@ -331,8 +331,8 @@ alc_miibus_statchg(device_t dev) reg = CSR_READ_4(sc, ALC_MAC_CFG); reg |= MAC_CFG_TX_ENB | MAC_CFG_RX_ENB; CSR_WRITE_4(sc, ALC_MAC_CFG, reg); + alc_aspm(sc, IFM_SUBTYPE(mii->mii_media_active)); } - alc_aspm(sc, IFM_SUBTYPE(mii->mii_media_active)); } static void From owner-svn-src-head@FreeBSD.ORG Sat Oct 30 08:18:17 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7374710656AB; Sat, 30 Oct 2010 08:18:17 +0000 (UTC) (envelope-from avg@freebsd.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 192988FC13; Sat, 30 Oct 2010 08:18:15 +0000 (UTC) Received: from porto.topspin.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id LAA18403; Sat, 30 Oct 2010 11:18:14 +0300 (EEST) (envelope-from avg@freebsd.org) Received: from localhost.topspin.kiev.ua ([127.0.0.1]) by porto.topspin.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1PC6di-000J4t-EI; Sat, 30 Oct 2010 11:18:14 +0300 Message-ID: <4CCBD4C6.2070505@freebsd.org> Date: Sat, 30 Oct 2010 11:18:14 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.11) Gecko/20101021 Lightning/1.0b2 Thunderbird/3.1.5 MIME-Version: 1.0 To: David Xu References: <201010290935.o9T9ZbXH089952@svn.freebsd.org> In-Reply-To: <201010290935.o9T9ZbXH089952@svn.freebsd.org> X-Enigmail-Version: 1.1.2 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r214506 - head/lib/libthr/thread X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Oct 2010 08:18:17 -0000 on 29/10/2010 12:35 David Xu said the following: > Author: davidxu > Date: Fri Oct 29 09:35:36 2010 > New Revision: 214506 > URL: http://svn.freebsd.org/changeset/base/214506 > > Log: > Return previous sigaction correctly. > > Submitted by: avg Thanks! > Modified: > head/lib/libthr/thread/thr_sig.c > > Modified: head/lib/libthr/thread/thr_sig.c > ============================================================================== > --- head/lib/libthr/thread/thr_sig.c Fri Oct 29 09:23:26 2010 (r214505) > +++ head/lib/libthr/thread/thr_sig.c Fri Oct 29 09:35:36 2010 (r214506) > @@ -547,7 +547,10 @@ _sigaction(int sig, const struct sigacti > > if (oldact.sa_handler != SIG_DFL && > oldact.sa_handler != SIG_IGN) { > - oldact = _thr_sigact[sig-1].sigact; > + if (act != NULL) > + oldact = oldact2; > + else if (oact != NULL) > + oldact = _thr_sigact[sig-1].sigact; > } > > _thr_rwl_unlock(&_thr_sigact[sig-1].lock); -- Andriy Gapon From owner-svn-src-head@FreeBSD.ORG Sat Oct 30 10:09:00 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 228D61065672; Sat, 30 Oct 2010 10:09:00 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail09.syd.optusnet.com.au (mail09.syd.optusnet.com.au [211.29.132.190]) by mx1.freebsd.org (Postfix) with ESMTP id A9EE48FC1E; Sat, 30 Oct 2010 10:08:59 +0000 (UTC) Received: from c122-106-146-165.carlnfd1.nsw.optusnet.com.au (c122-106-146-165.carlnfd1.nsw.optusnet.com.au [122.106.146.165]) by mail09.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id o9UA8u0T015813 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 30 Oct 2010 21:08:57 +1100 Date: Sat, 30 Oct 2010 21:08:56 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Pawel Jakub Dawidek In-Reply-To: <20101029222159.GA2160@garage.freebsd.pl> Message-ID: <20101030203424.M1007@besplex.bde.org> References: <201010291331.o9TDVAtm027022@svn.freebsd.org> <20101029222159.GA2160@garage.freebsd.pl> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, David Xu Subject: Re: svn commit: r214510 - in head: include lib/libc/gen sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Oct 2010 10:09:00 -0000 On Sat, 30 Oct 2010, Pawel Jakub Dawidek wrote: > On Fri, Oct 29, 2010 at 01:31:10PM +0000, David Xu wrote: >> Log: >> Add sysctl kern.sched.cpusetsize to export the size of kernel cpuset, >> also add sysconf() key _SC_CPUSET_SIZE to get sysctl value. >> >> Submitted by: gcooper > [...] >> +#ifdef _SC_CPUSET_SIZE >> + case _SC_CPUSET_SIZE: >> + len = sizeof(lvalue); >> + if (sysctlbyname("kern.sched.cpusetsize", &lvalue, &len, NULL, >> + 0) == -1) >> + return (-1); >> + return (lvalue); >> +#endif > [...] >> +static size_t _kern_cpuset_size = sizeof(cpuset_t); No need for this or its bogus type, since it is a small compile-time constant value. > [...] >> +/* >> + * Return the size of cpuset_t at the kernel level >> + * >> + * XXX (gcooper): replace ULONG with SIZE once CTLTYPE_SIZE is implemented. >> + */ >> +SYSCTL_ULONG(_kern_sched, OID_AUTO, cpusetsize, CTLFLAG_RD, >> + &_kern_cpuset_size, 0, "Kernel-level cpuset_t struct size"); >> + Just use: SYSCTL_INT(_kern_sched, OID_AUTO, cpusetsize, CTLFLAG_RD, 0, sizeof(cpuset_t), "sizeof(cpuset_t) in the kernel"); the same as for all debugging sizeofs in kern_mib.c. (I also changed the style of the message to be more like the ones there. (sysctl -ad | greo sizeof on ref9-i386 shows only 1 other inconsistency: the banal description is missing for debug.sizeof.namecache.)) > Because it is used via sysconf(3), I don't think it should be converted > to CTLTYPE_SIZE at all. I even think it would be safer to make > _kern_cpuset_size a long (sysconf's lvalue is long) and (just for > consistency) use SYSCTL_LONG(). > > Also note, that on i386 long is 32bit and on amd64 long is 64bit, so > 32bit process running on 64bit system won't be able to read this sysctl. > Or do we detect 32bit processes on 64bit systems and convert such types > in the kernel? Just use int. 16-bit ints are only large enough for 8*32767 CPUs, but 32-bit ints are large enough for 8*2147482647 CPUs, which should be enough for anyone. Also use 'int value' instead of 'long lvalue' in sysconf.c. Using u_long is also bogus. Because the value is returned by sysconf(3), u_long won't actually work if it is actually needed, because if the value exceeds LONG_MAX then `return (lvalue)' will blindly overflow. But the value is very far from exeeding even INT_MAX, so there is no problem. (Overflow would actually occur earlier, via the type pun of using sysctl for a u_long variable to read the variable into a plain long. It is unclear that this type pun is safe even when there is no overflow.) The kernel isn't going to be having any data structures larger than 2147482647 bytes any time soon, so 32-bit ints are plenty large enough for returning the size of any data structure in the kernel. However, 16-bit ints wouldn't be. Careful code might use size_t to avoid assuming anything about sizeof(int), but with 32-bit ints this mainly gives bloat when size_t is 64 bits. Bruce From owner-svn-src-head@FreeBSD.ORG Sat Oct 30 13:58:03 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E646F1065672; Sat, 30 Oct 2010 13:58:03 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id C651A8FC08; Sat, 30 Oct 2010 13:58:02 +0000 (UTC) Received: by wwi17 with SMTP id 17so2845811wwi.31 for ; Sat, 30 Oct 2010 06:58:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type; bh=ZT4QpLXxLvhROeCGwGSN+znNgaSaN6Qr5iJyYbojMi0=; b=KupCRTR0nFnYjB60e1se+c0LSee5ap3T6BTqofDs5LDwX3AhpQEEz4lTTLN7Ad1Gnn LwU3/0NzBAWh0jcbrDpw+0RiFSrzq7ExWWKD3Ra0x8nQnDlb8wp/B+YEVPDSrnOeq1yq 4LmFCxn59a4BfRhHVYBOpThfX+nvFxvxQ34tM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; b=my1BykgFtyV5N7uNVkn6qjXZnhv26NcbNn0NpvOQ1cx5yZEzUklj1mmFsEunYzbSum KpGjgulrotJ30nfAQwfN7CKrwvzCIzzan50McXVUFs0H517gBepry7D1vMHo27uqyWmZ K6PJBhFssdqveoxfVQYAUW7rhsbUro05D9ELA= MIME-Version: 1.0 Received: by 10.216.58.209 with SMTP id q59mr545691wec.41.1288447081194; Sat, 30 Oct 2010 06:58:01 -0700 (PDT) Sender: yanegomi@gmail.com Received: by 10.216.10.198 with HTTP; Sat, 30 Oct 2010 06:58:01 -0700 (PDT) In-Reply-To: <20101030203424.M1007@besplex.bde.org> References: <201010291331.o9TDVAtm027022@svn.freebsd.org> <20101029222159.GA2160@garage.freebsd.pl> <20101030203424.M1007@besplex.bde.org> Date: Sat, 30 Oct 2010 06:58:01 -0700 X-Google-Sender-Auth: e3eVA1vUX1aS3nv1u3ywGwvow1A Message-ID: From: Garrett Cooper To: Bruce Evans Content-Type: multipart/mixed; boundary=000e0ce02a0a96247c0493d5f6ad Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Pawel Jakub Dawidek , David Xu Subject: Re: svn commit: r214510 - in head: include lib/libc/gen sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Oct 2010 13:58:04 -0000 --000e0ce02a0a96247c0493d5f6ad Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Sat, Oct 30, 2010 at 3:08 AM, Bruce Evans wrote: > On Sat, 30 Oct 2010, Pawel Jakub Dawidek wrote: > >> On Fri, Oct 29, 2010 at 01:31:10PM +0000, David Xu wrote: >>> >>> Log: >>> =A0Add sysctl kern.sched.cpusetsize to export the size of kernel cpuset= , >>> =A0also add sysconf() key _SC_CPUSET_SIZE to get sysctl value. >>> >>> =A0Submitted by: gcooper >> >> [...] >>> >>> +#ifdef _SC_CPUSET_SIZE >>> + =A0 =A0 =A0 case _SC_CPUSET_SIZE: >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 len =3D sizeof(lvalue); >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (sysctlbyname("kern.sched.cpusetsize",= &lvalue, &len, >>> NULL, >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 0) =3D=3D -1) >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (-1); >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (lvalue); >>> +#endif >> >> [...] >>> >>> +static size_t _kern_cpuset_size =3D sizeof(cpuset_t); > > No need for this or its bogus type, since it is a small compile-time > constant value. > >> [...] >>> >>> +/* >>> + * Return the size of cpuset_t at the kernel level >>> + * >>> + * XXX (gcooper): replace ULONG with SIZE once CTLTYPE_SIZE is >>> implemented. >>> + */ >>> +SYSCTL_ULONG(_kern_sched, OID_AUTO, cpusetsize, CTLFLAG_RD, >>> + =A0 =A0&_kern_cpuset_size, 0, "Kernel-level cpuset_t struct size"); >>> + > > Just use: > > SYSCTL_INT(_kern_sched, OID_AUTO, cpusetsize, CTLFLAG_RD, > =A0 =A00, sizeof(cpuset_t), "sizeof(cpuset_t) in the kernel"); > > the same as for all debugging sizeofs in kern_mib.c. =A0(I also changed t= he > style of the message to be more like the ones there. =A0(sysctl -ad | gre= o > sizeof on ref9-i386 shows only 1 other inconsistency: the banal descripti= on > is missing for debug.sizeof.namecache.)) Yeah... it was silly of me to do it that way, in hindsight :(... >> Because it is used via sysconf(3), I don't think it should be converted >> to CTLTYPE_SIZE at all. I even think it would be safer to make >> _kern_cpuset_size a long (sysconf's lvalue is long) and (just for >> consistency) use SYSCTL_LONG(). >> >> Also note, that on i386 long is 32bit and on amd64 long is 64bit, so >> 32bit process running on 64bit system won't be able to read this sysctl. >> Or do we detect 32bit processes on 64bit systems and convert such types >> in the kernel? > > Just use int. =A016-bit ints are only large enough for 8*32767 CPUs, but > 32-bit ints are large enough for 8*2147482647 CPUs, which should be > enough for anyone. =A0Also use 'int value' instead of 'long lvalue' in > sysconf.c. That won't really do much good, otherwise it would oppose the POSIX API definition :/... > Using u_long is also bogus. =A0Because the value is returned by sysconf(3= ), > u_long won't actually work if it is actually needed, because if the > value exceeds LONG_MAX then `return (lvalue)' will blindly overflow. > But the value is very far from exeeding even INT_MAX, so there is no > problem. =A0(Overflow would actually occur earlier, via the type pun of > using sysctl for a u_long variable to read the variable into a plain > long. =A0It is unclear that this type pun is safe even when there is no > overflow.) > > The kernel isn't going to be having any data structures larger than > 2147482647 bytes any time soon, so 32-bit ints are plenty large enough > for returning the size of any data structure in the kernel. =A0However, > 16-bit ints wouldn't be. =A0Careful code might use size_t to avoid > assuming anything about sizeof(int), but with 32-bit ints this mainly > gives bloat when size_t is 64 bits. Ok. Thanks! -Garrett --000e0ce02a0a96247c0493d5f6ad Content-Type: text/x-patch; charset=US-ASCII; name="cpuset_t-less_suckage.patch" Content-Disposition: attachment; filename="cpuset_t-less_suckage.patch" Content-Transfer-Encoding: base64 X-Attachment-Id: f_gfwk3lu30 SW5kZXg6IHN5cy9rZXJuL3NjaGVkX3VsZS5jCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIHN5cy9rZXJuL3NjaGVk X3VsZS5jCShyZXZpc2lvbiAyMTQ1NTQpCisrKyBzeXMva2Vybi9zY2hlZF91bGUuYwkod29ya2lu ZyBjb3B5KQpAQCAtMjcxMiw4ICsyNzEyLDYgQEAKIAlzYnVmX2RlbGV0ZSh0b3BvKTsKIAlyZXR1 cm4gKGVycik7CiB9Ci0KLXN0YXRpYyBzaXplX3QgX2tlcm5fY3B1c2V0X3NpemUgPSBzaXplb2Yo Y3B1c2V0X3QpOwogI2VuZGlmCiAKIFNZU0NUTF9OT0RFKF9rZXJuLCBPSURfQVVUTywgc2NoZWQs IENUTEZMQUdfUlcsIDAsICJTY2hlZHVsZXIiKTsKQEAgLTI3NTEsMTMgKzI3NDksOSBAQAogICAg IENUTEZMQUdfUkQsIE5VTEwsIDAsIHN5c2N0bF9rZXJuX3NjaGVkX3RvcG9sb2d5X3NwZWMsICJB IiwgCiAgICAgIlhNTCBkdW1wIG9mIGRldGVjdGVkIENQVSB0b3BvbG9neSIpOwogCi0vKiAKLSAq IFJldHVybiB0aGUgc2l6ZSBvZiBjcHVzZXRfdCBhdCB0aGUga2VybmVsIGxldmVsCi0gKgotICog WFhYIChnY29vcGVyKTogcmVwbGFjZSBVTE9ORyB3aXRoIFNJWkUgb25jZSBDVExUWVBFX1NJWkUg aXMgaW1wbGVtZW50ZWQuCi0gKi8KLVNZU0NUTF9VTE9ORyhfa2Vybl9zY2hlZCwgT0lEX0FVVE8s IGNwdXNldHNpemUsIENUTEZMQUdfUkQsCi0gICAgJl9rZXJuX2NwdXNldF9zaXplLCAwLCAiS2Vy bmVsLWxldmVsIGNwdXNldF90IHN0cnVjdCBzaXplIik7CisvKiBSZXR1cm4gdGhlIHNpemUgb2Yg Y3B1c2V0X3QgYXQgdGhlIGtlcm5lbCBsZXZlbCAqLworU1lTQ1RMX0lOVChfa2Vybl9zY2hlZCwg T0lEX0FVVE8sIGNwdXNldHNpemUsIENUTEZMQUdfUkQsCisgICAgMCwgc2l6ZW9mKGNwdXNldF90 KSwgInNpemVvZihjcHVzZXRfdCkiKTsKIAogI2VuZGlmCiAK --000e0ce02a0a96247c0493d5f6ad-- From owner-svn-src-head@FreeBSD.ORG Sat Oct 30 14:08:26 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DD0FB106564A; Sat, 30 Oct 2010 14:08:26 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CB6928FC12; Sat, 30 Oct 2010 14:08:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9UE8QcE000534; Sat, 30 Oct 2010 14:08:26 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9UE8QNS000532; Sat, 30 Oct 2010 14:08:26 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201010301408.o9UE8QNS000532@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 30 Oct 2010 14:08:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214556 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Oct 2010 14:08:27 -0000 Author: kib Date: Sat Oct 30 14:08:26 2010 New Revision: 214556 URL: http://svn.freebsd.org/changeset/base/214556 Log: Remove sysctl debug.ncnegfactor, it is renamed to vfs.ncnegfactor. MFC: do not Modified: head/sys/kern/vfs_cache.c Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Sat Oct 30 13:25:41 2010 (r214555) +++ head/sys/kern/vfs_cache.c Sat Oct 30 14:08:26 2010 (r214556) @@ -129,8 +129,6 @@ static u_long nchash; /* size of hash SYSCTL_ULONG(_debug, OID_AUTO, nchash, CTLFLAG_RD, &nchash, 0, "Size of namecache hash table"); static u_long ncnegfactor = 16; /* ratio of negative entries */ -/* _debug sysctl left for backward compatibility */ -SYSCTL_ULONG(_debug, OID_AUTO, ncnegfactor, CTLFLAG_RW, &ncnegfactor, 0, ""); SYSCTL_ULONG(_vfs, OID_AUTO, ncnegfactor, CTLFLAG_RW, &ncnegfactor, 0, "Ratio of negative namecache entries"); static u_long numneg; /* number of negative entries allocated */ From owner-svn-src-head@FreeBSD.ORG Sat Oct 30 16:25:09 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4E57F106566C; Sat, 30 Oct 2010 16:25:09 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3B3A28FC13; Sat, 30 Oct 2010 16:25:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9UGP9eu004776; Sat, 30 Oct 2010 16:25:09 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9UGP9QZ004773; Sat, 30 Oct 2010 16:25:09 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201010301625.o9UGP9QZ004773@svn.freebsd.org> From: Dimitry Andric Date: Sat, 30 Oct 2010 16:25:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214559 - head/usr.sbin/tcpdump/tcpdump X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Oct 2010 16:25:09 -0000 Author: dim Date: Sat Oct 30 16:25:08 2010 New Revision: 214559 URL: http://svn.freebsd.org/changeset/base/214559 Log: Regenerate our usr.sbin/tcpdump/tcpdump/config.h for tcpdump 4.1.1, and remove unused HAVE_RC5_H and HAVE_CAST_H defines from CFLAGS. Modified: head/usr.sbin/tcpdump/tcpdump/Makefile head/usr.sbin/tcpdump/tcpdump/config.h Modified: head/usr.sbin/tcpdump/tcpdump/Makefile ============================================================================== --- head/usr.sbin/tcpdump/tcpdump/Makefile Sat Oct 30 16:09:15 2010 (r214558) +++ head/usr.sbin/tcpdump/tcpdump/Makefile Sat Oct 30 16:25:08 2010 (r214559) @@ -56,7 +56,7 @@ LDADD= -ll -lpcap DPADD+= ${LIBCRYPTO} LDADD+= -lcrypto CFLAGS+= -I${DESTDIR}/usr/include/openssl -CFLAGS+= -DHAVE_LIBCRYPTO -DHAVE_RC5_H -DHAVE_CAST_H -DHAVE_OPENSSL_EVP_H +CFLAGS+= -DHAVE_LIBCRYPTO -DHAVE_CAST_H -DHAVE_OPENSSL_EVP_H .endif .if ${MK_PF} != "no" Modified: head/usr.sbin/tcpdump/tcpdump/config.h ============================================================================== --- head/usr.sbin/tcpdump/tcpdump/config.h Sat Oct 30 16:09:15 2010 (r214558) +++ head/usr.sbin/tcpdump/tcpdump/config.h Sat Oct 30 16:25:08 2010 (r214559) @@ -1,14 +1,11 @@ /* $FreeBSD$ */ /* This is an edited copy of the config.h generated by configure. */ -/* config.h. Generated by configure. */ +/* config.h. Generated from config.h.in by configure. */ /* config.h.in. Generated from configure.in by autoheader. */ /* "generated automatically" means DO NOT MAKE CHANGES TO config.h.in -- * make them to acconfig.h and rerun autoheader */ -/* Define if you have SSLeay 0.9.0b with the buggy cast128. */ -/* #undef HAVE_BUGGY_CAST128 */ - /* Define if you enable IPv6 support */ /* See Makefile */ /* #undef INET6 */ @@ -16,23 +13,12 @@ /* Define if you enable support for the libsmi. */ /* #undef LIBSMI */ -/* Define if you have the header file. */ -/* #undef HAVE_SMI_H */ - /* define if you have struct __res_state_ext */ /* #undef HAVE_RES_STATE_EXT */ /* define if your struct __res_state has the nsort member */ /* #undef HAVE_NEW_RES_STATE */ -/* - * define if struct ether_header.ether_dhost is a struct with ether_addr_octet - */ -/* #undef ETHER_HEADER_HAS_EA */ - -/* define if struct ether_arp contains arp_xsha */ -/* #undef ETHER_ARP_HAS_X */ - /* define if you have the addrinfo function. */ #define HAVE_ADDRINFO 1 @@ -48,18 +34,9 @@ /* define if INADDRSZ is defined (XXX not used!) */ #define HAVE_INADDRSZ 1 -/* define if this is a development version, to use additional prototypes. */ -/* #undef HAVE_OS_PROTO_H */ - -/* define if defines __P() */ -/* #undef HAVE_PORTABLE_PROTOTYPE */ - /* define if RES_USE_INET6 is defined */ #define HAVE_RES_USE_INET6 1 -/* define if struct sockaddr has the sa_len member */ -#define HAVE_SOCKADDR_SA_LEN 1 - /* define if you have struct sockaddr_storage */ #define HAVE_SOCKADDR_STORAGE 1 @@ -96,18 +73,6 @@ /* define if you have getrpcbynumber() */ #define HAVE_GETRPCBYNUMBER 1 -/* define if unaligned memory accesses fail */ -/* #undef LBL_ALIGN */ - -/* The successful return value from signal (?)XXX */ -#define RETSIGVAL - -/* Define this on IRIX */ -/* #undef _BSD_SIGNALS */ - -/* For HP/UX ANSI compiler? */ -/* #undef _HPUX_SOURCE */ - /* AIX hack. */ /* #undef _SUN */ @@ -120,14 +85,6 @@ /* Whether or not to include the possibly-buggy SMB printer */ #define TCPDUMP_DO_SMB 1 -/* Long story short: aclocal.m4 depends on autoconf 2.13 - * implementation details wrt "const"; newer versions - * have different implementation details so for now we - * put "const" here. This may cause duplicate definitions - * in config.h but that should be OK since they're the same. - */ -/* #undef const */ - /* Define if you have the dnet_htoa function. */ /* #undef HAVE_DNET_HTOA */ @@ -156,9 +113,6 @@ /* Define to 1 if you have the header file. */ #define HAVE_FCNTL_H 1 -/* Define to 1 if you have the `getaddrinfo' function. */ -#define HAVE_GETADDRINFO 1 - /* Define to 1 if you have the `getnameinfo' function. */ #define HAVE_GETNAMEINFO 1 @@ -195,9 +149,18 @@ /* See Makefile */ /* #undef HAVE_OPENSSL_EVP_H 1 */ +/* if there's an os_proto.h for this platform, to use additional prototypes */ +/* #undef HAVE_OS_PROTO_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_PCAP_BLUETOOTH_H */ + /* Define to 1 if you have the `pcap_breakloop' function. */ #define HAVE_PCAP_BREAKLOOP 1 +/* Define to 1 if you have the `pcap_create' function. */ +#define HAVE_PCAP_CREATE 1 + /* Define to 1 if you have the `pcap_dump_flush' function. */ #define HAVE_PCAP_DUMP_FLUSH 1 @@ -210,6 +173,9 @@ /* Define to 1 if you have the `pcap_lib_version' function. */ #define HAVE_PCAP_LIB_VERSION 1 +/* Define to 1 if you have the header file. */ +/* #undef HAVE_PCAP_USB_H */ + /* Define to 1 if you have the `pfopen' function. */ /* #undef HAVE_PFOPEN */ @@ -231,6 +197,9 @@ /* Define to 1 if you have the `snprintf' function. */ #define HAVE_SNPRINTF 1 +/* if struct sockaddr has the sa_len member */ +#define HAVE_SOCKADDR_SA_LEN 1 + /* Define to 1 if you have the header file. */ #define HAVE_STDINT_H 1 @@ -285,6 +254,9 @@ /* define if your compiler has __attribute__ */ #define HAVE___ATTRIBUTE__ 1 +/* if unaligned access fails */ +/* #undef LBL_ALIGN */ + /* Define to 1 if netinet/ether.h declares `ether_ntohost' */ /* #undef NETINET_ETHER_H_DECLARES_ETHER_NTOHOST */ @@ -309,21 +281,23 @@ /* Define as the return type of signal handlers (`int' or `void'). */ #define RETSIGTYPE void +/* return value of signal handlers */ +#define RETSIGVAL + /* The size of `char', as computed by sizeof. */ -#define SIZEOF_CHAR 1 +#undef SIZEOF_CHAR /* The size of `int', as computed by sizeof. */ -#define SIZEOF_INT 4 +#undef SIZEOF_INT /* The size of `long', as computed by sizeof. */ -/* XXX: This is wrong, but possibly unused */ -#define SIZEOF_LONG 4 +#undef SIZEOF_LONG /* The size of `long long', as computed by sizeof. */ -#define SIZEOF_LONG_LONG 8 +#undef SIZEOF_LONG_LONG /* The size of `short', as computed by sizeof. */ -#define SIZEOF_SHORT 2 +#undef SIZEOF_SHORT /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 @@ -331,6 +305,19 @@ /* Define to 1 if you can safely include both and . */ #define TIME_WITH_SYS_TIME 1 +/* get BSD semantics on Irix */ +/* #undef _BSD_SIGNALS */ + +/* needed on HP-UX */ +/* #undef _HPUX_SOURCE */ + +/* define if your compiler allows __attribute__((format)) to be applied to + function pointers */ +#define __ATTRIBUTE___FORMAT_OK_FOR_FUNCTION_POINTERS 1 + +/* to handle Ultrix compilers that don't support const in prototypes */ +/* #undef const */ + /* Define as token for inline if inlining supported */ #define inline inline From owner-svn-src-head@FreeBSD.ORG Sat Oct 30 16:30:50 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 98A8A106564A; Sat, 30 Oct 2010 16:30:50 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 866868FC12; Sat, 30 Oct 2010 16:30:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9UGUoM7005237; Sat, 30 Oct 2010 16:30:50 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9UGUoee005235; Sat, 30 Oct 2010 16:30:50 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201010301630.o9UGUoee005235@svn.freebsd.org> From: Dimitry Andric Date: Sat, 30 Oct 2010 16:30:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214560 - head/usr.sbin/tcpdump/tcpdump X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Oct 2010 16:30:50 -0000 Author: dim Date: Sat Oct 30 16:30:50 2010 New Revision: 214560 URL: http://svn.freebsd.org/changeset/base/214560 Log: Actually remove the HAVE_CAST_H define this time. Modified: head/usr.sbin/tcpdump/tcpdump/Makefile Modified: head/usr.sbin/tcpdump/tcpdump/Makefile ============================================================================== --- head/usr.sbin/tcpdump/tcpdump/Makefile Sat Oct 30 16:25:08 2010 (r214559) +++ head/usr.sbin/tcpdump/tcpdump/Makefile Sat Oct 30 16:30:50 2010 (r214560) @@ -56,7 +56,7 @@ LDADD= -ll -lpcap DPADD+= ${LIBCRYPTO} LDADD+= -lcrypto CFLAGS+= -I${DESTDIR}/usr/include/openssl -CFLAGS+= -DHAVE_LIBCRYPTO -DHAVE_CAST_H -DHAVE_OPENSSL_EVP_H +CFLAGS+= -DHAVE_LIBCRYPTO -DHAVE_OPENSSL_EVP_H .endif .if ${MK_PF} != "no" From owner-svn-src-head@FreeBSD.ORG Sat Oct 30 16:53:43 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0EF171065672; Sat, 30 Oct 2010 16:53:43 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F0D1E8FC1D; Sat, 30 Oct 2010 16:53:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9UGrg8v006463; Sat, 30 Oct 2010 16:53:42 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9UGrg64006461; Sat, 30 Oct 2010 16:53:42 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201010301653.o9UGrg64006461@svn.freebsd.org> From: Rui Paulo Date: Sat, 30 Oct 2010 16:53:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214562 - head/lib/clang X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Oct 2010 16:53:43 -0000 Author: rpaulo Date: Sat Oct 30 16:53:42 2010 New Revision: 214562 URL: http://svn.freebsd.org/changeset/base/214562 Log: When the make target is 'install', don't descend into the clang libraries subdirectories since there's nothing to do there. This saves us quite a few seconds off installworld, esp. if the disk I/O is slow. Modified: head/lib/clang/Makefile Modified: head/lib/clang/Makefile ============================================================================== --- head/lib/clang/Makefile Sat Oct 30 16:51:25 2010 (r214561) +++ head/lib/clang/Makefile Sat Oct 30 16:53:42 2010 (r214562) @@ -1,5 +1,6 @@ # $FreeBSD$ +.if !make(install) SUBDIR= libclanganalysis \ libclangast \ libclangbasic \ @@ -48,8 +49,9 @@ SUBDIR= libclanganalysis \ libllvmx86asmprinter \ libllvmx86codegen \ libllvmx86disassembler \ - libllvmx86info \ - \ - include + libllvmx86info +.endif + +SUBDIR+= include .include From owner-svn-src-head@FreeBSD.ORG Sat Oct 30 17:21:32 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F0C98106564A; Sat, 30 Oct 2010 17:21:32 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DEDA48FC15; Sat, 30 Oct 2010 17:21:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9UHLWHs007734; Sat, 30 Oct 2010 17:21:32 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9UHLWCe007732; Sat, 30 Oct 2010 17:21:32 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201010301721.o9UHLWCe007732@svn.freebsd.org> From: Alan Cox Date: Sat, 30 Oct 2010 17:21:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214563 - head/sys/amd64/amd64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Oct 2010 17:21:33 -0000 Author: alc Date: Sat Oct 30 17:21:32 2010 New Revision: 214563 URL: http://svn.freebsd.org/changeset/base/214563 Log: Don't demote in pmap_demote_DMAP() if the specified length is zero. Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Sat Oct 30 16:53:42 2010 (r214562) +++ head/sys/amd64/amd64/pmap.c Sat Oct 30 17:21:32 2010 (r214563) @@ -4968,6 +4968,11 @@ pmap_demote_DMAP(vm_paddr_t base, vm_siz vm_offset_t va; boolean_t changed; + if (len == 0) + return; + KASSERT(powerof2(len), ("pmap_demote_DMAP: len is not a power of 2")); + KASSERT((base & (len - 1)) == 0, + ("pmap_demote_DMAP: base is not a multiple of len")); if (len < NBPDP) { va = PHYS_TO_DMAP(base); changed = FALSE; From owner-svn-src-head@FreeBSD.ORG Sat Oct 30 18:00:53 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7D8C8106564A; Sat, 30 Oct 2010 18:00:53 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6B2EE8FC14; Sat, 30 Oct 2010 18:00:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9UI0rmM009555; Sat, 30 Oct 2010 18:00:53 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9UI0rSp009552; Sat, 30 Oct 2010 18:00:53 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201010301800.o9UI0rSp009552@svn.freebsd.org> From: Alan Cox Date: Sat, 30 Oct 2010 18:00:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214564 - head/sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Oct 2010 18:00:53 -0000 Author: alc Date: Sat Oct 30 18:00:53 2010 New Revision: 214564 URL: http://svn.freebsd.org/changeset/base/214564 Log: Correct some format strings used by sysctls. MFC after: 1 week Modified: head/sys/vm/vm_phys.c head/sys/vm/vm_reserv.c Modified: head/sys/vm/vm_phys.c ============================================================================== --- head/sys/vm/vm_phys.c Sat Oct 30 17:21:32 2010 (r214563) +++ head/sys/vm/vm_phys.c Sat Oct 30 18:00:53 2010 (r214564) @@ -137,11 +137,11 @@ sysctl_vm_phys_free(SYSCTL_HANDLER_ARGS) sbuf_printf(&sbuf, "-- -- "); sbuf_printf(&sbuf, "--\n"); for (oind = VM_NFREEORDER - 1; oind >= 0; oind--) { - sbuf_printf(&sbuf, " %2.2d (%6.6dK)", oind, + sbuf_printf(&sbuf, " %2d (%6dK)", oind, 1 << (PAGE_SHIFT - 10 + oind)); for (pind = 0; pind < VM_NFREEPOOL; pind++) { fl = vm_phys_free_queues[flind][pind]; - sbuf_printf(&sbuf, " | %6.6d", fl[oind].lcnt); + sbuf_printf(&sbuf, " | %6d", fl[oind].lcnt); } sbuf_printf(&sbuf, "\n"); } Modified: head/sys/vm/vm_reserv.c ============================================================================== --- head/sys/vm/vm_reserv.c Sat Oct 30 17:21:32 2010 (r214563) +++ head/sys/vm/vm_reserv.c Sat Oct 30 18:00:53 2010 (r214564) @@ -193,7 +193,7 @@ sysctl_vm_reserv_partpopq(SYSCTL_HANDLER unused_pages += VM_LEVEL_0_NPAGES - rv->popcnt; } mtx_unlock(&vm_page_queue_free_mtx); - sbuf_printf(&sbuf, "%5.5d: %6.6dK, %6.6d\n", level, + sbuf_printf(&sbuf, "%5d: %6dK, %6d\n", level, unused_pages * (PAGE_SIZE / 1024), counter); } error = sbuf_finish(&sbuf); From owner-svn-src-head@FreeBSD.ORG Sat Oct 30 18:52:45 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2FCEA1065674; Sat, 30 Oct 2010 18:52:45 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1DCD38FC08; Sat, 30 Oct 2010 18:52:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9UIqjr5012019; Sat, 30 Oct 2010 18:52:45 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9UIqjeR012017; Sat, 30 Oct 2010 18:52:45 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201010301852.o9UIqjeR012017@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 30 Oct 2010 18:52:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214565 - head/sys/netipsec X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Oct 2010 18:52:45 -0000 Author: bz Date: Sat Oct 30 18:52:44 2010 New Revision: 214565 URL: http://svn.freebsd.org/changeset/base/214565 Log: Announce both IPsec and UDP Encap (NAT-T) if available for feature_present(3) checks. This will help to run-time detect and conditionally handle specific optionas of either feature in user space (i.e. in libipsec). Descriptions read by: rwatson MFC after: 2 weeks Modified: head/sys/netipsec/ipsec.c Modified: head/sys/netipsec/ipsec.c ============================================================================== --- head/sys/netipsec/ipsec.c Sat Oct 30 18:00:53 2010 (r214564) +++ head/sys/netipsec/ipsec.c Sat Oct 30 18:52:44 2010 (r214565) @@ -126,6 +126,11 @@ VNET_DEFINE(int, ip4_esp_randpad) = -1; */ VNET_DEFINE(int, crypto_support) = CRYPTOCAP_F_HARDWARE | CRYPTOCAP_F_SOFTWARE; +FEATURE(ipsec, "Internet Protocol Security (IPsec)"); +#ifdef IPSEC_NAT_T +FEATURE(ipsec_natt, "UDP Encapsulation of IPsec ESP Packets ('NAT-T')"); +#endif + SYSCTL_DECL(_net_inet_ipsec); /* net.inet.ipsec */ From owner-svn-src-head@FreeBSD.ORG Sat Oct 30 20:51:25 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B79691065670; Sat, 30 Oct 2010 20:51:25 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A62A28FC26; Sat, 30 Oct 2010 20:51:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9UKpP19021289; Sat, 30 Oct 2010 20:51:25 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9UKpPAp021287; Sat, 30 Oct 2010 20:51:25 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201010302051.o9UKpPAp021287@svn.freebsd.org> From: Marius Strobl Date: Sat, 30 Oct 2010 20:51:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214566 - head/sys/dev/mii X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Oct 2010 20:51:25 -0000 Author: marius Date: Sat Oct 30 20:51:25 2010 New Revision: 214566 URL: http://svn.freebsd.org/changeset/base/214566 Log: Correct a bug in r213893; within a PHY driver MIIF_PHYPRIVn should be used instead of MIIF_MACPRIVn. This didn't make a functional difference though. Modified: head/sys/dev/mii/e1000phy.c Modified: head/sys/dev/mii/e1000phy.c ============================================================================== --- head/sys/dev/mii/e1000phy.c Sat Oct 30 18:52:44 2010 (r214565) +++ head/sys/dev/mii/e1000phy.c Sat Oct 30 20:51:25 2010 (r214566) @@ -206,7 +206,7 @@ e1000phy_reset(struct mii_softc *sc) reg &= ~E1000_SCR_MODE_MASK; reg |= E1000_SCR_MODE_1000BX; PHY_WRITE(sc, E1000_SCR, reg); - if ((sc->mii_flags & MIIF_MACPRIV0) != 0) { + if ((sc->mii_flags & MIIF_PHYPRIV0) != 0) { /* Set SIGDET polarity low for SFP module. */ PHY_WRITE(sc, E1000_EADR, 1); reg = PHY_READ(sc, E1000_SCR); From owner-svn-src-head@FreeBSD.ORG Sat Oct 30 23:07:30 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9A753106564A; Sat, 30 Oct 2010 23:07:30 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8733E8FC15; Sat, 30 Oct 2010 23:07:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9UN7UhA029766; Sat, 30 Oct 2010 23:07:30 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9UN7U2u029753; Sat, 30 Oct 2010 23:07:30 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201010302307.o9UN7U2u029753@svn.freebsd.org> From: Nathan Whitehorn Date: Sat, 30 Oct 2010 23:07:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214574 - in head/sys/powerpc: aim include powerpc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Oct 2010 23:07:30 -0000 Author: nwhitehorn Date: Sat Oct 30 23:07:30 2010 New Revision: 214574 URL: http://svn.freebsd.org/changeset/base/214574 Log: Restructure the way the copyin/copyout segment is stored to prevent a concurrency bug. Since all SLB/SR entries were invalidated during an exception, a decrementer exception could cause the user segment to be invalidated during a copyin()/copyout() without a thread switch that would cause it to be restored from the PCB, potentially causing the operation to continue on invalid memory. This is now handled by explicit restoration of segment 12 from the PCB on 32-bit systems and a check in the Data Segment Exception handler on 64-bit. While here, cause copyin()/copyout() to check whether the requested user segment is already installed, saving some pipeline flushes, and fix the synchronization primitives around the mtsr and slbmte instructions to prevent accessing stale segments. MFC after: 2 weeks Modified: head/sys/powerpc/aim/copyinout.c head/sys/powerpc/aim/slb.c head/sys/powerpc/aim/swtch64.S head/sys/powerpc/aim/trap.c head/sys/powerpc/aim/trap_subr32.S head/sys/powerpc/aim/trap_subr64.S head/sys/powerpc/aim/vm_machdep.c head/sys/powerpc/include/pcb.h head/sys/powerpc/include/slb.h head/sys/powerpc/include/sr.h head/sys/powerpc/powerpc/exec_machdep.c head/sys/powerpc/powerpc/genassym.c Modified: head/sys/powerpc/aim/copyinout.c ============================================================================== --- head/sys/powerpc/aim/copyinout.c Sat Oct 30 23:04:54 2010 (r214573) +++ head/sys/powerpc/aim/copyinout.c Sat Oct 30 23:07:30 2010 (r214574) @@ -81,9 +81,7 @@ static __inline void set_user_sr(pmap_t pm, const void *addr) { struct slb *slb; - register_t esid, vsid, slb1, slb2; - - esid = USER_ADDR >> ADDR_SR_SHFT; + register_t slbv; /* Try lockless look-up first */ slb = user_va_to_slb_entry(pm, (vm_offset_t)addr); @@ -91,20 +89,21 @@ set_user_sr(pmap_t pm, const void *addr) if (slb == NULL) { /* If it isn't there, we need to pre-fault the VSID */ PMAP_LOCK(pm); - vsid = va_to_vsid(pm, (vm_offset_t)addr); + slbv = va_to_vsid(pm, (vm_offset_t)addr) << SLBV_VSID_SHIFT; PMAP_UNLOCK(pm); } else { - vsid = slb->slbv >> SLBV_VSID_SHIFT; + slbv = slb->slbv; } - slb1 = vsid << SLBV_VSID_SHIFT; - slb2 = (esid << SLBE_ESID_SHIFT) | SLBE_VALID | USER_SR; + /* If we have already set this VSID, we can just return */ + if (curthread->td_pcb->pcb_cpu.aim.usr_vsid == slbv) + return; + __asm __volatile ("isync; slbie %0; slbmte %1, %2; isync" :: + "r"(USER_ADDR), "r"(slbv), "r"(USER_SLB_SLBE)); curthread->td_pcb->pcb_cpu.aim.usr_segm = (uintptr_t)addr >> ADDR_SR_SHFT; - __asm __volatile ("slbie %0; slbmte %1, %2" :: "r"(esid << 28), - "r"(slb1), "r"(slb2)); - isync(); + curthread->td_pcb->pcb_cpu.aim.usr_vsid = slbv; } #else static __inline void @@ -114,9 +113,13 @@ set_user_sr(pmap_t pm, const void *addr) vsid = va_to_vsid(pm, (vm_offset_t)addr); - isync(); - __asm __volatile ("mtsr %0,%1" :: "n"(USER_SR), "r"(vsid)); - isync(); + /* If we have already set this VSID, we can just return */ + if (curthread->td_pcb->pcb_cpu.aim.usr_vsid == vsid) + return; + + __asm __volatile ("sync; mtsr %0,%1; sync; isync" :: "n"(USER_SR), + "r"(vsid)); + curthread->td_pcb->pcb_cpu.aim.usr_vsid = vsid; } #endif Modified: head/sys/powerpc/aim/slb.c ============================================================================== --- head/sys/powerpc/aim/slb.c Sat Oct 30 23:04:54 2010 (r214573) +++ head/sys/powerpc/aim/slb.c Sat Oct 30 23:07:30 2010 (r214574) @@ -200,7 +200,7 @@ kernel_va_to_slbv(vm_offset_t va) esid = (uintptr_t)va >> ADDR_SR_SHFT; /* Set kernel VSID to deterministic value */ - slbv = va_to_vsid(kernel_pmap, va) << SLBV_VSID_SHIFT; + slbv = (KERNEL_VSID((uintptr_t)va >> ADDR_SR_SHFT)) << SLBV_VSID_SHIFT; /* Figure out if this is a large-page mapping */ if (hw_direct_map && va < VM_MIN_KERNEL_ADDRESS) { @@ -421,19 +421,19 @@ slb_insert_kernel(uint64_t slbe, uint64_ slbcache = PCPU_GET(slb); - /* Check for an unused slot, abusing the USER_SR slot as a full flag */ - if (slbcache[USER_SR].slbe == 0) { - for (i = 0; i < USER_SR; i++) { + /* Check for an unused slot, abusing the user slot as a full flag */ + if (slbcache[USER_SLB_SLOT].slbe == 0) { + for (i = 0; i < USER_SLB_SLOT; i++) { if (!(slbcache[i].slbe & SLBE_VALID)) goto fillkernslb; } - if (i == USER_SR) - slbcache[USER_SR].slbe = 1; + if (i == USER_SLB_SLOT) + slbcache[USER_SLB_SLOT].slbe = 1; } for (i = mftb() % 64, j = 0; j < 64; j++, i = (i+1) % 64) { - if (i == USER_SR) + if (i == USER_SLB_SLOT) continue; if (SLB_SPILLABLE(slbcache[i].slbe)) Modified: head/sys/powerpc/aim/swtch64.S ============================================================================== --- head/sys/powerpc/aim/swtch64.S Sat Oct 30 23:04:54 2010 (r214573) +++ head/sys/powerpc/aim/swtch64.S Sat Oct 30 23:07:30 2010 (r214574) @@ -110,13 +110,10 @@ ENTRY(cpu_switch) std %r1,PCB_SP(%r6) /* Save the stack pointer */ std %r2,PCB_TOC(%r6) /* Save the TOC pointer */ - li %r14,0 /* Save USER_SR for copyin/out */ - li %r15,0 - li %r16,USER_SR - slbmfee %r14, %r16 + li %r15,0 /* Save user segment for copyin/out */ + li %r16,USER_SLB_SLOT slbmfev %r15, %r16 isync - std %r14,PCB_AIM_USR_ESID(%r6) std %r15,PCB_AIM_USR_VSID(%r6) mr %r14,%r3 /* Copy the old thread ptr... */ @@ -221,14 +218,17 @@ blocked_loop: ld %r1,PCB_SP(%r3) /* Load the stack pointer */ ld %r2,PCB_TOC(%r3) /* Load the TOC pointer */ - lis %r5,USER_ADDR@highesta /* Load the USER_SR segment reg */ + lis %r5,USER_ADDR@highesta /* Load the copyin/out segment reg */ ori %r5,%r5,USER_ADDR@highera sldi %r5,%r5,32 oris %r5,%r5,USER_ADDR@ha slbie %r5 + lis %r6,USER_SLB_SLBE@highesta + ori %r6,%r6,USER_SLB_SLBE@highera + sldi %r6,%r6,32 + oris %r6,%r6,USER_SLB_SLBE@ha + ori %r6,%r6,USER_SLB_SLBE@l ld %r5,PCB_AIM_USR_VSID(%r3) - ld %r6,PCB_AIM_USR_ESID(%r3) - ori %r6,%r6,USER_SR slbmte %r5,%r6 isync Modified: head/sys/powerpc/aim/trap.c ============================================================================== --- head/sys/powerpc/aim/trap.c Sat Oct 30 23:04:54 2010 (r214573) +++ head/sys/powerpc/aim/trap.c Sat Oct 30 23:07:30 2010 (r214574) @@ -249,8 +249,16 @@ trap(struct trapframe *frame) return; break; #ifdef __powerpc64__ - case EXC_ISE: case EXC_DSE: + if ((frame->cpu.aim.dar & SEGMENT_MASK) == USER_ADDR) { + __asm __volatile ("slbmte %0, %1" :: + "r"(td->td_pcb->pcb_cpu.aim.usr_vsid), + "r"(USER_SLB_SLBE)); + return; + } + + /* FALLTHROUGH */ + case EXC_ISE: if (handle_slb_spill(kernel_pmap, (type == EXC_ISE) ? frame->srr0 : frame->cpu.aim.dar) != 0) Modified: head/sys/powerpc/aim/trap_subr32.S ============================================================================== --- head/sys/powerpc/aim/trap_subr32.S Sat Oct 30 23:04:54 2010 (r214573) +++ head/sys/powerpc/aim/trap_subr32.S Sat Oct 30 23:07:30 2010 (r214574) @@ -54,7 +54,7 @@ lwz sr,9*4(pmap); mtsr 9,sr; \ lwz sr,10*4(pmap); mtsr 10,sr; \ lwz sr,11*4(pmap); mtsr 11,sr; \ - lwz sr,12*4(pmap); mtsr 12,sr; \ + /* Skip segment 12 (USER_SR), which is restored differently */ \ lwz sr,13*4(pmap); mtsr 13,sr; \ lwz sr,14*4(pmap); mtsr 14,sr; \ lwz sr,15*4(pmap); mtsr 15,sr; isync; @@ -66,7 +66,9 @@ GET_CPUINFO(pmap); \ lwz pmap,PC_CURPMAP(pmap); \ lwzu sr,PM_SR(pmap); \ - RESTORE_SRS(pmap,sr) + RESTORE_SRS(pmap,sr) \ + /* Restore SR 12 */ \ + lwz sr,12*4(pmap); mtsr 12,sr /* * Kernel SRs are loaded directly from kernel_pmap_ @@ -537,6 +539,11 @@ u_trap: */ k_trap: FRAME_SETUP(PC_TEMPSAVE) + /* Restore USER_SR */ + GET_CPUINFO(%r30) + lwz %r30,PC_CURPCB(%r30) + lwz %r30,PCB_AIM_USR_VSID(%r30) + mtsr USER_SR,%r30; sync; isync /* Call C interrupt dispatcher: */ trapagain: addi %r3,%r1,8 Modified: head/sys/powerpc/aim/trap_subr64.S ============================================================================== --- head/sys/powerpc/aim/trap_subr64.S Sat Oct 30 23:04:54 2010 (r214573) +++ head/sys/powerpc/aim/trap_subr64.S Sat Oct 30 23:07:30 2010 (r214574) @@ -99,7 +99,7 @@ instkernslb: addi %r28, %r28, 16; /* Advance pointer */ addi %r29, %r29, 1; - cmpli 0, %r29, USER_SR; /* Repeat if we are not at the end */ + cmpli 0, %r29, USER_SLB_SLOT; /* Repeat if we are not at the end */ blt instkernslb; blr; Modified: head/sys/powerpc/aim/vm_machdep.c ============================================================================== --- head/sys/powerpc/aim/vm_machdep.c Sat Oct 30 23:04:54 2010 (r214573) +++ head/sys/powerpc/aim/vm_machdep.c Sat Oct 30 23:07:30 2010 (r214574) @@ -197,7 +197,6 @@ cpu_fork(struct thread *td1, struct proc pcb->pcb_lr = (register_t)fork_trampoline; #endif pcb->pcb_cpu.aim.usr_vsid = 0; - pcb->pcb_cpu.aim.usr_esid = 0; /* Setup to release spin count in fork_exit(). */ td2->td_md.md_spinlock_count = 1; Modified: head/sys/powerpc/include/pcb.h ============================================================================== --- head/sys/powerpc/include/pcb.h Sat Oct 30 23:04:54 2010 (r214573) +++ head/sys/powerpc/include/pcb.h Sat Oct 30 23:07:30 2010 (r214574) @@ -67,7 +67,6 @@ struct pcb { union { struct { vm_offset_t usr_segm; /* Base address */ - register_t usr_esid; /* USER_SR segment */ register_t usr_vsid; /* USER_SR segment */ } aim; struct { Modified: head/sys/powerpc/include/slb.h ============================================================================== --- head/sys/powerpc/include/slb.h Sat Oct 30 23:04:54 2010 (r214573) +++ head/sys/powerpc/include/slb.h Sat Oct 30 23:07:30 2010 (r214574) @@ -62,6 +62,13 @@ #define SLBE_ESID_MASK 0xfffffffff0000000UL /* Effective segment ID mask */ #define SLBE_ESID_SHIFT 28 +/* + * User segment for copyin/out + */ +#define USER_SLB_SLOT 63 +#define USER_SLB_SLBE (((USER_ADDR >> ADDR_SR_SHFT) << SLBE_ESID_SHIFT) | \ + SLBE_VALID | USER_SLB_SLOT) + struct slb { uint64_t slbv; uint64_t slbe; Modified: head/sys/powerpc/include/sr.h ============================================================================== --- head/sys/powerpc/include/sr.h Sat Oct 30 23:04:54 2010 (r214573) +++ head/sys/powerpc/include/sr.h Sat Oct 30 23:07:30 2010 (r214574) @@ -42,11 +42,7 @@ #define SR_VSID_MASK 0x00ffffff /* Virtual Segment ID mask */ /* Kernel segment register usage */ -#ifdef __powerpc64__ -#define USER_SR 63 -#else #define USER_SR 12 -#endif #define KERNEL_SR 13 #define KERNEL2_SR 14 #define KERNEL3_SR 15 Modified: head/sys/powerpc/powerpc/exec_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/exec_machdep.c Sat Oct 30 23:04:54 2010 (r214573) +++ head/sys/powerpc/powerpc/exec_machdep.c Sat Oct 30 23:07:30 2010 (r214574) @@ -986,7 +986,6 @@ cpu_set_upcall(struct thread *td, struct pcb2->pcb_lr = (register_t)fork_trampoline; #endif pcb2->pcb_cpu.aim.usr_vsid = 0; - pcb2->pcb_cpu.aim.usr_esid = 0; /* Setup to release spin count in fork_exit(). */ td->td_md.md_spinlock_count = 1; Modified: head/sys/powerpc/powerpc/genassym.c ============================================================================== --- head/sys/powerpc/powerpc/genassym.c Sat Oct 30 23:04:54 2010 (r214573) +++ head/sys/powerpc/powerpc/genassym.c Sat Oct 30 23:07:30 2010 (r214574) @@ -103,13 +103,15 @@ ASSYM(TLBSAVE_BOOKE_R31, TLBSAVE_BOOKE_R ASSYM(MTX_LOCK, offsetof(struct mtx, mtx_lock)); #if defined(AIM) -ASSYM(USER_SR, USER_SR); ASSYM(USER_ADDR, USER_ADDR); #ifdef __powerpc64__ ASSYM(PC_KERNSLB, offsetof(struct pcpu, pc_slb)); ASSYM(PC_USERSLB, offsetof(struct pcpu, pc_userslb)); +ASSYM(USER_SLB_SLOT, USER_SLB_SLOT); +ASSYM(USER_SLB_SLBE, USER_SLB_SLBE); #else ASSYM(PM_SR, offsetof(struct pmap, pm_sr)); +ASSYM(USER_SR, USER_SR); #endif #elif defined(E500) ASSYM(PM_PDIR, offsetof(struct pmap, pm_pdir)); @@ -187,7 +189,6 @@ ASSYM(PCB_FLAGS, offsetof(struct pcb, pc ASSYM(PCB_FPU, PCB_FPU); ASSYM(PCB_VEC, PCB_VEC); -ASSYM(PCB_AIM_USR_ESID, offsetof(struct pcb, pcb_cpu.aim.usr_esid)); ASSYM(PCB_AIM_USR_VSID, offsetof(struct pcb, pcb_cpu.aim.usr_vsid)); ASSYM(PCB_BOOKE_CTR, offsetof(struct pcb, pcb_cpu.booke.ctr)); ASSYM(PCB_BOOKE_XER, offsetof(struct pcb, pcb_cpu.booke.xer)); From owner-svn-src-head@FreeBSD.ORG Sat Oct 30 23:09:56 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7A5E81065673; Sat, 30 Oct 2010 23:09:56 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4DFEB8FC14; Sat, 30 Oct 2010 23:09:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9UN9uqn029906; Sat, 30 Oct 2010 23:09:56 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9UN9uA7029904; Sat, 30 Oct 2010 23:09:56 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201010302309.o9UN9uA7029904@svn.freebsd.org> From: Nathan Whitehorn Date: Sat, 30 Oct 2010 23:09:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214575 - head/sys/powerpc/powermac X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Oct 2010 23:09:56 -0000 Author: nwhitehorn Date: Sat Oct 30 23:09:56 2010 New Revision: 214575 URL: http://svn.freebsd.org/changeset/base/214575 Log: Allow access to the HT I/O port space on the IBM CPC9X5 northbridge chips. MFC after: 2 weeks Modified: head/sys/powerpc/powermac/cpcht.c Modified: head/sys/powerpc/powermac/cpcht.c ============================================================================== --- head/sys/powerpc/powermac/cpcht.c Sat Oct 30 23:07:30 2010 (r214574) +++ head/sys/powerpc/powermac/cpcht.c Sat Oct 30 23:09:56 2010 (r214575) @@ -162,6 +162,7 @@ struct cpcht_softc { vm_offset_t sc_data; uint64_t sc_populated_slots; struct rman sc_mem_rman; + struct rman sc_io_rman; struct cpcht_irq htirq_map[128]; struct mtx htirq_mtx; @@ -177,6 +178,9 @@ static devclass_t cpcht_devclass; DRIVER_MODULE(cpcht, nexus, cpcht_driver, cpcht_devclass, 0, 0); +#define CPCHT_IOPORT_BASE 0xf4000000UL /* Hardwired */ +#define CPCHT_IOPORT_SIZE 0x00400000UL + #define HTAPIC_REQUEST_EOI 0x20 #define HTAPIC_TRIGGER_LEVEL 0x02 #define HTAPIC_MASK 0x01 @@ -236,7 +240,14 @@ cpcht_attach(device_t dev) sc->sc_mem_rman.rm_type = RMAN_ARRAY; sc->sc_mem_rman.rm_descr = "CPCHT Device Memory"; error = rman_init(&sc->sc_mem_rman); + if (error) { + device_printf(dev, "rman_init() failed. error = %d\n", error); + return (error); + } + sc->sc_io_rman.rm_type = RMAN_ARRAY; + sc->sc_io_rman.rm_descr = "CPCHT I/O Memory"; + error = rman_init(&sc->sc_io_rman); if (error) { device_printf(dev, "rman_init() failed. error = %d\n", error); return (error); @@ -248,6 +259,9 @@ cpcht_attach(device_t dev) * where we get the HT interrupts properties. */ + /* I/O port mappings are usually not in the device tree */ + rman_manage_region(&sc->sc_io_rman, 0, CPCHT_IOPORT_SIZE - 1); + bzero(sc->htirq_map, sizeof(sc->htirq_map)); mtx_init(&sc->htirq_mtx, "cpcht irq", NULL, MTX_DEF); for (i = 0; i < 8; i++) @@ -299,6 +313,9 @@ cpcht_configure_htbridge(device_t dev, p case OFW_PCI_PHYS_HI_SPACE_CONFIG: break; case OFW_PCI_PHYS_HI_SPACE_IO: + rman_manage_region(&sc->sc_io_rman, rp->pci_lo, + rp->pci_lo + rp->size_lo - 1); + break; case OFW_PCI_PHYS_HI_SPACE_MEM32: rman_manage_region(&sc->sc_mem_rman, rp->pci_lo, rp->pci_lo + rp->size_lo - 1); @@ -507,8 +524,9 @@ cpcht_alloc_resource(device_t bus, devic switch (type) { case SYS_RES_IOPORT: end = min(end, start + count); + rm = &sc->sc_io_rman; + break; - /* FALLTHROUGH */ case SYS_RES_MEMORY: rm = &sc->sc_mem_rman; break; @@ -562,6 +580,9 @@ cpcht_activate_resource(device_t bus, de start = (vm_offset_t)rman_get_start(res); + if (type == SYS_RES_IOPORT) + start += CPCHT_IOPORT_BASE; + if (bootverbose) printf("cpcht mapdev: start %zx, len %ld\n", start, rman_get_size(res)); From owner-svn-src-head@FreeBSD.ORG Sat Oct 30 23:49:37 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 75DE9106564A; Sat, 30 Oct 2010 23:49:37 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 644908FC08; Sat, 30 Oct 2010 23:49:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9UNnb4u031858; Sat, 30 Oct 2010 23:49:37 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9UNnbJ8031856; Sat, 30 Oct 2010 23:49:37 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201010302349.o9UNnbJ8031856@svn.freebsd.org> From: Alan Cox Date: Sat, 30 Oct 2010 23:49:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214576 - head/sys/amd64/amd64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Oct 2010 23:49:37 -0000 Author: alc Date: Sat Oct 30 23:49:37 2010 New Revision: 214576 URL: http://svn.freebsd.org/changeset/base/214576 Log: Add another safety belt to pmap_demote_DMAP(). Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Sat Oct 30 23:09:56 2010 (r214575) +++ head/sys/amd64/amd64/pmap.c Sat Oct 30 23:49:37 2010 (r214576) @@ -4973,7 +4973,7 @@ pmap_demote_DMAP(vm_paddr_t base, vm_siz KASSERT(powerof2(len), ("pmap_demote_DMAP: len is not a power of 2")); KASSERT((base & (len - 1)) == 0, ("pmap_demote_DMAP: base is not a multiple of len")); - if (len < NBPDP) { + if (len < NBPDP && base < dmaplimit) { va = PHYS_TO_DMAP(base); changed = FALSE; PMAP_LOCK(kernel_pmap);