From owner-svn-src-head@FreeBSD.ORG Sun Oct 17 04:40: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 6E7AC106566C; Sun, 17 Oct 2010 04:40:00 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 2D4578FC14; Sun, 17 Oct 2010 04:40:00 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id o9H4ZAut054759; Sat, 16 Oct 2010 22:35:10 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Sat, 16 Oct 2010 22:35:10 -0600 (MDT) Message-Id: <20101016.223510.41688183.imp@bsdimp.com> To: jhb@FreeBSD.org From: Warner Losh In-Reply-To: <201010150845.22576.jhb@freebsd.org> References: <201010141539.23573.jhb@freebsd.org> <4CB771A6.1070103@FreeBSD.org> <201010150845.22576.jhb@freebsd.org> X-Mailer: Mew version 3.3 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, rpaulo@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, dim@FreeBSD.org Subject: Re: svn commit: r213845 - head/sys/dev/aic7xxx/aicasm 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, 17 Oct 2010 04:40:00 -0000 From: John Baldwin Subject: Re: svn commit: r213845 - head/sys/dev/aic7xxx/aicasm Date: Fri, 15 Oct 2010 08:45:22 -0400 > On Thursday, October 14, 2010 5:09:58 pm Dimitry Andric wrote: > > On 2010-10-14 21:39, John Baldwin wrote: > > > On Thursday, October 14, 2010 3:19:19 pm Rui Paulo wrote: > > ... > > >> Revert r213765. This is required because our build infrastructure uses > > >> the host lex instead of the lex built during buildworld. I will MFC the > > >> lex changes soon and in a few weeks this I'll commit again r213765. > > > Can't you make 'lex' a build-tool to workaround this? > > > > That will not help for "cd conf/CONF && make kernel", apparently. It > > will always use the host lex. > > Well, yes, but that is always true. build-tools are only used for > buildkernel. However, if an 8.x lex cannot build a 9.x kernel, then having > lex be a build-tool (or cross-tool, ru@ knows which category better than I) > will let a 'make kernel-toolchain' followed by 'make buildkernel' of a 9.x > source tree work on an 8.x host. Agreed. Just because it doesn't fix one case doesn't invalidate the usefulness for the other. In general, we support the config FOO method of building only on kernels that are "close" versions to the host... Warner From owner-svn-src-head@FreeBSD.ORG Sun Oct 17 04:40: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 027D6106564A; Sun, 17 Oct 2010 04:40:00 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id A8D588FC16; Sun, 17 Oct 2010 04:40:00 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id o9H4bCSj054764; Sat, 16 Oct 2010 22:37:12 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Sat, 16 Oct 2010 22:37:12 -0600 (MDT) Message-Id: <20101016.223712.71141197.imp@bsdimp.com> To: rpaulo@FreeBSD.org From: Warner Losh In-Reply-To: <96F4E353-55A6-48E6-BA20-92720EC2C4E7@freebsd.org> References: <4CB771A6.1070103@FreeBSD.org> <201010150845.22576.jhb@freebsd.org> <96F4E353-55A6-48E6-BA20-92720EC2C4E7@freebsd.org> X-Mailer: Mew version 3.3 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, dim@FreeBSD.org, jhb@FreeBSD.org Subject: Re: svn commit: r213845 - head/sys/dev/aic7xxx/aicasm 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, 17 Oct 2010 04:40:01 -0000 From: Rui Paulo Subject: Re: svn commit: r213845 - head/sys/dev/aic7xxx/aicasm Date: Fri, 15 Oct 2010 19:50:46 +0100 > On 15 Oct 2010, at 13:45, John Baldwin wrote: > > > On Thursday, October 14, 2010 5:09:58 pm Dimitry Andric wrote: > >> On 2010-10-14 21:39, John Baldwin wrote: > >>> On Thursday, October 14, 2010 3:19:19 pm Rui Paulo wrote: > >> ... > >>>> Revert r213765. This is required because our build infrastructure uses > >>>> the host lex instead of the lex built during buildworld. I will MFC the > >>>> lex changes soon and in a few weeks this I'll commit again r213765. > >>> Can't you make 'lex' a build-tool to workaround this? > >> > >> That will not help for "cd conf/CONF && make kernel", apparently. It > >> will always use the host lex. > > > > Well, yes, but that is always true. build-tools are only used for > > buildkernel. However, if an 8.x lex cannot build a 9.x kernel, then having > > lex be a build-tool (or cross-tool, ru@ knows which category better than I) > > will let a 'make kernel-toolchain' followed by 'make buildkernel' of a 9.x > > source tree work on an 8.x host. > > Yes, but I was told that 'cd conf/CONF && make kernel' is a supported configuration (without requiring kernel-toolchain first). Only on "similar" versions... Warner From owner-svn-src-head@FreeBSD.ORG Sun Oct 17 11:01: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 BCE4E1065675; Sun, 17 Oct 2010 11:01:52 +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 AAB608FC1B; Sun, 17 Oct 2010 11:01: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 o9HB1qds027251; Sun, 17 Oct 2010 11:01:52 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9HB1qwJ027247; Sun, 17 Oct 2010 11:01:52 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201010171101.o9HB1qwJ027247@svn.freebsd.org> From: David Xu Date: Sun, 17 Oct 2010 11:01: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: r213950 - in head/sys: kern 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: Sun, 17 Oct 2010 11:01:52 -0000 Author: davidxu Date: Sun Oct 17 11:01:52 2010 New Revision: 213950 URL: http://svn.freebsd.org/changeset/base/213950 Log: - Insert thread0 into correct thread hash link list. - In thr_exit() and kthread_exit(), only remove thread from hash if it can directly exit, otherwise let exit1() do it. - In thread_suspend_check(), fix cleanup code when thread needs to exit. This change seems fixed the "Bad link elm " panic found by Peter Holm. Stress testing: pho Modified: head/sys/kern/init_main.c head/sys/kern/kern_thread.c head/sys/sys/proc.h Modified: head/sys/kern/init_main.c ============================================================================== --- head/sys/kern/init_main.c Sun Oct 17 09:13:47 2010 (r213949) +++ head/sys/kern/init_main.c Sun Oct 17 11:01:52 2010 (r213950) @@ -443,7 +443,6 @@ proc0_init(void *dummy __unused) */ LIST_INSERT_HEAD(&allproc, p, p_list); LIST_INSERT_HEAD(PIDHASH(0), p, p_hash); - LIST_INSERT_HEAD(TIDHASH(0), td, td_hash); mtx_init(&pgrp0.pg_mtx, "process group", NULL, MTX_DEF | MTX_DUPOK); p->p_pgrp = &pgrp0; LIST_INSERT_HEAD(PGRPHASH(0), &pgrp0, pg_hash); @@ -462,6 +461,7 @@ proc0_init(void *dummy __unused) STAILQ_INIT(&p->p_ktr); p->p_nice = NZERO; td->td_tid = PID_MAX + 1; + LIST_INSERT_HEAD(TIDHASH(td->td_tid), td, td_hash); td->td_state = TDS_RUNNING; td->td_pri_class = PRI_TIMESHARE; td->td_user_pri = PUSER; Modified: head/sys/kern/kern_thread.c ============================================================================== --- head/sys/kern/kern_thread.c Sun Oct 17 09:13:47 2010 (r213949) +++ head/sys/kern/kern_thread.c Sun Oct 17 11:01:52 2010 (r213950) @@ -746,25 +746,23 @@ thread_suspend_check(int return_instead) (p->p_flag & P_SINGLE_BOUNDARY) && return_instead) return (ERESTART); - /* If thread will exit, flush its pending signals */ - if ((p->p_flag & P_SINGLE_EXIT) && (p->p_singlethread != td)) - sigqueue_flush(&td->td_sigqueue); - - PROC_SLOCK(p); - thread_stopped(p); /* * If the process is waiting for us to exit, * this thread should just suicide. * Assumes that P_SINGLE_EXIT implies P_STOPPED_SINGLE. */ if ((p->p_flag & P_SINGLE_EXIT) && (p->p_singlethread != td)) { - PROC_SUNLOCK(p); PROC_UNLOCK(p); tidhash_remove(td); PROC_LOCK(p); + tdsigcleanup(td); PROC_SLOCK(p); + thread_stopped(p); thread_exit(); } + + PROC_SLOCK(p); + thread_stopped(p); if (P_SHOULDSTOP(p) == P_STOPPED_SINGLE) { if (p->p_numthreads == p->p_suspcount + 1) { thread_lock(p->p_singlethread); @@ -981,12 +979,7 @@ void tidhash_add(struct thread *td) { rw_wlock(&tidhash_lock); - thread_lock(td); - if ((td->td_flags & TDF_TIDHASH) == 0) { - LIST_INSERT_HEAD(TIDHASH(td->td_tid), td, td_hash); - td->td_flags |= TDF_TIDHASH; - } - thread_unlock(td); + LIST_INSERT_HEAD(TIDHASH(td->td_tid), td, td_hash); rw_wunlock(&tidhash_lock); } @@ -994,11 +987,6 @@ void tidhash_remove(struct thread *td) { rw_wlock(&tidhash_lock); - thread_lock(td); - if ((td->td_flags & TDF_TIDHASH) != 0) { - LIST_REMOVE(td, td_hash); - td->td_flags &= ~TDF_TIDHASH; - } - thread_unlock(td); + LIST_REMOVE(td, td_hash); rw_wunlock(&tidhash_lock); } Modified: head/sys/sys/proc.h ============================================================================== --- head/sys/sys/proc.h Sun Oct 17 09:13:47 2010 (r213949) +++ head/sys/sys/proc.h Sun Oct 17 11:01:52 2010 (r213950) @@ -353,7 +353,7 @@ do { \ #define TDF_NEEDRESCHED 0x00010000 /* Thread needs to yield. */ #define TDF_NEEDSIGCHK 0x00020000 /* Thread may need signal delivery. */ #define TDF_NOLOAD 0x00040000 /* Ignore during load avg calculations. */ -#define TDF_TIDHASH 0x00080000 /* Thread is on hash table. */ +#define TDF_UNUSED19 0x00080000 /* --available-- */ #define TDF_THRWAKEUP 0x00100000 /* Libthr thread must not suspend itself. */ #define TDF_UNUSED21 0x00200000 /* --available-- */ #define TDF_SWAPINREQ 0x00400000 /* Swapin request due to wakeup. */ From owner-svn-src-head@FreeBSD.ORG Sun Oct 17 15:47: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 CE0D6106564A; Sun, 17 Oct 2010 15:47:27 +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 BC1868FC15; Sun, 17 Oct 2010 15:47: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 o9HFlRuH036630; Sun, 17 Oct 2010 15:47:27 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9HFlRJw036628; Sun, 17 Oct 2010 15:47:27 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201010171547.o9HFlRJw036628@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 17 Oct 2010 15:47: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: r213981 - 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, 17 Oct 2010 15:47:27 -0000 Author: pjd Date: Sun Oct 17 15:47:27 2010 New Revision: 213981 URL: http://svn.freebsd.org/changeset/base/213981 Log: Log correct connection when canceling half-open connection. Submitted by: Mikolaj Golub MFC after: 3 days Modified: head/sbin/hastd/hastd.c Modified: head/sbin/hastd/hastd.c ============================================================================== --- head/sbin/hastd/hastd.c Sun Oct 17 15:25:33 2010 (r213980) +++ head/sbin/hastd/hastd.c Sun Oct 17 15:47:27 2010 (r213981) @@ -527,7 +527,8 @@ listen_accept(void) } else if (res->hr_remotein != NULL) { char oaddr[256]; - proto_remote_address(conn, oaddr, sizeof(oaddr)); + proto_remote_address(res->hr_remotein, oaddr, + sizeof(oaddr)); pjdlog_debug(1, "Canceling half-open connection from %s on connection from %s.", oaddr, raddr); From owner-svn-src-head@FreeBSD.ORG Sun Oct 17 16:30: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 8D6081065697; Sun, 17 Oct 2010 16:30:33 +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 7AD258FC22; Sun, 17 Oct 2010 16:30: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 o9HGUXQO037944; Sun, 17 Oct 2010 16:30:33 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9HGUXH9037941; Sun, 17 Oct 2010 16:30:33 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201010171630.o9HGUXH9037941@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 17 Oct 2010 16:30: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: r213983 - 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, 17 Oct 2010 16:30:33 -0000 Author: kib Date: Sun Oct 17 16:30:33 2010 New Revision: 213983 URL: http://svn.freebsd.org/changeset/base/213983 Log: Document vunref(9), add some important notes for vrele(9) and vput(9). Merge all three manpages to one, removing separate file for vput(9). MFC after: 1 week Deleted: head/share/man/man9/vput.9 Modified: head/share/man/man9/Makefile head/share/man/man9/vrele.9 Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Sun Oct 17 15:55:46 2010 (r213982) +++ head/share/man/man9/Makefile Sun Oct 17 16:30:33 2010 (r213983) @@ -364,7 +364,6 @@ MAN= accept_filter.9 \ VOP_STRATEGY.9 \ VOP_VPTOCNP.9 \ VOP_VPTOFH.9 \ - vput.9 \ vref.9 \ vrefcnt.9 \ vrele.9 \ @@ -1366,6 +1365,8 @@ MLINKS+=VOP_RDWR.9 VOP_READ.9 \ VOP_RDWR.9 VOP_WRITE.9 MLINKS+=VOP_REMOVE.9 VOP_RMDIR.9 MLINKS+=vref.9 VREF.9 +MLINKS+=vrele.9 vput.9 \ + vrele.9 vunref.9 MLINKS+=vslock.9 vsunlock.9 MLINKS+=zero_copy.9 zero_copy_sockets.9 MLINKS+=zone.9 uma.9 \ Modified: head/share/man/man9/vrele.9 ============================================================================== --- head/share/man/man9/vrele.9 Sun Oct 17 15:55:46 2010 (r213982) +++ head/share/man/man9/vrele.9 Sun Oct 17 16:30:33 2010 (r213983) @@ -1,6 +1,7 @@ .\" -*- nroff -*- .\" .\" Copyright (c) 1996 Doug Rabson +.\" Copyright (c) 2010 Konstantin Belousov .\" .\" All rights reserved. .\" @@ -28,17 +29,23 @@ .\" .\" $FreeBSD$ .\" -.Dd July 24, 1996 +.Dd October 17, 2010 .Dt VRELE 9 .Os .Sh NAME -.Nm vrele +.Nm vput , +.Nm vrele , +.Nm vunref .Nd decrement the use count for a vnode .Sh SYNOPSIS .In sys/param.h .In sys/vnode.h .Ft void +.Fn vput "struct vnode *vp" +.Ft void .Fn vrele "struct vnode *vp" +.Ft void +.Fn vunref "struct vnode *vp" .Sh DESCRIPTION Decrement the .Va v_usecount @@ -48,18 +55,51 @@ field of a vnode. the vnode to decrement .El .Pp -Any code in the system which is using a vnode should call +The .Fn vrele -when it is finished with the vnode. +function takes an unlocked vnode and returns with the vnode unlocked. +.Pp +.The +.Fn vput +function should be given a locked vnode as argument, the vnode is unlocked +after the function returned. +The +.Fn vput +is operationally equivalent to calling +.Xr VOP_UNLOCK 9 +followed by +.Xr vrele 9 , +with less overhead. +.Pp +The +.Fn vunref +function takes a locked vnode as argument, and returns with the vnode locked. +Nonetheless, the +.Fn vunref +might drop the vnode lock during the operation, so caller should not expect +that non-doomed vnode is still non-doomed after the function returned. +.Pp +Any code in the system which signified its use of a vnode by usecount +should call one of the listed function to decrement use counter. If the .Va v_usecount -field of the vnode reaches zero, then it will be placed on the free list. +field of the non-doomed vnode reaches zero, then it will be inactivated +and placed on the free list. +Since the functions might need to call VOPs for the vnode, the +.Va Giant +mutex should be conditionally locked around the call. +.Pp +The hold count for the vnode is always greater or equal to the usecount. +Non-forced unmount fails when mount point owns a vnode that has non-zero +usecount, see +.Xr vflush 9 . .Sh SEE ALSO .Xr vget 9 , .Xr vnode 9 , -.Xr vput 9 , .Xr vref 9 , .Xr vrefcnt 9 .Sh AUTHORS This manual page was written by -.An Doug Rabson . +.An Doug Rabson +and +.An Konstantin Belousov . From owner-svn-src-head@FreeBSD.ORG Sun Oct 17 16:46: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 5B40A1065674; Sun, 17 Oct 2010 16:46:54 +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 4897F8FC16; Sun, 17 Oct 2010 16:46: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 o9HGksMJ038503; Sun, 17 Oct 2010 16:46:54 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9HGks2U038501; Sun, 17 Oct 2010 16:46:54 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201010171646.o9HGks2U038501@svn.freebsd.org> From: Marius Strobl Date: Sun, 17 Oct 2010 16:46: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: r213985 - 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: Sun, 17 Oct 2010 16:46:54 -0000 Author: marius Date: Sun Oct 17 16:46:54 2010 New Revision: 213985 URL: http://svn.freebsd.org/changeset/base/213985 Log: - In oneshot-mode it doesn't make sense to try to compensate the clock drift in order to achieve a more stable clock as the tick intervals may vary in the first place. In fact I haven't seen this code kick in when in oneshot-mode so just skip it in that case. - There's no need to explicitly stop the (S)TICK counter in oneshot-mode with every tick as it just won't trigger again with the (S)TICK compare register set to a value in the past (with a wrap-around once every ~195 years of uptime at 1.5 GHz this isn't something we have to worry about in practice). - Given that we'll disable interrupts completely anyway there's no need to enter critical sections. Modified: head/sys/sparc64/sparc64/tick.c Modified: head/sys/sparc64/sparc64/tick.c ============================================================================== --- head/sys/sparc64/sparc64/tick.c Sun Oct 17 16:43:20 2010 (r213984) +++ head/sys/sparc64/sparc64/tick.c Sun Oct 17 16:46:54 2010 (r213985) @@ -96,8 +96,8 @@ static int tick_et_start(struct eventtim static int tick_et_stop(struct eventtimer *et); static void tick_intr(struct trapframe *tf); static void tick_intr_bbwar(struct trapframe *tf); -static inline void tick_hardclock_common(struct trapframe *tf, u_long tick, - u_long adj); +static inline void tick_hardclock_periodic(struct trapframe *tf, u_long tick, + u_long tick_increment, u_long adj); static inline void tick_process(struct trapframe *tf); static void stick_intr(struct trapframe *tf); @@ -225,18 +225,18 @@ tick_intr(struct trapframe *tf) u_long adj, tick, tick_increment; register_t s; - critical_enter(); - adj = PCPU_GET(tickadj); - tick_increment = PCPU_GET(tickincrement); s = intr_disable(); - tick = rd(tick); - if (tick_increment != 0) + tick_increment = PCPU_GET(tickincrement); + if (tick_increment != 0) { + adj = PCPU_GET(tickadj); + tick = rd(tick); wr(tick_cmpr, tick + tick_increment - adj, 0); - else - wr(tick_cmpr, 1L << 63, 0); - intr_restore(s); - tick_hardclock_common(tf, tick, adj); - critical_exit(); + intr_restore(s); + tick_hardclock_periodic(tf, tick, tick_increment, adj); + } else { + intr_restore(s); + tick_process(tf); + } } static void @@ -245,18 +245,18 @@ tick_intr_bbwar(struct trapframe *tf) u_long adj, tick, tick_increment; register_t s; - critical_enter(); - adj = PCPU_GET(tickadj); - tick_increment = PCPU_GET(tickincrement); s = intr_disable(); - tick = rd(tick); - if (tick_increment != 0) + tick_increment = PCPU_GET(tickincrement); + if (tick_increment != 0) { + adj = PCPU_GET(tickadj); + tick = rd(tick); wrtickcmpr(tick + tick_increment - adj, 0); - else - wrtickcmpr(1L << 63, 0); - intr_restore(s); - tick_hardclock_common(tf, tick, adj); - critical_exit(); + intr_restore(s); + tick_hardclock_periodic(tf, tick, tick_increment, adj); + } else { + intr_restore(s); + tick_process(tf); + } } static void @@ -265,28 +265,28 @@ stick_intr(struct trapframe *tf) u_long adj, stick, tick_increment; register_t s; - critical_enter(); - adj = PCPU_GET(tickadj); - tick_increment = PCPU_GET(tickincrement); s = intr_disable(); - stick = rdstick(); - if (tick_increment != 0) + tick_increment = PCPU_GET(tickincrement); + if (tick_increment != 0) { + adj = PCPU_GET(tickadj); + stick = rdstick(); wrstickcmpr(stick + tick_increment - adj, 0); - else - wrstickcmpr(1L << 63, 0); - intr_restore(s); - tick_hardclock_common(tf, stick, adj); - critical_exit(); + intr_restore(s); + tick_hardclock_periodic(tf, stick, tick_increment, adj); + } else { + intr_restore(s); + tick_process(tf); + } } static inline void -tick_hardclock_common(struct trapframe *tf, u_long tick, u_long adj) +tick_hardclock_periodic(struct trapframe *tf, u_long tick, + u_long tick_increment, u_long adj) { - u_long ref, tick_increment; + u_long ref; long delta; int count; - tick_increment = PCPU_GET(tickincrement); ref = PCPU_GET(tickref); delta = tick - ref; count = 0; @@ -297,8 +297,6 @@ tick_hardclock_common(struct trapframe * if (adj != 0) adjust_ticks++; count++; - if (tick_increment == 0) - break; } if (count > 0) { adjust_missed += count - 1; @@ -361,11 +359,10 @@ tick_get_timecount_mp(struct timecounter #endif static int -tick_et_start(struct eventtimer *et, - struct bintime *first, struct bintime *period) +tick_et_start(struct eventtimer *et, struct bintime *first, + struct bintime *period) { - u_long fdiv, div; - u_long base; + u_long base, div, fdiv; register_t s; if (period != NULL) { @@ -387,22 +384,21 @@ tick_et_start(struct eventtimer *et, * on all CPUs to avoid inaccuracies for migrating processes. Leave * out one tick to make sure that it is not missed. */ - critical_enter(); - PCPU_SET(tickadj, 0); s = intr_disable(); if (hardclock_use_stick != 0) base = rdstick(); else base = rd(tick); - if (div != 0) + if (div != 0) { + PCPU_SET(tickadj, 0); base = roundup(base, div); + } PCPU_SET(tickref, base); if (hardclock_use_stick != 0) wrstickcmpr(base + fdiv, 0); else wrtickcmpr(base + fdiv, 0); intr_restore(s); - critical_exit(); return (0); } From owner-svn-src-head@FreeBSD.ORG Sun Oct 17 17:31: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 AF1A0106564A; Sun, 17 Oct 2010 17:31:49 +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 9CA128FC12; Sun, 17 Oct 2010 17:31: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 o9HHVn0G039762; Sun, 17 Oct 2010 17:31:49 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9HHVnSE039760; Sun, 17 Oct 2010 17:31:49 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201010171731.o9HHVnSE039760@svn.freebsd.org> From: Nathan Whitehorn Date: Sun, 17 Oct 2010 17:31: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: r213986 - 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: Sun, 17 Oct 2010 17:31:49 -0000 Author: nwhitehorn Date: Sun Oct 17 17:31:49 2010 New Revision: 213986 URL: http://svn.freebsd.org/changeset/base/213986 Log: Fix an XXX comment by answering 'no'. OS X does not set the day-of-week counter on SMU-based systems, which causes FreeBSD to reject the RTC time when used in a dual-boot environment. Since we don't use the day-of-week counter anyway, solve this by just not checking that it matches. MFC after: 3 weeks Modified: head/sys/kern/subr_clock.c Modified: head/sys/kern/subr_clock.c ============================================================================== --- head/sys/kern/subr_clock.c Sun Oct 17 16:46:54 2010 (r213985) +++ head/sys/kern/subr_clock.c Sun Oct 17 17:31:49 2010 (r213986) @@ -164,10 +164,6 @@ clock_ct_to_ts(struct clocktime *ct, str days += days_in_month(year, i); days += (ct->day - 1); - /* XXX Dow sanity check. Dow is not used, so should we check it? */ - if (ct->dow != -1 && ct->dow != day_of_week(days)) - return (EINVAL); - /* Add hours, minutes, seconds. */ secs = ((days * 24 + ct->hour) * 60 + ct->min) * 60 + ct->sec; From owner-svn-src-head@FreeBSD.ORG Sun Oct 17 18:48: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 9F1D8106564A; Sun, 17 Oct 2010 18:48:51 +0000 (UTC) (envelope-from culot@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8CF988FC19; Sun, 17 Oct 2010 18:48: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 o9HImpxW042040; Sun, 17 Oct 2010 18:48:51 GMT (envelope-from culot@svn.freebsd.org) Received: (from culot@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9HImpQn042038; Sun, 17 Oct 2010 18:48:51 GMT (envelope-from culot@svn.freebsd.org) Message-Id: <201010171848.o9HImpQn042038@svn.freebsd.org> From: Frederic Culot Date: Sun, 17 Oct 2010 18:48: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: r213988 - 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: Sun, 17 Oct 2010 18:48:51 -0000 Author: culot (ports committer) Date: Sun Oct 17 18:48:51 2010 New Revision: 213988 URL: http://svn.freebsd.org/changeset/base/213988 Log: Add an entry for myself to committers-ports.dot. Approved by: sahil@ (mentor) Modified: head/share/misc/committers-ports.dot Modified: head/share/misc/committers-ports.dot ============================================================================== --- head/share/misc/committers-ports.dot Sun Oct 17 17:39:54 2010 (r213987) +++ head/share/misc/committers-ports.dot Sun Oct 17 18:48:51 2010 (r213988) @@ -66,6 +66,7 @@ chinsan [label="Chinsan Huang\nchinsan@F clement [label="Clement Laforet\nclement@FreeBSD.org\n2003/12/17"] clsung [label="Cheng-Lung Sung\nclsung@FreeBSD.org\n2004/8/18"] cperciva [label="Colin Percival\ncperciva@FreeBSD.org\n2006/01/31"] +culot [label="Frederic Culot\nculot@FreeBSD.org\n2010/10/16"] daichi [label="Daichi Goto\ndaichi@FreeBSD.org\n2002/10/17"] danfe [label="Alexey Dokuchaev\ndanfe@FreeBSD.org\n2004/08/20"] db [label="Diane Bruce\ndb@FreeBSD.org\n2007/01/18"] @@ -340,6 +341,8 @@ philip -> koitsu rafan -> chinsan +sahil -> culot + sat -> beech sem -> az @@ -373,6 +376,8 @@ thierry -> jadawin tmclaugh -> itetcu tmclaugh -> xride +wen -> culot + will -> lioux wxs -> jsa From owner-svn-src-head@FreeBSD.ORG Sun Oct 17 18:49: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 385F51065673; Sun, 17 Oct 2010 18:49:46 +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 0C2DC8FC14; Sun, 17 Oct 2010 18:49: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 o9HInjlI042105; Sun, 17 Oct 2010 18:49:45 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9HInjGA042104; Sun, 17 Oct 2010 18:49:45 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201010171849.o9HInjGA042104@svn.freebsd.org> From: Dimitry Andric Date: Sun, 17 Oct 2010 18:49: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: r213989 - head/contrib/binutils 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, 17 Oct 2010 18:49:46 -0000 Author: dim Date: Sun Oct 17 18:49:45 2010 New Revision: 213989 URL: http://svn.freebsd.org/changeset/base/213989 Log: Bootstrap merge history for binutils. Modified: Directory Properties: head/contrib/binutils/ (props changed) From owner-svn-src-head@FreeBSD.ORG Sun Oct 17 19:02: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 859151065673; Sun, 17 Oct 2010 19:02:42 +0000 (UTC) (envelope-from culot@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 732678FC1E; Sun, 17 Oct 2010 19:02: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 o9HJ2gTV042595; Sun, 17 Oct 2010 19:02:42 GMT (envelope-from culot@svn.freebsd.org) Received: (from culot@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9HJ2gjw042593; Sun, 17 Oct 2010 19:02:42 GMT (envelope-from culot@svn.freebsd.org) Message-Id: <201010171902.o9HJ2gjw042593@svn.freebsd.org> From: Frederic Culot Date: Sun, 17 Oct 2010 19:02: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: r213990 - head/usr.bin/calendar/calendars 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, 17 Oct 2010 19:02:42 -0000 Author: culot (ports committer) Date: Sun Oct 17 19:02:42 2010 New Revision: 213990 URL: http://svn.freebsd.org/changeset/base/213990 Log: Add myself to calendar.freebsd. Approved by: sahil@ (mentor) Modified: head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/usr.bin/calendar/calendars/calendar.freebsd ============================================================================== --- head/usr.bin/calendar/calendars/calendar.freebsd Sun Oct 17 18:49:45 2010 (r213989) +++ head/usr.bin/calendar/calendars/calendar.freebsd Sun Oct 17 19:02:42 2010 (r213990) @@ -302,6 +302,7 @@ 11/19 Konstantin Belousov born in Kiev, USSR, 1972 11/20 Dmitry Morozovsky born in Moscow, USSR, 1968 11/20 Gavin Atkinson born in Middlesbrough, United Kingdom, 1979 +11/22 Frederic Culot born in Saint-Germain-En-Laye, France, 1976 11/23 Josef Lawrence Karthauser born in Pembury, Kent, United Kingdom, 1972 11/24 Andrey Zakhvatov born in Chelyabinsk, Russian Federation, 1974 11/24 Daniel Gerzo born in Bratislava, Slovakia, 1986 From owner-svn-src-head@FreeBSD.ORG Sun Oct 17 20:01: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 A12D81065672; Sun, 17 Oct 2010 20:01:56 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8F8B58FC08; Sun, 17 Oct 2010 20:01: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 o9HK1usr044330; Sun, 17 Oct 2010 20:01:56 GMT (envelope-from scottl@svn.freebsd.org) Received: (from scottl@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9HK1ubZ044328; Sun, 17 Oct 2010 20:01:56 GMT (envelope-from scottl@svn.freebsd.org) Message-Id: <201010172001.o9HK1ubZ044328@svn.freebsd.org> From: Scott Long Date: Sun, 17 Oct 2010 20:01: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: r213993 - head/sys/modules/mps 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, 17 Oct 2010 20:01:56 -0000 Author: scottl Date: Sun Oct 17 20:01:56 2010 New Revision: 213993 URL: http://svn.freebsd.org/changeset/base/213993 Log: Re-add opt_mps.h and opt_cam.h, lost in the previous rev. Modified: head/sys/modules/mps/Makefile Modified: head/sys/modules/mps/Makefile ============================================================================== --- head/sys/modules/mps/Makefile Sun Oct 17 19:22:19 2010 (r213992) +++ head/sys/modules/mps/Makefile Sun Oct 17 20:01:56 2010 (r213993) @@ -4,7 +4,7 @@ KMOD= mps SRCS= mps_pci.c mps.c mps_sas.c mps_table.c mps_user.c -SRCS+= opt_compat.h +SRCS+= opt_mps.h opt_cam.h opt_compat.h SRCS+= device_if.h bus_if.h pci_if.h #CFLAGS += -DMPS_DEBUG From owner-svn-src-head@FreeBSD.ORG Mon Oct 18 03:34: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 18ABF1065673; Mon, 18 Oct 2010 03:34:34 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 073DC8FC13; Mon, 18 Oct 2010 03:34: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 o9I3YXoN064429; Mon, 18 Oct 2010 03:34:33 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9I3YXlg064427; Mon, 18 Oct 2010 03:34:33 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201010180334.o9I3YXlg064427@svn.freebsd.org> From: Kevin Lo Date: Mon, 18 Oct 2010 03:34: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: r214001 - head/sys/fs/msdosfs 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, 18 Oct 2010 03:34:34 -0000 Author: kevlo Date: Mon Oct 18 03:34:33 2010 New Revision: 214001 URL: http://svn.freebsd.org/changeset/base/214001 Log: Fix a possible race where the directory dirent is moved to the location that was used by ".." entry. This change seems fixed panic during attempt to access msdosfs data over nfs. Reviewed by: kib MFC after: 1 week Modified: head/sys/fs/msdosfs/msdosfs_lookup.c Modified: head/sys/fs/msdosfs/msdosfs_lookup.c ============================================================================== --- head/sys/fs/msdosfs/msdosfs_lookup.c Sun Oct 17 23:15:36 2010 (r214000) +++ head/sys/fs/msdosfs/msdosfs_lookup.c Mon Oct 18 03:34:33 2010 (r214001) @@ -594,10 +594,15 @@ msdosfs_deget_dotdot(struct vnode *vp, u vfs_unbusy(mp); if (error == 0) *rvp = DETOV(rdp); - vn_lock(vp, ltype | LK_RETRY); + if (*rvp != vp) + vn_lock(vp, ltype | LK_RETRY); if (vp->v_iflag & VI_DOOMED) { - if (error == 0) - vput(*rvp); + if (error == 0) { + if (*rvp == vp) + vunref(*rvp); + else + vput(*rvp); + } error = ENOENT; } return (error); From owner-svn-src-head@FreeBSD.ORG Mon Oct 18 03:59: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 F37CA106566B; Mon, 18 Oct 2010 03:59:55 +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 E1A758FC19; Mon, 18 Oct 2010 03:59: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 o9I3xto6068127; Mon, 18 Oct 2010 03:59:55 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9I3xt8Z068125; Mon, 18 Oct 2010 03:59:55 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <201010180359.o9I3xt8Z068125@svn.freebsd.org> From: Edwin Groothuis Date: Mon, 18 Oct 2010 03:59: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: r214002 - head/usr.bin/uudecode 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, 18 Oct 2010 03:59:56 -0000 Author: edwin Date: Mon Oct 18 03:59:55 2010 New Revision: 214002 URL: http://svn.freebsd.org/changeset/base/214002 Log: Stylify of uudecode(1) Part of PR bin/124739. PR: bin/124739 Submitted by: Mark Andrews Modified: head/usr.bin/uudecode/uudecode.c Modified: head/usr.bin/uudecode/uudecode.c ============================================================================== --- head/usr.bin/uudecode/uudecode.c Mon Oct 18 03:34:33 2010 (r214001) +++ head/usr.bin/uudecode/uudecode.c Mon Oct 18 03:59:55 2010 (r214002) @@ -87,7 +87,7 @@ main(int argc, char *argv[]) base64 = 1; while ((ch = getopt(argc, argv, "cimo:prs")) != -1) { - switch(ch) { + switch (ch) { case 'c': if (oflag || rflag) usage(); @@ -125,10 +125,10 @@ main(int argc, char *argv[]) usage(); } } - argc -= optind; - argv += optind; + argc -= optind; + argv += optind; - if (*argv) { + if (*argv != NULL) { rval = 0; do { infp = fopen(infile = *argv, "r"); @@ -184,7 +184,7 @@ decode2(void) void *handle; struct passwd *pw; struct stat st; - char buf[MAXPATHLEN+1]; + char buf[MAXPATHLEN + 1]; base64 = 0; /* search for header line */ @@ -259,7 +259,7 @@ decode2(void) if (pflag || strcmp(outfile, "/dev/stdout") == 0) outfp = stdout; else { - flags = O_WRONLY|O_CREAT|O_EXCL; + flags = O_WRONLY | O_CREAT | O_EXCL; if (lstat(outfile, &st) == 0) { if (iflag) { warnc(EEXIST, "%s: %s", infile, outfile); @@ -305,6 +305,7 @@ decode2(void) static int getline(char *buf, size_t size) { + if (fgets(buf, size, infp) != NULL) return (2); if (rflag) @@ -341,17 +342,19 @@ uu_decode(void) /* for each input line */ for (;;) { switch (getline(buf, sizeof(buf))) { - case 0: return (0); - case 1: return (1); + case 0: + return (0); + case 1: + return (1); } -#define DEC(c) (((c) - ' ') & 077) /* single character decode */ -#define IS_DEC(c) ( (((c) - ' ') >= 0) && (((c) - ' ') <= 077 + 1) ) +#define DEC(c) (((c) - ' ') & 077) /* single character decode */ +#define IS_DEC(c) ( (((c) - ' ') >= 0) && (((c) - ' ') <= 077 + 1) ) #define OUT_OF_RANGE do { \ warnx("%s: %s: character out of range: [%d-%d]", \ infile, outfile, 1 + ' ', 077 + ' ' + 1); \ - return (1); \ + return (1); \ } while (0) /* @@ -364,8 +367,8 @@ uu_decode(void) for (++p; i > 0; p += 4, i -= 3) if (i >= 3) { if (!(IS_DEC(*p) && IS_DEC(*(p + 1)) && - IS_DEC(*(p + 2)) && IS_DEC(*(p + 3)))) - OUT_OF_RANGE; + IS_DEC(*(p + 2)) && IS_DEC(*(p + 3)))) + OUT_OF_RANGE; ch = DEC(p[0]) << 2 | DEC(p[1]) >> 4; putc(ch, outfp); @@ -373,8 +376,7 @@ uu_decode(void) putc(ch, outfp); ch = DEC(p[2]) << 6 | DEC(p[3]); putc(ch, outfp); - } - else { + } else { if (i >= 1) { if (!(IS_DEC(*p) && IS_DEC(*(p + 1)))) OUT_OF_RANGE; @@ -383,25 +385,28 @@ uu_decode(void) } if (i >= 2) { if (!(IS_DEC(*(p + 1)) && - IS_DEC(*(p + 2)))) - OUT_OF_RANGE; + IS_DEC(*(p + 2)))) + OUT_OF_RANGE; ch = DEC(p[1]) << 4 | DEC(p[2]) >> 2; putc(ch, outfp); } if (i >= 3) { if (!(IS_DEC(*(p + 2)) && - IS_DEC(*(p + 3)))) - OUT_OF_RANGE; + IS_DEC(*(p + 3)))) + OUT_OF_RANGE; ch = DEC(p[2]) << 6 | DEC(p[3]); putc(ch, outfp); } } } switch (getline(buf, sizeof(buf))) { - case 0: return (0); - case 1: return (1); - default: return (checkend(buf, "end", "no \"end\" line")); + case 0: + return (0); + case 1: + return (1); + default: + return (checkend(buf, "end", "no \"end\" line")); } } @@ -409,7 +414,7 @@ static int base64_decode(void) { int n; - char inbuf[MAXPATHLEN+1]; + char inbuf[MAXPATHLEN + 1]; unsigned char outbuf[MAXPATHLEN * 4]; for (;;) { @@ -418,21 +423,22 @@ base64_decode(void) case 1: return (1); } n = b64_pton(inbuf, outbuf, sizeof(outbuf)); + if (n < 0) break; fwrite(outbuf, 1, n, outfp); } - return (checkend(inbuf, "====", - "error decoding base64 input stream")); + return (checkend(inbuf, "====", "error decoding base64 input stream")); } static void usage(void) { + (void)fprintf(stderr, -"usage: uudecode [-cimprs] [file ...]\n" -" uudecode [-i] -o output_file [file]\n" -" b64decode [-cimprs] [file ...]\n" -" b64decode [-i] -o output_file [file]\n"); + "usage: uudecode [-cimprs] [file ...]\n" + " uudecode [-i] -o output_file [file]\n" + " b64decode [-cimprs] [file ...]\n" + " b64decode [-i] -o output_file [file]\n"); exit(1); } From owner-svn-src-head@FreeBSD.ORG Mon Oct 18 04:26: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 54E16106564A; Mon, 18 Oct 2010 04:26:33 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 42FF48FC13; Mon, 18 Oct 2010 04:26: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 o9I4QXAC072471; Mon, 18 Oct 2010 04:26:33 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9I4QX4G072469; Mon, 18 Oct 2010 04:26:33 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201010180426.o9I4QX4G072469@svn.freebsd.org> From: Marcel Moolenaar Date: Mon, 18 Oct 2010 04:26: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: r214003 - head/sys/dev/md 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, 18 Oct 2010 04:26:33 -0000 Author: marcel Date: Mon Oct 18 04:26:32 2010 New Revision: 214003 URL: http://svn.freebsd.org/changeset/base/214003 Log: Allow the MDIOCATTACH ioctl operation to originate from within the kernel. To protect against malicious software, we demand that the file name is at a particular location (i.e. appended to the mdio structure) for it to be treated as in-kernel. Modified: head/sys/dev/md/md.c Modified: head/sys/dev/md/md.c ============================================================================== --- head/sys/dev/md/md.c Mon Oct 18 03:59:55 2010 (r214002) +++ head/sys/dev/md/md.c Mon Oct 18 04:26:32 2010 (r214003) @@ -909,18 +909,26 @@ mdcreate_vnode(struct md_s *sc, struct m { struct vattr vattr; struct nameidata nd; + char *fname; int error, flags, vfslocked; - error = copyinstr(mdio->md_file, sc->file, sizeof(sc->file), NULL); - if (error != 0) - return (error); - flags = FREAD|FWRITE; /* - * If the user specified that this is a read only device, unset the - * FWRITE mask before trying to open the backing store. + * Kernel-originated requests must have the filename appended + * to the mdio structure to protect against malicious software. + */ + fname = mdio->md_file; + if ((void *)fname != (void *)(mdio + 1)) { + error = copyinstr(fname, sc->file, sizeof(sc->file), NULL); + if (error != 0) + return (error); + } else + strlcpy(sc->file, fname, sizeof(sc->file)); + + /* + * If the user specified that this is a read only device, don't + * set the FWRITE mask before trying to open the backing store. */ - if ((mdio->md_options & MD_READONLY) != 0) - flags &= ~FWRITE; + flags = FREAD | ((mdio->md_options & MD_READONLY) ? 0 : FWRITE); NDINIT(&nd, LOOKUP, FOLLOW | MPSAFE, UIO_SYSSPACE, sc->file, td); error = vn_open(&nd, &flags, 0, NULL); if (error != 0) From owner-svn-src-head@FreeBSD.ORG Mon Oct 18 04:30: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 9D22B106566C; Mon, 18 Oct 2010 04:30:27 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 70CC88FC17; Mon, 18 Oct 2010 04:30: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 o9I4URau073102; Mon, 18 Oct 2010 04:30:27 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9I4URLe073099; Mon, 18 Oct 2010 04:30:27 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201010180430.o9I4URLe073099@svn.freebsd.org> From: Marcel Moolenaar Date: Mon, 18 Oct 2010 04:30: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: r214004 - in head/sys: kern 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: Mon, 18 Oct 2010 04:30:27 -0000 Author: marcel Date: Mon Oct 18 04:30:27 2010 New Revision: 214004 URL: http://svn.freebsd.org/changeset/base/214004 Log: Rename boot() to kern_reboot() and make it visible outside of kern_shutdown.c. This makes it easier for emulators and other parts of the kernel to initiate a reboot. Modified: head/sys/kern/kern_shutdown.c head/sys/sys/systm.h Modified: head/sys/kern/kern_shutdown.c ============================================================================== --- head/sys/kern/kern_shutdown.c Mon Oct 18 04:26:32 2010 (r214003) +++ head/sys/kern/kern_shutdown.c Mon Oct 18 04:30:27 2010 (r214004) @@ -133,7 +133,6 @@ static struct dumperinfo dumper; /* our static struct pcb dumppcb; /* Registers. */ static lwpid_t dumptid; /* Thread ID. */ -static void boot(int) __dead2; static void poweroff_wait(void *, int); static void shutdown_halt(void *junk, int howto); static void shutdown_panic(void *junk, int howto); @@ -173,7 +172,7 @@ reboot(struct thread *td, struct reboot_ error = priv_check(td, PRIV_REBOOT); if (error == 0) { mtx_lock(&Giant); - boot(uap->opt); + kern_reboot(uap->opt); mtx_unlock(&Giant); } return (error); @@ -197,7 +196,7 @@ shutdown_nice(int howto) PROC_UNLOCK(initproc); } else { /* No init(8) running, so simply reboot */ - boot(RB_NOSYNC); + kern_reboot(RB_NOSYNC); } return; } @@ -269,8 +268,8 @@ isbufbusy(struct buf *bp) /* * Shutdown the system cleanly to prepare for reboot, halt, or power off. */ -static void -boot(int howto) +void +kern_reboot(int howto) { static int first_buf_printf = 1; @@ -283,7 +282,7 @@ boot(int howto) thread_lock(curthread); sched_bind(curthread, 0); thread_unlock(curthread); - KASSERT(PCPU_GET(cpuid) == 0, ("boot: not running on cpu 0")); + KASSERT(PCPU_GET(cpuid) == 0, ("%s: not running on cpu 0", __func__)); #endif /* We're in the process of rebooting. */ rebooting = 1; @@ -589,7 +588,7 @@ panic(const char *fmt, ...) if (!sync_on_panic) bootopt |= RB_NOSYNC; critical_exit(); - boot(bootopt); + kern_reboot(bootopt); } /* Modified: head/sys/sys/systm.h ============================================================================== --- head/sys/sys/systm.h Mon Oct 18 04:26:32 2010 (r214003) +++ head/sys/sys/systm.h Mon Oct 18 04:30:27 2010 (r214004) @@ -46,7 +46,7 @@ #include /* for people using printf mainly */ extern int cold; /* nonzero if we are doing a cold boot */ -extern int rebooting; /* boot() has been called. */ +extern int rebooting; /* kern_reboot() has been called. */ extern const char *panicstr; /* panic message */ extern char version[]; /* system version */ extern char copyright[]; /* system copyright */ @@ -291,6 +291,7 @@ void cpu_initclocks_ap(void); void usrinfoinit(void); /* Finalize the world */ +void kern_reboot(int) __dead2; void shutdown_nice(int); /* Timeouts */ From owner-svn-src-head@FreeBSD.ORG Mon Oct 18 04:34: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 EED1A1065674; Mon, 18 Oct 2010 04:34:42 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DD6078FC08; Mon, 18 Oct 2010 04:34: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 o9I4YgZL073844; Mon, 18 Oct 2010 04:34:42 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9I4Yg04073842; Mon, 18 Oct 2010 04:34:42 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201010180434.o9I4Yg04073842@svn.freebsd.org> From: Marcel Moolenaar Date: Mon, 18 Oct 2010 04:34: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: r214005 - 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, 18 Oct 2010 04:34:43 -0000 Author: marcel Date: Mon Oct 18 04:34:42 2010 New Revision: 214005 URL: http://svn.freebsd.org/changeset/base/214005 Log: In vfs_filteropt(), only print the errmsg when there's no errmsg mount option. Otherwise errors tend to get printed multiple times. Modified: head/sys/kern/vfs_mount.c Modified: head/sys/kern/vfs_mount.c ============================================================================== --- head/sys/kern/vfs_mount.c Mon Oct 18 04:30:27 2010 (r214004) +++ head/sys/kern/vfs_mount.c Mon Oct 18 04:34:42 2010 (r214005) @@ -1424,15 +1424,17 @@ vfs_filteropt(struct vfsoptlist *opts, c continue; snprintf(errmsg, sizeof(errmsg), "mount option <%s> is unknown", p); - printf("%s\n", errmsg); ret = EINVAL; } if (ret != 0) { TAILQ_FOREACH(opt, opts, link) { if (strcmp(opt->name, "errmsg") == 0) { strncpy((char *)opt->value, errmsg, opt->len); + break; } } + if (opt == NULL) + printf("%s\n", errmsg); } return (ret); } From owner-svn-src-head@FreeBSD.ORG Mon Oct 18 05: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 B08E1106566C; Mon, 18 Oct 2010 05:01:53 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9DA238FC0C; Mon, 18 Oct 2010 05: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 o9I51rrJ078389; Mon, 18 Oct 2010 05:01:53 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9I51rfE078387; Mon, 18 Oct 2010 05:01:53 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201010180501.o9I51rfE078387@svn.freebsd.org> From: Marcel Moolenaar Date: Mon, 18 Oct 2010 05: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: r214006 - 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, 18 Oct 2010 05:01:53 -0000 Author: marcel Date: Mon Oct 18 05:01:53 2010 New Revision: 214006 URL: http://svn.freebsd.org/changeset/base/214006 Log: Re-implement the root mount logic using a recursive approach, whereby each root file system (starting with devfs and a synthesized configuration) can contain directives for mounting another file system as root. The old root file system is re-mounted under the new root file system (with /.mount or /mnt as the mount point) to allow access to the underlying file system. The configuration allows for creating vnode-backed memory disks that can subsequently be mounted as root. This allows for an efficient and low- cost way to distribute and boot FreeBSD software images that reside on some storage media. When trying a mount, the kernel will wait for the device in question to arrive. The timeout is configurable and is part of the configuration. This allows arbitrarily complex GEOM configurations to be constructed on the fly. A side-effect of this change is that all root specifications, whether compiled into the kernel or typed at the prompt can contain root mount options. Modified: head/sys/kern/vfs_mountroot.c Modified: head/sys/kern/vfs_mountroot.c ============================================================================== --- head/sys/kern/vfs_mountroot.c Mon Oct 18 04:34:42 2010 (r214005) +++ head/sys/kern/vfs_mountroot.c Mon Oct 18 05:01:53 2010 (r214006) @@ -1,4 +1,5 @@ /*- + * Copyright (c) 2010 Marcel Moolenaar * Copyright (c) 1999-2004 Poul-Henning Kamp * Copyright (c) 1999 Michael Smith * Copyright (c) 1989, 1993 @@ -34,6 +35,8 @@ * SUCH DAMAGE. */ +#include "opt_rootdevname.h" + #include __FBSDID("$FreeBSD$"); @@ -44,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -51,6 +55,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -58,25 +63,9 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include -#include - -#include "opt_rootdevname.h" - -#define ROOTNAME "root_device" - -static int vfs_mountroot_ask(void); -static int vfs_mountroot_try(const char *mountfrom, const char *options); - -/* - * The vnode of the system's root (/ in the filesystem, without chroot - * active.) - */ -struct vnode *rootvnode; - /* * The root filesystem is detailed in the kernel environment variable * vfs.root.mountfrom, which is expected to be in the general format @@ -96,21 +85,16 @@ struct vnode *rootvnode; * by nmount() in the kernel. */ +static int parse_mount(char **); +static struct mntarg *parse_mountroot_options(struct mntarg *, const char *); + /* - * The root specifiers we will try if RB_CDROM is specified. + * The vnode of the system's root (/ in the filesystem, without chroot + * active.) */ -static char *cdrom_rootdevnames[] = { - "cd9660:cd0", - "cd9660:acd0", - NULL -}; +struct vnode *rootvnode; -/* legacy find-root code */ -char *rootdevnames[2] = {NULL, NULL}; -#ifndef ROOTDEVNAME -# define ROOTDEVNAME NULL -#endif -static const char *ctrootdevname = ROOTDEVNAME; +char *rootdevnames[2] = {NULL, NULL}; struct root_hold_token { const char *who; @@ -120,8 +104,21 @@ struct root_hold_token { static LIST_HEAD(, root_hold_token) root_holds = LIST_HEAD_INITIALIZER(root_holds); +enum action { + A_CONTINUE, + A_PANIC, + A_REBOOT, + A_RETRY +}; + +static enum action root_mount_onfail = A_CONTINUE; + +static int root_mount_mddev; static int root_mount_complete; +/* By default wait up to 3 seconds for devices to appear. */ +static int root_mount_timeout = 3; + struct root_hold_token * root_mount_hold(const char *identifier) { @@ -151,52 +148,6 @@ root_mount_rel(struct root_hold_token *h free(h, M_DEVBUF); } -static void -root_mount_prepare(void) -{ - struct root_hold_token *h; - struct timeval lastfail; - int curfail = 0; - - for (;;) { - DROP_GIANT(); - g_waitidle(); - PICKUP_GIANT(); - mtx_lock(&mountlist_mtx); - if (LIST_EMPTY(&root_holds)) { - mtx_unlock(&mountlist_mtx); - break; - } - if (ppsratecheck(&lastfail, &curfail, 1)) { - printf("Root mount waiting for:"); - LIST_FOREACH(h, &root_holds, list) - printf(" %s", h->who); - printf("\n"); - } - msleep(&root_holds, &mountlist_mtx, PZERO | PDROP, "roothold", - hz); - } -} - -static void -root_mount_done(void) -{ - - /* Keep prison0's root in sync with the global rootvnode. */ - mtx_lock(&prison0.pr_mtx); - prison0.pr_root = rootvnode; - vref(prison0.pr_root); - mtx_unlock(&prison0.pr_mtx); - /* - * Use a mutex to prevent the wakeup being missed and waiting for - * an extra 1 second sleep. - */ - mtx_lock(&mountlist_mtx); - root_mount_complete = 1; - wakeup(&root_mount_complete); - mtx_unlock(&mountlist_mtx); -} - int root_mounted(void) { @@ -251,26 +202,27 @@ set_rootvnode(void) EVENTHANDLER_INVOKE(mountroot); } -static void -devfs_first(void) +static int +vfs_mountroot_devfs(struct thread *td, struct mount **mpp) { - struct thread *td = curthread; struct vfsoptlist *opts; struct vfsconf *vfsp; - struct mount *mp = NULL; + struct mount *mp; int error; + *mpp = NULL; + vfsp = vfs_byname("devfs"); KASSERT(vfsp != NULL, ("Could not find devfs by name")); if (vfsp == NULL) - return; + return (ENOENT); mp = vfs_mount_alloc(NULLVP, vfsp, "/dev", td->td_ucred); error = VFS_MOUNT(mp); KASSERT(error == 0, ("VFS_MOUNT(devfs) failed %d", error)); if (error) - return; + return (error); opts = malloc(sizeof(struct vfsoptlist), M_MOUNT, M_WAITOK); TAILQ_INIT(opts); @@ -280,170 +232,763 @@ devfs_first(void) TAILQ_INSERT_HEAD(&mountlist, mp, mnt_list); mtx_unlock(&mountlist_mtx); + *mpp = mp; set_rootvnode(); error = kern_symlink(td, "/", "dev", UIO_SYSSPACE); if (error) printf("kern_symlink /dev -> / returns %d\n", error); + + return (error); } -static void -devfs_fixup(struct thread *td) +static int +vfs_mountroot_shuffle(struct thread *td, struct mount *mpdevfs) { struct nameidata nd; - struct vnode *vp, *dvp; - struct mount *mp; + struct mount *mporoot, *mpnroot; + struct vnode *vp, *vporoot, *vpdevfs; + char *fspath; int error; - /* Remove our devfs mount from the mountlist and purge the cache */ + mpnroot = TAILQ_NEXT(mpdevfs, mnt_list); + + /* Shuffle the mountlist. */ mtx_lock(&mountlist_mtx); - mp = TAILQ_FIRST(&mountlist); - TAILQ_REMOVE(&mountlist, mp, mnt_list); + mporoot = TAILQ_FIRST(&mountlist); + TAILQ_REMOVE(&mountlist, mpdevfs, mnt_list); + if (mporoot != mpdevfs) { + TAILQ_REMOVE(&mountlist, mpnroot, mnt_list); + TAILQ_INSERT_HEAD(&mountlist, mpnroot, mnt_list); + } + TAILQ_INSERT_TAIL(&mountlist, mpdevfs, mnt_list); mtx_unlock(&mountlist_mtx); - cache_purgevfs(mp); - VFS_ROOT(mp, LK_EXCLUSIVE, &dvp); - VI_LOCK(dvp); - dvp->v_iflag &= ~VI_MOUNT; - VI_UNLOCK(dvp); - dvp->v_mountedhere = NULL; + cache_purgevfs(mporoot); + if (mporoot != mpdevfs) + cache_purgevfs(mpdevfs); + + VFS_ROOT(mporoot, LK_EXCLUSIVE, &vporoot); + + VI_LOCK(vporoot); + vporoot->v_iflag &= ~VI_MOUNT; + VI_UNLOCK(vporoot); + vporoot->v_mountedhere = NULL; + mporoot->mnt_flag &= ~MNT_ROOTFS; + mporoot->mnt_vnodecovered = NULL; + vput(vporoot); - /* Set up the real rootvnode, and purge the cache */ - TAILQ_FIRST(&mountlist)->mnt_vnodecovered = NULL; + /* Set up the new rootvnode, and purge the cache */ + mpnroot->mnt_vnodecovered = NULL; set_rootvnode(); cache_purgevfs(rootvnode->v_mount); + if (mporoot != mpdevfs) { + /* Remount old root under /.mount or /mnt */ + fspath = "/.mount"; + NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, + fspath, td); + error = namei(&nd); + if (error) { + NDFREE(&nd, NDF_ONLY_PNBUF); + fspath = "/mnt"; + NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, + fspath, td); + error = namei(&nd); + } + if (!error) { + vp = nd.ni_vp; + error = (vp->v_type == VDIR) ? 0 : ENOTDIR; + if (!error) + error = vinvalbuf(vp, V_SAVE, 0, 0); + if (!error) { + cache_purge(vp); + mporoot->mnt_vnodecovered = vp; + vp->v_mountedhere = mporoot; + strlcpy(mporoot->mnt_stat.f_mntonname, + fspath, MNAMELEN); + VOP_UNLOCK(vp, 0); + } else + vput(vp); + } + NDFREE(&nd, NDF_ONLY_PNBUF); + + if (error && bootverbose) + printf("mountroot: unable to remount previous root " + "under /.mount or /mnt (error %d).\n", error); + } + + /* Remount devfs under /dev */ NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, "/dev", td); error = namei(&nd); - if (error) { - printf("Lookup of /dev for devfs, error: %d\n", error); - vput(dvp); - vfs_unbusy(mp); - return; + if (!error) { + vp = nd.ni_vp; + error = (vp->v_type == VDIR) ? 0 : ENOTDIR; + if (!error) + error = vinvalbuf(vp, V_SAVE, 0, 0); + if (!error) { + vpdevfs = mpdevfs->mnt_vnodecovered; + if (vpdevfs != NULL) { + cache_purge(vpdevfs); + vpdevfs->v_mountedhere = NULL; + vrele(vpdevfs); + } + mpdevfs->mnt_vnodecovered = vp; + vp->v_mountedhere = mpdevfs; + VOP_UNLOCK(vp, 0); + } else + vput(vp); } + if (error && bootverbose) + printf("mountroot: unable to remount devfs under /dev " + "(error %d).\n", error); NDFREE(&nd, NDF_ONLY_PNBUF); - vp = nd.ni_vp; - if (vp->v_type != VDIR) { - printf("/dev is not a directory\n"); - vput(dvp); - vput(vp); - vfs_unbusy(mp); - return; + + if (mporoot == mpdevfs) { + vfs_unbusy(mpdevfs); + /* Unlink the no longer needed /dev/dev -> / symlink */ + error = kern_unlink(td, "/dev/dev", UIO_SYSSPACE); + if (error && bootverbose) + printf("mountroot: unable to unlink /dev/dev " + "(error %d)\n", error); } - error = vinvalbuf(vp, V_SAVE, 0, 0); - if (error) { - printf("vinvalbuf() of /dev failed, error: %d\n", error); - vput(dvp); - vput(vp); - vfs_unbusy(mp); - return; + + return (0); +} + +/* + * Configuration parser. + */ + +/* Parser character classes. */ +#define CC_WHITESPACE -1 +#define CC_NONWHITESPACE -2 + +/* Parse errors. */ +#define PE_EOF -1 +#define PE_EOL -2 + +static __inline int +parse_peek(char **conf) +{ + + return (**conf); +} + +static __inline void +parse_poke(char **conf, int c) +{ + + **conf = c; +} + +static __inline void +parse_advance(char **conf) +{ + + (*conf)++; +} + +static __inline int +parse_isspace(int c) +{ + + return ((c == ' ' || c == '\t' || c == '\n') ? 1 : 0); +} + +static int +parse_skipto(char **conf, int mc) +{ + int c, match; + + while (1) { + c = parse_peek(conf); + if (c == 0) + return (PE_EOF); + switch (mc) { + case CC_WHITESPACE: + match = (c == ' ' || c == '\t' || c == '\n') ? 1 : 0; + break; + case CC_NONWHITESPACE: + if (c == '\n') + return (PE_EOL); + match = (c != ' ' && c != '\t') ? 1 : 0; + break; + default: + match = (c == mc) ? 1 : 0; + break; + } + if (match) + break; + parse_advance(conf); } - cache_purge(vp); - mp->mnt_vnodecovered = vp; - vp->v_mountedhere = mp; - mtx_lock(&mountlist_mtx); - TAILQ_INSERT_TAIL(&mountlist, mp, mnt_list); - mtx_unlock(&mountlist_mtx); - VOP_UNLOCK(vp, 0); - vput(dvp); - vfs_unbusy(mp); + return (0); +} + +static int +parse_token(char **conf, char **tok) +{ + char *p; + size_t len; + int error; - /* Unlink the no longer needed /dev/dev -> / symlink */ - error = kern_unlink(td, "/dev/dev", UIO_SYSSPACE); + *tok = NULL; + error = parse_skipto(conf, CC_NONWHITESPACE); if (error) - printf("kern_unlink of /dev/dev failed, error: %d\n", error); + return (error); + p = *conf; + error = parse_skipto(conf, CC_WHITESPACE); + len = *conf - p; + *tok = malloc(len + 1, M_TEMP, M_WAITOK | M_ZERO); + bcopy(p, *tok, len); + return (0); } -void -vfs_mountroot(void) +static void +parse_dir_ask_printenv(const char *var) { - char *cp, *cpt, *options, *tmpdev; - int error, i, asked = 0; + char *val; - options = NULL; + val = getenv(var); + if (val != NULL) { + printf(" %s=%s\n", var, val); + freeenv(val); + } +} - root_mount_prepare(); +static int +parse_dir_ask(char **conf) +{ + char name[80]; + char *mnt; + int error; - devfs_first(); + printf("\nLoader variables:\n"); + parse_dir_ask_printenv("vfs.root.mountfrom"); + parse_dir_ask_printenv("vfs.root.mountfrom.options"); + + printf("\nManual root filesystem specification:\n"); + printf(" : [options]\n"); + printf(" Mount using filesystem \n"); + printf(" and with the specified (optional) option list.\n"); + printf("\n"); + printf(" eg. ufs:/dev/da0s1a\n"); + printf(" zfs:tank\n"); + printf(" cd9660:/dev/acd0 ro\n"); + printf(" (which is equivalent to: "); + printf("mount -t cd9660 -o ro /dev/acd0 /)\n"); + printf("\n"); + printf(" ? List valid disk boot devices\n"); + printf(" . Yield 1 second (for background tasks)\n"); + printf(" Abort manual input\n"); + + again: + printf("\nmountroot> "); + gets(name, sizeof(name), 1); + if (name[0] == '\0') + return (0); + if (name[0] == '?') { + printf("\nList of GEOM managed disk devices:\n "); + g_dev_print(); + goto again; + } + if (name[0] == '.') { + pause("rmask", hz); + goto again; + } + mnt = name; + error = parse_mount(&mnt); + if (error == -1) { + printf("Invalid specification.\n"); + goto again; + } + return (error); +} - /* - * We are booted with instructions to prompt for the root filesystem. - */ - if (boothowto & RB_ASKNAME) { - if (!vfs_mountroot_ask()) - goto mounted; - asked = 1; +static int +parse_dir_md(char **conf) +{ + struct stat sb; + struct thread *td; + struct md_ioctl *mdio; + char *path, *tok; + int error, fd, len; + + td = curthread; + + error = parse_token(conf, &tok); + if (error) + return (error); + + len = strlen(tok); + mdio = malloc(sizeof(*mdio) + len + 1, M_TEMP, M_WAITOK | M_ZERO); + path = (void *)(mdio + 1); + bcopy(tok, path, len); + free(tok, M_TEMP); + + /* Get file status. */ + error = kern_stat(td, path, UIO_SYSSPACE, &sb); + if (error) + goto out; + + /* Open /dev/mdctl so that we can attach/detach. */ + error = kern_open(td, "/dev/" MDCTL_NAME, UIO_SYSSPACE, O_RDWR, 0); + if (error) + goto out; + + fd = td->td_retval[0]; + mdio->md_version = MDIOVERSION; + mdio->md_type = MD_VNODE; + + if (root_mount_mddev != -1) { + mdio->md_unit = root_mount_mddev; + DROP_GIANT(); + error = kern_ioctl(td, fd, MDIOCDETACH, (void *)mdio); + PICKUP_GIANT(); + /* Ignore errors. We don't care. */ + root_mount_mddev = -1; } - options = getenv("vfs.root.mountfrom.options"); + mdio->md_file = (void *)(mdio + 1); + mdio->md_options = MD_AUTOUNIT | MD_READONLY; + mdio->md_mediasize = sb.st_size; + mdio->md_unit = 0; + DROP_GIANT(); + error = kern_ioctl(td, fd, MDIOCATTACH, (void *)mdio); + PICKUP_GIANT(); + if (error) + goto out; - /* - * The root filesystem information is compiled in, and we are - * booted with instructions to use it. - */ - if (ctrootdevname != NULL && (boothowto & RB_DFLTROOT)) { - if (!vfs_mountroot_try(ctrootdevname, options)) - goto mounted; - ctrootdevname = NULL; + if (mdio->md_unit > 9) { + printf("rootmount: too many md units\n"); + mdio->md_file = NULL; + mdio->md_options = 0; + mdio->md_mediasize = 0; + DROP_GIANT(); + error = kern_ioctl(td, fd, MDIOCDETACH, (void *)mdio); + PICKUP_GIANT(); + /* Ignore errors. We don't care. */ + error = ERANGE; + goto out; + } + + root_mount_mddev = mdio->md_unit; + printf(MD_NAME "%u attached to %s\n", root_mount_mddev, mdio->md_file); + + error = kern_close(td, fd); + + out: + free(mdio, M_TEMP); + return (error); +} + +static int +parse_dir_onfail(char **conf) +{ + char *action; + int error; + + error = parse_token(conf, &action); + if (error) + return (error); + + if (!strcmp(action, "continue")) + root_mount_onfail = A_CONTINUE; + else if (!strcmp(action, "panic")) + root_mount_onfail = A_PANIC; + else if (!strcmp(action, "reboot")) + root_mount_onfail = A_REBOOT; + else if (!strcmp(action, "retry")) + root_mount_onfail = A_RETRY; + else { + printf("rootmount: %s: unknown action\n", action); + error = EINVAL; + } + + free(action, M_TEMP); + return (0); +} + +static int +parse_dir_timeout(char **conf) +{ + char *tok, *endtok; + long secs; + int error; + + error = parse_token(conf, &tok); + if (error) + return (error); + + secs = strtol(tok, &endtok, 0); + error = (secs < 0 || *endtok != '\0') ? EINVAL : 0; + if (!error) + root_mount_timeout = secs; + free(tok, M_TEMP); + return (error); +} + +static int +parse_directive(char **conf) +{ + char *dir; + int error; + + error = parse_token(conf, &dir); + if (error) + return (error); + + if (strcmp(dir, ".ask") == 0) + error = parse_dir_ask(conf); + else if (strcmp(dir, ".md") == 0) + error = parse_dir_md(conf); + else if (strcmp(dir, ".onfail") == 0) + error = parse_dir_onfail(conf); + else if (strcmp(dir, ".timeout") == 0) + error = parse_dir_timeout(conf); + else { + printf("mountroot: invalid directive `%s'\n", dir); + /* Ignore the rest of the line. */ + (void)parse_skipto(conf, '\n'); + error = EINVAL; } + free(dir, M_TEMP); + return (error); +} + +static int +parse_mount_dev_present(const char *dev) +{ + struct nameidata nd; + int error; + + NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, dev, curthread); + error = namei(&nd); + if (!error) + vput(nd.ni_vp); + NDFREE(&nd, NDF_ONLY_PNBUF); + return (error != 0) ? 0 : 1; +} + +static int +parse_mount(char **conf) +{ + char errmsg[255]; + struct mntarg *ma; + char *dev, *fs, *opts, *tok; + int delay, error, timeout; + + error = parse_token(conf, &tok); + if (error) + return (error); + fs = tok; + error = parse_skipto(&tok, ':'); + if (error) { + free(fs, M_TEMP); + return (error); + } + parse_poke(&tok, '\0'); + parse_advance(&tok); + dev = tok; + + if (root_mount_mddev != -1) { + /* Handle substitution for the md unit number. */ + tok = strstr(dev, "md#"); + if (tok != NULL) + tok[2] = '0' + root_mount_mddev; + } + + /* Parse options. */ + error = parse_token(conf, &tok); + opts = (error == 0) ? tok : NULL; + + printf("Trying to mount root from %s:%s [%s]...\n", fs, dev, + (opts != NULL) ? opts : ""); + + bzero(errmsg, sizeof(errmsg)); + + if (vfs_byname(fs) == NULL) { + strlcpy(errmsg, "unknown file system", sizeof(errmsg)); + error = ENOENT; + goto out; + } + + if (dev[0] != '\0' && !parse_mount_dev_present(dev)) { + printf("mountroot: waiting for device %s ...\n", dev); + delay = hz / 10; + timeout = root_mount_timeout * hz; + do { + pause("rmdev", delay); + timeout -= delay; + } while (timeout > 0 && !parse_mount_dev_present(dev)); + if (timeout <= 0) { + error = ENODEV; + goto out; + } + } + + ma = NULL; + ma = mount_arg(ma, "fstype", fs, -1); + ma = mount_arg(ma, "fspath", "/", -1); + ma = mount_arg(ma, "from", dev, -1); + ma = mount_arg(ma, "errmsg", errmsg, sizeof(errmsg)); + ma = mount_arg(ma, "ro", NULL, 0); + ma = parse_mountroot_options(ma, opts); + error = kernel_mount(ma, MNT_ROOTFS); + + out: + if (error) { + printf("Mounting from %s:%s failed with error %d", + fs, dev, error); + if (errmsg[0] != '\0') + printf(": %s", errmsg); + printf(".\n"); + } + free(fs, M_TEMP); + if (opts != NULL) + free(opts, M_TEMP); + /* kernel_mount can return -1 on error. */ + return ((error < 0) ? EDOOFUS : error); +} + +static int +vfs_mountroot_parse(struct sbuf *sb, struct mount *mpdevfs) +{ + struct mount *mp; + char *conf; + int error; + + root_mount_mddev = -1; + +retry: + conf = sbuf_data(sb); + mp = TAILQ_NEXT(mpdevfs, mnt_list); + error = (mp == NULL) ? 0 : EDOOFUS; + root_mount_onfail = A_CONTINUE; + while (mp == NULL) { + error = parse_skipto(&conf, CC_NONWHITESPACE); + if (error == PE_EOL) { + parse_advance(&conf); + continue; + } + if (error < 0) + break; + switch (parse_peek(&conf)) { + case '#': + error = parse_skipto(&conf, '\n'); + break; + case '.': + error = parse_directive(&conf); + break; + default: + error = parse_mount(&conf); + break; + } + if (error < 0) + break; + /* Ignore any trailing garbage on the line. */ + if (parse_peek(&conf) != '\n') { + printf("mountroot: advancing to next directive...\n"); + (void)parse_skipto(&conf, '\n'); + } + mp = TAILQ_NEXT(mpdevfs, mnt_list); + } + if (mp != NULL) + return (0); /* - * We've been given the generic "use CDROM as root" flag. This is - * necessary because one media may be used in many different - * devices, so we need to search for them. + * We failed to mount (a new) root. */ + switch (root_mount_onfail) { + case A_CONTINUE: + break; + case A_PANIC: + panic("mountroot: unable to (re-)mount root."); + /* NOTREACHED */ + case A_RETRY: + goto retry; + case A_REBOOT: + kern_reboot(RB_NOSYNC); + /* NOTREACHED */ + } + + return (error); +} + +static void +vfs_mountroot_conf0(struct sbuf *sb) +{ + char *s, *tok, *mnt, *opt; + int error; + + sbuf_printf(sb, ".onfail panic\n"); + sbuf_printf(sb, ".timeout %d\n", root_mount_timeout); + if (boothowto & RB_ASKNAME) + sbuf_printf(sb, ".ask\n"); +#ifdef ROOTDEVNAME + if (boothowto & RB_DFLTROOT) + sbuf_printf(sb, "%s\n", ROOTDEVNAME); +#endif if (boothowto & RB_CDROM) { - for (i = 0; cdrom_rootdevnames[i] != NULL; i++) { - if (!vfs_mountroot_try(cdrom_rootdevnames[i], options)) - goto mounted; + sbuf_printf(sb, "cd9660:cd0\n"); + sbuf_printf(sb, ".timeout 0\n"); + sbuf_printf(sb, "cd9660:acd0\n"); + sbuf_printf(sb, ".timeout %d\n", root_mount_timeout); + } + s = getenv("vfs.root.mountfrom"); + if (s != NULL) { + opt = getenv("vfs.root.mountfrom.options"); + tok = s; + error = parse_token(&tok, &mnt); + while (!error) { + sbuf_printf(sb, "%s %s\n", mnt, + (opt != NULL) ? opt : ""); + free(mnt, M_TEMP); + error = parse_token(&tok, &mnt); } + if (opt != NULL) + freeenv(opt); + freeenv(s); } + if (rootdevnames[0] != NULL) + sbuf_printf(sb, "%s\n", rootdevnames[0]); + if (rootdevnames[1] != NULL) + sbuf_printf(sb, "%s\n", rootdevnames[1]); +#ifdef ROOTDEVNAME + if (!(boothowto & RB_DFLTROOT)) + sbuf_printf(sb, "%s\n", ROOTDEVNAME); +#endif + if (!(boothowto & RB_ASKNAME)) + sbuf_printf(sb, ".ask\n"); +} - /* - * Try to use the value read by the loader from /etc/fstab, or - * supplied via some other means. This is the preferred - * mechanism. - */ - cp = getenv("vfs.root.mountfrom"); - if (cp != NULL) { - cpt = cp; - while ((tmpdev = strsep(&cpt, " \t")) != NULL) { - error = vfs_mountroot_try(tmpdev, options); - if (error == 0) { - freeenv(cp); - goto mounted; +static int +vfs_mountroot_readconf(struct thread *td, struct sbuf *sb) +{ + static char buf[128]; + struct nameidata nd; + off_t ofs; + int error, flags; + int len, resid; + int vfslocked; + + NDINIT(&nd, LOOKUP, FOLLOW | MPSAFE, UIO_SYSSPACE, + "/.mount.conf", td); + flags = FREAD; + error = vn_open(&nd, &flags, 0, NULL); + if (error) + return (error); + + vfslocked = NDHASGIANT(&nd); + NDFREE(&nd, NDF_ONLY_PNBUF); + ofs = 0; + len = sizeof(buf) - 1; + while (1) { + error = vn_rdwr(UIO_READ, nd.ni_vp, buf, len, ofs, + UIO_SYSSPACE, IO_NODELOCKED, td->td_ucred, + NOCRED, &resid, td); + if (error) + break; + if (resid == len) + break; + buf[len - resid] = 0; + sbuf_printf(sb, "%s", buf); + ofs += len - resid; + } + + VOP_UNLOCK(nd.ni_vp, 0); + vn_close(nd.ni_vp, FREAD, td->td_ucred, td); + VFS_UNLOCK_GIANT(vfslocked); + return (error); +} + +static void +vfs_mountroot_wait(void) +{ + struct root_hold_token *h; + struct timeval lastfail; + int curfail; + + curfail = 0; + while (1) { + DROP_GIANT(); + g_waitidle(); + PICKUP_GIANT(); + mtx_lock(&mountlist_mtx); + if (LIST_EMPTY(&root_holds)) { + mtx_unlock(&mountlist_mtx); + break; + } + if (ppsratecheck(&lastfail, &curfail, 1)) { + printf("Root mount waiting for:"); + LIST_FOREACH(h, &root_holds, list) + printf(" %s", h->who); + printf("\n"); + } + msleep(&root_holds, &mountlist_mtx, PZERO | PDROP, "roothold", + hz); + } +} + +void +vfs_mountroot(void) +{ + struct mount *mp; + struct sbuf *sb; + struct thread *td; + time_t timebase; + int error; + + td = curthread; + + vfs_mountroot_wait(); + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Mon Oct 18 05:09: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 6557F106564A; Mon, 18 Oct 2010 05:09:23 +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 529C28FC1E; Mon, 18 Oct 2010 05:09: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 o9I59NbG079735; Mon, 18 Oct 2010 05:09:23 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9I59MQP079728; Mon, 18 Oct 2010 05:09:22 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201010180509.o9I59MQP079728@svn.freebsd.org> From: David Xu Date: Mon, 18 Oct 2010 05:09:22 +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: r214007 - in head: include lib/libthr 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, 18 Oct 2010 05:09:23 -0000 Author: davidxu Date: Mon Oct 18 05:09:22 2010 New Revision: 214007 URL: http://svn.freebsd.org/changeset/base/214007 Log: Add pthread_rwlockattr_setkind_np and pthread_rwlockattr_getkind_np, the functions set or get pthread_rwlock type, current supported types are: PTHREAD_RWLOCK_PREFER_READER_NP, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP, PTHREAD_RWLOCK_PREFER_WRITER_NP, default is PTHREAD_RWLOCK_PREFER_WRITER_NONCECURSIVE_NP, this maintains binary compatible with old code. Modified: head/include/pthread.h head/lib/libthr/pthread.map head/lib/libthr/thread/thr_private.h head/lib/libthr/thread/thr_rwlock.c head/lib/libthr/thread/thr_rwlockattr.c Modified: head/include/pthread.h ============================================================================== --- head/include/pthread.h Mon Oct 18 05:01:53 2010 (r214006) +++ head/include/pthread.h Mon Oct 18 05:09:22 2010 (r214007) @@ -135,6 +135,15 @@ enum pthread_mutextype { #define PTHREAD_MUTEX_DEFAULT PTHREAD_MUTEX_ERRORCHECK +enum pthread_rwlocktype_np +{ + PTHREAD_RWLOCK_PREFER_READER_NP, + PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP, + PTHREAD_RWLOCK_PREFER_WRITER_NP, + PTHREAD_RWLOCK_DEFAULT_NP = + PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP +}; + struct _pthread_cleanup_info { __uintptr_t pthread_cleanup_pad[8]; }; @@ -233,11 +242,14 @@ int pthread_rwlock_tryrdlock(pthread_rw int pthread_rwlock_trywrlock(pthread_rwlock_t *); int pthread_rwlock_unlock(pthread_rwlock_t *); int pthread_rwlock_wrlock(pthread_rwlock_t *); -int pthread_rwlockattr_init(pthread_rwlockattr_t *); +int pthread_rwlockattr_destroy(pthread_rwlockattr_t *); +int pthread_rwlockattr_getkind_np(const pthread_rwlockattr_t *, + int *); int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t *, int *); +int pthread_rwlockattr_init(pthread_rwlockattr_t *); +int pthread_rwlockattr_setkind_np(pthread_rwlockattr_t *, int); int pthread_rwlockattr_setpshared(pthread_rwlockattr_t *, int); -int pthread_rwlockattr_destroy(pthread_rwlockattr_t *); pthread_t pthread_self(void); int pthread_setspecific(pthread_key_t, const void *); Modified: head/lib/libthr/pthread.map ============================================================================== --- head/lib/libthr/pthread.map Mon Oct 18 05:01:53 2010 (r214006) +++ head/lib/libthr/pthread.map Mon Oct 18 05:09:22 2010 (r214007) @@ -318,7 +318,9 @@ FBSDprivate_1.0 { _pthread_rwlock_wrlock; _pthread_rwlockattr_destroy; _pthread_rwlockattr_getpshared; + _pthread_rwlockattr_getkind_np; _pthread_rwlockattr_init; + _pthread_rwlockattr_setkind_np; _pthread_rwlockattr_setpshared; _pthread_self; _pthread_set_name_np; @@ -403,4 +405,6 @@ FBSD_1.2 { openat; setcontext; swapcontext; + pthread_rwlockattr_getkind_np; + pthread_rwlockattr_setkind_np; }; Modified: head/lib/libthr/thread/thr_private.h ============================================================================== --- head/lib/libthr/thread/thr_private.h Mon Oct 18 05:01:53 2010 (r214006) +++ head/lib/libthr/thread/thr_private.h Mon Oct 18 05:09:22 2010 (r214007) @@ -285,11 +285,14 @@ struct pthread_prio { struct pthread_rwlockattr { int pshared; + int kind; }; struct pthread_rwlock { struct urwlock lock; struct pthread *owner; + int recurse; + int kind; }; /* Modified: head/lib/libthr/thread/thr_rwlock.c ============================================================================== --- head/lib/libthr/thread/thr_rwlock.c Mon Oct 18 05:01:53 2010 (r214006) +++ head/lib/libthr/thread/thr_rwlock.c Mon Oct 18 05:09:22 2010 (r214007) @@ -63,13 +63,19 @@ __weak_reference(_pthread_rwlock_timedwr */ static int -rwlock_init(pthread_rwlock_t *rwlock, const pthread_rwlockattr_t *attr __unused) +rwlock_init(pthread_rwlock_t *rwlock, const pthread_rwlockattr_t *attr) { pthread_rwlock_t prwlock; prwlock = (pthread_rwlock_t)calloc(1, sizeof(struct pthread_rwlock)); if (prwlock == NULL) return (ENOMEM); + if (attr != NULL) + prwlock->kind = (*attr)->kind; + else + prwlock->kind = PTHREAD_RWLOCK_DEFAULT_NP; + if (prwlock->kind == PTHREAD_RWLOCK_PREFER_READER_NP) + prwlock->lock.rw_flags |= URWLOCK_PREFER_READER; *rwlock = prwlock; return (0); } @@ -112,7 +118,7 @@ init_static(struct pthread *thread, pthr } int -_pthread_rwlock_init (pthread_rwlock_t *rwlock, const pthread_rwlockattr_t *attr) +_pthread_rwlock_init(pthread_rwlock_t *rwlock, const pthread_rwlockattr_t *attr) { *rwlock = NULL; return (rwlock_init(rwlock, attr)); @@ -260,6 +266,14 @@ rwlock_wrlock_common (pthread_rwlock_t * CHECK_AND_INIT_RWLOCK + if (__predict_false(prwlock->owner == curthread)) { + if (__predict_false( + prwlock->kind == PTHREAD_RWLOCK_PREFER_WRITER_NP)) { + prwlock->recurse++; + return (0); + } + } + /* * POSIX said the validity of the abstimeout parameter need * not be checked if the lock can be immediately acquired. @@ -335,6 +349,13 @@ _pthread_rwlock_unlock (pthread_rwlock_t if (state & URWLOCK_WRITE_OWNER) { if (__predict_false(prwlock->owner != curthread)) return (EPERM); + if (__predict_false( + prwlock->kind == PTHREAD_RWLOCK_PREFER_WRITER_NP)) { + if (prwlock->recurse > 0) { + prwlock->recurse--; + return (0); + } + } prwlock->owner = NULL; } Modified: head/lib/libthr/thread/thr_rwlockattr.c ============================================================================== --- head/lib/libthr/thread/thr_rwlockattr.c Mon Oct 18 05:01:53 2010 (r214006) +++ head/lib/libthr/thread/thr_rwlockattr.c Mon Oct 18 05:09:22 2010 (r214007) @@ -36,8 +36,10 @@ __weak_reference(_pthread_rwlockattr_destroy, pthread_rwlockattr_destroy); __weak_reference(_pthread_rwlockattr_getpshared, pthread_rwlockattr_getpshared); +__weak_reference(_pthread_rwlockattr_getkind_np, pthread_rwlockattr_getkind_np); __weak_reference(_pthread_rwlockattr_init, pthread_rwlockattr_init); __weak_reference(_pthread_rwlockattr_setpshared, pthread_rwlockattr_setpshared); +__weak_reference(_pthread_rwlockattr_setkind_np, pthread_rwlockattr_setkind_np); int _pthread_rwlockattr_destroy(pthread_rwlockattr_t *rwlockattr) @@ -98,3 +100,21 @@ _pthread_rwlockattr_setpshared(pthread_r return(0); } +int +_pthread_rwlockattr_setkind_np(pthread_rwlockattr_t *attr, int kind) +{ + if (kind != PTHREAD_RWLOCK_PREFER_READER_NP || + kind != PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP || + kind != PTHREAD_RWLOCK_PREFER_WRITER_NP) { + return (EINVAL); + } + (*attr)->kind = kind; + return (0); +} + +int +_pthread_rwlockattr_getkind_np(const pthread_rwlockattr_t *attr, int *kind) +{ + *kind = (*attr)->kind; + return (0); +} From owner-svn-src-head@FreeBSD.ORG Mon Oct 18 05:15: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 E75D0106564A; Mon, 18 Oct 2010 05:15:26 +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 D5E028FC12; Mon, 18 Oct 2010 05:15: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 o9I5FQ75080833; Mon, 18 Oct 2010 05:15:26 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9I5FQkV080831; Mon, 18 Oct 2010 05:15:26 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201010180515.o9I5FQkV080831@svn.freebsd.org> From: David Xu Date: Mon, 18 Oct 2010 05:15: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: r214008 - 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, 18 Oct 2010 05:15:27 -0000 Author: davidxu Date: Mon Oct 18 05:15:26 2010 New Revision: 214008 URL: http://svn.freebsd.org/changeset/base/214008 Log: s/||/&& Modified: head/lib/libthr/thread/thr_rwlockattr.c Modified: head/lib/libthr/thread/thr_rwlockattr.c ============================================================================== --- head/lib/libthr/thread/thr_rwlockattr.c Mon Oct 18 05:09:22 2010 (r214007) +++ head/lib/libthr/thread/thr_rwlockattr.c Mon Oct 18 05:15:26 2010 (r214008) @@ -103,8 +103,8 @@ _pthread_rwlockattr_setpshared(pthread_r int _pthread_rwlockattr_setkind_np(pthread_rwlockattr_t *attr, int kind) { - if (kind != PTHREAD_RWLOCK_PREFER_READER_NP || - kind != PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP || + if (kind != PTHREAD_RWLOCK_PREFER_READER_NP && + kind != PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP && kind != PTHREAD_RWLOCK_PREFER_WRITER_NP) { return (EINVAL); } From owner-svn-src-head@FreeBSD.ORG Mon Oct 18 05:16: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 1C240106566C; Mon, 18 Oct 2010 05:16: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 E4A6D8FC18; Mon, 18 Oct 2010 05:16: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 o9I5GiZT081092; Mon, 18 Oct 2010 05:16:44 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9I5GiAe081090; Mon, 18 Oct 2010 05:16:44 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201010180516.o9I5GiAe081090@svn.freebsd.org> From: David Xu Date: Mon, 18 Oct 2010 05:16: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: r214009 - head/lib/libthr 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, 18 Oct 2010 05:16:45 -0000 Author: davidxu Date: Mon Oct 18 05:16:44 2010 New Revision: 214009 URL: http://svn.freebsd.org/changeset/base/214009 Log: sort function name. Modified: head/lib/libthr/pthread.map Modified: head/lib/libthr/pthread.map ============================================================================== --- head/lib/libthr/pthread.map Mon Oct 18 05:15:26 2010 (r214008) +++ head/lib/libthr/pthread.map Mon Oct 18 05:16:44 2010 (r214009) @@ -403,8 +403,8 @@ FBSD_1.1 { FBSD_1.2 { openat; - setcontext; - swapcontext; pthread_rwlockattr_getkind_np; pthread_rwlockattr_setkind_np; + setcontext; + swapcontext; }; From owner-svn-src-head@FreeBSD.ORG Mon Oct 18 05:34: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 8DFCF106566B for ; Mon, 18 Oct 2010 05:34:43 +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 1BBD88FC21 for ; Mon, 18 Oct 2010 05:34:42 +0000 (UTC) Received: (qmail 14654 invoked by uid 399); 18 Oct 2010 05:34:41 -0000 Received: from localhost (HELO laptop.dougb.net) (dougb@dougbarton.us@127.0.0.1) by localhost with ESMTPAM; 18 Oct 2010 05:34:41 -0000 X-Originating-IP: 127.0.0.1 X-Sender: dougb@dougbarton.us Date: Sun, 17 Oct 2010 22:34:39 -0700 (PDT) From: Doug Barton To: David Xu In-Reply-To: <201010180515.o9I5FQkV080831@svn.freebsd.org> Message-ID: References: <201010180515.o9I5FQkV080831@svn.freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) X-message-flag: Outlook -- Not just for spreading viruses anymore! OpenPGP: id=1A1ABC84 Organization: http://SupersetSolutions.com/ 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: r214008 - 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, 18 Oct 2010 05:34:43 -0000 On Mon, 18 Oct 2010, David Xu wrote: > Author: davidxu > Date: Mon Oct 18 05:15:26 2010 > New Revision: 214008 > URL: http://svn.freebsd.org/changeset/base/214008 > > Log: > s/||/&& Since this came up in another context this evening ... We can see the "what" from the diff. I'm curious about the "why" for this change. Doug -- Improve the effectiveness of your Internet presence with a domain name makeover! http://SupersetSolutions.com/ Computers are useless. They can only give you answers. -- Pablo Picasso From owner-svn-src-head@FreeBSD.ORG Mon Oct 18 05:44: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 1FDBC10656A3; Mon, 18 Oct 2010 05:44:12 +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 0E0858FC14; Mon, 18 Oct 2010 05:44: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 o9I5iBtd085942; Mon, 18 Oct 2010 05:44:11 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9I5iBqi085940; Mon, 18 Oct 2010 05:44:11 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <201010180544.o9I5iBqi085940@svn.freebsd.org> From: Edwin Groothuis Date: Mon, 18 Oct 2010 05:44: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: r214010 - head/usr.bin/uudecode 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, 18 Oct 2010 05:44:12 -0000 Author: edwin Date: Mon Oct 18 05:44:11 2010 New Revision: 214010 URL: http://svn.freebsd.org/changeset/base/214010 Log: "b64decode -r" did not handle arbitary breaks in base64 encoded data. White space should be accepted anywhere in a base64 encoded stream, not just after every chunk (4 characters). Test-scenario: VmVsb2NpdHkgUmV3YXJkcw== and VmVsb2NpdHkgUmV3YXJkcw == should both produce "Velocity Rewards" PR: bin/124739 Submitted by: Mark Andrews MFC after: 2 weeks Modified: head/usr.bin/uudecode/uudecode.c Modified: head/usr.bin/uudecode/uudecode.c ============================================================================== --- head/usr.bin/uudecode/uudecode.c Mon Oct 18 05:16:44 2010 (r214009) +++ head/usr.bin/uudecode/uudecode.c Mon Oct 18 05:44:11 2010 (r214010) @@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -413,15 +414,40 @@ uu_decode(void) static int base64_decode(void) { - int n; - char inbuf[MAXPATHLEN + 1]; + int n, count, count4; + char inbuf[MAXPATHLEN + 1], *p; unsigned char outbuf[MAXPATHLEN * 4]; + char leftover[MAXPATHLEN + 1]; + leftover[0] = '\0'; for (;;) { - switch (getline(inbuf, sizeof(inbuf))) { - case 0: return (0); - case 1: return (1); + strcpy(inbuf, leftover); + switch (getline(inbuf + strlen(inbuf), + sizeof(inbuf) - strlen(inbuf))) { + case 0: + return (0); + case 1: + return (1); } + + count = 0; + count4 = -1; + p = inbuf; + while (*p != '\0') { + /* + * Base64 encoded strings have the following + * characters in them: A-Z, a-z, 0-9 and +, / and = + */ + if (isalnum(*p) || *p == '+' || *p == '/' || *p == '=') + count++; + if (count % 4 == 0) + count4 = p - inbuf; + p++; + } + + strcpy(leftover, inbuf + count4 + 1); + inbuf[count4 + 1] = 0; + n = b64_pton(inbuf, outbuf, sizeof(outbuf)); if (n < 0) From owner-svn-src-head@FreeBSD.ORG Mon Oct 18 06:02: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 8FF02106566B; Mon, 18 Oct 2010 06:02:52 +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 62BBB8FC15; Mon, 18 Oct 2010 06:02:52 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id o9I62oPS086215; Mon, 18 Oct 2010 06:02:51 GMT (envelope-from davidxu@freebsd.org) Message-ID: <4CBC538C.50508@freebsd.org> Date: Mon, 18 Oct 2010 14:02:52 +0000 From: David Xu User-Agent: Thunderbird 2.0.0.24 (X11/20100630) MIME-Version: 1.0 To: Doug Barton References: <201010180515.o9I5FQkV080831@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: r214008 - 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, 18 Oct 2010 06:02:52 -0000 Doug Barton wrote: > On Mon, 18 Oct 2010, David Xu wrote: > >> Author: davidxu >> Date: Mon Oct 18 05:15:26 2010 >> New Revision: 214008 >> URL: http://svn.freebsd.org/changeset/base/214008 >> >> Log: >> s/||/&& > > Since this came up in another context this evening ... > > We can see the "what" from the diff. I'm curious about the "why" for > this change. > > > Doug > This is for mysql which they think they can run better with the give feature, just like PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP. From owner-svn-src-head@FreeBSD.ORG Mon Oct 18 06:15: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 CD1E9106566C for ; Mon, 18 Oct 2010 06:15:45 +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 22BFC8FC1E for ; Mon, 18 Oct 2010 06:15:44 +0000 (UTC) Received: (qmail 485 invoked by uid 399); 18 Oct 2010 06:15:43 -0000 Received: from localhost (HELO laptop.dougb.net) (dougb@dougbarton.us@127.0.0.1) by localhost with ESMTPAM; 18 Oct 2010 06:15:43 -0000 X-Originating-IP: 127.0.0.1 X-Sender: dougb@dougbarton.us Date: Sun, 17 Oct 2010 23:15:41 -0700 (PDT) From: Doug Barton To: David Xu In-Reply-To: <4CBC538C.50508@freebsd.org> Message-ID: References: <201010180515.o9I5FQkV080831@svn.freebsd.org> <4CBC538C.50508@freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) X-message-flag: Outlook -- Not just for spreading viruses anymore! OpenPGP: id=1A1ABC84 Organization: http://SupersetSolutions.com/ 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: r214008 - 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, 18 Oct 2010 06:15:45 -0000 On Mon, 18 Oct 2010, David Xu wrote: > Doug Barton wrote: >> On Mon, 18 Oct 2010, David Xu wrote: >> >>> Author: davidxu >>> Date: Mon Oct 18 05:15:26 2010 >>> New Revision: 214008 >>> URL: http://svn.freebsd.org/changeset/base/214008 >>> >>> Log: >>> s/||/&& >> >> Since this came up in another context this evening ... >> >> We can see the "what" from the diff. I'm curious about the "why" for this >> change. >> >> >> Doug >> > This is for mysql which they think they can run better with the give feature, > just like PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP. Ok, thanks for the quick response. :) Doug -- Improve the effectiveness of your Internet presence with a domain name makeover! http://SupersetSolutions.com/ Computers are useless. They can only give you answers. -- Pablo Picasso From owner-svn-src-head@FreeBSD.ORG Mon Oct 18 07:28: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 27F801065672; Mon, 18 Oct 2010 07:28:54 +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 163ED8FC19; Mon, 18 Oct 2010 07:28: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 o9I7SrJM006171; Mon, 18 Oct 2010 07:28:53 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9I7Srxx006168; Mon, 18 Oct 2010 07:28:53 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201010180728.o9I7Srxx006168@svn.freebsd.org> From: Gleb Smirnoff Date: Mon, 18 Oct 2010 07:28: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: r214011 - head/usr.sbin/ppp 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, 18 Oct 2010 07:28:54 -0000 Author: glebius Date: Mon Oct 18 07:28:53 2010 New Revision: 214011 URL: http://svn.freebsd.org/changeset/base/214011 Log: Log if fopen() fails. Reviewed by: brian Modified: head/usr.sbin/ppp/ipcp.c Modified: head/usr.sbin/ppp/ipcp.c ============================================================================== --- head/usr.sbin/ppp/ipcp.c Mon Oct 18 05:44:11 2010 (r214010) +++ head/usr.sbin/ppp/ipcp.c Mon Oct 18 07:28:53 2010 (r214011) @@ -319,8 +319,11 @@ ipcp_WriteDNS(struct ipcp *ipcp) strerror(errno)); return 0; } - } else + } else { umask(mask); + log_Printf(LogERROR,"fopen(\"%s\", \"w\") failed: %s\n", _PATH_RESCONF, + strerror(errno)); + } return 1; } From owner-svn-src-head@FreeBSD.ORG Mon Oct 18 08: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 291571065673; Mon, 18 Oct 2010 08:34:53 +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 06F138FC1F; Mon, 18 Oct 2010 08:34:51 +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 o9I8YmUa038226 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 18 Oct 2010 11:34:48 +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 o9I8YmRC046865; Mon, 18 Oct 2010 11:34:48 +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 o9I8Ym8u046864; Mon, 18 Oct 2010 11:34:48 +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: Mon, 18 Oct 2010 11:34:48 +0300 From: Kostik Belousov To: Kevin Lo Message-ID: <20101018083448.GB2392@deviant.kiev.zoral.com.ua> References: <201010180334.o9I3YXlg064427@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="dw6fAZ2Gq7hkCwZ4" Content-Disposition: inline In-Reply-To: <201010180334.o9I3YXlg064427@svn.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 Subject: Re: svn commit: r214001 - head/sys/fs/msdosfs 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, 18 Oct 2010 08:34:53 -0000 --dw6fAZ2Gq7hkCwZ4 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Oct 18, 2010 at 03:34:33AM +0000, Kevin Lo wrote: > Author: kevlo > Date: Mon Oct 18 03:34:33 2010 > New Revision: 214001 > URL: http://svn.freebsd.org/changeset/base/214001 >=20 > Log: > Fix a possible race where the directory dirent is moved to the location > that was used by ".." entry. As I said, possible, but very unlikely. > This change seems fixed panic during attempt to access msdosfs data > over nfs. We are looking at the actual cause of the panic at the moment. The change itself covers the consequences of the actual bug or possibly filesystem corruption. --dw6fAZ2Gq7hkCwZ4 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAky8BqcACgkQC3+MBN1Mb4ia0ACgtmYQlyJtMTRBwb7TA65etOJE X3QAoMFtCnB7xt6w1pC0nbwkJEfvVfPo =tQ2U -----END PGP SIGNATURE----- --dw6fAZ2Gq7hkCwZ4-- From owner-svn-src-head@FreeBSD.ORG Mon Oct 18 08:36: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 47285106566B; Mon, 18 Oct 2010 08:36:04 +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 3541D8FC14; Mon, 18 Oct 2010 08:36: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 o9I8a4l2027926; Mon, 18 Oct 2010 08:36:04 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9I8a4ZR027924; Mon, 18 Oct 2010 08:36:04 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201010180836.o9I8a4ZR027924@svn.freebsd.org> From: Marius Strobl Date: Mon, 18 Oct 2010 08:36: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: r214012 - 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: Mon, 18 Oct 2010 08:36:04 -0000 Author: marius Date: Mon Oct 18 08:36:03 2010 New Revision: 214012 URL: http://svn.freebsd.org/changeset/base/214012 Log: Revert r213867; while this driver really doesn't use any of the generic subroutines, at least mii_capabilities is used within itself. Modified: head/sys/dev/mii/brgphy.c Modified: head/sys/dev/mii/brgphy.c ============================================================================== --- head/sys/dev/mii/brgphy.c Mon Oct 18 07:28:53 2010 (r214011) +++ head/sys/dev/mii/brgphy.c Mon Oct 18 08:36:03 2010 (r214012) @@ -280,6 +280,10 @@ brgphy_attach(device_t dev) brgphy_reset(sc); + /* Read the PHY's capabilities. */ + sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; + if (sc->mii_capabilities & BMSR_EXTSTAT) + sc->mii_extcapabilities = PHY_READ(sc, MII_EXTSR); device_printf(dev, " "); #define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL) From owner-svn-src-head@FreeBSD.ORG Mon Oct 18 09:44: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 BEE71106566B; Mon, 18 Oct 2010 09:44:21 +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 ACF348FC1B; Mon, 18 Oct 2010 09:44: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 o9I9iLGH063517; Mon, 18 Oct 2010 09:44:21 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9I9iLQD063513; Mon, 18 Oct 2010 09:44:21 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201010180944.o9I9iLQD063513@svn.freebsd.org> From: David Xu Date: Mon, 18 Oct 2010 09:44: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: r214015 - head/lib/libc/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, 18 Oct 2010 09:44:21 -0000 Author: davidxu Date: Mon Oct 18 09:44:21 2010 New Revision: 214015 URL: http://svn.freebsd.org/changeset/base/214015 Log: Unbreak buildworld by including pthread_rwlockattr_setkind_np and pthread_rwlockattr_getkind_np. Modified: head/lib/libc/include/namespace.h head/lib/libc/include/un-namespace.h Modified: head/lib/libc/include/namespace.h ============================================================================== --- head/lib/libc/include/namespace.h Mon Oct 18 09:26:39 2010 (r214014) +++ head/lib/libc/include/namespace.h Mon Oct 18 09:44:21 2010 (r214015) @@ -177,8 +177,10 @@ #define pthread_rwlock_unlock _pthread_rwlock_unlock #define pthread_rwlock_wrlock _pthread_rwlock_wrlock #define pthread_rwlockattr_destroy _pthread_rwlockattr_destroy +#define pthread_rwlockattr_getkind_np _pthread_rwlockattr_getkind_np #define pthread_rwlockattr_getpshared _pthread_rwlockattr_getpshared #define pthread_rwlockattr_init _pthread_rwlockattr_init +#define pthread_rwlockattr_setkind_np _pthread_rwlockattr_setkind_np #define pthread_rwlockattr_setpshared _pthread_rwlockattr_setpshared #define pthread_self _pthread_self #define pthread_set_name_np _pthread_set_name_np Modified: head/lib/libc/include/un-namespace.h ============================================================================== --- head/lib/libc/include/un-namespace.h Mon Oct 18 09:26:39 2010 (r214014) +++ head/lib/libc/include/un-namespace.h Mon Oct 18 09:44:21 2010 (r214015) @@ -158,8 +158,10 @@ #undef pthread_rwlock_unlock #undef pthread_rwlock_wrlock #undef pthread_rwlockattr_destroy +#undef pthread_rwlockattr_getkind_np #undef pthread_rwlockattr_getpshared #undef pthread_rwlockattr_init +#undef pthread_rwlockattr_setkind_np #undef pthread_rwlockattr_setpshared #undef pthread_self #undef pthread_set_name_np From owner-svn-src-head@FreeBSD.ORG Mon Oct 18 11:30: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 19DC51065672; Mon, 18 Oct 2010 11:30:14 +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 06DF58FC14; Mon, 18 Oct 2010 11:30: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 o9IBUEqm070216; Mon, 18 Oct 2010 11:30:14 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9IBUDep070203; Mon, 18 Oct 2010 11:30:13 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201010181130.o9IBUDep070203@svn.freebsd.org> From: Alexander Motin Date: Mon, 18 Oct 2010 11:30: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: r214016 - in head/sys: arm/mv dev/ata dev/ata/chipsets 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, 18 Oct 2010 11:30:14 -0000 Author: mav Date: Mon Oct 18 11:30:13 2010 New Revision: 214016 URL: http://svn.freebsd.org/changeset/base/214016 Log: Set of legacy mode SATA enchancements: - Implement proper combined mode decoding for Intel controllers to properly identify SATA and PATA channels and associate ATA channels with SATA ports. This fixes wrong reporting and in some cases hard resets to wrong SATA ports. - Improve SATA registers support to handle hot-plug events and potentially interface errors. For ICH5/6300ESB chipsets these registers accessible via PCI config space. For later ones they may be accessible via PCI BAR(5). - For controllers not generating interrupts on hot-plug events, implement periodic status polling. Use it to detect hot-plug on Intel and VIA controllers. Same probably could also be used for Serverworks and SIS. Modified: head/sys/arm/mv/mv_sata.c head/sys/dev/ata/ata-all.c head/sys/dev/ata/ata-all.h head/sys/dev/ata/ata-pci.c head/sys/dev/ata/ata-sata.c head/sys/dev/ata/chipsets/ata-ahci.c head/sys/dev/ata/chipsets/ata-intel.c head/sys/dev/ata/chipsets/ata-marvell.c head/sys/dev/ata/chipsets/ata-nvidia.c head/sys/dev/ata/chipsets/ata-promise.c head/sys/dev/ata/chipsets/ata-siliconimage.c head/sys/dev/ata/chipsets/ata-via.c Modified: head/sys/arm/mv/mv_sata.c ============================================================================== --- head/sys/arm/mv/mv_sata.c Mon Oct 18 09:44:21 2010 (r214015) +++ head/sys/arm/mv/mv_sata.c Mon Oct 18 11:30:13 2010 (r214016) @@ -710,7 +710,7 @@ sata_channel_status(device_t dev) if ((icr & SATA_ICR_DEV(ch->unit)) || iecr) { /* Disable EDMA before accessing SATA registers */ sata_edma_ctrl(dev, 0); - ata_sata_phy_check_events(dev); + ata_sata_phy_check_events(dev, -1); /* Ack device and error interrupt */ SATA_OUTL(sc, SATA_ICR, ~SATA_ICR_DEV(ch->unit)); Modified: head/sys/dev/ata/ata-all.c ============================================================================== --- head/sys/dev/ata/ata-all.c Mon Oct 18 09:44:21 2010 (r214015) +++ head/sys/dev/ata/ata-all.c Mon Oct 18 11:30:13 2010 (r214016) @@ -83,6 +83,7 @@ static void bswap(int8_t *, int); static void btrim(int8_t *, int); static void bpack(int8_t *, int8_t *, int); static void ata_interrupt_locked(void *data); +static void ata_periodic_poll(void *data); /* global vars */ MALLOC_DEFINE(M_ATA, "ata_generic", "ATA driver generic layer"); @@ -173,6 +174,7 @@ ata_attach(device_t dev) ch->curr[i] = ch->user[i]; } #endif + callout_init(&ch->poll_callout, 1); /* reset the controller HW, the channel and device(s) */ while (ATA_LOCKING(dev, ATA_LF_LOCK) != ch->unit) @@ -200,6 +202,8 @@ ata_attach(device_t dev) device_printf(dev, "unable to setup interrupt\n"); return error; } + if (ch->flags & ATA_PERIODIC_POLL) + callout_reset(&ch->poll_callout, hz, ata_periodic_poll, ch); #ifndef ATA_CAM /* probe and attach devices on this channel unless we are in early boot */ @@ -246,6 +250,8 @@ err2: err1: bus_release_resource(dev, SYS_RES_IRQ, rid, ch->r_irq); mtx_unlock(&ch->state_mtx); + if (ch->flags & ATA_PERIODIC_POLL) + callout_drain(&ch->poll_callout); return (error); #endif } @@ -267,6 +273,8 @@ ata_detach(device_t dev) mtx_lock(&ch->state_mtx); ch->state |= ATA_STALL_QUEUE; mtx_unlock(&ch->state_mtx); + if (ch->flags & ATA_PERIODIC_POLL) + callout_drain(&ch->poll_callout); #ifndef ATA_CAM /* detach & delete all children */ @@ -454,6 +462,8 @@ ata_suspend(device_t dev) if (!dev || !(ch = device_get_softc(dev))) return ENXIO; + if (ch->flags & ATA_PERIODIC_POLL) + callout_drain(&ch->poll_callout); #ifdef ATA_CAM mtx_lock(&ch->state_mtx); xpt_freeze_simq(ch->sim, 1); @@ -498,6 +508,8 @@ ata_resume(device_t dev) /* kick off requests on the queue */ ata_start(dev); #endif + if (ch->flags & ATA_PERIODIC_POLL) + callout_reset(&ch->poll_callout, hz, ata_periodic_poll, ch); return error; } @@ -564,6 +576,15 @@ ata_interrupt_locked(void *data) #endif } +static void +ata_periodic_poll(void *data) +{ + struct ata_channel *ch = (struct ata_channel *)data; + + callout_reset(&ch->poll_callout, hz, ata_periodic_poll, ch); + ata_interrupt(ch); +} + void ata_print_cable(device_t dev, u_int8_t *who) { Modified: head/sys/dev/ata/ata-all.h ============================================================================== --- head/sys/dev/ata/ata-all.h Mon Oct 18 09:44:21 2010 (r214015) +++ head/sys/dev/ata/ata-all.h Mon Oct 18 11:30:13 2010 (r214016) @@ -114,13 +114,6 @@ #define ATA_SS_IPM_PARTIAL 0x00000200 #define ATA_SS_IPM_SLUMBER 0x00000600 -#define ATA_SS_CONWELL_MASK \ - (ATA_SS_DET_MASK|ATA_SS_SPD_MASK|ATA_SS_IPM_MASK) -#define ATA_SS_CONWELL_GEN1 \ - (ATA_SS_DET_PHY_ONLINE|ATA_SS_SPD_GEN1|ATA_SS_IPM_ACTIVE) -#define ATA_SS_CONWELL_GEN2 \ - (ATA_SS_DET_PHY_ONLINE|ATA_SS_SPD_GEN2|ATA_SS_IPM_ACTIVE) - #define ATA_SERROR 14 #define ATA_SE_DATA_CORRECTED 0x00000001 #define ATA_SE_COMM_CORRECTED 0x00000002 @@ -567,6 +560,7 @@ struct ata_channel { #define ATA_DMA_BEFORE_CMD 0x100 #define ATA_KNOWN_PRESENCE 0x200 #define ATA_STATUS_IS_LONG 0x400 +#define ATA_PERIODIC_POLL 0x800 int pm_level; /* power management level */ int devices; /* what is present */ @@ -593,6 +587,7 @@ struct ata_channel { struct ata_cam_device user[16]; /* User-specified settings */ struct ata_cam_device curr[16]; /* Current settings */ #endif + struct callout poll_callout; /* Periodic status poll. */ }; /* disk bay/enclosure related */ @@ -666,7 +661,7 @@ void ata_dmainit(device_t); void ata_dmafini(device_t dev); /* ata-sata.c: */ -void ata_sata_phy_check_events(device_t dev); +void ata_sata_phy_check_events(device_t dev, int port); int ata_sata_scr_read(struct ata_channel *ch, int port, int reg, uint32_t *val); int ata_sata_scr_write(struct ata_channel *ch, int port, int reg, uint32_t val); int ata_sata_phy_reset(device_t dev, int port, int quick); Modified: head/sys/dev/ata/ata-pci.c ============================================================================== --- head/sys/dev/ata/ata-pci.c Mon Oct 18 09:44:21 2010 (r214015) +++ head/sys/dev/ata/ata-pci.c Mon Oct 18 11:30:13 2010 (r214016) @@ -615,6 +615,7 @@ ata_pcichannel_attach(device_t dev) return (0); ch->attached = 1; + ch->dev = dev; ch->unit = (intptr_t)device_get_ivars(dev); resource_int_value(device_get_name(dev), Modified: head/sys/dev/ata/ata-sata.c ============================================================================== --- head/sys/dev/ata/ata-sata.c Mon Oct 18 09:44:21 2010 (r214015) +++ head/sys/dev/ata/ata-sata.c Mon Oct 18 11:30:13 2010 (r214016) @@ -48,20 +48,23 @@ __FBSDID("$FreeBSD$"); #include void -ata_sata_phy_check_events(device_t dev) +ata_sata_phy_check_events(device_t dev, int port) { struct ata_channel *ch = device_get_softc(dev); - u_int32_t error = ATA_IDX_INL(ch, ATA_SERROR); + u_int32_t error, status; - /* clear error bits/interrupt */ - ATA_IDX_OUTL(ch, ATA_SERROR, error); + ata_sata_scr_read(ch, port, ATA_SERROR, &error); + /* Clear set error bits/interrupt. */ + if (error) + ata_sata_scr_write(ch, port, ATA_SERROR, error); /* if we have a connection event deal with it */ if ((error & ATA_SE_PHY_CHANGED) && (ch->pm_level == 0)) { if (bootverbose) { - u_int32_t status = ATA_IDX_INL(ch, ATA_SSTATUS); - if (((status & ATA_SS_CONWELL_MASK) == ATA_SS_CONWELL_GEN1) || - ((status & ATA_SS_CONWELL_MASK) == ATA_SS_CONWELL_GEN2)) { + ata_sata_scr_read(ch, port, ATA_SSTATUS, &status); + if (((status & ATA_SS_DET_MASK) == ATA_SS_DET_PHY_ONLINE) && + ((status & ATA_SS_SPD_MASK) != ATA_SS_SPD_NO_SPEED) && + ((status & ATA_SS_IPM_MASK) == ATA_SS_IPM_ACTIVE)) { device_printf(dev, "CONNECT requested\n"); } else device_printf(dev, "DISCONNECT requested\n"); @@ -73,69 +76,51 @@ ata_sata_phy_check_events(device_t dev) int ata_sata_scr_read(struct ata_channel *ch, int port, int reg, uint32_t *val) { - int r; - if (port < 0) { + if (ch->hw.pm_read != NULL) + return (ch->hw.pm_read(ch->dev, port, reg, val)); + if (ch->r_io[reg].res) { *val = ATA_IDX_INL(ch, reg); return (0); - } else { - switch (reg) { - case ATA_SSTATUS: - r = 0; - break; - case ATA_SERROR: - r = 1; - break; - case ATA_SCONTROL: - r = 2; - break; - default: - return (EINVAL); - } - return (ch->hw.pm_read(ch->dev, port, r, val)); } + return (-1); } int ata_sata_scr_write(struct ata_channel *ch, int port, int reg, uint32_t val) { - int r; - if (port < 0) { + if (ch->hw.pm_write != NULL) + return (ch->hw.pm_write(ch->dev, port, reg, val)); + if (ch->r_io[reg].res) { ATA_IDX_OUTL(ch, reg, val); return (0); - } else { - switch (reg) { - case ATA_SERROR: - r = 1; - break; - case ATA_SCONTROL: - r = 2; - break; - default: - return (EINVAL); - } - return (ch->hw.pm_write(ch->dev, port, r, val)); } + return (-1); } static int -ata_sata_connect(struct ata_channel *ch, int port) +ata_sata_connect(struct ata_channel *ch, int port, int quick) { u_int32_t status; - int timeout; + int timeout, t; /* wait up to 1 second for "connect well" */ - for (timeout = 0; timeout < 100 ; timeout++) { + timeout = (quick == 2) ? 0 : 100; + t = 0; + while (1) { if (ata_sata_scr_read(ch, port, ATA_SSTATUS, &status)) return (0); - if ((status & ATA_SS_CONWELL_MASK) == ATA_SS_CONWELL_GEN1 || - (status & ATA_SS_CONWELL_MASK) == ATA_SS_CONWELL_GEN2) + if (((status & ATA_SS_DET_MASK) == ATA_SS_DET_PHY_ONLINE) && + ((status & ATA_SS_SPD_MASK) != ATA_SS_SPD_NO_SPEED) && + ((status & ATA_SS_IPM_MASK) == ATA_SS_IPM_ACTIVE)) + break; + if (++t > timeout) break; ata_udelay(10000); } - if (timeout >= 100) { - if (bootverbose) { + if (bootverbose) { + if (t > timeout) { if (port < 0) { device_printf(ch->dev, "SATA connect timeout status=%08x\n", status); @@ -143,23 +128,19 @@ ata_sata_connect(struct ata_channel *ch, device_printf(ch->dev, "p%d: SATA connect timeout status=%08x\n", port, status); } - } - return 0; - } - if (bootverbose) { - if (port < 0) { + } else if (port < 0) { device_printf(ch->dev, "SATA connect time=%dms status=%08x\n", - timeout * 10, status); + t * 10, status); } else { device_printf(ch->dev, "p%d: SATA connect time=%dms status=%08x\n", - port, timeout * 10, status); + port, t * 10, status); } } /* clear SATA error register */ ata_sata_scr_write(ch, port, ATA_SERROR, 0xffffffff); - return 1; + return ((t > timeout) ? 0 : 1); } int @@ -173,7 +154,7 @@ ata_sata_phy_reset(device_t dev, int por if (ata_sata_scr_read(ch, port, ATA_SCONTROL, &val)) return (0); if ((val & ATA_SC_DET_MASK) == ATA_SC_DET_IDLE) - return ata_sata_connect(ch, port); + return ata_sata_connect(ch, port, quick); } if (bootverbose) { @@ -203,7 +184,7 @@ ata_sata_phy_reset(device_t dev, int por if (ata_sata_scr_read(ch, port, ATA_SCONTROL, &val)) return (0); if ((val & ATA_SC_DET_MASK) == 0) - return ata_sata_connect(ch, port); + return ata_sata_connect(ch, port, 0); } } return 0; Modified: head/sys/dev/ata/chipsets/ata-ahci.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-ahci.c Mon Oct 18 09:44:21 2010 (r214015) +++ head/sys/dev/ata/chipsets/ata-ahci.c Mon Oct 18 11:30:13 2010 (r214016) @@ -403,7 +403,7 @@ ata_ahci_status(device_t dev) /* do we have any PHY events ? */ if (istatus & (ATA_AHCI_P_IX_PRC | ATA_AHCI_P_IX_PC)) - ata_sata_phy_check_events(dev); + ata_sata_phy_check_events(dev, -1); /* do we have a potentially hanging engine to take care of? */ /* XXX SOS what todo on NCQ */ @@ -623,6 +623,25 @@ ata_ahci_pm_read(device_t dev, int port, (struct ata_ahci_cmd_tab *)(ch->dma.work + ATA_AHCI_CT_OFFSET); u_int8_t *fis = ch->dma.work + ATA_AHCI_FB_OFFSET + 0x40; + if (port < 0) { + *result = ATA_IDX_INL(ch, reg); + return (0); + } + if (port < ATA_PM) { + switch (reg) { + case ATA_SSTATUS: + reg = 0; + break; + case ATA_SERROR: + reg = 1; + break; + case ATA_SCONTROL: + reg = 2; + break; + default: + return (EINVAL); + } + } bzero(ctp->cfis, 64); ctp->cfis[0] = 0x27; /* host to device */ ctp->cfis[1] = 0x8f; /* command FIS to PM port */ @@ -649,6 +668,25 @@ ata_ahci_pm_write(device_t dev, int port (struct ata_ahci_cmd_tab *)(ch->dma.work + ATA_AHCI_CT_OFFSET); int offset = ch->unit << 7; + if (port < 0) { + ATA_IDX_OUTL(ch, reg, value); + return (0); + } + if (port < ATA_PM) { + switch (reg) { + case ATA_SSTATUS: + reg = 0; + break; + case ATA_SERROR: + reg = 1; + break; + case ATA_SCONTROL: + reg = 2; + break; + default: + return (EINVAL); + } + } bzero(ctp->cfis, 64); ctp->cfis[0] = 0x27; /* host to device */ ctp->cfis[1] = 0x8f; /* command FIS to PM port */ Modified: head/sys/dev/ata/chipsets/ata-intel.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-intel.c Mon Oct 18 09:44:21 2010 (r214015) +++ head/sys/dev/ata/chipsets/ata-intel.c Mon Oct 18 11:30:13 2010 (r214016) @@ -59,6 +59,15 @@ static int ata_intel_old_setmode(device_ static int ata_intel_new_setmode(device_t dev, int target, int mode); static int ata_intel_sch_setmode(device_t dev, int target, int mode); static int ata_intel_sata_getrev(device_t dev, int target); +static int ata_intel_sata_status(device_t dev); +static int ata_intel_sata_cscr_read(device_t dev, int port, + int reg, u_int32_t *result); +static int ata_intel_sata_sidpr_read(device_t dev, int port, + int reg, u_int32_t *result); +static int ata_intel_sata_cscr_write(device_t dev, int port, + int reg, u_int32_t result); +static int ata_intel_sata_sidpr_write(device_t dev, int port, + int reg, u_int32_t result); static int ata_intel_31244_ch_attach(device_t dev); static int ata_intel_31244_ch_detach(device_t dev); static int ata_intel_31244_status(device_t dev); @@ -67,7 +76,9 @@ static void ata_intel_31244_reset(device /* misc defines */ #define INTEL_AHCI 1 - +#define INTEL_ICH5 2 +#define INTEL_6CH 4 +#define INTEL_6CH2 8 /* * Intel chipset support functions @@ -92,74 +103,74 @@ ata_intel_probe(device_t dev) { ATA_I82801DB, 0, 0, 2, ATA_UDMA5, "ICH4" }, { ATA_I82801DB_1, 0, 0, 2, ATA_UDMA5, "ICH4" }, { ATA_I82801EB, 0, 0, 2, ATA_UDMA5, "ICH5" }, - { ATA_I82801EB_S1, 0, 0, 2, ATA_SA150, "ICH5" }, - { ATA_I82801EB_R1, 0, 0, 2, ATA_SA150, "ICH5" }, + { ATA_I82801EB_S1, 0, INTEL_ICH5, 2, ATA_SA150, "ICH5" }, + { ATA_I82801EB_R1, 0, INTEL_ICH5, 2, ATA_SA150, "ICH5" }, { ATA_I6300ESB, 0, 0, 2, ATA_UDMA5, "6300ESB" }, - { ATA_I6300ESB_S1, 0, 0, 2, ATA_SA150, "6300ESB" }, - { ATA_I6300ESB_R1, 0, 0, 2, ATA_SA150, "6300ESB" }, + { ATA_I6300ESB_S1, 0, INTEL_ICH5, 2, ATA_SA150, "6300ESB" }, + { ATA_I6300ESB_R1, 0, INTEL_ICH5, 2, ATA_SA150, "6300ESB" }, { ATA_I82801FB, 0, 0, 2, ATA_UDMA5, "ICH6" }, { ATA_I82801FB_S1, 0, INTEL_AHCI, 0, ATA_SA150, "ICH6" }, { ATA_I82801FB_R1, 0, INTEL_AHCI, 0, ATA_SA150, "ICH6" }, { ATA_I82801FBM, 0, INTEL_AHCI, 0, ATA_SA150, "ICH6M" }, { ATA_I82801GB, 0, 0, 1, ATA_UDMA5, "ICH7" }, - { ATA_I82801GB_S1, 0, INTEL_AHCI, 0, ATA_SA300, "ICH7" }, - { ATA_I82801GB_R1, 0, INTEL_AHCI, 0, ATA_SA300, "ICH7" }, + { ATA_I82801GB_S1, 0, 0, 0, ATA_SA300, "ICH7" }, + { ATA_I82801GB_R1, 0, 0, 0, ATA_SA300, "ICH7" }, { ATA_I82801GB_AH, 0, INTEL_AHCI, 0, ATA_SA300, "ICH7" }, - { ATA_I82801GBM_S1, 0, INTEL_AHCI, 0, ATA_SA150, "ICH7M" }, - { ATA_I82801GBM_R1, 0, INTEL_AHCI, 0, ATA_SA150, "ICH7M" }, + { ATA_I82801GBM_S1, 0, 0, 0, ATA_SA150, "ICH7M" }, + { ATA_I82801GBM_R1, 0, 0, 0, ATA_SA150, "ICH7M" }, { ATA_I82801GBM_AH, 0, INTEL_AHCI, 0, ATA_SA150, "ICH7M" }, { ATA_I63XXESB2, 0, 0, 1, ATA_UDMA5, "63XXESB2" }, - { ATA_I63XXESB2_S1, 0, INTEL_AHCI, 0, ATA_SA300, "63XXESB2" }, + { ATA_I63XXESB2_S1, 0, 0, 0, ATA_SA300, "63XXESB2" }, { ATA_I63XXESB2_S2, 0, INTEL_AHCI, 0, ATA_SA300, "63XXESB2" }, { ATA_I63XXESB2_R1, 0, INTEL_AHCI, 0, ATA_SA300, "63XXESB2" }, { ATA_I63XXESB2_R2, 0, INTEL_AHCI, 0, ATA_SA300, "63XXESB2" }, - { ATA_I82801HB_S1, 0, INTEL_AHCI, 0, ATA_SA300, "ICH8" }, - { ATA_I82801HB_S2, 0, INTEL_AHCI, 0, ATA_SA300, "ICH8" }, + { ATA_I82801HB_S1, 0, INTEL_6CH, 0, ATA_SA300, "ICH8" }, + { ATA_I82801HB_S2, 0, INTEL_6CH2, 0, ATA_SA300, "ICH8" }, { ATA_I82801HB_R1, 0, INTEL_AHCI, 0, ATA_SA300, "ICH8" }, { ATA_I82801HB_AH4, 0, INTEL_AHCI, 0, ATA_SA300, "ICH8" }, { ATA_I82801HB_AH6, 0, INTEL_AHCI, 0, ATA_SA300, "ICH8" }, { ATA_I82801HBM, 0, 0, 1, ATA_UDMA5, "ICH8M" }, - { ATA_I82801HBM_S1, 0, INTEL_AHCI, 0, ATA_SA300, "ICH8M" }, + { ATA_I82801HBM_S1, 0, INTEL_6CH, 0, ATA_SA300, "ICH8M" }, { ATA_I82801HBM_S2, 0, INTEL_AHCI, 0, ATA_SA300, "ICH8M" }, { ATA_I82801HBM_S3, 0, INTEL_AHCI, 0, ATA_SA300, "ICH8M" }, - { ATA_I82801IB_S1, 0, INTEL_AHCI, 0, ATA_SA300, "ICH9" }, - { ATA_I82801IB_S2, 0, INTEL_AHCI, 0, ATA_SA300, "ICH9" }, + { ATA_I82801IB_S1, 0, INTEL_6CH, 0, ATA_SA300, "ICH9" }, + { ATA_I82801IB_S2, 0, INTEL_6CH2, 0, ATA_SA300, "ICH9" }, { ATA_I82801IB_AH2, 0, INTEL_AHCI, 0, ATA_SA300, "ICH9" }, { ATA_I82801IB_AH4, 0, INTEL_AHCI, 0, ATA_SA300, "ICH9" }, { ATA_I82801IB_AH6, 0, INTEL_AHCI, 0, ATA_SA300, "ICH9" }, { ATA_I82801IB_R1, 0, INTEL_AHCI, 0, ATA_SA300, "ICH9" }, - { ATA_I82801JIB_S1, 0, INTEL_AHCI, 0, ATA_SA300, "ICH10" }, + { ATA_I82801JIB_S1, 0, INTEL_6CH, 0, ATA_SA300, "ICH10" }, { ATA_I82801JIB_AH, 0, INTEL_AHCI, 0, ATA_SA300, "ICH10" }, { ATA_I82801JIB_R1, 0, INTEL_AHCI, 0, ATA_SA300, "ICH10" }, - { ATA_I82801JIB_S2, 0, INTEL_AHCI, 0, ATA_SA300, "ICH10" }, - { ATA_I82801JD_S1, 0, INTEL_AHCI, 0, ATA_SA300, "ICH10" }, + { ATA_I82801JIB_S2, 0, INTEL_6CH2, 0, ATA_SA300, "ICH10" }, + { ATA_I82801JD_S1, 0, INTEL_6CH, 0, ATA_SA300, "ICH10" }, { ATA_I82801JD_AH, 0, INTEL_AHCI, 0, ATA_SA300, "ICH10" }, { ATA_I82801JD_R1, 0, INTEL_AHCI, 0, ATA_SA300, "ICH10" }, - { ATA_I82801JD_S2, 0, INTEL_AHCI, 0, ATA_SA300, "ICH10" }, - { ATA_I82801JI_S1, 0, INTEL_AHCI, 0, ATA_SA300, "ICH10" }, + { ATA_I82801JD_S2, 0, INTEL_6CH2, 0, ATA_SA300, "ICH10" }, + { ATA_I82801JI_S1, 0, INTEL_6CH, 0, ATA_SA300, "ICH10" }, { ATA_I82801JI_AH, 0, INTEL_AHCI, 0, ATA_SA300, "ICH10" }, { ATA_I82801JI_R1, 0, INTEL_AHCI, 0, ATA_SA300, "ICH10" }, - { ATA_I82801JI_S2, 0, INTEL_AHCI, 0, ATA_SA300, "ICH10" }, - { ATA_5Series_S1, 0, INTEL_AHCI, 0, ATA_SA300, "5 Series/3400 Series PCH" }, - { ATA_5Series_S2, 0, INTEL_AHCI, 0, ATA_SA300, "5 Series/3400 Series PCH" }, + { ATA_I82801JI_S2, 0, INTEL_6CH2, 0, ATA_SA300, "ICH10" }, + { ATA_5Series_S1, 0, INTEL_6CH, 0, ATA_SA300, "5 Series/3400 Series PCH" }, + { ATA_5Series_S2, 0, INTEL_6CH2, 0, ATA_SA300, "5 Series/3400 Series PCH" }, { ATA_5Series_AH1, 0, INTEL_AHCI, 0, ATA_SA300, "5 Series/3400 Series PCH" }, { ATA_5Series_AH2, 0, INTEL_AHCI, 0, ATA_SA300, "5 Series/3400 Series PCH" }, { ATA_5Series_R1, 0, INTEL_AHCI, 0, ATA_SA300, "5 Series/3400 Series PCH" }, - { ATA_5Series_S3, 0, INTEL_AHCI, 0, ATA_SA300, "5 Series/3400 Series PCH" }, - { ATA_5Series_S4, 0, INTEL_AHCI, 0, ATA_SA300, "5 Series/3400 Series PCH" }, + { ATA_5Series_S3, 0, INTEL_6CH2, 0, ATA_SA300, "5 Series/3400 Series PCH" }, + { ATA_5Series_S4, 0, INTEL_6CH, 0, ATA_SA300, "5 Series/3400 Series PCH" }, { ATA_5Series_AH3, 0, INTEL_AHCI, 0, ATA_SA300, "5 Series/3400 Series PCH" }, { ATA_5Series_R2, 0, INTEL_AHCI, 0, ATA_SA300, "5 Series/3400 Series PCH" }, - { ATA_5Series_S5, 0, INTEL_AHCI, 0, ATA_SA300, "5 Series/3400 Series PCH" }, - { ATA_5Series_S6, 0, INTEL_AHCI, 0, ATA_SA300, "5 Series/3400 Series PCH" }, + { ATA_5Series_S5, 0, INTEL_6CH2, 0, ATA_SA300, "5 Series/3400 Series PCH" }, + { ATA_5Series_S6, 0, INTEL_6CH, 0, ATA_SA300, "5 Series/3400 Series PCH" }, { ATA_5Series_AH4, 0, INTEL_AHCI, 0, ATA_SA300, "5 Series/3400 Series PCH" }, - { ATA_CPT_S1, 0, INTEL_AHCI, 0, ATA_SA300, "Cougar Point" }, - { ATA_CPT_S2, 0, INTEL_AHCI, 0, ATA_SA300, "Cougar Point" }, + { ATA_CPT_S1, 0, INTEL_6CH, 0, ATA_SA300, "Cougar Point" }, + { ATA_CPT_S2, 0, INTEL_6CH, 0, ATA_SA300, "Cougar Point" }, { ATA_CPT_AH1, 0, INTEL_AHCI, 0, ATA_SA300, "Cougar Point" }, { ATA_CPT_AH2, 0, INTEL_AHCI, 0, ATA_SA300, "Cougar Point" }, { ATA_CPT_R1, 0, INTEL_AHCI, 0, ATA_SA300, "Cougar Point" }, { ATA_CPT_R2, 0, INTEL_AHCI, 0, ATA_SA300, "Cougar Point" }, - { ATA_CPT_S3, 0, INTEL_AHCI, 0, ATA_SA300, "Cougar Point" }, - { ATA_CPT_S4, 0, INTEL_AHCI, 0, ATA_SA300, "Cougar Point" }, + { ATA_CPT_S3, 0, INTEL_6CH2, 0, ATA_SA300, "Cougar Point" }, + { ATA_CPT_S4, 0, INTEL_6CH2, 0, ATA_SA300, "Cougar Point" }, { ATA_I31244, 0, 0, 2, ATA_SA150, "31244" }, { ATA_ISCH, 0, 0, 1, ATA_UDMA5, "SCH" }, { 0, 0, 0, 0, 0, 0}}; @@ -183,6 +194,8 @@ ata_intel_chipinit(device_t dev) if (ata_setup_interrupt(dev, ata_generic_intr)) return ENXIO; + ctlr->chipset_data = NULL; + /* good old PIIX needs special treatment (not implemented) */ if (ctlr->chip->chipid == ATA_I82371FB) { ctlr->setmode = ata_intel_old_setmode; @@ -233,7 +246,7 @@ ata_intel_chipinit(device_t dev) * if we have AHCI capability and AHCI or RAID mode enabled * in BIOS we try for AHCI mode */ - if ((ctlr->chip->cfg1 == INTEL_AHCI) && + if ((ctlr->chip->cfg1 & INTEL_AHCI) && (pci_read_config(dev, 0x90, 1) & 0xc0) && (ata_ahci_chipinit(dev) != ENXIO)) return 0; @@ -242,7 +255,8 @@ ata_intel_chipinit(device_t dev) ctlr->r_type2 = SYS_RES_IOPORT; ctlr->r_rid2 = PCIR_BAR(5); if ((ctlr->r_res2 = bus_alloc_resource_any(dev, ctlr->r_type2, - &ctlr->r_rid2, RF_ACTIVE))) + &ctlr->r_rid2, RF_ACTIVE)) + || (ctlr->chip->cfg1 & INTEL_ICH5)) ctlr->getrev = ata_intel_sata_getrev; ctlr->setmode = ata_sata_setmode; } @@ -252,63 +266,142 @@ ata_intel_chipinit(device_t dev) static int ata_intel_ch_attach(device_t dev) { - struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); - struct ata_channel *ch = device_get_softc(dev); - - /* setup the usual register normal pci style */ - if (ata_pci_ch_attach(dev)) - return ENXIO; - - /* if r_res2 is valid it points to SATA interface registers */ - if (ctlr->r_res2) { - ch->r_io[ATA_IDX_ADDR].res = ctlr->r_res2; - ch->r_io[ATA_IDX_ADDR].offset = 0x00; - ch->r_io[ATA_IDX_DATA].res = ctlr->r_res2; - ch->r_io[ATA_IDX_DATA].offset = 0x04; - } + struct ata_pci_controller *ctlr; + struct ata_channel *ch; + u_char *smap; + u_int map; + + /* setup the usual register normal pci style */ + if (ata_pci_ch_attach(dev)) + return (ENXIO); + + ctlr = device_get_softc(device_get_parent(dev)); + ch = device_get_softc(dev); + + /* if r_res2 is valid it points to SATA interface registers */ + if (ctlr->r_res2) { + ch->r_io[ATA_IDX_ADDR].res = ctlr->r_res2; + ch->r_io[ATA_IDX_ADDR].offset = 0x00; + ch->r_io[ATA_IDX_DATA].res = ctlr->r_res2; + ch->r_io[ATA_IDX_DATA].offset = 0x04; + } - ch->flags |= ATA_ALWAYS_DMASTAT; - if (ctlr->chip->max_dma >= ATA_SA150) { - if (ctlr->chip->cfg1 == 0 && - (pci_read_config(device_get_parent(dev), 0x90, 1) & 0x04) == 0) - ch->flags |= ATA_NO_SLAVE; - ch->flags |= ATA_SATA; - } else if (ctlr->chip->chipid != ATA_ISCH) - ch->flags |= ATA_CHECKS_CABLE; - return 0; + ch->flags |= ATA_ALWAYS_DMASTAT; + if (ctlr->chip->max_dma >= ATA_SA150) { + smap = (u_char *)&ctlr->chipset_data + ch->unit * 2; + map = pci_read_config(device_get_parent(dev), 0x90, 1); + if (ctlr->chip->cfg1 & INTEL_ICH5) { + map &= 0x07; + if ((map & 0x04) == 0) { + ch->flags |= ATA_SATA; + ch->flags |= ATA_NO_SLAVE; + smap[0] = (map & 0x01) ^ ch->unit; + smap[1] = 0; + } else if ((map & 0x02) == 0 && ch->unit == 0) { + ch->flags |= ATA_SATA; + smap[0] = (map & 0x01) ? 1 : 0; + smap[1] = (map & 0x01) ? 0 : 1; + } else if ((map & 0x02) != 0 && ch->unit == 1) { + ch->flags |= ATA_SATA; + smap[0] = (map & 0x01) ? 1 : 0; + smap[1] = (map & 0x01) ? 0 : 1; + } + } else if (ctlr->chip->cfg1 & INTEL_6CH2) { + ch->flags |= ATA_SATA; + ch->flags |= ATA_NO_SLAVE; + smap[0] = (ch->unit == 0) ? 4 : 5; + smap[1] = 0; + } else { + map &= 0x03; + if (map == 0x00) { + ch->flags |= ATA_SATA; + smap[ch->unit] = (ch->unit == 0) ? 0x20 : 0x31; + smap[0] = (ch->unit == 0) ? 0 : 1; + smap[1] = (ch->unit == 0) ? 2 : 3; + } else if (map == 0x02 && ch->unit == 0) { + ch->flags |= ATA_SATA; + smap[0] = 0; + smap[1] = 2; + } else if (map == 0x01 && ch->unit == 1) { + ch->flags |= ATA_SATA; + smap[0] = 1; + smap[1] = 3; + } + } + if (ch->flags & ATA_SATA) { + if ((ctlr->chip->cfg1 & INTEL_ICH5)) { + ch->flags |= ATA_PERIODIC_POLL; + ch->hw.status = ata_intel_sata_status; + ch->hw.pm_read = ata_intel_sata_cscr_read; + ch->hw.pm_write = ata_intel_sata_cscr_write; + } else if (ctlr->r_res2) { + ch->flags |= ATA_PERIODIC_POLL; + ch->hw.status = ata_intel_sata_status; + ch->hw.pm_read = ata_intel_sata_sidpr_read; + ch->hw.pm_write = ata_intel_sata_sidpr_write; + } + if (ch->hw.pm_write != NULL) { + ata_sata_scr_write(ch, 0, + ATA_SERROR, 0xffffffff); + if ((ch->flags & ATA_NO_SLAVE) == 0) { + ata_sata_scr_write(ch, 1, + ATA_SERROR, 0xffffffff); + } + } + } else + ctlr->setmode = ata_intel_new_setmode; + } else if (ctlr->chip->chipid != ATA_ISCH) + ch->flags |= ATA_CHECKS_CABLE; + return (0); } static void ata_intel_reset(device_t dev) { - device_t parent = device_get_parent(dev); - struct ata_pci_controller *ctlr = device_get_softc(parent); - struct ata_channel *ch = device_get_softc(dev); - int mask, timeout; + device_t parent = device_get_parent(dev); + struct ata_pci_controller *ctlr = device_get_softc(parent); + struct ata_channel *ch = device_get_softc(dev); + int mask, pmask, timeout, devs; + u_char *smap; - /* ICH6 & ICH7 in compat mode has 4 SATA ports as master/slave on 2 ch's */ - if (ctlr->chip->cfg1) { - mask = (0x0005 << ch->unit); - } - else { - /* ICH5 in compat mode has SATA ports as master/slave on 1 channel */ - if (pci_read_config(parent, 0x90, 1) & 0x04) - mask = 0x0003; + /* In combined mode, skip SATA stuff for PATA channel. */ + if ((ch->flags & ATA_SATA) == 0) + return (ata_generic_reset(dev)); + + /* Do hard-reset on respective SATA ports. */ + smap = (u_char *)&ctlr->chipset_data + ch->unit * 2; + mask = 1 << smap[0]; + if ((ch->flags & ATA_NO_SLAVE) == 0) + mask |= (1 << smap[1]); + pci_write_config(parent, 0x92, + pci_read_config(parent, 0x92, 2) & ~mask, 2); + DELAY(10); + pci_write_config(parent, 0x92, + pci_read_config(parent, 0x92, 2) | mask, 2); + + /* Wait up to 1 sec for "connect well". */ + if (ctlr->chip->cfg1 & (INTEL_6CH | INTEL_6CH2)) + pmask = mask << 8; else - mask = (0x0001 << ch->unit); - } - pci_write_config(parent, 0x92, pci_read_config(parent, 0x92, 2) & ~mask, 2); - DELAY(10); - pci_write_config(parent, 0x92, pci_read_config(parent, 0x92, 2) | mask, 2); - - /* wait up to 1 sec for "connect well" */ - for (timeout = 0; timeout < 100 ; timeout++) { - if (((pci_read_config(parent, 0x92, 2) & (mask << 4)) == (mask << 4)) && - (ATA_IDX_INB(ch, ATA_STATUS) != 0xff)) - break; - ata_udelay(10000); - } - ata_generic_reset(dev); + pmask = mask << 4; + for (timeout = 0; timeout < 100 ; timeout++) { + if (((pci_read_config(parent, 0x92, 2) & pmask) == pmask) && + (ATA_IDX_INB(ch, ATA_STATUS) != 0xff)) + break; + ata_udelay(10000); + } + + /* If any device found, do soft-reset. */ + if (ch->hw.pm_read != NULL) { + devs = ata_sata_phy_reset(dev, 0, 2); + if ((ch->flags & ATA_NO_SLAVE) == 0) + devs += ata_sata_phy_reset(dev, 1, 2); + } else + devs = 1; + if (devs) + ata_generic_reset(dev); + else + ch->devices = 0; } static int @@ -339,6 +432,10 @@ ata_intel_new_setmode(device_t dev, int u_int8_t timings[] = { 0x00, 0x00, 0x10, 0x21, 0x23, 0x00, 0x21, 0x23 }; u_int8_t utimings[] = { 0x00, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02 }; + /* In combined mode, skip PATA stuff for SATA channel. */ + if (ch->flags & ATA_SATA) + return (ata_sata_setmode(dev, target, mode)); + mode = min(mode, ctlr->chip->max_dma); if (ata_dma_check_80pin && mode > ATA_UDMA2 && !(reg54 & (0x10 << devno))) { @@ -421,12 +518,145 @@ static int ata_intel_sata_getrev(device_t dev, int target) { struct ata_channel *ch = device_get_softc(dev); - int devno = (ch->unit << 1) + target; + uint32_t status; + + if (ata_sata_scr_read(ch, target, ATA_SSTATUS, &status) == 0) + return ((status & 0x0f0) >> 4); + return (0xff); +} + +static int +ata_intel_sata_status(device_t dev) +{ + struct ata_channel *ch = device_get_softc(dev); + + ata_sata_phy_check_events(dev, 0); + if ((ch->flags & ATA_NO_SLAVE) == 0) + ata_sata_phy_check_events(dev, 1); - /* set ATA_SSTATUS register offset */ - ATA_IDX_OUTL(ch, ATA_IDX_ADDR, devno * 0x100); - /* query SATA STATUS for the speed */ - return ((ATA_IDX_INL(ch, ATA_IDX_DATA) & 0x0f0) >> 4); + return ata_pci_status(dev); +} + +static int +ata_intel_sata_cscr_read(device_t dev, int port, int reg, u_int32_t *result) +{ + struct ata_pci_controller *ctlr; + struct ata_channel *ch; + device_t parent; + u_char *smap; + + parent = device_get_parent(dev); + ctlr = device_get_softc(parent); + ch = device_get_softc(dev); + smap = (u_char *)&ctlr->chipset_data + ch->unit * 2; + port = (port == 1) ? 1 : 0; + switch (reg) { + case ATA_SSTATUS: + reg = 0; + break; + case ATA_SERROR: + reg = 1; + break; + case ATA_SCONTROL: + reg = 2; + break; + default: + return (EINVAL); + } + pci_write_config(parent, 0xa0, + 0x50 + smap[port] * 0x10 + reg * 4, 4); + *result = pci_read_config(parent, 0xa4, 4); + return (0); +} + +static int +ata_intel_sata_sidpr_read(device_t dev, int port, int reg, u_int32_t *result) +{ + struct ata_pci_controller *ctlr; + struct ata_channel *ch; + device_t parent; + + parent = device_get_parent(dev); + ctlr = device_get_softc(parent); + ch = device_get_softc(dev); + port = (port == 1) ? 1 : 0; + switch (reg) { + case ATA_SSTATUS: + reg = 0; + break; + case ATA_SCONTROL: + reg = 1; + break; + case ATA_SERROR: + reg = 2; + break; + default: + return (EINVAL); + } + ATA_IDX_OUTL(ch, ATA_IDX_ADDR, ((ch->unit * 2 + port) << 8) + reg); + *result = ATA_IDX_INL(ch, ATA_IDX_DATA); + return (0); +} + +static int +ata_intel_sata_cscr_write(device_t dev, int port, int reg, u_int32_t value) +{ + struct ata_pci_controller *ctlr; + struct ata_channel *ch; + device_t parent; + u_char *smap; + + parent = device_get_parent(dev); + ctlr = device_get_softc(parent); + ch = device_get_softc(dev); + smap = (u_char *)&ctlr->chipset_data + ch->unit * 2; + port = (port == 1) ? 1 : 0; + switch (reg) { + case ATA_SSTATUS: + reg = 0; + break; + case ATA_SERROR: + reg = 1; + break; + case ATA_SCONTROL: + reg = 2; + break; + default: + return (EINVAL); + } + pci_write_config(parent, 0xa0, + 0x50 + smap[port] * 0x10 + reg * 4, 4); + pci_write_config(parent, 0xa4, value, 4); + return (0); +} + +static int +ata_intel_sata_sidpr_write(device_t dev, int port, int reg, u_int32_t value) +{ + struct ata_pci_controller *ctlr; + struct ata_channel *ch; + device_t parent; + + parent = device_get_parent(dev); + ctlr = device_get_softc(parent); + ch = device_get_softc(dev); + port = (port == 1) ? 1 : 0; + switch (reg) { + case ATA_SSTATUS: + reg = 0; + break; + case ATA_SCONTROL: + reg = 1; + break; + case ATA_SERROR: + reg = 2; + break; + default: + return (EINVAL); + } + ATA_IDX_OUTL(ch, ATA_IDX_ADDR, ((ch->unit * 2 + port) << 8) + reg); + ATA_IDX_OUTL(ch, ATA_IDX_DATA, value); + return (0); } static int @@ -492,7 +722,7 @@ static int ata_intel_31244_status(device_t dev) { /* do we have any PHY events ? */ - ata_sata_phy_check_events(dev); + ata_sata_phy_check_events(dev, -1); /* any drive action to take care of ? */ return ata_pci_status(dev); Modified: head/sys/dev/ata/chipsets/ata-marvell.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-marvell.c Mon Oct 18 09:44:21 2010 (r214015) +++ head/sys/dev/ata/chipsets/ata-marvell.c Mon Oct 18 11:30:13 2010 (r214016) @@ -374,7 +374,7 @@ ata_marvell_edma_status(device_t dev) ATA_OUTL(ctlr->r_res1, 0x02008 + ATA_MV_EDMA_BASE(ch), 0x0); /* do we have any PHY events ? */ - ata_sata_phy_check_events(dev); + ata_sata_phy_check_events(dev, -1); } /* do we have any device action ? */ Modified: head/sys/dev/ata/chipsets/ata-nvidia.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-nvidia.c Mon Oct 18 09:44:21 2010 (r214015) +++ head/sys/dev/ata/chipsets/ata-nvidia.c Mon Oct 18 11:30:13 2010 (r214016) @@ -281,7 +281,7 @@ ata_nvidia_status(device_t dev) /* do we have any PHY events ? */ if (istatus & (0x0c << shift)) - ata_sata_phy_check_events(dev); + ata_sata_phy_check_events(dev, -1); /* clear interrupt(s) */ if (ctlr->chip->cfg1 & NVQ) Modified: head/sys/dev/ata/chipsets/ata-promise.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-promise.c Mon Oct 18 09:44:21 2010 (r214015) +++ head/sys/dev/ata/chipsets/ata-promise.c Mon Oct 18 11:30:13 2010 (r214016) @@ -830,6 +830,25 @@ ata_promise_mio_pm_read(device_t dev, in struct ata_channel *ch = device_get_softc(dev); int timeout = 0; + if (port < 0) { + *result = ATA_IDX_INL(ch, reg); + return (0); + } + if (port < ATA_PM) { + switch (reg) { + case ATA_SSTATUS: + reg = 0; + break; + case ATA_SERROR: + reg = 1; + break; + case ATA_SCONTROL: + reg = 2; + break; + default: + return (EINVAL); + } + } /* set portmultiplier port */ ATA_OUTB(ctlr->r_res2, 0x4e8 + (ch->unit << 8), 0x0f); @@ -862,6 +881,25 @@ ata_promise_mio_pm_write(device_t dev, i struct ata_channel *ch = device_get_softc(dev); int timeout = 0; + if (port < 0) { + ATA_IDX_OUTL(ch, reg, value); + return (0); + } + if (port < ATA_PM) { + switch (reg) { + case ATA_SSTATUS: + reg = 0; + break; + case ATA_SERROR: + reg = 1; + break; + case ATA_SCONTROL: + reg = 2; + break; + default: + return (EINVAL); + } + } /* set portmultiplier port */ ATA_OUTB(ctlr->r_res2, 0x4e8 + (ch->unit << 8), 0x0f); Modified: head/sys/dev/ata/chipsets/ata-siliconimage.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-siliconimage.c Mon Oct 18 09:44:21 2010 (r214015) +++ head/sys/dev/ata/chipsets/ata-siliconimage.c Mon Oct 18 11:30:13 2010 (r214016) @@ -354,7 +354,7 @@ ata_sii_status(device_t dev) /* do we have any PHY events ? */ if (ctlr->chip->max_dma >= ATA_SA150 && (ATA_INL(ctlr->r_res2, 0x10 + offset0) & 0x00000010)) - ata_sata_phy_check_events(dev); + ata_sata_phy_check_events(dev, -1); if (ATA_INL(ctlr->r_res2, 0xa0 + offset1) & 0x00000800) return ata_pci_status(dev); @@ -510,7 +510,7 @@ ata_siiprb_status(device_t dev) u_int32_t istatus = ATA_INL(ctlr->r_res2, 0x1008 + offset); /* do we have any PHY events ? */ - ata_sata_phy_check_events(dev); + ata_sata_phy_check_events(dev, -1); /* clear interrupt(s) */ ATA_OUTL(ctlr->r_res2, 0x1008 + offset, istatus); @@ -700,6 +700,25 @@ ata_siiprb_pm_read(device_t dev, int por struct ata_siiprb_command *prb = (struct ata_siiprb_command *)ch->dma.work; int offset = ch->unit * 0x2000; + if (port < 0) { + *result = ATA_IDX_INL(ch, reg); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Mon Oct 18 11:41: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 7B540106564A; Mon, 18 Oct 2010 11:41:14 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from gse-mta-27.emailfiltering.com (gse-mta-27-tx.emailfiltering.com [194.116.198.158]) by mx1.freebsd.org (Postfix) with ESMTP id 6C6FB8FC15; Mon, 18 Oct 2010 11:41:12 +0000 (UTC) Received: from mail-gw14.york.ac.uk ([144.32.129.164]) by gse-mta-27.emailfiltering.com with emfmta (version 4.6.0.72) by TLS id 779643584 for culot@FreeBSD.org; a50c6825d3676c00; Mon, 18 Oct 2010 12:41:12 +0100 Received: from buffy-128.york.ac.uk ([144.32.128.160]:19820 helo=buffy.york.ac.uk) by mail-gw14.york.ac.uk with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1P7o5X-0000F1-AP; Mon, 18 Oct 2010 12:41:11 +0100 Received: from buffy.york.ac.uk (localhost [127.0.0.1]) by buffy.york.ac.uk (8.14.4/8.14.4) with ESMTP id o9IBfA3L088211; Mon, 18 Oct 2010 12:41:10 +0100 (BST) (envelope-from gavin@FreeBSD.org) Received: (from ga9@localhost) by buffy.york.ac.uk (8.14.4/8.14.4/Submit) id o9IBfAkC088210; Mon, 18 Oct 2010 12:41:10 +0100 (BST) (envelope-from gavin@FreeBSD.org) X-Authentication-Warning: buffy.york.ac.uk: ga9 set sender to gavin@FreeBSD.org using -f From: Gavin Atkinson To: Frederic Culot In-Reply-To: <201010171902.o9HJ2gjw042593@svn.freebsd.org> References: <201010171902.o9HJ2gjw042593@svn.freebsd.org> Content-Type: text/plain; charset="ASCII" Content-Transfer-Encoding: quoted-printable Date: Mon, 18 Oct 2010 12:41:09 +0100 Message-ID: <1287402069.73576.24.camel@buffy.york.ac.uk> Mime-Version: 1.0 X-Mailer: Evolution 2.30.1.2 FreeBSD GNOME Team Port Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r213990 - head/usr.bin/calendar/calendars 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, 18 Oct 2010 11:41:14 -0000 On Sun, 2010-10-17 at 19:02 +0000, Frederic Culot wrote: > Author: culot (ports committer) > Date: Sun Oct 17 19:02:42 2010 > New Revision: 213990 > URL: http://svn.freebsd.org/changeset/base/213990 >=20 > Log: > Add myself to calendar.freebsd. >=20 > Modified: > head/usr.bin/calendar/calendars/calendar.freebsd >=20 > Modified: head/usr.bin/calendar/calendars/calendar.freebsd > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=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/usr.bin/calendar/calendars/calendar.freebsd Sun Oct 17 18:49:45 = 2010 (r213989) > +++ head/usr.bin/calendar/calendars/calendar.freebsd Sun Oct 17 19:02:42 = 2010 (r213990) > @@ -302,6 +302,7 @@ > 11/19 Konstantin Belousov born in Kiev, USSR, 1972 > 11/20 Dmitry Morozovsky born in Moscow, USSR, 1968 > 11/20 Gavin Atkinson born in Middlesbrough, United K= ingdom, 1979 > +11/22 Frederic Culot born in Saint-Germain-En-Laye= , France, 1976 > 11/23 Josef Lawrence Karthauser born in Pembury, Kent,= United Kingdom, 1972 > 11/24 Andrey Zakhvatov born in Chelyabinsk, Russian F= ederation, 1974 > 11/24 Daniel Gerzo born in Bratislava, Slovakia, 19= 86 It looks like you've accidentally added an extra space between the date and your name. Gavin --=20 Gavin Atkinson FreeBSD committer and bugmeister GPG: A093262B (313A A79F 697D 3A5C 216A EDF5 935D EF44 A093 262B) From owner-svn-src-head@FreeBSD.ORG Mon Oct 18 12:10: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 4FA14106566B; Mon, 18 Oct 2010 12:10:11 +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 B04AF8FC2A; Mon, 18 Oct 2010 12:10:10 +0000 (UTC) Received: from muon.cran.org.uk (localhost [127.0.0.1]) by muon.cran.org.uk (Postfix) with ESMTP id 178E7E869E; Mon, 18 Oct 2010 13:10:09 +0100 (BST) Received: from unknown (unknown [109.144.232.255]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by muon.cran.org.uk (Postfix) with ESMTPSA; Mon, 18 Oct 2010 13:10:08 +0100 (BST) Date: Mon, 18 Oct 2010 13:10:06 +0100 From: Bruce Cran To: Gavin Atkinson Message-ID: <20101018131006.000062b8@unknown> In-Reply-To: <1287402069.73576.24.camel@buffy.york.ac.uk> References: <201010171902.o9HJ2gjw042593@svn.freebsd.org> <1287402069.73576.24.camel@buffy.york.ac.uk> X-Mailer: Claws Mail 3.7.4cvs1 (GTK+ 2.16.0; i586-pc-mingw32msvc) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, Frederic Culot , svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r213990 - head/usr.bin/calendar/calendars 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, 18 Oct 2010 12:10:11 -0000 On Mon, 18 Oct 2010 12:41:09 +0100 Gavin Atkinson wrote: > It looks like you've accidentally added an extra space between the > date and your name. I think there should be a single tab, and instead there are spaces. -- Bruce Cran From owner-svn-src-head@FreeBSD.ORG Mon Oct 18 12:35: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 E878B1065673; Mon, 18 Oct 2010 12:35:10 +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 D74018FC08; Mon, 18 Oct 2010 12:35: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 o9ICZAcs071665; Mon, 18 Oct 2010 12:35:10 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9ICZArX071663; Mon, 18 Oct 2010 12:35:10 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201010181235.o9ICZArX071663@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 18 Oct 2010 12:35: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: r214018 - head/lib/libradius 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, 18 Oct 2010 12:35:11 -0000 Author: pjd Date: Mon Oct 18 12:35:10 2010 New Revision: 214018 URL: http://svn.freebsd.org/changeset/base/214018 Log: Add links for libradius(3) functions. Modified: head/lib/libradius/Makefile Modified: head/lib/libradius/Makefile ============================================================================== --- head/lib/libradius/Makefile Mon Oct 18 12:12:38 2010 (r214017) +++ head/lib/libradius/Makefile Mon Oct 18 12:35:10 2010 (r214018) @@ -33,6 +33,39 @@ CFLAGS+= -Wall SHLIB_MAJOR= 4 MAN= libradius.3 radius.conf.5 +MLINKS+=libradius.3 rad_acct_open.3 \ + libradius.3 rad_add_server.3 \ + libradius.3 rad_auth_open.3 \ + libradius.3 rad_close.3 \ + libradius.3 rad_config.3 \ + libradius.3 rad_continue_send_request.3 \ + libradius.3 rad_create_request.3 \ + libradius.3 rad_create_response.3 \ + libradius.3 rad_cvt_addr.3 \ + libradius.3 rad_cvt_int.3 \ + libradius.3 rad_cvt_string.3 \ + libradius.3 rad_demangle.3 \ + libradius.3 rad_demangle_mppe_key.3 \ + libradius.3 rad_get_attr.3 \ + libradius.3 rad_get_vendor_attr.3 \ + libradius.3 rad_init_send_request.3 \ + libradius.3 rad_put_addr.3 \ + libradius.3 rad_put_attr.3 \ + libradius.3 rad_put_int.3 \ + libradius.3 rad_put_message_authentic.3 \ + libradius.3 rad_put_string.3 \ + libradius.3 rad_put_vendor_addr.3 \ + libradius.3 rad_put_vendor_attr.3 \ + libradius.3 rad_put_vendor_int.3 \ + libradius.3 rad_put_vendor_string.3 \ + libradius.3 rad_receive_request.3 \ + libradius.3 rad_request_authenticator.3 \ + libradius.3 rad_send_request.3 \ + libradius.3 rad_send_response.3 \ + libradius.3 rad_server_open.3 \ + libradius.3 rad_server_secret.3 \ + libradius.3 rad_strerror.3 + WARNS?= 3 .if ${MK_OPENSSL} == "no" From owner-svn-src-head@FreeBSD.ORG Mon Oct 18 12:35: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 2FE06106566C; Mon, 18 Oct 2010 12:35:49 +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 1ECE88FC22; Mon, 18 Oct 2010 12:35: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 o9ICZneg071709; Mon, 18 Oct 2010 12:35:49 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9ICZndh071707; Mon, 18 Oct 2010 12:35:49 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201010181235.o9ICZndh071707@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 18 Oct 2010 12:35:48 +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: r214019 - 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: Mon, 18 Oct 2010 12:35:49 -0000 Author: pjd Date: Mon Oct 18 12:35:48 2010 New Revision: 214019 URL: http://svn.freebsd.org/changeset/base/214019 Log: Update links for taskqueue(9) functions. Modified: head/share/man/man9/Makefile Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Mon Oct 18 12:35:10 2010 (r214018) +++ head/share/man/man9/Makefile Mon Oct 18 12:35:48 2010 (r214019) @@ -1212,11 +1212,17 @@ MLINKS+=sysctl_ctx_init.9 sysctl_ctx_ent sysctl_ctx_init.9 sysctl_ctx_free.9 MLINKS+=taskqueue.9 TASK_INIT.9 \ taskqueue.9 taskqueue_create.9 \ + taskqueue.9 taskqueue_create_fast.9 \ taskqueue.9 TASKQUEUE_DECLARE.9 \ taskqueue.9 TASKQUEUE_DEFINE.9 \ + taskqueue.9 TASKQUEUE_DEFINE_THREAD.9 \ + taskqueue.9 taskqueue_drain.9 \ taskqueue.9 taskqueue_enqueue.9 \ - taskqueue.9 taskqueue_find.9 \ + taskqueue.9 taskqueue_enqueue_fast.9 \ + taskqueue.9 TASKQUEUE_FAST_DEFINE.9 \ + taskqueue.9 TASKQUEUE_FAST_DEFINE_THREAD.9 \ taskqueue.9 taskqueue_free.9 \ + taskqueue.9 taskqueue_member.9 \ taskqueue.9 taskqueue_run.9 MLINKS+=time.9 boottime.9 \ time.9 time_second.9 \ From owner-svn-src-head@FreeBSD.ORG Mon Oct 18 14:13: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 EE3BF106566B; Mon, 18 Oct 2010 14:13:19 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DC8888FC0A; Mon, 18 Oct 2010 14:13: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 o9IEDJRk073778; Mon, 18 Oct 2010 14:13:19 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9IEDJP1073776; Mon, 18 Oct 2010 14:13:19 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201010181413.o9IEDJP1073776@svn.freebsd.org> From: Sergey Kandaurov Date: Mon, 18 Oct 2010 14:13: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: r214020 - 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: Mon, 18 Oct 2010 14:13:20 -0000 Author: pluknet Date: Mon Oct 18 14:13:19 2010 New Revision: 214020 URL: http://svn.freebsd.org/changeset/base/214020 Log: Fix typo: Offlaod -> Offload. PR: docs/150756 Approved by: avg (mentor) MFC after: 3 days Modified: head/share/man/man4/nxge.4 Modified: head/share/man/man4/nxge.4 ============================================================================== --- head/share/man/man4/nxge.4 Mon Oct 18 12:35:48 2010 (r214019) +++ head/share/man/man4/nxge.4 Mon Oct 18 14:13:19 2010 (r214020) @@ -49,7 +49,7 @@ The .Nm driver provides support for Neterion Xframe-I and Xframe-II adapters. The driver supports TCP Segmentation Offload (TSO/LSO), -Large Receive Offlaod (LRO), Jumbo Frames (5 buffer mode), +Large Receive Offload (LRO), Jumbo Frames (5 buffer mode), Header Separation (Rx 2 buffer mode), VLAN, and Promiscuous mode. .Pp For general information and support, please visit the Neterion support page From owner-svn-src-head@FreeBSD.ORG Mon Oct 18 14:26: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 5CE381065674; Mon, 18 Oct 2010 14:26:29 +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 4B5258FC24; Mon, 18 Oct 2010 14:26: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 o9IEQTmP074160; Mon, 18 Oct 2010 14:26:29 GMT (envelope-from brucec@svn.freebsd.org) Received: (from brucec@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9IEQTnP074158; Mon, 18 Oct 2010 14:26:29 GMT (envelope-from brucec@svn.freebsd.org) Message-Id: <201010181426.o9IEQTnP074158@svn.freebsd.org> From: Bruce Cran Date: Mon, 18 Oct 2010 14:26: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: r214021 - head/sys/dev/firewire 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, 18 Oct 2010 14:26:29 -0000 Author: brucec Date: Mon Oct 18 14:26:29 2010 New Revision: 214021 URL: http://svn.freebsd.org/changeset/base/214021 Log: Fix grammar. Modified: head/sys/dev/firewire/fwohci.c Modified: head/sys/dev/firewire/fwohci.c ============================================================================== --- head/sys/dev/firewire/fwohci.c Mon Oct 18 14:13:19 2010 (r214020) +++ head/sys/dev/firewire/fwohci.c Mon Oct 18 14:26:29 2010 (r214021) @@ -1971,8 +1971,8 @@ fwohci_intr_dma(struct fwohci_softc *sc, OWRITE(sc, OHCI_LNKCTLCLR, OHCI_CNTL_CYCTIMER); #endif OWRITE(sc, FWOHCI_INTMASKCLR, OHCI_INT_CYC_LOST); - device_printf(fc->dev, "too many cycle lost, " - "no cycle master presents?\n"); + device_printf(fc->dev, "too many cycles lost, " + "no cycle master present?\n"); } } if (stat & OHCI_INT_DMA_ATRQ) { From owner-svn-src-head@FreeBSD.ORG Mon Oct 18 14:35: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 89E131065696; Mon, 18 Oct 2010 14:35:21 +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 781548FC1B; Mon, 18 Oct 2010 14:35: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 o9IEZLMK074422; Mon, 18 Oct 2010 14:35:21 GMT (envelope-from brucec@svn.freebsd.org) Received: (from brucec@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9IEZLaw074420; Mon, 18 Oct 2010 14:35:21 GMT (envelope-from brucec@svn.freebsd.org) Message-Id: <201010181435.o9IEZLaw074420@svn.freebsd.org> From: Bruce Cran Date: Mon, 18 Oct 2010 14:35: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: r214022 - head/contrib/netcat 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, 18 Oct 2010 14:35:21 -0000 Author: brucec Date: Mon Oct 18 14:35:21 2010 New Revision: 214022 URL: http://svn.freebsd.org/changeset/base/214022 Log: Remove extra word, which looks like a left-over from a deleted sentence. Modified: head/contrib/netcat/nc.1 Modified: head/contrib/netcat/nc.1 ============================================================================== --- head/contrib/netcat/nc.1 Mon Oct 18 14:26:29 2010 (r214021) +++ head/contrib/netcat/nc.1 Mon Oct 18 14:35:21 2010 (r214022) @@ -158,7 +158,6 @@ TCP_NOOPT socket option. .It Fl O Ar length Specifies the size of the TCP send buffer. -When .It Fl P Ar proxy_username Specifies a username to present to a proxy server that requires authentication. If no username is specified then authentication will not be attempted. From owner-svn-src-head@FreeBSD.ORG Mon Oct 18 14:37: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 DFA3E106566C; Mon, 18 Oct 2010 14:37:05 +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 B04E88FC0A; Mon, 18 Oct 2010 14:37:05 +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 4E81646B0C; Mon, 18 Oct 2010 10:37:05 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 4C64D8A009; Mon, 18 Oct 2010 10:37:04 -0400 (EDT) From: John Baldwin To: Marius Strobl Date: Mon, 18 Oct 2010 10:03:12 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100819; KDE/4.4.5; amd64; ; ) References: <201010171646.o9HGks2U038501@svn.freebsd.org> In-Reply-To: <201010171646.o9HGks2U038501@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201010181003.13045.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Mon, 18 Oct 2010 10:37:04 -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: r213985 - 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, 18 Oct 2010 14:37:06 -0000 On Sunday, October 17, 2010 12:46:54 pm Marius Strobl wrote: > Author: marius > Date: Sun Oct 17 16:46:54 2010 > New Revision: 213985 > URL: http://svn.freebsd.org/changeset/base/213985 > > Log: > - In oneshot-mode it doesn't make sense to try to compensate the clock > drift in order to achieve a more stable clock as the tick intervals may > vary in the first place. In fact I haven't seen this code kick in when > in oneshot-mode so just skip it in that case. > - There's no need to explicitly stop the (S)TICK counter in oneshot-mode > with every tick as it just won't trigger again with the (S)TICK compare > register set to a value in the past (with a wrap-around once every ~195 > years of uptime at 1.5 GHz this isn't something we have to worry about > in practice). > - Given that we'll disable interrupts completely anyway there's no > need to enter critical sections. This last is not entirely true. The purpose of the critical section is to prevent the kernel from preempting to the softclock swi thread until all of the hardclock handler has finished execution. Thus, places that actually actually call hardclock() should probably still be wrapped in a critical section. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Mon Oct 18 15:46: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 A9C86106566C; Mon, 18 Oct 2010 15:46:58 +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 97C358FC1A; Mon, 18 Oct 2010 15:46: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 o9IFkwAE076700; Mon, 18 Oct 2010 15:46:58 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9IFkwrR076698; Mon, 18 Oct 2010 15:46:58 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201010181546.o9IFkwrR076698@svn.freebsd.org> From: Ed Maste Date: Mon, 18 Oct 2010 15:46: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: r214025 - 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, 18 Oct 2010 15:46:58 -0000 Author: emaste Date: Mon Oct 18 15:46:58 2010 New Revision: 214025 URL: http://svn.freebsd.org/changeset/base/214025 Log: We've already set p = td->td_proc, so use it. Modified: head/sys/kern/kern_resource.c Modified: head/sys/kern/kern_resource.c ============================================================================== --- head/sys/kern/kern_resource.c Mon Oct 18 14:40:48 2010 (r214024) +++ head/sys/kern/kern_resource.c Mon Oct 18 15:46:58 2010 (r214025) @@ -699,8 +699,8 @@ kern_setrlimit(td, which, limp) if (limp->rlim_max > maxssiz) limp->rlim_max = maxssiz; oldssiz = *alimp; - if (td->td_proc->p_sysent->sv_fixlimit != NULL) - td->td_proc->p_sysent->sv_fixlimit(&oldssiz, + if (p->p_sysent->sv_fixlimit != NULL) + p->p_sysent->sv_fixlimit(&oldssiz, RLIMIT_STACK); break; @@ -722,8 +722,8 @@ kern_setrlimit(td, which, limp) limp->rlim_max = 1; break; } - if (td->td_proc->p_sysent->sv_fixlimit != NULL) - td->td_proc->p_sysent->sv_fixlimit(limp, which); + if (p->p_sysent->sv_fixlimit != NULL) + p->p_sysent->sv_fixlimit(limp, which); *alimp = *limp; p->p_limit = newlim; PROC_UNLOCK(p); From owner-svn-src-head@FreeBSD.ORG Mon Oct 18 16:29: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 198A6106564A; Mon, 18 Oct 2010 16:29:36 +0000 (UTC) (envelope-from rpaulo@freebsd.org) Received: from karen.lavabit.com (karen.lavabit.com [72.249.41.33]) by mx1.freebsd.org (Postfix) with ESMTP id CF57D8FC12; Mon, 18 Oct 2010 16:29:35 +0000 (UTC) Received: from c.earth.lavabit.com (c.earth.lavabit.com [192.168.111.12]) by karen.lavabit.com (Postfix) with ESMTP id F2420157543; Mon, 18 Oct 2010 11:29:34 -0500 (CDT) Received: from rui-macbook.lan (bl17-136-196.dsl.telepac.pt [188.82.136.196]) by lavabit.com with ESMTP id T3LRIH3WZ607; Mon, 18 Oct 2010 11:29:34 -0500 References: <201004091205.o39C5OD5045357@svn.freebsd.org> In-Reply-To: Mime-Version: 1.0 (Apple Message framework v1081) Content-Type: text/plain; charset=us-ascii Message-Id: Content-Transfer-Encoding: quoted-printable From: Rui Paulo Date: Mon, 18 Oct 2010 17:29:31 +0100 To: Paul B Mahol X-Mailer: Apple Mail (2.1081) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r206418 - head/sys/modules/wlan 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, 18 Oct 2010 16:29:36 -0000 On 18 Oct 2010, at 17:23, Paul B Mahol wrote: > On 4/9/10, Rui Paulo wrote: >> Author: rpaulo >> Date: Fri Apr 9 12:05:24 2010 >> New Revision: 206418 >> URL: http://svn.freebsd.org/changeset/base/206418 >>=20 >> Log: >> Add ieee80211_{amrr,rssadapt}.c. >>=20 >=20 > Either revert this or remove amrr and rssadapt modules (IMHO better = option). Why? AMRR is used by many drivers. >> MFC after: 1 month >>=20 >> Modified: >> head/sys/modules/wlan/Makefile >>=20 >> Modified: head/sys/modules/wlan/Makefile >> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=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/modules/wlan/Makefile Fri Apr 9 11:56:38 2010 = (r206417) >> +++ head/sys/modules/wlan/Makefile Fri Apr 9 12:05:24 2010 = (r206418) >> @@ -3,13 +3,13 @@ >> .PATH: ${.CURDIR}/../../net80211 >>=20 >> KMOD=3D wlan >> -SRCS=3D ieee80211.c ieee80211_action.c ieee80211_ageq.c \ >> +SRCS=3D ieee80211.c ieee80211_action.c ieee80211_ageq.c = ieee80211_amrr.c \ >> ieee80211_crypto.c ieee80211_crypto_none.c ieee80211_dfs.c \ >> ieee80211_freebsd.c ieee80211_input.c ieee80211_ioctl.c \ >> ieee80211_mesh.c ieee80211_node.c ieee80211_output.c = ieee80211_phy.c \ >> ieee80211_power.c ieee80211_proto.c ieee80211_scan.c \ >> ieee80211_scan_sta.c ieee80211_radiotap.c ieee80211_ratectl.c \ >> - ieee80211_regdomain.c \ >> + ieee80211_regdomain.c ieee80211_rssadapt.c \ >> ieee80211_ht.c ieee80211_hwmp.c ieee80211_adhoc.c = ieee80211_hostap.c \ >> ieee80211_monitor.c ieee80211_sta.c ieee80211_wds.c = ieee80211_ddb.c >> SRCS+=3D bus_if.h device_if.h opt_inet.h opt_inet6.h opt_ipx.h = opt_wlan.h \ >> _______________________________________________ >> svn-src-head@freebsd.org mailing list >> http://lists.freebsd.org/mailman/listinfo/svn-src-head >> To unsubscribe, send any mail to = "svn-src-head-unsubscribe@freebsd.org" >>=20 >=20 > = __________________________________________________________________________= __________ > Use the link below to report this message as spam. > https://lavabit.com/apps/teacher?sig=3D1413657&key=3D1486363005 > = __________________________________________________________________________= __________ Regards, -- Rui Paulo From owner-svn-src-head@FreeBSD.ORG Mon Oct 18 16:44: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 6F773106566B; Mon, 18 Oct 2010 16:44:28 +0000 (UTC) (envelope-from onemda@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 864978FC0C; Mon, 18 Oct 2010 16:44:27 +0000 (UTC) Received: by wyb38 with SMTP id 38so1494745wyb.13 for ; Mon, 18 Oct 2010 09:44:26 -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=MpaoEIbtzEieogxhv0TOkAKUbmbpdu7rSG+5ixC5ydU=; b=bm388f8v28l5drQZfLGvQD9rbO81n0JuZubDyFuZg4BlqparQO6IoJaOeYn8faBKdl 9sr45rjpSNuAWYflmf5uOiTxFnVG+Z5dtW4jDR0SkxI6ilQ+oZVzbpzGV1aMC5KBhwy9 8fwLb3bdWyXj97DWhqJARBWNq4qpz819divhA= 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=qt8y0WyYPPEieaJb116S4BY1mehl/57kJjH70qRd/6HHgybYN2y1/VVR+U77BRDWmq YtPo3N+FQfnSC30yR+6BCOjKAjrUJz/LulmpAwCwHqKL4R60Q2E3kRplx5SN2YSHUr1h kg+0ABywiLb2ZxmhbQcMw5Bn06q8BVFw0EKQc= MIME-Version: 1.0 Received: by 10.216.37.4 with SMTP id x4mr5579936wea.1.1287420266112; Mon, 18 Oct 2010 09:44:26 -0700 (PDT) Received: by 10.216.87.67 with HTTP; Mon, 18 Oct 2010 09:44:26 -0700 (PDT) In-Reply-To: References: <201004091205.o39C5OD5045357@svn.freebsd.org> Date: Mon, 18 Oct 2010 16:44:26 +0000 Message-ID: From: Paul B Mahol To: Rui Paulo Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r206418 - head/sys/modules/wlan 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, 18 Oct 2010 16:44:28 -0000 On 10/18/10, Rui Paulo wrote: > > On 18 Oct 2010, at 17:23, Paul B Mahol wrote: > >> On 4/9/10, Rui Paulo wrote: >>> Author: rpaulo >>> Date: Fri Apr 9 12:05:24 2010 >>> New Revision: 206418 >>> URL: http://svn.freebsd.org/changeset/base/206418 >>> >>> Log: >>> Add ieee80211_{amrr,rssadapt}.c. >>> >> >> Either revert this or remove amrr and rssadapt modules (IMHO better >> option). > > Why? AMRR is used by many drivers. Try to load wlan_amrr.ko module or wlan_rssadapt.ko module while wlan.ko module is already loaded. > >>> MFC after: 1 month >>> >>> Modified: >>> head/sys/modules/wlan/Makefile >>> >>> Modified: head/sys/modules/wlan/Makefile >>> ============================================================================== >>> --- head/sys/modules/wlan/Makefile Fri Apr 9 11:56:38 2010 (r206417) >>> +++ head/sys/modules/wlan/Makefile Fri Apr 9 12:05:24 2010 (r206418) >>> @@ -3,13 +3,13 @@ >>> .PATH: ${.CURDIR}/../../net80211 >>> >>> KMOD= wlan >>> -SRCS= ieee80211.c ieee80211_action.c ieee80211_ageq.c \ >>> +SRCS= ieee80211.c ieee80211_action.c ieee80211_ageq.c ieee80211_amrr.c \ >>> ieee80211_crypto.c ieee80211_crypto_none.c ieee80211_dfs.c \ >>> ieee80211_freebsd.c ieee80211_input.c ieee80211_ioctl.c \ >>> ieee80211_mesh.c ieee80211_node.c ieee80211_output.c ieee80211_phy.c \ >>> ieee80211_power.c ieee80211_proto.c ieee80211_scan.c \ >>> ieee80211_scan_sta.c ieee80211_radiotap.c ieee80211_ratectl.c \ >>> - ieee80211_regdomain.c \ >>> + ieee80211_regdomain.c ieee80211_rssadapt.c \ >>> ieee80211_ht.c ieee80211_hwmp.c ieee80211_adhoc.c ieee80211_hostap.c \ >>> ieee80211_monitor.c ieee80211_sta.c ieee80211_wds.c ieee80211_ddb.c >>> SRCS+= bus_if.h device_if.h opt_inet.h opt_inet6.h opt_ipx.h opt_wlan.h \ >>> _______________________________________________ >>> svn-src-head@freebsd.org mailing list >>> http://lists.freebsd.org/mailman/listinfo/svn-src-head >>> To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" >>> >> >> ____________________________________________________________________________________ >> Use the link below to report this message as spam. >> https://lavabit.com/apps/teacher?sig=1413657&key=1486363005 >> ____________________________________________________________________________________ > > Regards, > -- > Rui Paulo > > > From owner-svn-src-head@FreeBSD.ORG Mon Oct 18 16:49: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 8DBFD1065673; Mon, 18 Oct 2010 16:49:26 +0000 (UTC) (envelope-from onemda@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 CBAC18FC3E; Mon, 18 Oct 2010 16:49:25 +0000 (UTC) Received: by wwb13 with SMTP id 13so512295wwb.31 for ; Mon, 18 Oct 2010 09:49:24 -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=xg38ioETs0xftorO1cb4EFzxUTLkDezdPtyaC457ZBk=; b=JM+FRJeFgAGLM6gancFiYht6FVY3HhxFqzXnVYedoO0G4g7bN7Fmq6gpWj1LgmVb7E ZBlLPAzGQfu4a1vuIlLlwpzJy0sjVkj1JEt1MDWCWTJ9f466LVTrQ2pGuIFwmNOvLSvE nN5Ag1H46+AVfH6OhchezrYxEbrQDCqZl0Rxs= 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=vqggQfZRyys/4kXOumkUsBHRP30WaKjF6LRVzTECx4Dr77rc482O8m35lYpGPO39JM 718toQI+C7ZLA2bEc/9bY3ypCAHqKTeHtVlxpWDzLeXPC9mUdKierIDbp30RlyXxhKYi oqu6IYzgMkvu+vle2M4BsEmlVT7WqGFxt5cBA= MIME-Version: 1.0 Received: by 10.216.58.209 with SMTP id q59mr5496439wec.41.1287419030922; Mon, 18 Oct 2010 09:23:50 -0700 (PDT) Received: by 10.216.87.67 with HTTP; Mon, 18 Oct 2010 09:23:50 -0700 (PDT) In-Reply-To: <201004091205.o39C5OD5045357@svn.freebsd.org> References: <201004091205.o39C5OD5045357@svn.freebsd.org> Date: Mon, 18 Oct 2010 16:23:50 +0000 Message-ID: From: Paul B Mahol To: Rui Paulo Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r206418 - head/sys/modules/wlan 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, 18 Oct 2010 16:49:26 -0000 On 4/9/10, Rui Paulo wrote: > Author: rpaulo > Date: Fri Apr 9 12:05:24 2010 > New Revision: 206418 > URL: http://svn.freebsd.org/changeset/base/206418 > > Log: > Add ieee80211_{amrr,rssadapt}.c. > Either revert this or remove amrr and rssadapt modules (IMHO better option). > MFC after: 1 month > > Modified: > head/sys/modules/wlan/Makefile > > Modified: head/sys/modules/wlan/Makefile > ============================================================================== > --- head/sys/modules/wlan/Makefile Fri Apr 9 11:56:38 2010 (r206417) > +++ head/sys/modules/wlan/Makefile Fri Apr 9 12:05:24 2010 (r206418) > @@ -3,13 +3,13 @@ > .PATH: ${.CURDIR}/../../net80211 > > KMOD= wlan > -SRCS= ieee80211.c ieee80211_action.c ieee80211_ageq.c \ > +SRCS= ieee80211.c ieee80211_action.c ieee80211_ageq.c ieee80211_amrr.c \ > ieee80211_crypto.c ieee80211_crypto_none.c ieee80211_dfs.c \ > ieee80211_freebsd.c ieee80211_input.c ieee80211_ioctl.c \ > ieee80211_mesh.c ieee80211_node.c ieee80211_output.c ieee80211_phy.c \ > ieee80211_power.c ieee80211_proto.c ieee80211_scan.c \ > ieee80211_scan_sta.c ieee80211_radiotap.c ieee80211_ratectl.c \ > - ieee80211_regdomain.c \ > + ieee80211_regdomain.c ieee80211_rssadapt.c \ > ieee80211_ht.c ieee80211_hwmp.c ieee80211_adhoc.c ieee80211_hostap.c \ > ieee80211_monitor.c ieee80211_sta.c ieee80211_wds.c ieee80211_ddb.c > SRCS+= bus_if.h device_if.h opt_inet.h opt_inet6.h opt_ipx.h opt_wlan.h \ > _______________________________________________ > svn-src-head@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" > From owner-svn-src-head@FreeBSD.ORG Mon Oct 18 19:06: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 C2F921065670; Mon, 18 Oct 2010 19:06:18 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (alchemy.franken.de [194.94.249.214]) by mx1.freebsd.org (Postfix) with ESMTP id 2DA888FC15; Mon, 18 Oct 2010 19:06:17 +0000 (UTC) Received: from alchemy.franken.de (localhost [127.0.0.1]) by alchemy.franken.de (8.14.4/8.14.4/ALCHEMY.FRANKEN.DE) with ESMTP id o9IJ6Fbt034678; Mon, 18 Oct 2010 21:06:15 +0200 (CEST) (envelope-from marius@alchemy.franken.de) Received: (from marius@localhost) by alchemy.franken.de (8.14.4/8.14.4/Submit) id o9IJ6FUV034677; Mon, 18 Oct 2010 21:06:15 +0200 (CEST) (envelope-from marius) Date: Mon, 18 Oct 2010 21:06:15 +0200 From: Marius Strobl To: John Baldwin Message-ID: <20101018190615.GL1416@alchemy.franken.de> References: <201010171646.o9HGks2U038501@svn.freebsd.org> <201010181003.13045.jhb@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201010181003.13045.jhb@freebsd.org> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r213985 - 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, 18 Oct 2010 19:06:18 -0000 On Mon, Oct 18, 2010 at 10:03:12AM -0400, John Baldwin wrote: > On Sunday, October 17, 2010 12:46:54 pm Marius Strobl wrote: > > Author: marius > > Date: Sun Oct 17 16:46:54 2010 > > New Revision: 213985 > > URL: http://svn.freebsd.org/changeset/base/213985 > > > > Log: > > - In oneshot-mode it doesn't make sense to try to compensate the clock > > drift in order to achieve a more stable clock as the tick intervals may > > vary in the first place. In fact I haven't seen this code kick in when > > in oneshot-mode so just skip it in that case. > > - There's no need to explicitly stop the (S)TICK counter in oneshot-mode > > with every tick as it just won't trigger again with the (S)TICK compare > > register set to a value in the past (with a wrap-around once every ~195 > > years of uptime at 1.5 GHz this isn't something we have to worry about > > in practice). > > - Given that we'll disable interrupts completely anyway there's no > > need to enter critical sections. > > This last is not entirely true. The purpose of the critical section is to > prevent the kernel from preempting to the softclock swi thread until all of > the hardclock handler has finished execution. Thus, places that actually > actually call hardclock() should probably still be wrapped in a critical > section. > It's currently unclear to me how on architectures converted to the event timer world order hardclock() is called eventually but in any case shouldn't it be the responsibility of the code actually calling it (or the equivalent code) to wrap it in a critical section instead then? After all the MD part just enrolls in calling _something_ in one-shot and/or periodic mode without knowing what it actually calls (and IMO it also should no longer need to). In handleevents() of kern_clocksource.c hardclock_anycpu() is called so i think that is what actually needs to be wrapped in a critical section. Marius From owner-svn-src-head@FreeBSD.ORG Mon Oct 18 19:06: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 498821065672; Mon, 18 Oct 2010 19:06:47 +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 2CEA78FC22; Mon, 18 Oct 2010 19:06: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 o9IJ6k0c082158; Mon, 18 Oct 2010 19:06:46 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9IJ6k6G082153; Mon, 18 Oct 2010 19:06:46 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201010181906.o9IJ6k6G082153@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 18 Oct 2010 19:06: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: r214026 - 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: Mon, 18 Oct 2010 19:06:47 -0000 Author: kib Date: Mon Oct 18 19:06:46 2010 New Revision: 214026 URL: http://svn.freebsd.org/changeset/base/214026 Log: Do not synchronously start the nfsiod threads at all. The r212506 fixed the issues with file descriptor locks, but the same problems are present for vnode lock/user map lock. If the nfs_asyncio() cannot find the free nfsiod, schedule task to create new nfsiod and return error. This causes fall back to the synchronous i/o for nfs_strategy(), or does not start read at all in the case of readahead. The caller that holds vnode and potentially user map lock does not wait for kproc_create() to finish, preventing the LORs. The change effectively reverts r203072, because we never hand off the request to newly created nfsiod thread anymore. Reviewed by: jhb Tested by: jhb, pluknet MFC after: 3 weeks Modified: head/sys/nfsclient/nfs.h head/sys/nfsclient/nfs_bio.c head/sys/nfsclient/nfs_nfsiod.c head/sys/nfsclient/nfsnode.h Modified: head/sys/nfsclient/nfs.h ============================================================================== --- head/sys/nfsclient/nfs.h Mon Oct 18 15:46:58 2010 (r214025) +++ head/sys/nfsclient/nfs.h Mon Oct 18 19:06:46 2010 (r214026) @@ -253,7 +253,7 @@ int nfs_writerpc(struct vnode *, struct int nfs_commit(struct vnode *vp, u_quad_t offset, int cnt, struct ucred *cred, struct thread *td); int nfs_readdirrpc(struct vnode *, struct uio *, struct ucred *); -int nfs_nfsiodnew(int); +void nfs_nfsiodnew(void); void nfs_nfsiodnew_tq(__unused void *, int); int nfs_asyncio(struct nfsmount *, struct buf *, struct ucred *, struct thread *); int nfs_doio(struct vnode *, struct buf *, struct ucred *, struct thread *); Modified: head/sys/nfsclient/nfs_bio.c ============================================================================== --- head/sys/nfsclient/nfs_bio.c Mon Oct 18 15:46:58 2010 (r214025) +++ head/sys/nfsclient/nfs_bio.c Mon Oct 18 19:06:46 2010 (r214026) @@ -1375,13 +1375,9 @@ again: /* * Try to create one if none are free. */ - if (!gotiod) { - iod = nfs_nfsiodnew(1); - if (iod != -1) - gotiod = TRUE; - } - - if (gotiod) { + if (!gotiod) + nfs_nfsiodnew(); + else { /* * Found one, so wake it up and tell it which * mount to process. @@ -1401,7 +1397,7 @@ again: if (!gotiod) { if (nmp->nm_bufqiods > 0) { NFS_DPF(ASYNCIO, - ("nfs_asyncio: %d iods are already processing mount %p\n", + ("nfs_asyncio: %d iods are already processing mount %p\n", nmp->nm_bufqiods, nmp)); gotiod = TRUE; } @@ -1416,9 +1412,9 @@ again: * Ensure that the queue never grows too large. We still want * to asynchronize so we block rather then return EIO. */ - while (nmp->nm_bufqlen >= 2*nfs_numasync) { + while (nmp->nm_bufqlen >= 2 * nfs_numasync) { NFS_DPF(ASYNCIO, - ("nfs_asyncio: waiting for mount %p queue to drain\n", nmp)); + ("nfs_asyncio: waiting for mount %p queue to drain\n", nmp)); nmp->nm_bufqwant = TRUE; error = nfs_msleep(td, &nmp->nm_bufq, &nfs_iod_mtx, slpflag | PRIBIO, @@ -1426,7 +1422,7 @@ again: if (error) { error2 = nfs_sigintr(nmp, td); if (error2) { - mtx_unlock(&nfs_iod_mtx); + mtx_unlock(&nfs_iod_mtx); return (error2); } if (slpflag == NFS_PCATCH) { @@ -1438,17 +1434,13 @@ again: * We might have lost our iod while sleeping, * so check and loop if nescessary. */ - if (nmp->nm_bufqiods == 0) { - NFS_DPF(ASYNCIO, - ("nfs_asyncio: no iods after mount %p queue was drained, looping\n", nmp)); - goto again; - } + goto again; } /* We might have lost our nfsiod */ if (nmp->nm_bufqiods == 0) { NFS_DPF(ASYNCIO, - ("nfs_asyncio: no iods after mount %p queue was drained, looping\n", nmp)); +("nfs_asyncio: no iods after mount %p queue was drained, looping\n", nmp)); goto again; } Modified: head/sys/nfsclient/nfs_nfsiod.c ============================================================================== --- head/sys/nfsclient/nfs_nfsiod.c Mon Oct 18 15:46:58 2010 (r214025) +++ head/sys/nfsclient/nfs_nfsiod.c Mon Oct 18 19:06:46 2010 (r214026) @@ -76,16 +76,6 @@ static MALLOC_DEFINE(M_NFSSVC, "nfsclien static void nfssvc_iod(void *); -struct nfsiod_str { - STAILQ_ENTRY(nfsiod_str) ni_links; - int *ni_inst; - int ni_iod; - int ni_error; - int ni_done; -}; -static STAILQ_HEAD(, nfsiod_str) nfsiodhead = - STAILQ_HEAD_INITIALIZER(nfsiodhead); - static int nfs_asyncdaemon[NFS_MAXASYNCDAEMON]; SYSCTL_DECL(_vfs_nfs); @@ -101,6 +91,8 @@ unsigned int nfs_iodmax = 20; /* Minimum number of nfsiod kthreads to keep as spares */ static unsigned int nfs_iodmin = 0; +static int nfs_nfsiodnew_sync(void); + static int sysctl_iodmin(SYSCTL_HANDLER_ARGS) { @@ -124,7 +116,7 @@ sysctl_iodmin(SYSCTL_HANDLER_ARGS) * than the new minimum, create some more. */ for (i = nfs_iodmin - nfs_numasync; i > 0; i--) - nfs_nfsiodnew(0); + nfs_nfsiodnew_sync(); out: mtx_unlock(&nfs_iod_mtx); return (0); @@ -170,68 +162,55 @@ SYSCTL_PROC(_vfs_nfs, OID_AUTO, iodmax, sizeof (nfs_iodmax), sysctl_iodmax, "IU", "Max number of nfsiod kthreads"); +static int +nfs_nfsiodnew_sync(void) +{ + int error, i; + + mtx_assert(&nfs_iod_mtx, MA_OWNED); + for (i = 0; i < nfs_iodmax; i++) { + if (nfs_asyncdaemon[i] == 0) { + nfs_asyncdaemon[i] = 1; + break; + } + } + if (i == nfs_iodmax) + return (0); + mtx_unlock(&nfs_iod_mtx); + error = kproc_create(nfssvc_iod, nfs_asyncdaemon + i, NULL, + RFHIGHPID, 0, "nfsiod %d", i); + mtx_lock(&nfs_iod_mtx); + if (error == 0) { + nfs_numasync++; + nfs_iodwant[i] = NFSIOD_AVAILABLE; + } else + nfs_asyncdaemon[i] = 0; + return (error); +} + void nfs_nfsiodnew_tq(__unused void *arg, int pending) { - struct nfsiod_str *nip; mtx_lock(&nfs_iod_mtx); - while ((nip = STAILQ_FIRST(&nfsiodhead)) != NULL) { - STAILQ_REMOVE_HEAD(&nfsiodhead, ni_links); - mtx_unlock(&nfs_iod_mtx); - nip->ni_error = kproc_create(nfssvc_iod, nip->ni_inst, NULL, - RFHIGHPID, 0, "nfsiod %d", nip->ni_iod); - nip->ni_done = 1; - mtx_lock(&nfs_iod_mtx); - wakeup(nip); + while (pending > 0) { + pending--; + nfs_nfsiodnew_sync(); } mtx_unlock(&nfs_iod_mtx); } -int -nfs_nfsiodnew(int set_iodwant) +void +nfs_nfsiodnew(void) { - int error, i; - int newiod; - struct nfsiod_str *nip; - if (nfs_numasync >= nfs_iodmax) - return (-1); - newiod = -1; - for (i = 0; i < nfs_iodmax; i++) - if (nfs_asyncdaemon[i] == 0) { - nfs_asyncdaemon[i]++; - newiod = i; - break; - } - if (newiod == -1) - return (-1); - if (set_iodwant > 0) - nfs_iodwant[i] = NFSIOD_CREATED_FOR_NFS_ASYNCIO; - mtx_unlock(&nfs_iod_mtx); - nip = malloc(sizeof(*nip), M_TEMP, M_WAITOK | M_ZERO); - nip->ni_inst = nfs_asyncdaemon + i; - nip->ni_iod = newiod; - mtx_lock(&nfs_iod_mtx); - STAILQ_INSERT_TAIL(&nfsiodhead, nip, ni_links); + mtx_assert(&nfs_iod_mtx, MA_OWNED); taskqueue_enqueue(taskqueue_thread, &nfs_nfsiodnew_task); - while (!nip->ni_done) - mtx_sleep(nip, &nfs_iod_mtx, 0, "niwt", 0); - error = nip->ni_error; - free(nip, M_TEMP); - if (error) { - if (set_iodwant > 0) - nfs_iodwant[i] = NFSIOD_NOT_AVAILABLE; - return (-1); - } - nfs_numasync++; - return (newiod); } static void nfsiod_setup(void *dummy) { - int i; int error; TUNABLE_INT_FETCH("vfs.nfs.iodmin", &nfs_iodmin); @@ -240,8 +219,8 @@ nfsiod_setup(void *dummy) if (nfs_iodmin > NFS_MAXASYNCDAEMON) nfs_iodmin = NFS_MAXASYNCDAEMON; - for (i = 0; i < nfs_iodmin; i++) { - error = nfs_nfsiodnew(0); + while (nfs_numasync < nfs_iodmin) { + error = nfs_nfsiodnew_sync(); if (error == -1) panic("nfsiod_setup: nfs_nfsiodnew failed"); } Modified: head/sys/nfsclient/nfsnode.h ============================================================================== --- head/sys/nfsclient/nfsnode.h Mon Oct 18 15:46:58 2010 (r214025) +++ head/sys/nfsclient/nfsnode.h Mon Oct 18 19:06:46 2010 (r214026) @@ -165,16 +165,13 @@ struct nfsnode { #define NFS_TIMESPEC_COMPARE(T1, T2) (((T1)->tv_sec != (T2)->tv_sec) || ((T1)->tv_nsec != (T2)->tv_nsec)) /* - * NFS iod threads can be in one of these three states once spawned. + * NFS iod threads can be in one of these two states once spawned. * NFSIOD_NOT_AVAILABLE - Cannot be assigned an I/O operation at this time. * NFSIOD_AVAILABLE - Available to be assigned an I/O operation. - * NFSIOD_CREATED_FOR_NFS_ASYNCIO - Newly created for nfs_asyncio() and - * will be used by the thread that called nfs_asyncio(). */ enum nfsiod_state { NFSIOD_NOT_AVAILABLE = 0, NFSIOD_AVAILABLE = 1, - NFSIOD_CREATED_FOR_NFS_ASYNCIO = 2, }; /* From owner-svn-src-head@FreeBSD.ORG Mon Oct 18 19:14:59 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 AFCA81065694; Mon, 18 Oct 2010 19:14:59 +0000 (UTC) (envelope-from culot@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9DA2C8FC15; Mon, 18 Oct 2010 19:14: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 o9IJExF8082420; Mon, 18 Oct 2010 19:14:59 GMT (envelope-from culot@svn.freebsd.org) Received: (from culot@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9IJEx9W082418; Mon, 18 Oct 2010 19:14:59 GMT (envelope-from culot@svn.freebsd.org) Message-Id: <201010181914.o9IJEx9W082418@svn.freebsd.org> From: Frederic Culot Date: Mon, 18 Oct 2010 19:14: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: r214027 - head/usr.bin/calendar/calendars 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, 18 Oct 2010 19:14:59 -0000 Author: culot (ports committer) Date: Mon Oct 18 19:14:59 2010 New Revision: 214027 URL: http://svn.freebsd.org/changeset/base/214027 Log: Replace spaces by a tab after the date. Reported by: gavin@, brucec@ Approved by: sahil@ (mentor) Modified: head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/usr.bin/calendar/calendars/calendar.freebsd ============================================================================== --- head/usr.bin/calendar/calendars/calendar.freebsd Mon Oct 18 19:06:46 2010 (r214026) +++ head/usr.bin/calendar/calendars/calendar.freebsd Mon Oct 18 19:14:59 2010 (r214027) @@ -302,7 +302,7 @@ 11/19 Konstantin Belousov born in Kiev, USSR, 1972 11/20 Dmitry Morozovsky born in Moscow, USSR, 1968 11/20 Gavin Atkinson born in Middlesbrough, United Kingdom, 1979 -11/22 Frederic Culot born in Saint-Germain-En-Laye, France, 1976 +11/22 Frederic Culot born in Saint-Germain-En-Laye, France, 1976 11/23 Josef Lawrence Karthauser born in Pembury, Kent, United Kingdom, 1972 11/24 Andrey Zakhvatov born in Chelyabinsk, Russian Federation, 1974 11/24 Daniel Gerzo born in Bratislava, Slovakia, 1986 From owner-svn-src-head@FreeBSD.ORG Mon Oct 18 19:17: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 D79BE1065672; Mon, 18 Oct 2010 19:17:26 +0000 (UTC) (envelope-from sahil@tandon.net) Received: from spartan.hamla.org (spartan.hamla.org [206.251.255.30]) by mx1.freebsd.org (Postfix) with ESMTP id ACDA38FC0C; Mon, 18 Oct 2010 19:17:26 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by spartan.hamla.org (Postfix) with ESMTP id 0C09617131; Mon, 18 Oct 2010 15:02:08 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tandon.net; h= date:date:subject:subject:from:from:x-mailer:message-id :content-type:content-type:content-transfer-encoding :mime-version:in-reply-to:references:received:received; s=aegis; t=1287428527; bh=LxHCZtNh/ec0i9wS4IOjKdVRncCwFkL1vYJmyUDT8gE=; b= YgsXJYuT8RxeBd6OnKjxrwhEjVxR3fnWNrnenlaGnf1feY+FKvNzIsPcxxNJSBc6 r2e3NkmfG/S433Nb+6yT1Ya2QrbZE7c2PqNm73197iJPRhkNtLxqrHab4ez+IsEf xT1sFNvZa0cB0YaJXEKQott0sRcZyfkn/Mb19XVnJUo= X-Virus-Scanned: by ClamAV at spartan.hamla.org Received: from spartan.hamla.org ([127.0.0.1]) by localhost (spartan.hamla.org [127.0.0.1]) (amavisd-new, port 10027) with LMTP id CODF-hAwRC1j; Mon, 18 Oct 2010 15:02:07 -0400 (EDT) Received: from [10.58.152.112] (mobile-166-137-139-251.mycingular.net [166.137.139.251]) by spartan.hamla.org (Postfix) with ESMTPSA id 6675F17088; Mon, 18 Oct 2010 15:02:00 -0400 (EDT) References: <201010171902.o9HJ2gjw042593@svn.freebsd.org> <1287402069.73576.24.camel@buffy.york.ac.uk> <20101018131006.000062b8@unknown> In-Reply-To: <20101018131006.000062b8@unknown> Mime-Version: 1.0 (iPhone Mail 8A293) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Message-Id: <7B468C67-9442-4977-B098-AEC00A818B37@tandon.net> X-Mailer: iPhone Mail (8A293) From: Sahil Tandon Date: Mon, 18 Oct 2010 15:01:07 -0400 To: Bruce Cran Cc: "svn-src-head@FreeBSD.org" , Frederic Culot , "svn-src-all@FreeBSD.org" , Gavin Atkinson , "src-committers@FreeBSD.org" Subject: Re: svn commit: r213990 - head/usr.bin/calendar/calendars 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, 18 Oct 2010 19:17:26 -0000 On Oct 18, 2010, at 8:10 AM, Bruce Cran wrote: > On Mon, 18 Oct 2010 12:41:09 +0100 > Gavin Atkinson wrote: >=20 >> It looks like you've accidentally added an extra space between the >> date and your name. >=20 > I think there should be a single tab This is my fault; in my haste, I missed this. culot@ will commit the correc= ted version shortly. Sorry everyone.= From owner-svn-src-head@FreeBSD.ORG Mon Oct 18 19:23: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 DDE20106566C; Mon, 18 Oct 2010 19:23:00 +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 AB82B8FC12; Mon, 18 Oct 2010 19:23:00 +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 113A946B82; Mon, 18 Oct 2010 15:23:00 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 035378A009; Mon, 18 Oct 2010 15:22:58 -0400 (EDT) From: John Baldwin To: Marius Strobl Date: Mon, 18 Oct 2010 15:22:47 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100819; KDE/4.4.5; amd64; ; ) References: <201010171646.o9HGks2U038501@svn.freebsd.org> <201010181003.13045.jhb@freebsd.org> <20101018190615.GL1416@alchemy.franken.de> In-Reply-To: <20101018190615.GL1416@alchemy.franken.de> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201010181522.47714.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Mon, 18 Oct 2010 15:22: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: r213985 - 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, 18 Oct 2010 19:23:01 -0000 On Monday, October 18, 2010 3:06:15 pm Marius Strobl wrote: > On Mon, Oct 18, 2010 at 10:03:12AM -0400, John Baldwin wrote: > > On Sunday, October 17, 2010 12:46:54 pm Marius Strobl wrote: > > > Author: marius > > > Date: Sun Oct 17 16:46:54 2010 > > > New Revision: 213985 > > > URL: http://svn.freebsd.org/changeset/base/213985 > > > > > > Log: > > > - In oneshot-mode it doesn't make sense to try to compensate the clock > > > drift in order to achieve a more stable clock as the tick intervals may > > > vary in the first place. In fact I haven't seen this code kick in when > > > in oneshot-mode so just skip it in that case. > > > - There's no need to explicitly stop the (S)TICK counter in oneshot-mode > > > with every tick as it just won't trigger again with the (S)TICK compare > > > register set to a value in the past (with a wrap-around once every ~195 > > > years of uptime at 1.5 GHz this isn't something we have to worry about > > > in practice). > > > - Given that we'll disable interrupts completely anyway there's no > > > need to enter critical sections. > > > > This last is not entirely true. The purpose of the critical section is to > > prevent the kernel from preempting to the softclock swi thread until all of > > the hardclock handler has finished execution. Thus, places that actually > > actually call hardclock() should probably still be wrapped in a critical > > section. > > > > It's currently unclear to me how on architectures converted to the > event timer world order hardclock() is called eventually but in any case > shouldn't it be the responsibility of the code actually calling it (or > the equivalent code) to wrap it in a critical section instead then? After > all the MD part just enrolls in calling _something_ in one-shot and/or > periodic mode without knowing what it actually calls (and IMO it also > should no longer need to). In handleevents() of kern_clocksource.c > hardclock_anycpu() is called so i think that is what actually needs to > be wrapped in a critical section. Hmm, we've previously done the critical section in the MD code instead of in hardclock() itself so that if a timer needed to be reprogrammed or interrupt acknowledged as much of that as possible could happen before being preempted (or put another way, the preemption to softclock was deferred until all that stuff had completed). I don't know if handleevents() is at a sufficient level to know for certain that everything is done such that it is safe to preempt when critical_exit() is invoked. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Mon Oct 18 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 2092E106564A; Mon, 18 Oct 2010 20:18:26 +0000 (UTC) (envelope-from pgollucci@p6m7g8.com) Received: from cell.p6m7g8.net (static-71-178-236-107.washdc.fios.verizon.net [71.178.236.107]) by mx1.freebsd.org (Postfix) with ESMTP id AA1118FC0C; Mon, 18 Oct 2010 20:18:25 +0000 (UTC) Received: from philip.hq.rws (wsip-174-79-184-239.dc.dc.cox.net [174.79.184.239]) (authenticated bits=0) by cell.p6m7g8.net (8.14.4/8.14.3) with ESMTP id o9IJur46052331 (version=TLSv1/SSLv3 cipher=DHE-DSS-CAMELLIA256-SHA bits=256 verify=NO); Mon, 18 Oct 2010 19:56:53 GMT (envelope-from pgollucci@p6m7g8.com) Message-ID: <4CBCA685.4030009@p6m7g8.com> Date: Mon, 18 Oct 2010 19:56:53 +0000 From: "Philip M. Gollucci" Organization: P6M7G8 Inc. User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.1.12) Gecko/20100908 Thunderbird/3.0.7 MIME-Version: 1.0 To: Frederic Culot References: <201010171902.o9HJ2gjw042593@svn.freebsd.org> In-Reply-To: <201010171902.o9HJ2gjw042593@svn.freebsd.org> X-Enigmail-Version: 1.0.1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,RDNS_DYNAMIC autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on cell.p6m7g8.net Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r213990 - head/usr.bin/calendar/calendars 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, 18 Oct 2010 20:18:26 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 10/17/10 19:02, Frederic Culot wrote: > Author: culot (ports committer) > Date: Sun Oct 17 19:02:42 2010 > New Revision: 213990 > URL: http://svn.freebsd.org/changeset/base/213990 > > Log: > Add myself to calendar.freebsd. > > Approved by: sahil@ (mentor) > > Modified: > head/usr.bin/calendar/calendars/calendar.freebsd > > Modified: head/usr.bin/calendar/calendars/calendar.freebsd > ============================================================================== > --- head/usr.bin/calendar/calendars/calendar.freebsd Sun Oct 17 18:49:45 2010 (r213989) > +++ head/usr.bin/calendar/calendars/calendar.freebsd Sun Oct 17 19:02:42 2010 (r213990) > @@ -302,6 +302,7 @@ > 11/19 Konstantin Belousov born in Kiev, USSR, 1972 > 11/20 Dmitry Morozovsky born in Moscow, USSR, 1968 > 11/20 Gavin Atkinson born in Middlesbrough, United Kingdom, 1979 > +11/22 Frederic Culot born in Saint-Germain-En-Laye, France, 1976 Minor whitespace glitch. Welcome! - -- - ------------------------------------------------------------------------ 1024D/DB9B8C1C B90B FBC3 A3A1 C71A 8E70 3F8C 75B8 8FFB DB9B 8C1C Philip M. Gollucci (pgollucci@p6m7g8.com) c: 703.336.9354 VP Apache Infrastructure; Member, Apache Software Foundation Committer, FreeBSD Foundation Consultant, P6M7G8 Inc. Sr. System Admin, Ridecharge Inc. Work like you don't need the money, love like you'll never get hurt, and dance like nobody's watching. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (FreeBSD) iD8DBQFMvKaFdbiP+9ubjBwRAhCbAJ98GMXOcfJMKQg5BLHOguUJmmyC/QCeIuyT lw5XUNU/9aYhV4pZQQ2JpZI= =BtB8 -----END PGP SIGNATURE----- From owner-svn-src-head@FreeBSD.ORG Mon Oct 18 20:28: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 4052A106564A; Mon, 18 Oct 2010 20:28:20 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-bw0-f54.google.com (mail-bw0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id 390D58FC0C; Mon, 18 Oct 2010 20:28:18 +0000 (UTC) Received: by bwz16 with SMTP id 16so50430bwz.13 for ; Mon, 18 Oct 2010 13:28: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=1yO7oI4ob14StQJvo3N913YV9ZuB7WiFOsNsXlLLLBs=; b=UHY5YpGNqVc7dioo7hWQ+rEwziNud9igdTSwPzyeU7rLGE3LVBft1cOhnNed9jSSrs QSn9D4XaB8L0vqLRKFZQWylNNmNULRjSsbEo750Ap0oZ7rC2FhVAP/msqUrheWVSlrSP /pw5peWVRp6iVIHvyB9NV/47U9nV4Hqsg2DxY= 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=a9IvMnnkgFNyGjgbOjOrUY2Oz3+rE9LWSmLa+nDMYtOTf8yafyzoB4RyOMWHj1Foia xB/Zq9/INIfRvRrqXHDbAtGL9kaDhacyoSN5VDNDFm0T1qeP+TtGjJl9aw6f21yxUBPB n6U+1AOl89dBgmXC3Zm9ydQeqIdGMYVg4sHnw= Received: by 10.204.24.144 with SMTP id v16mr4817449bkb.137.1287433696962; Mon, 18 Oct 2010 13:28:16 -0700 (PDT) Received: from mavbook.mavhome.dp.ua (pc.mavhome.dp.ua [212.86.226.226]) by mx.google.com with ESMTPS id 4sm14496041bki.1.2010.10.18.13.28.14 (version=SSLv3 cipher=RC4-MD5); Mon, 18 Oct 2010 13:28:15 -0700 (PDT) Sender: Alexander Motin Message-ID: <4CBCADDD.5070109@FreeBSD.org> Date: Mon, 18 Oct 2010 23:28:13 +0300 From: Alexander Motin User-Agent: Thunderbird 2.0.0.24 (X11/20100402) MIME-Version: 1.0 To: Marius Strobl References: <201010171646.o9HGks2U038501@svn.freebsd.org> <201010181003.13045.jhb@freebsd.org> <20101018190615.GL1416@alchemy.franken.de> In-Reply-To: <20101018190615.GL1416@alchemy.franken.de> X-Enigmail-Version: 0.96.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, John Baldwin Subject: Re: svn commit: r213985 - 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, 18 Oct 2010 20:28:20 -0000 Marius Strobl wrote: > On Mon, Oct 18, 2010 at 10:03:12AM -0400, John Baldwin wrote: >> On Sunday, October 17, 2010 12:46:54 pm Marius Strobl wrote: >>> Author: marius >>> Date: Sun Oct 17 16:46:54 2010 >>> New Revision: 213985 >>> URL: http://svn.freebsd.org/changeset/base/213985 >>> >>> Log: >>> - In oneshot-mode it doesn't make sense to try to compensate the clock >>> drift in order to achieve a more stable clock as the tick intervals may >>> vary in the first place. In fact I haven't seen this code kick in when >>> in oneshot-mode so just skip it in that case. >>> - There's no need to explicitly stop the (S)TICK counter in oneshot-mode >>> with every tick as it just won't trigger again with the (S)TICK compare >>> register set to a value in the past (with a wrap-around once every ~195 >>> years of uptime at 1.5 GHz this isn't something we have to worry about >>> in practice). >>> - Given that we'll disable interrupts completely anyway there's no >>> need to enter critical sections. >> This last is not entirely true. The purpose of the critical section is to >> prevent the kernel from preempting to the softclock swi thread until all of >> the hardclock handler has finished execution. Thus, places that actually >> actually call hardclock() should probably still be wrapped in a critical >> section. > > It's currently unclear to me how on architectures converted to the > event timer world order hardclock() is called eventually but in any case > shouldn't it be the responsibility of the code actually calling it (or > the equivalent code) to wrap it in a critical section instead then? After > all the MD part just enrolls in calling _something_ in one-shot and/or > periodic mode without knowing what it actually calls (and IMO it also > should no longer need to). In handleevents() of kern_clocksource.c > hardclock_anycpu() is called so i think that is what actually needs to > be wrapped in a critical section. At this time on most (all?) platforms critical section is grabbed by MD interrupt code. It is important to be there, as soon as there touched td_intr_nesting_level and td_intr_frame fields of curthread. We can't allow thread migration until all counted interrupt handlers complete. -- Alexander Motin From owner-svn-src-head@FreeBSD.ORG Mon Oct 18 20:52: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 BBC5D106564A; Mon, 18 Oct 2010 20:52:26 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (alchemy.franken.de [194.94.249.214]) by mx1.freebsd.org (Postfix) with ESMTP id 1D3AC8FC17; Mon, 18 Oct 2010 20:52:25 +0000 (UTC) Received: from alchemy.franken.de (localhost [127.0.0.1]) by alchemy.franken.de (8.14.4/8.14.4/ALCHEMY.FRANKEN.DE) with ESMTP id o9IKqOjs035128; Mon, 18 Oct 2010 22:52:25 +0200 (CEST) (envelope-from marius@alchemy.franken.de) Received: (from marius@localhost) by alchemy.franken.de (8.14.4/8.14.4/Submit) id o9IKqOuH035127; Mon, 18 Oct 2010 22:52:24 +0200 (CEST) (envelope-from marius) Date: Mon, 18 Oct 2010 22:52:24 +0200 From: Marius Strobl To: Alexander Motin Message-ID: <20101018205224.GO1416@alchemy.franken.de> References: <201010171646.o9HGks2U038501@svn.freebsd.org> <201010181003.13045.jhb@freebsd.org> <20101018190615.GL1416@alchemy.franken.de> <4CBCADDD.5070109@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4CBCADDD.5070109@FreeBSD.org> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, John Baldwin Subject: Re: svn commit: r213985 - 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, 18 Oct 2010 20:52:26 -0000 On Mon, Oct 18, 2010 at 11:28:13PM +0300, Alexander Motin wrote: > Marius Strobl wrote: > > On Mon, Oct 18, 2010 at 10:03:12AM -0400, John Baldwin wrote: > >> On Sunday, October 17, 2010 12:46:54 pm Marius Strobl wrote: > >>> Author: marius > >>> Date: Sun Oct 17 16:46:54 2010 > >>> New Revision: 213985 > >>> URL: http://svn.freebsd.org/changeset/base/213985 > >>> > >>> Log: > >>> - In oneshot-mode it doesn't make sense to try to compensate the clock > >>> drift in order to achieve a more stable clock as the tick intervals may > >>> vary in the first place. In fact I haven't seen this code kick in when > >>> in oneshot-mode so just skip it in that case. > >>> - There's no need to explicitly stop the (S)TICK counter in oneshot-mode > >>> with every tick as it just won't trigger again with the (S)TICK compare > >>> register set to a value in the past (with a wrap-around once every ~195 > >>> years of uptime at 1.5 GHz this isn't something we have to worry about > >>> in practice). > >>> - Given that we'll disable interrupts completely anyway there's no > >>> need to enter critical sections. > >> This last is not entirely true. The purpose of the critical section is to > >> prevent the kernel from preempting to the softclock swi thread until all of > >> the hardclock handler has finished execution. Thus, places that actually > >> actually call hardclock() should probably still be wrapped in a critical > >> section. > > > > It's currently unclear to me how on architectures converted to the > > event timer world order hardclock() is called eventually but in any case > > shouldn't it be the responsibility of the code actually calling it (or > > the equivalent code) to wrap it in a critical section instead then? After > > all the MD part just enrolls in calling _something_ in one-shot and/or > > periodic mode without knowing what it actually calls (and IMO it also > > should no longer need to). In handleevents() of kern_clocksource.c > > hardclock_anycpu() is called so i think that is what actually needs to > > be wrapped in a critical section. > > At this time on most (all?) platforms critical section is grabbed by MD > interrupt code. It is important to be there, as soon as there touched > td_intr_nesting_level and td_intr_frame fields of curthread. We can't > allow thread migration until all counted interrupt handlers complete. > AFAICT this is not true; intr_event_handle() in sys/kern/kern_intr.c is what enters a critical section and f.e. on amd64 I don't see where anywhere in the path from ISR_VEC() to intr_execute_handlers() calling intr_event_handle() a critical section would be entered, which also means that in intr_execute_handlers() td_intr_nesting_level is incremented outside of a critical section. Marius From owner-svn-src-head@FreeBSD.ORG Mon Oct 18 21:05: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 ECC681065673; Mon, 18 Oct 2010 21:05:29 +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 A33D48FC16; Mon, 18 Oct 2010 21:05:29 +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 1DD7A46B17; Mon, 18 Oct 2010 17:05:29 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 0840B8A009; Mon, 18 Oct 2010 17:05:28 -0400 (EDT) From: John Baldwin To: Marius Strobl Date: Mon, 18 Oct 2010 17:05:24 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100819; KDE/4.4.5; amd64; ; ) References: <201010171646.o9HGks2U038501@svn.freebsd.org> <4CBCADDD.5070109@FreeBSD.org> <20101018205224.GO1416@alchemy.franken.de> In-Reply-To: <20101018205224.GO1416@alchemy.franken.de> MIME-Version: 1.0 Message-Id: <201010181705.24879.jhb@freebsd.org> Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Mon, 18 Oct 2010 17:05:28 -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, Alexander Motin , src-committers@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r213985 - 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, 18 Oct 2010 21:05:30 -0000 On Monday, October 18, 2010 4:52:24 pm Marius Strobl wrote: > On Mon, Oct 18, 2010 at 11:28:13PM +0300, Alexander Motin wrote: > > Marius Strobl wrote: > > > On Mon, Oct 18, 2010 at 10:03:12AM -0400, John Baldwin wrote: > > >> On Sunday, October 17, 2010 12:46:54 pm Marius Strobl wrote: > > >>> Author: marius > > >>> Date: Sun Oct 17 16:46:54 2010 > > >>> New Revision: 213985 > > >>> URL: http://svn.freebsd.org/changeset/base/213985 > > >>> > > >>> Log: > > >>> - In oneshot-mode it doesn't make sense to try to compensate the clock > > >>> drift in order to achieve a more stable clock as the tick intervals may > > >>> vary in the first place. In fact I haven't seen this code kick in when > > >>> in oneshot-mode so just skip it in that case. > > >>> - There's no need to explicitly stop the (S)TICK counter in oneshot-mode > > >>> with every tick as it just won't trigger again with the (S)TICK compare > > >>> register set to a value in the past (with a wrap-around once every ~195 > > >>> years of uptime at 1.5 GHz this isn't something we have to worry about > > >>> in practice). > > >>> - Given that we'll disable interrupts completely anyway there's no > > >>> need to enter critical sections. > > >> This last is not entirely true. The purpose of the critical section is to > > >> prevent the kernel from preempting to the softclock swi thread until all of > > >> the hardclock handler has finished execution. Thus, places that actually > > >> actually call hardclock() should probably still be wrapped in a critical > > >> section. > > > > > > It's currently unclear to me how on architectures converted to the > > > event timer world order hardclock() is called eventually but in any case > > > shouldn't it be the responsibility of the code actually calling it (or > > > the equivalent code) to wrap it in a critical section instead then? After > > > all the MD part just enrolls in calling _something_ in one-shot and/or > > > periodic mode without knowing what it actually calls (and IMO it also > > > should no longer need to). In handleevents() of kern_clocksource.c > > > hardclock_anycpu() is called so i think that is what actually needs to > > > be wrapped in a critical section. > > > > At this time on most (all?) platforms critical section is grabbed by MD > > interrupt code. It is important to be there, as soon as there touched > > td_intr_nesting_level and td_intr_frame fields of curthread. We can't > > allow thread migration until all counted interrupt handlers complete. > > > > AFAICT this is not true; intr_event_handle() in sys/kern/kern_intr.c > is what enters a critical section and f.e. on amd64 I don't see where > anywhere in the path from ISR_VEC() to intr_execute_handlers() > calling intr_event_handle() a critical section would be entered, > which also means that in intr_execute_handlers() td_intr_nesting_level > is incremented outside of a critical section. Not all of the clock interrupts use intr_event_handle(). The local APIC timer uses its own interrupt entry point on x86 for example and uses an explicit critical section as a result. I suspect the sparc64 tick interrupt is closer to the local APIC timer case and doesn't use intr_event_handle(). The fact that some clock interrupts do use intr_event_handle() (e.g. the atrtc driver on x86 now) does indicate that the low-level interrupt code probably does not belong in the time events code but in the caller. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Mon Oct 18 21:11: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 575A61065672; Mon, 18 Oct 2010 21:11:03 +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 23F538FC1A; Mon, 18 Oct 2010 21:11: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 C5B5C46B17; Mon, 18 Oct 2010 17:11:02 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id C51A08A009; Mon, 18 Oct 2010 17:11:01 -0400 (EDT) From: John Baldwin To: Rui Paulo Date: Mon, 18 Oct 2010 17:10:14 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100819; KDE/4.4.5; amd64; ; ) References: <201010141919.o9EJJJIc034032@svn.freebsd.org> <96F4E353-55A6-48E6-BA20-92720EC2C4E7@freebsd.org> <201010151628.41177.jhb@freebsd.org> In-Reply-To: <201010151628.41177.jhb@freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201010181710.15226.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Mon, 18 Oct 2010 17:11: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, Dimitry Andric Subject: Re: svn commit: r213845 - head/sys/dev/aic7xxx/aicasm 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, 18 Oct 2010 21:11:03 -0000 On Friday, October 15, 2010 4:28:40 pm John Baldwin wrote: > On Friday, October 15, 2010 2:50:46 pm Rui Paulo wrote: > > On 15 Oct 2010, at 13:45, John Baldwin wrote: > > > > > On Thursday, October 14, 2010 5:09:58 pm Dimitry Andric wrote: > > >> On 2010-10-14 21:39, John Baldwin wrote: > > >>> On Thursday, October 14, 2010 3:19:19 pm Rui Paulo wrote: > > >> ... > > >>>> Revert r213765. This is required because our build infrastructure uses > > >>>> the host lex instead of the lex built during buildworld. I will MFC the > > >>>> lex changes soon and in a few weeks this I'll commit again r213765. > > >>> Can't you make 'lex' a build-tool to workaround this? > > >> > > >> That will not help for "cd conf/CONF && make kernel", apparently. It > > >> will always use the host lex. > > > > > > Well, yes, but that is always true. build-tools are only used for > > > buildkernel. However, if an 8.x lex cannot build a 9.x kernel, then having > > > lex be a build-tool (or cross-tool, ru@ knows which category better than I) > > > will let a 'make kernel-toolchain' followed by 'make buildkernel' of a 9.x > > > source tree work on an 8.x host. > > > > Yes, but I was told that 'cd conf/CONF && make kernel' is a supported configuration (without requiring kernel-toolchain first). > > Nah, just when it happens to work. It's ok to require people to build a new > world to get a new lex in that case. However, for the buildkernel case the > 'buildworld' / 'toolchain' / 'kernel-toolchain' targets should always build > enough tools to let buildkernel work, so if a new lex is required they should > build a new lex. Untested patch: Index: Makefile.inc1 =================================================================== --- Makefile.inc1 (revision 213841) +++ Makefile.inc1 (working copy) @@ -1088,6 +1090,7 @@ ${_clang} \ gnu/usr.bin/binutils \ gnu/usr.bin/cc \ + usr.bin/lex \ usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \ ${_btxld} \ ${_crunchide} \ -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Mon Oct 18 21:30: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 E962C1065694; Mon, 18 Oct 2010 21:30:57 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (alchemy.franken.de [194.94.249.214]) by mx1.freebsd.org (Postfix) with ESMTP id 694578FC1F; Mon, 18 Oct 2010 21:30:57 +0000 (UTC) Received: from alchemy.franken.de (localhost [127.0.0.1]) by alchemy.franken.de (8.14.4/8.14.4/ALCHEMY.FRANKEN.DE) with ESMTP id o9ILUuxO035334; Mon, 18 Oct 2010 23:30:56 +0200 (CEST) (envelope-from marius@alchemy.franken.de) Received: (from marius@localhost) by alchemy.franken.de (8.14.4/8.14.4/Submit) id o9ILUtFT035333; Mon, 18 Oct 2010 23:30:55 +0200 (CEST) (envelope-from marius) Date: Mon, 18 Oct 2010 23:30:55 +0200 From: Marius Strobl To: John Baldwin Message-ID: <20101018213055.GP1416@alchemy.franken.de> References: <201010171646.o9HGks2U038501@svn.freebsd.org> <4CBCADDD.5070109@FreeBSD.org> <20101018205224.GO1416@alchemy.franken.de> <201010181705.24879.jhb@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201010181705.24879.jhb@freebsd.org> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@freebsd.org, Alexander Motin , src-committers@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r213985 - 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, 18 Oct 2010 21:30:58 -0000 On Mon, Oct 18, 2010 at 05:05:24PM -0400, John Baldwin wrote: > On Monday, October 18, 2010 4:52:24 pm Marius Strobl wrote: > > On Mon, Oct 18, 2010 at 11:28:13PM +0300, Alexander Motin wrote: > > > Marius Strobl wrote: > > > > On Mon, Oct 18, 2010 at 10:03:12AM -0400, John Baldwin wrote: > > > >> On Sunday, October 17, 2010 12:46:54 pm Marius Strobl wrote: > > > >>> Author: marius > > > >>> Date: Sun Oct 17 16:46:54 2010 > > > >>> New Revision: 213985 > > > >>> URL: http://svn.freebsd.org/changeset/base/213985 > > > >>> > > > >>> Log: > > > >>> - In oneshot-mode it doesn't make sense to try to compensate the clock > > > >>> drift in order to achieve a more stable clock as the tick intervals may > > > >>> vary in the first place. In fact I haven't seen this code kick in when > > > >>> in oneshot-mode so just skip it in that case. > > > >>> - There's no need to explicitly stop the (S)TICK counter in oneshot-mode > > > >>> with every tick as it just won't trigger again with the (S)TICK compare > > > >>> register set to a value in the past (with a wrap-around once every ~195 > > > >>> years of uptime at 1.5 GHz this isn't something we have to worry about > > > >>> in practice). > > > >>> - Given that we'll disable interrupts completely anyway there's no > > > >>> need to enter critical sections. > > > >> This last is not entirely true. The purpose of the critical section is to > > > >> prevent the kernel from preempting to the softclock swi thread until all of > > > >> the hardclock handler has finished execution. Thus, places that actually > > > >> actually call hardclock() should probably still be wrapped in a critical > > > >> section. > > > > > > > > It's currently unclear to me how on architectures converted to the > > > > event timer world order hardclock() is called eventually but in any case > > > > shouldn't it be the responsibility of the code actually calling it (or > > > > the equivalent code) to wrap it in a critical section instead then? After > > > > all the MD part just enrolls in calling _something_ in one-shot and/or > > > > periodic mode without knowing what it actually calls (and IMO it also > > > > should no longer need to). In handleevents() of kern_clocksource.c > > > > hardclock_anycpu() is called so i think that is what actually needs to > > > > be wrapped in a critical section. > > > > > > At this time on most (all?) platforms critical section is grabbed by MD > > > interrupt code. It is important to be there, as soon as there touched > > > td_intr_nesting_level and td_intr_frame fields of curthread. We can't > > > allow thread migration until all counted interrupt handlers complete. > > > > > > > AFAICT this is not true; intr_event_handle() in sys/kern/kern_intr.c > > is what enters a critical section and f.e. on amd64 I don't see where > > anywhere in the path from ISR_VEC() to intr_execute_handlers() > > calling intr_event_handle() a critical section would be entered, > > which also means that in intr_execute_handlers() td_intr_nesting_level > > is incremented outside of a critical section. > > Not all of the clock interrupts use intr_event_handle(). The local APIC > timer uses its own interrupt entry point on x86 for example and uses an > explicit critical section as a result. I suspect the sparc64 tick interrupt > is closer to the local APIC timer case and doesn't use intr_event_handle(). Correct; but still you can't say that the MD interrupt code enters a critical section in general, neither is incrementing td_intr_nesting_level in intr_execute_handlers() protected by a critical section. > > The fact that some clock interrupts do use intr_event_handle() (e.g. the > atrtc driver on x86 now) does indicate that the low-level interrupt code > probably does not belong in the time events code but in the caller. > Well, I agree that entering a critical section in the time events code would mean entering a nested critical section unnecessarily in case the clock driver uses a regular "fast" interrupt handler and that should be avoided. Still I don't think the event time front-end actually should need to worry about wrapping the callback in a critical section. Marius From owner-svn-src-head@FreeBSD.ORG Mon Oct 18 21:42: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 93246106566C; Mon, 18 Oct 2010 21:42:03 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-bw0-f54.google.com (mail-bw0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id 876078FC0C; Mon, 18 Oct 2010 21:42:02 +0000 (UTC) Received: by bwz16 with SMTP id 16so119770bwz.13 for ; Mon, 18 Oct 2010 14:42:01 -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=SIZ9/1T45x08RYa6bz/6I0uEbZL+HUn4mKfgOmWlNAE=; b=JRbrbRzDRVtsaJzXS/m5o6tGSxZqwFvZWpDpOiILxeQq1NL9rmfR/hRdm0L3Jzu2Lm NEejN+3lvUMjYkYGxY6OFdkWoujQ8QAXSwUYiu0AZu3zfaa/oCCeTFu3kgSuHUwdrJ0C 6JbTRZGjRcvFHc8/4evSVI3Rxz8b/4wsxC3F8= 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=CefEWW0fdcQEf9ABhuauE57qXBRqdUbaENNhKaD/Ojy4cBoqrew5Le9kAtl6xwItIa RxYpq9NnrfMUYbcQe1rnDRpwSF4GJVYDWfForJyzCPpkhinvoCftEnDkJ4W5l/WkufsW d/LUV/cmLmXhDUURioKqoS222JOJiw9FFvGOY= Received: by 10.204.46.226 with SMTP id k34mr4843952bkf.38.1287438121212; Mon, 18 Oct 2010 14:42:01 -0700 (PDT) Received: from mavbook.mavhome.dp.ua (pc.mavhome.dp.ua [212.86.226.226]) by mx.google.com with ESMTPS id 4sm14545460bki.1.2010.10.18.14.41.59 (version=SSLv3 cipher=RC4-MD5); Mon, 18 Oct 2010 14:42:00 -0700 (PDT) Sender: Alexander Motin Message-ID: <4CBCBF25.8010902@FreeBSD.org> Date: Tue, 19 Oct 2010 00:41:57 +0300 From: Alexander Motin User-Agent: Thunderbird 2.0.0.24 (X11/20100402) MIME-Version: 1.0 To: Marius Strobl References: <201010171646.o9HGks2U038501@svn.freebsd.org> <4CBCADDD.5070109@FreeBSD.org> <20101018205224.GO1416@alchemy.franken.de> <201010181705.24879.jhb@freebsd.org> <20101018213055.GP1416@alchemy.franken.de> In-Reply-To: <20101018213055.GP1416@alchemy.franken.de> X-Enigmail-Version: 0.96.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, John Baldwin Subject: Re: svn commit: r213985 - 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, 18 Oct 2010 21:42:03 -0000 Marius Strobl wrote: > On Mon, Oct 18, 2010 at 05:05:24PM -0400, John Baldwin wrote: >> On Monday, October 18, 2010 4:52:24 pm Marius Strobl wrote: >>> AFAICT this is not true; intr_event_handle() in sys/kern/kern_intr.c >>> is what enters a critical section and f.e. on amd64 I don't see where >>> anywhere in the path from ISR_VEC() to intr_execute_handlers() >>> calling intr_event_handle() a critical section would be entered, >>> which also means that in intr_execute_handlers() td_intr_nesting_level >>> is incremented outside of a critical section. >> Not all of the clock interrupts use intr_event_handle(). The local APIC >> timer uses its own interrupt entry point on x86 for example and uses an >> explicit critical section as a result. I suspect the sparc64 tick interrupt >> is closer to the local APIC timer case and doesn't use intr_event_handle(). > > Correct; but still you can't say that the MD interrupt code enters a > critical section in general, neither is incrementing td_intr_nesting_level > in intr_execute_handlers() protected by a critical section. > >> The fact that some clock interrupts do use intr_event_handle() (e.g. the >> atrtc driver on x86 now) does indicate that the low-level interrupt code >> probably does not belong in the time events code but in the caller. > > Well, I agree that entering a critical section in the time events > code would mean entering a nested critical section unnecessarily in > case the clock driver uses a regular "fast" interrupt handler and > that should be avoided. Still I don't think the event time front-end > actually should need to worry about wrapping the callback in a > critical section. Interrupt frame, required for hard-/stat-/profclock() operation is stored in curthread. So critical section is effectively mandatory there now. Correct td_intr_nesting_level value is also important for proper interrupt threads scheduling - one more reason to have critical section there. It is indeed strange that td_intr_nesting_level in intr_event_handle() is not covered by critical section, but probably it should. -- Alexander Motin From owner-svn-src-head@FreeBSD.ORG Mon Oct 18 23:37: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 93A761065670; Mon, 18 Oct 2010 23:37:56 +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 81E998FC0C; Mon, 18 Oct 2010 23:37: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 o9INbu7u090422; Mon, 18 Oct 2010 23:37:56 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9INbuTt090420; Mon, 18 Oct 2010 23:37:56 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201010182337.o9INbuTt090420@svn.freebsd.org> From: David Xu Date: Mon, 18 Oct 2010 23:37: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: r214046 - 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, 18 Oct 2010 23:37:56 -0000 Author: davidxu Date: Mon Oct 18 23:37:56 2010 New Revision: 214046 URL: http://svn.freebsd.org/changeset/base/214046 Log: Set default type to PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP, this is the type we are using. Modified: head/lib/libthr/thread/thr_rwlockattr.c Modified: head/lib/libthr/thread/thr_rwlockattr.c ============================================================================== --- head/lib/libthr/thread/thr_rwlockattr.c Mon Oct 18 23:10:32 2010 (r214045) +++ head/lib/libthr/thread/thr_rwlockattr.c Mon Oct 18 23:37:56 2010 (r214046) @@ -83,6 +83,7 @@ _pthread_rwlockattr_init(pthread_rwlocka return(ENOMEM); prwlockattr->pshared = PTHREAD_PROCESS_PRIVATE; + prwlockattr->kind = PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP; *rwlockattr = prwlockattr; return(0); From owner-svn-src-head@FreeBSD.ORG Tue Oct 19 00: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 D3ABD1065672; Tue, 19 Oct 2010 00:01:53 +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 C09798FC0A; Tue, 19 Oct 2010 00: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 o9J01rj3091160; Tue, 19 Oct 2010 00:01:53 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9J01raB091155; Tue, 19 Oct 2010 00:01:53 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201010190001.o9J01raB091155@svn.freebsd.org> From: Xin LI Date: Tue, 19 Oct 2010 00: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: r214047 - in head: contrib/netcat usr.bin/nc 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, 19 Oct 2010 00:01:53 -0000 Author: delphij Date: Tue Oct 19 00:01:53 2010 New Revision: 214047 URL: http://svn.freebsd.org/changeset/base/214047 Log: MFV: nc(1) from OpenBSD 4.8. While I'm there, bump WARNS level to 2 as the vendor have the right printf format string now. MFC after: 1 month Obtained from: OpenBSD Modified: head/contrib/netcat/nc.1 head/contrib/netcat/netcat.c head/contrib/netcat/socks.c head/usr.bin/nc/Makefile Directory Properties: head/contrib/netcat/ (props changed) Modified: head/contrib/netcat/nc.1 ============================================================================== --- head/contrib/netcat/nc.1 Mon Oct 18 23:37:56 2010 (r214046) +++ head/contrib/netcat/nc.1 Tue Oct 19 00:01:53 2010 (r214047) @@ -1,4 +1,4 @@ -.\" $OpenBSD: nc.1,v 1.53 2010/02/23 23:00:52 schwarze Exp $ +.\" $OpenBSD: nc.1,v 1.55 2010/07/25 07:51:39 guenther Exp $ .\" .\" Copyright (c) 1996 David Sacerdote .\" All rights reserved. @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 3, 2010 +.Dd July 25, 2010 .Dt NC 1 .Os .Sh NAME @@ -46,7 +46,7 @@ .Op Fl p Ar source_port .Op Fl s Ar source_ip_address .Op Fl T Ar ToS -.Op Fl V Ar fib +.Op Fl V Ar rtable .Op Fl w Ar timeout .Op Fl X Ar proxy_protocol .Oo Xo @@ -201,8 +201,10 @@ Specifies to use sockets. .It Fl u Use UDP instead of the default option of TCP. -.It Fl V Ar fib -Set the routing table (FIB). +.It Fl V Ar rtable +Set the routing table +.Pq Dq FIB +to be used. The default is 0. .It Fl v Have Modified: head/contrib/netcat/netcat.c ============================================================================== --- head/contrib/netcat/netcat.c Mon Oct 18 23:37:56 2010 (r214046) +++ head/contrib/netcat/netcat.c Tue Oct 19 00:01:53 2010 (r214047) @@ -1,4 +1,4 @@ -/* $OpenBSD: netcat.c,v 1.95 2010/02/27 00:58:56 nicm Exp $ */ +/* $OpenBSD: netcat.c,v 1.98 2010/07/03 04:44:51 guenther Exp $ */ /* * Copyright (c) 2001 Eric Jackson * @@ -93,7 +93,7 @@ int Iflag; /* TCP receive buffer siz int Oflag; /* TCP send buffer size */ int Sflag; /* TCP MD5 signature option */ int Tflag = -1; /* IP Type of Service */ -u_int rdomain; +u_int rtableid; int timeout = -1; int family = AF_UNSPEC; @@ -139,7 +139,6 @@ main(int argc, char *argv[]) { NULL, 0, NULL, 0 } }; - rdomain = 0; ret = 1; ipsec_count = 0; s = 0; @@ -235,10 +234,10 @@ main(int argc, char *argv[]) case 'V': if (sysctlbyname("net.fibs", &numfibs, &intsize, NULL, 0) == -1) errx(1, "Multiple FIBS not supported"); - rdomain = (unsigned int)strtonum(optarg, 0, + rtableid = (unsigned int)strtonum(optarg, 0, numfibs - 1, &errstr); if (errstr) - errx(1, "FIB %s: %s", errstr, optarg); + errx(1, "rtable %s: %s", errstr, optarg); break; case 'v': vflag = 1; @@ -371,11 +370,11 @@ main(int argc, char *argv[]) */ if (uflag) { int rv, plen; - char buf[8192]; + char buf[16384]; struct sockaddr_storage z; len = sizeof(z); - plen = jflag ? 8192 : 1024; + plen = jflag ? 16384 : 2048; rv = recvfrom(s, buf, plen, MSG_PEEK, (struct sockaddr *)&z, &len); if (rv < 0) @@ -561,8 +560,8 @@ remote_connect(const char *host, const c add_ipsec_policy(s, ipsec_policy[1]); #endif - if (rdomain) { - if (setfib(rdomain) == -1) + if (rtableid) { + if (setfib(rtableid) == -1) err(1, "setfib"); } @@ -634,8 +633,8 @@ local_listen(char *host, char *port, str res0->ai_protocol)) < 0) continue; - if (rdomain) { - if (setfib(rdomain) == -1) + if (rtableid) { + if (setfib(rtableid) == -1) err(1, "setfib"); } @@ -680,12 +679,12 @@ void readwrite(int nfd) { struct pollfd pfd[2]; - unsigned char buf[8192]; + unsigned char buf[16384]; int n, wfd = fileno(stdin); int lfd = fileno(stdout); int plen; - plen = jflag ? 8192 : 1024; + plen = jflag ? 16384 : 2048; /* Setup Network FD */ pfd[0].fd = nfd; @@ -827,10 +826,9 @@ build_ports(char *p) hi = strtonum(p, 1, PORT_MAX, &errstr); if (errstr) errx(1, "port number %s: %s", errstr, p); - portlist[0] = calloc(1, PORT_MAX_LEN); + portlist[0] = strdup(p); if (portlist[0] == NULL) err(1, NULL); - portlist[0] = p; } } @@ -947,7 +945,7 @@ help(void) \t-t Answer TELNET negotiation\n\ \t-U Use UNIX domain socket\n\ \t-u UDP mode\n\ - \t-V fib Specify alternate routing table (FIB)\n\ + \t-V rtable Specify alternate routing table\n\ \t-v Verbose\n\ \t-w secs\t Timeout for connects and final net reads\n\ \t-X proto Proxy protocol: \"4\", \"5\" (SOCKS) or \"connect\"\n\ @@ -992,7 +990,7 @@ usage(int ret) "usage: nc [-46DdhklnrStUuvz] [-I length] [-i interval] [-O length]\n" #endif "\t [-P proxy_username] [-p source_port] [-s source_ip_address] [-T ToS]\n" - "\t [-V fib] [-w timeout] [-X proxy_protocol]\n" + "\t [-V rtable] [-w timeout] [-X proxy_protocol]\n" "\t [-x proxy_address[:port]] [hostname] [port]\n"); if (ret) exit(1); Modified: head/contrib/netcat/socks.c ============================================================================== --- head/contrib/netcat/socks.c Mon Oct 18 23:37:56 2010 (r214046) +++ head/contrib/netcat/socks.c Tue Oct 19 00:01:53 2010 (r214047) @@ -1,4 +1,4 @@ -/* $OpenBSD: socks.c,v 1.17 2006/09/25 04:51:20 ray Exp $ */ +/* $OpenBSD: socks.c,v 1.18 2010/04/20 07:26:35 nicm Exp $ */ /* * Copyright (c) 1999 Niklas Hallqvist. All rights reserved. @@ -167,11 +167,11 @@ socks_connect(const char *host, const ch buf[2] = SOCKS_NOAUTH; cnt = atomicio(vwrite, proxyfd, buf, 3); if (cnt != 3) - err(1, "write failed (%d/3)", cnt); + err(1, "write failed (%zu/3)", cnt); cnt = atomicio(read, proxyfd, buf, 2); if (cnt != 2) - err(1, "read failed (%d/3)", cnt); + err(1, "read failed (%zu/3)", cnt); if (buf[1] == SOCKS_NOMETHOD) errx(1, "authentication method negotiation failed"); @@ -220,11 +220,11 @@ socks_connect(const char *host, const ch cnt = atomicio(vwrite, proxyfd, buf, wlen); if (cnt != wlen) - err(1, "write failed (%d/%d)", cnt, wlen); + err(1, "write failed (%zu/%zu)", cnt, wlen); cnt = atomicio(read, proxyfd, buf, 10); if (cnt != 10) - err(1, "read failed (%d/10)", cnt); + err(1, "read failed (%zu/10)", cnt); if (buf[1] != 0) errx(1, "connection failed, SOCKS error %d", buf[1]); } else if (socksv == 4) { @@ -242,11 +242,11 @@ socks_connect(const char *host, const ch cnt = atomicio(vwrite, proxyfd, buf, wlen); if (cnt != wlen) - err(1, "write failed (%d/%d)", cnt, wlen); + err(1, "write failed (%zu/%zu)", cnt, wlen); cnt = atomicio(read, proxyfd, buf, 8); if (cnt != 8) - err(1, "read failed (%d/8)", cnt); + err(1, "read failed (%zu/8)", cnt); if (buf[1] != 90) errx(1, "connection failed, SOCKS error %d", buf[1]); } else if (socksv == -1) { @@ -272,7 +272,7 @@ socks_connect(const char *host, const ch cnt = atomicio(vwrite, proxyfd, buf, r); if (cnt != r) - err(1, "write failed (%d/%d)", cnt, r); + err(1, "write failed (%zu/%d)", cnt, r); if (authretry > 1) { char resp[1024]; @@ -290,7 +290,7 @@ socks_connect(const char *host, const ch errx(1, "Proxy auth response too long"); r = strlen(buf); if ((cnt = atomicio(vwrite, proxyfd, buf, r)) != r) - err(1, "write failed (%d/%d)", cnt, r); + err(1, "write failed (%zu/%d)", cnt, r); } /* Terminate headers */ Modified: head/usr.bin/nc/Makefile ============================================================================== --- head/usr.bin/nc/Makefile Mon Oct 18 23:37:56 2010 (r214046) +++ head/usr.bin/nc/Makefile Tue Oct 19 00:01:53 2010 (r214047) @@ -9,6 +9,6 @@ CFLAGS+=-DIPSEC LDADD= -lipsec DPADD= ${LIBIPSEC} -WARNS?= 1 +WARNS?= 2 .include From owner-svn-src-head@FreeBSD.ORG Tue Oct 19 00:20: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 528BF106566B; Tue, 19 Oct 2010 00:20:01 +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 3AB628FC08; Tue, 19 Oct 2010 00:20: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 o9J0K1UR091669; Tue, 19 Oct 2010 00:20:01 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9J0K1g9091654; Tue, 19 Oct 2010 00:20:01 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201010190020.o9J0K1g9091654@svn.freebsd.org> From: Rick Macklem Date: Tue, 19 Oct 2010 00:20: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: r214048 - in head/sys: fs/nfsclient nfs nfsclient nlm 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, 19 Oct 2010 00:20:01 -0000 Author: rmacklem Date: Tue Oct 19 00:20:00 2010 New Revision: 214048 URL: http://svn.freebsd.org/changeset/base/214048 Log: Modify the NFS clients and the NLM so that the NLM can be used by both clients. Since the NLM uses various fields of the nfsmount structure, those fields were extracted and put in a separate nfs_mountcommon structure stored in sys/nfs/nfs_mountcommon.h. This structure also has a function pointer for a function that extracts the required information from the mount point and nfs vnode for that particular client, for information stored differently by the clients. Reviewed by: jhb MFC after: 2 weeks Added: head/sys/nfs/nfs_mountcommon.h (contents, props changed) Modified: head/sys/fs/nfsclient/nfs_clnode.c head/sys/fs/nfsclient/nfs_clvfsops.c head/sys/fs/nfsclient/nfs_clvnops.c head/sys/fs/nfsclient/nfsmount.h head/sys/nfs/nfs_lock.c head/sys/nfs/nfs_lock.h head/sys/nfsclient/nfs_node.c head/sys/nfsclient/nfs_vfsops.c head/sys/nfsclient/nfs_vnops.c head/sys/nfsclient/nfsmount.h head/sys/nfsclient/nfsnode.h head/sys/nlm/nlm_advlock.c head/sys/nlm/nlm_prot_impl.c Modified: head/sys/fs/nfsclient/nfs_clnode.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clnode.c Tue Oct 19 00:01:53 2010 (r214047) +++ head/sys/fs/nfsclient/nfs_clnode.c Tue Oct 19 00:20:00 2010 (r214048) @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -53,12 +54,13 @@ __FBSDID("$FreeBSD$"); #include #include +#include + extern struct vop_vector newnfs_vnodeops; extern struct buf_ops buf_ops_newnfs; MALLOC_DECLARE(M_NEWNFSREQ); uma_zone_t newnfsnode_zone; -vop_reclaim_t *ncl_reclaim_p = NULL; void ncl_nhinit(void) @@ -238,8 +240,8 @@ ncl_reclaim(struct vop_reclaim_args *ap) * If the NLM is running, give it a chance to abort pending * locks. */ - if (ncl_reclaim_p) - ncl_reclaim_p(ap); + if (nfs_reclaim_p != NULL) + nfs_reclaim_p(ap); /* * Destroy the vm object and flush associated pages. Modified: head/sys/fs/nfsclient/nfs_clvfsops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clvfsops.c Tue Oct 19 00:01:53 2010 (r214047) +++ head/sys/fs/nfsclient/nfs_clvfsops.c Tue Oct 19 00:20:00 2010 (r214048) @@ -96,10 +96,13 @@ SYSCTL_INT(_vfs_newnfs, NFS_TPRINTF_DELA static void nfs_sec_name(char *, int *); static void nfs_decode_args(struct mount *mp, struct nfsmount *nmp, - struct nfs_args *argp, struct ucred *, struct thread *); + struct nfs_args *argp, const char *, struct ucred *, + struct thread *); static int mountnfs(struct nfs_args *, struct mount *, struct sockaddr *, char *, u_char *, u_char *, u_char *, struct vnode **, struct ucred *, struct thread *, int); +static void nfs_getnlminfo(struct vnode *, uint8_t *, int *, + struct sockaddr_storage *, int *, off_t *); static vfs_mount_t nfs_mount; static vfs_cmount_t nfs_cmount; static vfs_unmount_t nfs_unmount; @@ -518,10 +521,11 @@ nfs_sec_name(char *sec, int *flagsp) static void nfs_decode_args(struct mount *mp, struct nfsmount *nmp, struct nfs_args *argp, - struct ucred *cred, struct thread *td) + const char *hostname, struct ucred *cred, struct thread *td) { int s; int adjsock; + char *p; s = splnet(); @@ -659,6 +663,14 @@ nfs_decode_args(struct mount *mp, struct nmp->nm_sotype = argp->sotype; nmp->nm_soproto = argp->proto; } + + if (hostname != NULL) { + strlcpy(nmp->nm_hostname, hostname, + sizeof(nmp->nm_hostname)); + p = strchr(nmp->nm_hostname, ':'); + if (p != NULL) + *p = '\0'; + } } static const char *nfs_opts[] = { "from", @@ -933,7 +945,7 @@ nfs_mount(struct mount *mp) NFSMNT_INTEGRITY | NFSMNT_PRIVACY | NFSMNT_NOLOCKD /*|NFSMNT_XLATECOOKIE*/)); - nfs_decode_args(mp, nmp, &args, td->td_ucred, td); + nfs_decode_args(mp, nmp, &args, NULL, td->td_ucred, td); goto out; } @@ -1110,13 +1122,14 @@ mountnfs(struct nfs_args *argp, struct m nmp->nm_sockreq.nr_cred = crhold(cred); mtx_init(&nmp->nm_sockreq.nr_mtx, "nfssock", NULL, MTX_DEF); mp->mnt_data = nmp; + nmp->nm_getinfo = nfs_getnlminfo; } vfs_getnewfsid(mp); nmp->nm_mountp = mp; mtx_init(&nmp->nm_mtx, "NFSmount lock", NULL, MTX_DEF | MTX_DUPOK); nmp->nm_negnametimeo = negnametimeo; - nfs_decode_args(mp, nmp, argp, cred, td); + nfs_decode_args(mp, nmp, argp, hst, cred, td); /* * V2 can only handle 32 bit filesizes. A 4GB-1 limit may be too @@ -1447,3 +1460,26 @@ nfs_sysctl(struct mount *mp, fsctlop_t o return (0); } +/* + * Extract the information needed by the nlm from the nfs vnode. + */ +static void +nfs_getnlminfo(struct vnode *vp, uint8_t *fhp, int *fhlenp, + struct sockaddr_storage *sp, int *is_v3p, off_t *sizep) +{ + struct nfsmount *nmp; + struct nfsnode *np = VTONFS(vp); + + nmp = VFSTONFS(vp->v_mount); + if (fhlenp != NULL) + *fhlenp = np->n_fhp->nfh_len; + if (fhp != NULL) + bcopy(np->n_fhp->nfh_fh, fhp, np->n_fhp->nfh_len); + if (sp != NULL) + bcopy(nmp->nm_nam, sp, min(nmp->nm_nam->sa_len, sizeof(*sp))); + if (is_v3p != NULL) + *is_v3p = NFS_ISV3(vp); + if (sizep != NULL) + *sizep = np->n_size; +} + Modified: head/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clvnops.c Tue Oct 19 00:01:53 2010 (r214047) +++ head/sys/fs/nfsclient/nfs_clvnops.c Tue Oct 19 00:20:00 2010 (r214048) @@ -84,7 +84,6 @@ __FBSDID("$FreeBSD$"); extern struct nfsstats newnfsstats; MALLOC_DECLARE(M_NEWNFSREQ); -vop_advlock_t *ncl_advlock_p = NULL; /* * Ifdef for FreeBSD-current merged buffer cache. It is unfortunate that these @@ -2937,8 +2936,8 @@ nfs_advlock(struct vop_advlock_args *ap) VOP_UNLOCK(vp, 0); error = lf_advlock(ap, &(vp->v_lockf), size); } else { - if (ncl_advlock_p) - error = ncl_advlock_p(ap); + if (nfs_advlock_p != NULL) + error = nfs_advlock_p(ap); else { VOP_UNLOCK(vp, 0); error = ENOLCK; Modified: head/sys/fs/nfsclient/nfsmount.h ============================================================================== --- head/sys/fs/nfsclient/nfsmount.h Tue Oct 19 00:01:53 2010 (r214047) +++ head/sys/fs/nfsclient/nfsmount.h Tue Oct 19 00:20:00 2010 (r214048) @@ -35,22 +35,19 @@ #ifndef _NFSCLIENT_NFSMOUNT_H_ #define _NFSCLIENT_NFSMOUNT_H_ +#include + /* * Mount structure. * One allocated on every NFS mount. * Holds NFS specific information for mount. */ struct nfsmount { - struct mtx nm_mtx; - int nm_flag; /* Flags for soft/hard... */ - int nm_state; /* Internal state flags */ - struct mount *nm_mountp; /* Vfs structure for this filesystem */ + struct nfsmount_common nm_com; /* Common fields for nlm */ int nm_numgrps; /* Max. size of groupslist */ u_char nm_fh[NFSX_FHMAX]; /* File handle of root dir */ int nm_fhsize; /* Size of root file handle */ struct nfssockreq nm_sockreq; /* Socket Info */ - int nm_timeo; /* Init timer for NFSMNT_DUMBTIMR */ - int nm_retry; /* Max retries */ int nm_timeouts; /* Request timeouts */ int nm_rsize; /* Max size of read rpc */ int nm_wsize; /* Max size of write rpc */ @@ -89,6 +86,14 @@ struct nfsmount { #define nm_soproto nm_sockreq.nr_soproto #define nm_client nm_sockreq.nr_client #define nm_krbname nm_name +#define nm_mtx nm_com.nmcom_mtx +#define nm_flag nm_com.nmcom_flag +#define nm_state nm_com.nmcom_state +#define nm_mountp nm_com.nmcom_mountp +#define nm_timeo nm_com.nmcom_timeo +#define nm_retry nm_com.nmcom_retry +#define nm_hostname nm_com.nmcom_hostname +#define nm_getinfo nm_com.nmcom_getinfo #define NFSMNT_DIRPATH(m) (&((m)->nm_name[(m)->nm_krbnamelen + 1])) #define NFSMNT_SRVKRBNAME(m) \ Modified: head/sys/nfs/nfs_lock.c ============================================================================== --- head/sys/nfs/nfs_lock.c Tue Oct 19 00:01:53 2010 (r214047) +++ head/sys/nfs/nfs_lock.c Tue Oct 19 00:20:00 2010 (r214048) @@ -62,6 +62,9 @@ __FBSDID("$FreeBSD$"); extern void (*nlminfo_release_p)(struct proc *p); +vop_advlock_t *nfs_advlock_p = nfs_dolock; +vop_reclaim_t *nfs_reclaim_p = NULL; + MALLOC_DEFINE(M_NFSLOCK, "nfsclient_lock", "NFS lock request"); MALLOC_DEFINE(M_NLMINFO, "nfsclient_nlminfo", "NFS lock process structure"); @@ -236,20 +239,19 @@ nfs_dolock(struct vop_advlock_args *ap) int error; struct flock *fl; struct proc *p; + struct nfsmount *nmp; td = curthread; p = td->td_proc; vp = ap->a_vp; fl = ap->a_fl; + nmp = VFSTONFS(vp->v_mount); ASSERT_VOP_LOCKED(vp, "nfs_dolock"); - bcopy(VFSTONFS(vp->v_mount)->nm_nam, &msg.lm_addr, - min(sizeof msg.lm_addr, VFSTONFS(vp->v_mount)->nm_nam->sa_len)); - msg.lm_fh_len = NFS_ISV3(vp) ? VTONFS(vp)->n_fhsize : NFSX_V2FH; - bcopy(VTONFS(vp)->n_fhp, msg.lm_fh, msg.lm_fh_len); - msg.lm_nfsv3 = NFS_ISV3(vp); + nmp->nm_getinfo(vp, msg.lm_fh, &msg.lm_fh_len, &msg.lm_addr, + &msg.lm_nfsv3, NULL); VOP_UNLOCK(vp, 0); /* Modified: head/sys/nfs/nfs_lock.h ============================================================================== --- head/sys/nfs/nfs_lock.h Tue Oct 19 00:01:53 2010 (r214047) +++ head/sys/nfs/nfs_lock.h Tue Oct 19 00:20:00 2010 (r214048) @@ -87,4 +87,6 @@ struct lockd_ans { #ifdef _KERNEL int nfs_dolock(struct vop_advlock_args *ap); +extern vop_advlock_t *nfs_advlock_p; +extern vop_reclaim_t *nfs_reclaim_p; #endif Added: head/sys/nfs/nfs_mountcommon.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/nfs/nfs_mountcommon.h Tue Oct 19 00:20:00 2010 (r214048) @@ -0,0 +1,51 @@ +/*- + * Copyright (c) 2009 Rick Macklem, University of Guelph + * 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. + * + * $FreeBSD$ + */ + +#ifndef _NFS_MOUNTCOMMON_H_ +#define _NFS_MOUNTCOMMON_H_ + +/* + * The common fields of the nfsmount structure for the two clients + * used by the nlm. It includes a function pointer that provides + * a mechanism for getting the client specific info for an nfs vnode. + */ +typedef void nfs_getinfofromvp_ftype(struct vnode *, uint8_t *, int *, + struct sockaddr_storage *, int *, off_t *); + +struct nfsmount_common { + struct mtx nmcom_mtx; + int nmcom_flag; /* Flags for soft/hard... */ + int nmcom_state; /* Internal state flags */ + struct mount *nmcom_mountp; /* Vfs structure for this filesystem */ + int nmcom_timeo; /* Init timer for NFSMNT_DUMBTIMR */ + int nmcom_retry; /* Max retries */ + char nmcom_hostname[MNAMELEN]; /* server's name */ + nfs_getinfofromvp_ftype *nmcom_getinfo; /* Get info from nfsnode */ +}; + +#endif /* _NFS_MOUNTCOMMON_H_ */ Modified: head/sys/nfsclient/nfs_node.c ============================================================================== --- head/sys/nfsclient/nfs_node.c Tue Oct 19 00:01:53 2010 (r214047) +++ head/sys/nfsclient/nfs_node.c Tue Oct 19 00:20:00 2010 (r214048) @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -51,6 +52,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include Modified: head/sys/nfsclient/nfs_vfsops.c ============================================================================== --- head/sys/nfsclient/nfs_vfsops.c Tue Oct 19 00:01:53 2010 (r214047) +++ head/sys/nfsclient/nfs_vfsops.c Tue Oct 19 00:20:00 2010 (r214048) @@ -115,6 +115,8 @@ static void nfs_decode_args(struct mount static int mountnfs(struct nfs_args *, struct mount *, struct sockaddr *, char *, struct vnode **, struct ucred *cred, int); +static void nfs_getnlminfo(struct vnode *, uint8_t *, int *, + struct sockaddr_storage *, int *, off_t *); static vfs_mount_t nfs_mount; static vfs_cmount_t nfs_cmount; static vfs_unmount_t nfs_unmount; @@ -1202,6 +1204,7 @@ mountnfs(struct nfs_args *argp, struct m bzero((caddr_t)nmp, sizeof (struct nfsmount)); TAILQ_INIT(&nmp->nm_bufq); mp->mnt_data = nmp; + nmp->nm_getinfo = nfs_getnlminfo; } vfs_getnewfsid(mp); nmp->nm_mountp = mp; @@ -1490,3 +1493,27 @@ nfs_sysctl(struct mount *mp, fsctlop_t o } return (0); } + +/* + * Extract the information needed by the nlm from the nfs vnode. + */ +static void +nfs_getnlminfo(struct vnode *vp, uint8_t *fhp, int *fhlenp, + struct sockaddr_storage *sp, int *is_v3p, off_t *sizep) +{ + struct nfsmount *nmp; + struct nfsnode *np = VTONFS(vp); + + nmp = VFSTONFS(vp->v_mount); + if (fhlenp != NULL) + *fhlenp = np->n_fhsize; + if (fhp != NULL) + bcopy(np->n_fhp, fhp, np->n_fhsize); + if (sp != NULL) + bcopy(nmp->nm_nam, sp, min(nmp->nm_nam->sa_len, sizeof(*sp))); + if (is_v3p != NULL) + *is_v3p = NFS_ISV3(vp); + if (sizep != NULL) + *sizep = np->n_size; +} + Modified: head/sys/nfsclient/nfs_vnops.c ============================================================================== --- head/sys/nfsclient/nfs_vnops.c Tue Oct 19 00:01:53 2010 (r214047) +++ head/sys/nfsclient/nfs_vnops.c Tue Oct 19 00:20:00 2010 (r214048) @@ -215,8 +215,6 @@ struct mtx nfs_iod_mtx; enum nfsiod_state nfs_iodwant[NFS_MAXASYNCDAEMON]; struct nfsmount *nfs_iodmount[NFS_MAXASYNCDAEMON]; int nfs_numasync = 0; -vop_advlock_t *nfs_advlock_p = nfs_dolock; -vop_reclaim_t *nfs_reclaim_p = NULL; #define DIRHDSIZ (sizeof (struct dirent) - (MAXNAMLEN + 1)) SYSCTL_DECL(_vfs_nfs); Modified: head/sys/nfsclient/nfsmount.h ============================================================================== --- head/sys/nfsclient/nfsmount.h Tue Oct 19 00:01:53 2010 (r214047) +++ head/sys/nfsclient/nfsmount.h Tue Oct 19 00:20:00 2010 (r214048) @@ -36,6 +36,10 @@ #ifndef _NFSCLIENT_NFSMOUNT_H_ #define _NFSCLIENT_NFSMOUNT_H_ +#include + +#include + #include #include #include @@ -47,10 +51,7 @@ * Holds NFS specific information for mount. */ struct nfsmount { - struct mtx nm_mtx; - int nm_flag; /* Flags for soft/hard... */ - int nm_state; /* Internal state flags */ - struct mount *nm_mountp; /* Vfs structure for this filesystem */ + struct nfsmount_common nm_com; /* Common fields for nlm */ int nm_numgrps; /* Max. size of groupslist */ u_char nm_fh[NFSX_V4FH]; /* File handle of root dir */ int nm_fhsize; /* Size of root file handle */ @@ -58,8 +59,6 @@ struct nfsmount { int nm_soproto; /* and protocol */ int nm_soflags; /* pr_flags for socket protocol */ struct sockaddr *nm_nam; /* Addr of server */ - int nm_timeo; /* Init timer for NFSMNT_DUMBTIMR */ - int nm_retry; /* Max retries */ int nm_deadthresh; /* Threshold of timeouts-->dead server*/ int nm_rsize; /* Max size of read rpc */ int nm_wsize; /* Max size of write rpc */ @@ -79,7 +78,6 @@ struct nfsmount { struct nfs_rpcops *nm_rpcops; int nm_tprintf_initial_delay; /* initial delay */ int nm_tprintf_delay; /* interval for messages */ - char nm_hostname[MNAMELEN]; /* server's name */ int nm_secflavor; /* auth flavor to use for rpc */ struct __rpc_client *nm_client; struct rpc_timers nm_timers[NFS_MAX_TIMER]; /* RTT Timers for rpcs */ @@ -94,6 +92,15 @@ struct nfsmount { time_t nm_last_renewal; }; +#define nm_mtx nm_com.nmcom_mtx +#define nm_flag nm_com.nmcom_flag +#define nm_state nm_com.nmcom_state +#define nm_mountp nm_com.nmcom_mountp +#define nm_timeo nm_com.nmcom_timeo +#define nm_retry nm_com.nmcom_retry +#define nm_hostname nm_com.nmcom_hostname +#define nm_getinfo nm_com.nmcom_getinfo + #if defined(_KERNEL) /* * Convert mount ptr to nfsmount ptr. Modified: head/sys/nfsclient/nfsnode.h ============================================================================== --- head/sys/nfsclient/nfsnode.h Tue Oct 19 00:01:53 2010 (r214047) +++ head/sys/nfsclient/nfsnode.h Tue Oct 19 00:20:00 2010 (r214048) @@ -187,9 +187,6 @@ extern struct vop_vector nfs_fifoops; extern struct vop_vector nfs_vnodeops; extern struct buf_ops buf_ops_nfs; -extern vop_advlock_t *nfs_advlock_p; -extern vop_reclaim_t *nfs_reclaim_p; - /* * Prototypes for NFS vnode operations */ Modified: head/sys/nlm/nlm_advlock.c ============================================================================== --- head/sys/nlm/nlm_advlock.c Tue Oct 19 00:01:53 2010 (r214047) +++ head/sys/nlm/nlm_advlock.c Tue Oct 19 00:20:00 2010 (r214048) @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -47,7 +48,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include @@ -196,7 +196,6 @@ nlm_advlock_internal(struct vnode *vp, v { struct thread *td = curthread; struct nfsmount *nmp; - struct nfsnode *np; off_t size; size_t fhlen; union nfsfh fh; @@ -214,6 +213,7 @@ nlm_advlock_internal(struct vnode *vp, v struct nlm_file_svid *ns; int svid; int error; + int is_v3; ASSERT_VOP_LOCKED(vp, "nlm_advlock_1"); @@ -225,18 +225,13 @@ nlm_advlock_internal(struct vnode *vp, v if (op == F_SETLK || op == F_UNLCK) nfs_vinvalbuf(vp, V_SAVE, td, 1); - np = VTONFS(vp); nmp = VFSTONFS(vp->v_mount); - size = np->n_size; - sa = nmp->nm_nam; - memcpy(&ss, sa, sa->sa_len); - sa = (struct sockaddr *) &ss; strcpy(servername, nmp->nm_hostname); - fhlen = np->n_fhsize; - memcpy(&fh.fh_bytes, np->n_fhp, fhlen); + nmp->nm_getinfo(vp, fh.fh_bytes, &fhlen, &ss, &is_v3, &size); + sa = (struct sockaddr *) &ss; timo.tv_sec = nmp->nm_timeo / NFS_HZ; timo.tv_usec = (nmp->nm_timeo % NFS_HZ) * (1000000 / NFS_HZ); - if (NFS_ISV3(vp)) + if (is_v3 != 0) vers = NLM_VERS4; else vers = NLM_VERS; Modified: head/sys/nlm/nlm_prot_impl.c ============================================================================== --- head/sys/nlm/nlm_prot_impl.c Tue Oct 19 00:01:53 2010 (r214047) +++ head/sys/nlm/nlm_prot_impl.c Tue Oct 19 00:20:00 2010 (r214048) @@ -55,8 +55,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include +#include #include #include @@ -2432,4 +2431,5 @@ DECLARE_MODULE(nfslockd, nfslockd_mod, S /* So that loader and kldload(2) can find us, wherever we are.. */ MODULE_DEPEND(nfslockd, krpc, 1, 1, 1); MODULE_DEPEND(nfslockd, nfs, 1, 1, 1); +MODULE_DEPEND(nfslockd, nfslock, 1, 1, 1); MODULE_VERSION(nfslockd, 1); From owner-svn-src-head@FreeBSD.ORG Tue Oct 19 02:52: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 CC4CD106564A; Tue, 19 Oct 2010 02:52:39 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail01.syd.optusnet.com.au (mail01.syd.optusnet.com.au [211.29.132.182]) by mx1.freebsd.org (Postfix) with ESMTP id 469E68FC0A; Tue, 19 Oct 2010 02:52:38 +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 mail01.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id o9J2qT0h031901 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 19 Oct 2010 13:52:30 +1100 Date: Tue, 19 Oct 2010 13:52:29 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Alexander Motin In-Reply-To: <4CBCBF25.8010902@FreeBSD.org> Message-ID: <20101019122827.T1195@besplex.bde.org> References: <201010171646.o9HGks2U038501@svn.freebsd.org> <4CBCADDD.5070109@FreeBSD.org> <20101018205224.GO1416@alchemy.franken.de> <201010181705.24879.jhb@freebsd.org> <20101018213055.GP1416@alchemy.franken.de> <4CBCBF25.8010902@FreeBSD.org> 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, John Baldwin , Marius Strobl Subject: Re: svn commit: r213985 - 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: Tue, 19 Oct 2010 02:52:39 -0000 On Tue, 19 Oct 2010, Alexander Motin wrote: > Marius Strobl wrote: >> On Mon, Oct 18, 2010 at 05:05:24PM -0400, John Baldwin wrote: >>> On Monday, October 18, 2010 4:52:24 pm Marius Strobl wrote: >>>> AFAICT this is not true; intr_event_handle() in sys/kern/kern_intr.c >>>> is what enters a critical section and f.e. on amd64 I don't see where >>>> anywhere in the path from ISR_VEC() to intr_execute_handlers() >>>> calling intr_event_handle() a critical section would be entered, >>>> which also means that in intr_execute_handlers() td_intr_nesting_level >>>> is incremented outside of a critical section. >>> Not all of the clock interrupts use intr_event_handle(). The local APIC >>> timer uses its own interrupt entry point on x86 for example and uses an >>> explicit critical section as a result. I suspect the sparc64 tick interrupt >>> is closer to the local APIC timer case and doesn't use intr_event_handle(). >> >> Correct; but still you can't say that the MD interrupt code enters a >> critical section in general, neither is incrementing td_intr_nesting_level >> in intr_execute_handlers() protected by a critical section. >> >>> The fact that some clock interrupts do use intr_event_handle() (e.g. the >>> atrtc driver on x86 now) does indicate that the low-level interrupt code >>> probably does not belong in the time events code but in the caller. >> >> Well, I agree that entering a critical section in the time events >> code would mean entering a nested critical section unnecessarily in >> case the clock driver uses a regular "fast" interrupt handler and >> that should be avoided. Still I don't think the event time front-end >> actually should need to worry about wrapping the callback in a >> critical section. I think it belongs in the caller, and the front end shouldn't do any more than assert it. > Interrupt frame, required for hard-/stat-/profclock() operation is > stored in curthread. So critical section is effectively mandatory there > now. Correct td_intr_nesting_level value is also important for proper > interrupt threads scheduling - one more reason to have critical section > there. It is indeed strange that td_intr_nesting_level in > intr_event_handle() is not covered by critical section, but probably it > should. td_intr_nesting_level is garbage, as is the style of the use of it in sched_ule.c (non-boolean used in boolean context). I introduced it (as a global named intr_nesting_level) to count interrupt nesting with spls. It was an i386 implemention detail for limiting interrupt nesting to about 4, but a few places abused it to detect things like M_WAITOK malloc()s in interrupt context. There was 1 non-abusive MI reference to it, via the MD CLKF_INTR(framep) macro, and the most of the abuses wouldn't have been abuses if there had been a MD macro for them. See RELENG_4 for all this. (spls allow interrupt nesting to either the number of bits in the mask or the number of high-level spls, but the kernel stack is not large enough for this, so there was an even more arbitary limit of about 4.) Now with ithreads for interrupts, interrupts can't nest (an interrupt can interrupt an ithread, but that is no more nesting than an interrupt interrupting a user thread). td_intr_nesting_level is 0 in ithreads, so it is almost useless for its original abuse for detecting things like M_WAITOK malloc()s in interrupt context, but it is still abused for that :-(. td_intr_nesting level is != 0 mainly in low-level interrupt handling code and fast interrupt handlers, and neither of these should be so broken as to call malloc(), so the check in malloc() is useless; the correct check (for TDP_ITHREAD) is missing. Similar checks in uipc_mbuf.c were just removed, and similar but more-bogus checks in vinum went away with vinum. This leaves 3 possibly-useful uses of td_intr_nesting_level in -current: - {amd64,i386}/trap.c: td_intr_nesting_level is checked to be zero to makes certain traps more fatal when it is nonzero. Other arches don't bother with such a test. amd64 and i386 don't bother with testing the more likely error of a trap that should be fatal in an ithread. This can be handled in the same way as in malloc() -- don't bother testing for the very unlikely case, especially if you don't bother testing for the unlikely case. - kern_clock.c: this tests for td_intr_nesting_level >= 2. That is almost exactly the test that used to be hidden in the MD CLKF_INTR(). I used to maintain patches with an assertion that this never happens with ithreads. It never happens unless there is a bug in the low-level interrupt handling code or in the management of td_intr_nesting_level. On entry to an interrupt, td_intr_nesting level is incremented to 1, and another thread should be switched to without allowing any interrupt that will increment it again; then on switch back, interrupts should remain masked so that it is not incremented from 1 to 2 just before it is decremented to 0. I would have removed td_intr_nesting_level from my version, except my version actually needs it, for this use in hardclock() only :-(. In my version, the low-level interrupt masking is partially in software, so clock interrupts can interrupt the low-level interrupt handling. I just remembered that sparce64 also has or had some interrupt masking in software; perhaps it needs a similar treatment. - sched_ule.c: releatively recently, this scheduler started using td_intr_nesting_level. More recently td_intr_nesting_level was incremented in clock code to keep this scheduler happy, so something is clearly needed. But sched_4bsd.c doesn't need it, and the increment being outside of the critical section in intr_execute_handlers() shows how uncritical this variable is. Perhaps sched_ule.c can use td_critnest instead. You have to be carefully with not calling critical_enter() too much, so that the scheduler cannot tell the real level. Levels near mi_switch() have to have levels of precisely 0, 1 or 2, so that the level drops to precisely 0 when the switch is complete, and this is related to deciding whether to schedule. and 2 other nonsense abuses: - dev/sound/isa/sb16.c: abuses td_intr_nesting_level to avoid doing a diagnostic interrupt if (td_intr_nesting_level != 0). I think this has no effect, as for malloc() except it is easier to inspect the code to see that it cannot be reached in fast interrupt handler context, so the check is null. - vm_page.c: exactly the same as in malloc(), with a check for unlikely fast interrupt handler context but none for ordinary ithread context. Most arch-specific code that manages td_intr_nesting_level does it in a critical section. powerpc also uses atomic ops. I only grepped for td_intr_nesting_level, and would have missed any different spelling of it in asm code where most of the original i386 code for it was. Bruce From owner-svn-src-head@FreeBSD.ORG Tue Oct 19 08:55: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 1B5DA1065672; Tue, 19 Oct 2010 08:55:32 +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 E35CE8FC18; Tue, 19 Oct 2010 08:55:31 +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 o9J8tVsE006256; Tue, 19 Oct 2010 08:55:31 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9J8tVjI006254; Tue, 19 Oct 2010 08:55:31 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201010190855.o9J8tVjI006254@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 19 Oct 2010 08:55:31 +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: r214049 - head/sys/nfsserver 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, 19 Oct 2010 08:55:32 -0000 Author: kib Date: Tue Oct 19 08:55:31 2010 New Revision: 214049 URL: http://svn.freebsd.org/changeset/base/214049 Log: When readdirplus() is handled on the exported filesystem that does not support VFS_VGET, like msdosfs, do not call VOP_LOOKUP() for dotdot on the root directory. Our filesystems expect that VFS handles dotdot lookups on root on its own. Reported and tested by: kevlo MFC after: 2 weeks Modified: head/sys/nfsserver/nfs_serv.c Modified: head/sys/nfsserver/nfs_serv.c ============================================================================== --- head/sys/nfsserver/nfs_serv.c Tue Oct 19 00:20:00 2010 (r214048) +++ head/sys/nfsserver/nfs_serv.c Tue Oct 19 08:55:31 2010 (r214049) @@ -3036,7 +3036,7 @@ nfsrv_readdirplus(struct nfsrv_descript struct iovec iv; struct vattr va, at, *vap = &va; struct nfs_fattr *fp; - int len, nlen, rem, xfer, tsiz, i, error = 0, getret = 1; + int len, nlen, rem, xfer, tsiz, i, error = 0, error1, getret = 1; int siz, cnt, fullsiz, eofflag, rdonly, dirlen, ncookies; u_quad_t off, toff, verf; u_long *cookies = NULL, *cookiep; /* needs to be int64_t or off_t */ @@ -3240,24 +3240,25 @@ again: } if (!VOP_ISLOCKED(vp)) vn_lock(vp, LK_SHARED | LK_RETRY); - if (VOP_LOOKUP(vp, &nvp, &cn) != 0) + if ((vp->v_vflag & VV_ROOT) != 0 && + (cn.cn_flags & ISDOTDOT) != 0) { + vref(vp); + nvp = vp; + } else if (VOP_LOOKUP(vp, &nvp, &cn) != 0) goto invalid; } bzero((caddr_t)nfhp, NFSX_V3FH); nfhp->fh_fsid = nvp->v_mount->mnt_stat.f_fsid; - if (VOP_VPTOFH(nvp, &nfhp->fh_fid)) { + if ((error1 = VOP_VPTOFH(nvp, &nfhp->fh_fid)) == 0) + error1 = VOP_GETATTR(nvp, vap, cred); + if (vp == nvp) + vunref(nvp); + else vput(nvp); - nvp = NULL; - goto invalid; - } - if (VOP_GETATTR(nvp, vap, cred)) { - vput(nvp); - nvp = NULL; - goto invalid; - } - vput(nvp); nvp = NULL; + if (error1 != 0) + goto invalid; /* * If either the dircount or maxcount will be From owner-svn-src-head@FreeBSD.ORG Tue Oct 19 10:10: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 1D8911065672; Tue, 19 Oct 2010 10:10:32 +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 A04038FC18; Tue, 19 Oct 2010 10:10:31 +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 o9JAARhV055192 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 19 Oct 2010 13:10:27 +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 o9JAARCr040910; Tue, 19 Oct 2010 13:10:27 +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 o9JAARXw040909; Tue, 19 Oct 2010 13:10:27 +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: Tue, 19 Oct 2010 13:10:26 +0300 From: Kostik Belousov To: Rick Macklem Message-ID: <20101019101026.GZ2392@deviant.kiev.zoral.com.ua> References: <201010190020.o9J0K1g9091654@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="fLv/lpE57INsRhka" Content-Disposition: inline In-Reply-To: <201010190020.o9J0K1g9091654@svn.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 Subject: Re: svn commit: r214048 - in head/sys: fs/nfsclient nfs nfsclient nlm 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, 19 Oct 2010 10:10:32 -0000 --fLv/lpE57INsRhka Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Oct 19, 2010 at 12:20:01AM +0000, Rick Macklem wrote: > Author: rmacklem > Date: Tue Oct 19 00:20:00 2010 > New Revision: 214048 > URL: http://svn.freebsd.org/changeset/base/214048 >=20 > Log: > Modify the NFS clients and the NLM so that the NLM can be used > by both clients. Since the NLM uses various fields of the > nfsmount structure, those fields were extracted and put in a > separate nfs_mountcommon structure stored in sys/nfs/nfs_mountcommon.h. > This structure also has a function pointer for a function that > extracts the required information from the mount point and nfs vnode > for that particular client, for information stored differently by the > clients. > =20 > Reviewed by: jhb > MFC after: 2 weeks I believe the following is needed for 64bit platforms. diff --git a/sys/fs/nfsclient/nfs_clvfsops.c b/sys/fs/nfsclient/nfs_clvfsop= s.c index 816d288..0c27b9d 100644 --- a/sys/fs/nfsclient/nfs_clvfsops.c +++ b/sys/fs/nfsclient/nfs_clvfsops.c @@ -101,7 +101,7 @@ static void nfs_decode_args(struct mount *mp, struct nf= smount *nmp, static int mountnfs(struct nfs_args *, struct mount *, struct sockaddr *, char *, u_char *, u_char *, u_char *, struct vnode **, struct ucred *, struct thread *, int); -static void nfs_getnlminfo(struct vnode *, uint8_t *, int *, +static void nfs_getnlminfo(struct vnode *, uint8_t *, size_t *, struct sockaddr_storage *, int *, off_t *); static vfs_mount_t nfs_mount; static vfs_cmount_t nfs_cmount; @@ -1464,7 +1464,7 @@ nfs_sysctl(struct mount *mp, fsctlop_t op, struct sys= ctl_req *req) * Extract the information needed by the nlm from the nfs vnode. */ static void -nfs_getnlminfo(struct vnode *vp, uint8_t *fhp, int *fhlenp, +nfs_getnlminfo(struct vnode *vp, uint8_t *fhp, size_t *fhlenp, struct sockaddr_storage *sp, int *is_v3p, off_t *sizep) { struct nfsmount *nmp; diff --git a/sys/nfs/nfs_mountcommon.h b/sys/nfs/nfs_mountcommon.h index fa2547e..c004b9c 100644 --- a/sys/nfs/nfs_mountcommon.h +++ b/sys/nfs/nfs_mountcommon.h @@ -34,7 +34,7 @@ * used by the nlm. It includes a function pointer that provides * a mechanism for getting the client specific info for an nfs vnode. */ -typedef void nfs_getinfofromvp_ftype(struct vnode *, uint8_t *, int *, +typedef void nfs_getinfofromvp_ftype(struct vnode *, uint8_t *, size_t *, struct sockaddr_storage *, int *, off_t *); =20 struct nfsmount_common { diff --git a/sys/nfsclient/nfs_vfsops.c b/sys/nfsclient/nfs_vfsops.c index 3175e0f..45459e5 100644 --- a/sys/nfsclient/nfs_vfsops.c +++ b/sys/nfsclient/nfs_vfsops.c @@ -115,7 +115,7 @@ static void nfs_decode_args(struct mount *mp, struct nf= smount *nmp, static int mountnfs(struct nfs_args *, struct mount *, struct sockaddr *, char *, struct vnode **, struct ucred *cred, int); -static void nfs_getnlminfo(struct vnode *, uint8_t *, int *, +static void nfs_getnlminfo(struct vnode *, uint8_t *, size_t *, struct sockaddr_storage *, int *, off_t *); static vfs_mount_t nfs_mount; static vfs_cmount_t nfs_cmount; @@ -1498,7 +1498,7 @@ nfs_sysctl(struct mount *mp, fsctlop_t op, struct sys= ctl_req *req) * Extract the information needed by the nlm from the nfs vnode. */ static void -nfs_getnlminfo(struct vnode *vp, uint8_t *fhp, int *fhlenp, +nfs_getnlminfo(struct vnode *vp, uint8_t *fhp, size_t *fhlenp, struct sockaddr_storage *sp, int *is_v3p, off_t *sizep) { struct nfsmount *nmp; --fLv/lpE57INsRhka Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAky9bpIACgkQC3+MBN1Mb4hK7gCgpFMZy32LMePWZMYTzNN5zZWb xsIAoObMxtOMPr193adm8t13u5Lu9P+5 =PNJz -----END PGP SIGNATURE----- --fLv/lpE57INsRhka-- From owner-svn-src-head@FreeBSD.ORG Tue Oct 19 11:55: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 6C1AB1065674; Tue, 19 Oct 2010 11:55:58 +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 59AFD8FC25; Tue, 19 Oct 2010 11:55: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 o9JBtwIF013774; Tue, 19 Oct 2010 11:55:58 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9JBtw6I013770; Tue, 19 Oct 2010 11:55:58 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201010191155.o9JBtw6I013770@svn.freebsd.org> From: Rick Macklem Date: Tue, 19 Oct 2010 11:55: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: r214053 - in head/sys: fs/nfsclient 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, 19 Oct 2010 11:55:58 -0000 Author: rmacklem Date: Tue Oct 19 11:55:58 2010 New Revision: 214053 URL: http://svn.freebsd.org/changeset/base/214053 Log: Fix the type of the 3rd argument for nm_getinfo so that it works for architectures like sparc64. Suggested by: kib MFC after: 2 weeks Modified: head/sys/fs/nfsclient/nfs_clvfsops.c head/sys/nfs/nfs_mountcommon.h head/sys/nfsclient/nfs_vfsops.c Modified: head/sys/fs/nfsclient/nfs_clvfsops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clvfsops.c Tue Oct 19 10:56:56 2010 (r214052) +++ head/sys/fs/nfsclient/nfs_clvfsops.c Tue Oct 19 11:55:58 2010 (r214053) @@ -101,7 +101,7 @@ static void nfs_decode_args(struct mount static int mountnfs(struct nfs_args *, struct mount *, struct sockaddr *, char *, u_char *, u_char *, u_char *, struct vnode **, struct ucred *, struct thread *, int); -static void nfs_getnlminfo(struct vnode *, uint8_t *, int *, +static void nfs_getnlminfo(struct vnode *, uint8_t *, size_t *, struct sockaddr_storage *, int *, off_t *); static vfs_mount_t nfs_mount; static vfs_cmount_t nfs_cmount; @@ -1464,7 +1464,7 @@ nfs_sysctl(struct mount *mp, fsctlop_t o * Extract the information needed by the nlm from the nfs vnode. */ static void -nfs_getnlminfo(struct vnode *vp, uint8_t *fhp, int *fhlenp, +nfs_getnlminfo(struct vnode *vp, uint8_t *fhp, size_t *fhlenp, struct sockaddr_storage *sp, int *is_v3p, off_t *sizep) { struct nfsmount *nmp; @@ -1472,7 +1472,7 @@ nfs_getnlminfo(struct vnode *vp, uint8_t nmp = VFSTONFS(vp->v_mount); if (fhlenp != NULL) - *fhlenp = np->n_fhp->nfh_len; + *fhlenp = (size_t)np->n_fhp->nfh_len; if (fhp != NULL) bcopy(np->n_fhp->nfh_fh, fhp, np->n_fhp->nfh_len); if (sp != NULL) Modified: head/sys/nfs/nfs_mountcommon.h ============================================================================== --- head/sys/nfs/nfs_mountcommon.h Tue Oct 19 10:56:56 2010 (r214052) +++ head/sys/nfs/nfs_mountcommon.h Tue Oct 19 11:55:58 2010 (r214053) @@ -34,7 +34,7 @@ * used by the nlm. It includes a function pointer that provides * a mechanism for getting the client specific info for an nfs vnode. */ -typedef void nfs_getinfofromvp_ftype(struct vnode *, uint8_t *, int *, +typedef void nfs_getinfofromvp_ftype(struct vnode *, uint8_t *, size_t *, struct sockaddr_storage *, int *, off_t *); struct nfsmount_common { Modified: head/sys/nfsclient/nfs_vfsops.c ============================================================================== --- head/sys/nfsclient/nfs_vfsops.c Tue Oct 19 10:56:56 2010 (r214052) +++ head/sys/nfsclient/nfs_vfsops.c Tue Oct 19 11:55:58 2010 (r214053) @@ -115,7 +115,7 @@ static void nfs_decode_args(struct mount static int mountnfs(struct nfs_args *, struct mount *, struct sockaddr *, char *, struct vnode **, struct ucred *cred, int); -static void nfs_getnlminfo(struct vnode *, uint8_t *, int *, +static void nfs_getnlminfo(struct vnode *, uint8_t *, size_t *, struct sockaddr_storage *, int *, off_t *); static vfs_mount_t nfs_mount; static vfs_cmount_t nfs_cmount; @@ -1498,7 +1498,7 @@ nfs_sysctl(struct mount *mp, fsctlop_t o * Extract the information needed by the nlm from the nfs vnode. */ static void -nfs_getnlminfo(struct vnode *vp, uint8_t *fhp, int *fhlenp, +nfs_getnlminfo(struct vnode *vp, uint8_t *fhp, size_t *fhlenp, struct sockaddr_storage *sp, int *is_v3p, off_t *sizep) { struct nfsmount *nmp; @@ -1506,7 +1506,7 @@ nfs_getnlminfo(struct vnode *vp, uint8_t nmp = VFSTONFS(vp->v_mount); if (fhlenp != NULL) - *fhlenp = np->n_fhsize; + *fhlenp = (size_t)np->n_fhsize; if (fhp != NULL) bcopy(np->n_fhp, fhp, np->n_fhsize); if (sp != NULL) From owner-svn-src-head@FreeBSD.ORG Tue Oct 19 12:32: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 B4194106564A; Tue, 19 Oct 2010 12:32:04 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from esa-jnhn.mail.uoguelph.ca (esa-jnhn.mail.uoguelph.ca [131.104.91.44]) by mx1.freebsd.org (Postfix) with ESMTP id 3F6BE8FC20; Tue, 19 Oct 2010 12:32:04 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApwEAFslvUyDaFvO/2dsb2JhbACDH586qi+SMoEigzR0BIpL X-IronPort-AV: E=Sophos;i="4.57,350,1283745600"; d="scan'208";a="97709519" Received: from erie.cs.uoguelph.ca (HELO zcs3.mail.uoguelph.ca) ([131.104.91.206]) by esa-jnhn-pri.mail.uoguelph.ca with ESMTP; 19 Oct 2010 08:02:50 -0400 Received: from zcs3.mail.uoguelph.ca (localhost.localdomain [127.0.0.1]) by zcs3.mail.uoguelph.ca (Postfix) with ESMTP id 28447B3F36; Tue, 19 Oct 2010 08:02:50 -0400 (EDT) Date: Tue, 19 Oct 2010 08:02:50 -0400 (EDT) From: Rick Macklem To: Kostik Belousov Message-ID: <82448027.240470.1287489770103.JavaMail.root@erie.cs.uoguelph.ca> In-Reply-To: <20101019101026.GZ2392@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [99.225.56.115] X-Mailer: Zimbra 6.0.7_GA_2476.RHEL4 (ZimbraWebClient - SAF3 (Mac)/6.0.7_GA_2473.RHEL4_64) Cc: svn-src-head@freebsd.org, Rick Macklem , svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r214048 - in head/sys: fs/nfsclient nfs nfsclient nlm 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, 19 Oct 2010 12:32:04 -0000 > On Tue, Oct 19, 2010 at 12:20:01AM +0000, Rick Macklem wrote: > > Author: rmacklem > > Date: Tue Oct 19 00:20:00 2010 > > New Revision: 214048 > > URL: http://svn.freebsd.org/changeset/base/214048 > > > > Log: > > Modify the NFS clients and the NLM so that the NLM can be used > > by both clients. Since the NLM uses various fields of the > > nfsmount structure, those fields were extracted and put in a > > separate nfs_mountcommon structure stored in > > sys/nfs/nfs_mountcommon.h. > > This structure also has a function pointer for a function that > > extracts the required information from the mount point and nfs > > vnode > > for that particular client, for information stored differently by > > the > > clients. > > > > Reviewed by: jhb > > MFC after: 2 weeks > I believe the following is needed for 64bit platforms. > > diff --git a/sys/fs/nfsclient/nfs_clvfsops.c > b/sys/fs/nfsclient/nfs_clvfsops.c > index 816d288..0c27b9d 100644 > --- a/sys/fs/nfsclient/nfs_clvfsops.c > +++ b/sys/fs/nfsclient/nfs_clvfsops.c > @@ -101,7 +101,7 @@ static void nfs_decode_args(struct mount *mp, > struct nfsmount *nmp, > static int mountnfs(struct nfs_args *, struct mount *, > struct sockaddr *, char *, u_char *, u_char *, u_char *, > struct vnode **, struct ucred *, struct thread *, int); > -static void nfs_getnlminfo(struct vnode *, uint8_t *, int *, > +static void nfs_getnlminfo(struct vnode *, uint8_t *, size_t *, > struct sockaddr_storage *, int *, off_t *); > static vfs_mount_t nfs_mount; > static vfs_cmount_t nfs_cmount; > @@ -1464,7 +1464,7 @@ nfs_sysctl(struct mount *mp, fsctlop_t op, > struct sysctl_req *req) > * Extract the information needed by the nlm from the nfs vnode. > */ > static void > -nfs_getnlminfo(struct vnode *vp, uint8_t *fhp, int *fhlenp, > +nfs_getnlminfo(struct vnode *vp, uint8_t *fhp, size_t *fhlenp, > struct sockaddr_storage *sp, int *is_v3p, off_t *sizep) > { > struct nfsmount *nmp; > diff --git a/sys/nfs/nfs_mountcommon.h b/sys/nfs/nfs_mountcommon.h > index fa2547e..c004b9c 100644 > --- a/sys/nfs/nfs_mountcommon.h > +++ b/sys/nfs/nfs_mountcommon.h > @@ -34,7 +34,7 @@ > * used by the nlm. It includes a function pointer that provides > * a mechanism for getting the client specific info for an nfs vnode. > */ > -typedef void nfs_getinfofromvp_ftype(struct vnode *, uint8_t *, int > *, > +typedef void nfs_getinfofromvp_ftype(struct vnode *, uint8_t *, > size_t *, > struct sockaddr_storage *, int *, off_t *); > > struct nfsmount_common { > diff --git a/sys/nfsclient/nfs_vfsops.c b/sys/nfsclient/nfs_vfsops.c > index 3175e0f..45459e5 100644 > --- a/sys/nfsclient/nfs_vfsops.c > +++ b/sys/nfsclient/nfs_vfsops.c > @@ -115,7 +115,7 @@ static void nfs_decode_args(struct mount *mp, > struct nfsmount *nmp, > static int mountnfs(struct nfs_args *, struct mount *, > struct sockaddr *, char *, struct vnode **, > struct ucred *cred, int); > -static void nfs_getnlminfo(struct vnode *, uint8_t *, int *, > +static void nfs_getnlminfo(struct vnode *, uint8_t *, size_t *, > struct sockaddr_storage *, int *, off_t *); > static vfs_mount_t nfs_mount; > static vfs_cmount_t nfs_cmount; > @@ -1498,7 +1498,7 @@ nfs_sysctl(struct mount *mp, fsctlop_t op, > struct sysctl_req *req) > * Extract the information needed by the nlm from the nfs vnode. > */ > static void > -nfs_getnlminfo(struct vnode *vp, uint8_t *fhp, int *fhlenp, > +nfs_getnlminfo(struct vnode *vp, uint8_t *fhp, size_t *fhlenp, > struct sockaddr_storage *sp, int *is_v3p, off_t *sizep) > { > struct nfsmount *nmp; Oops, sorry. I should have done the "make universe". rick ps: I think r214053 fixes it. I will be away from a computer until tomorrow evening, but will look then to check that it's ok now. From owner-svn-src-head@FreeBSD.ORG Tue Oct 19 12:35: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 5396B106564A; Tue, 19 Oct 2010 12:35: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 3E6918FC0A; Tue, 19 Oct 2010 12:35: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 o9JCZfKH014715; Tue, 19 Oct 2010 12:35:41 GMT (envelope-from uqs@svn.freebsd.org) Received: (from uqs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9JCZeTg014701; Tue, 19 Oct 2010 12:35:40 GMT (envelope-from uqs@svn.freebsd.org) Message-Id: <201010191235.o9JCZeTg014701@svn.freebsd.org> From: Ulrich Spoerlein Date: Tue, 19 Oct 2010 12:35: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: r214054 - in head: contrib/bsnmp/lib libexec/bootpd sbin/routed sbin/setkey sbin/sunlabel share/man/man4/man4.arm share/man/man4/man4.i386 share/man/man4/man4.powerpc share/man/man5 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: Tue, 19 Oct 2010 12:35:41 -0000 Author: uqs Date: Tue Oct 19 12:35:40 2010 New Revision: 214054 URL: http://svn.freebsd.org/changeset/base/214054 Log: mdoc: drop even more redundant .Pp calls No change in rendered output, less mandoc lint warnings. Tool provided by: Nobuyuki Koganemaru n-kogane at syd.odn.ne.jp Modified: head/contrib/bsnmp/lib/bsnmplib.3 head/libexec/bootpd/bootptab.5 head/sbin/routed/routed.8 head/sbin/setkey/setkey.8 head/sbin/sunlabel/sunlabel.8 head/share/man/man4/man4.arm/mge.4 head/share/man/man4/man4.i386/ep.4 head/share/man/man4/man4.i386/mse.4 head/share/man/man4/man4.powerpc/tsec.4 head/share/man/man5/freebsd-update.conf.5 head/sys/netinet/libalias/libalias.3 head/usr.sbin/apmd/apmd.8 head/usr.sbin/gpioctl/gpioctl.8 Modified: head/contrib/bsnmp/lib/bsnmplib.3 ============================================================================== --- head/contrib/bsnmp/lib/bsnmplib.3 Tue Oct 19 11:55:58 2010 (r214053) +++ head/contrib/bsnmp/lib/bsnmplib.3 Tue Oct 19 12:35:40 2010 (r214054) @@ -134,7 +134,6 @@ is not zero, .Fa v.octetstring.octets points to a string allocated by .Xr malloc 3 . -.Pp .Bd -literal -offset indent #define SNMP_COMMUNITY_MAXLEN 128 #define SNMP_MAX_BINDINGS 100 Modified: head/libexec/bootpd/bootptab.5 ============================================================================== --- head/libexec/bootpd/bootptab.5 Tue Oct 19 11:55:58 2010 (r214053) +++ head/libexec/bootpd/bootptab.5 Tue Oct 19 12:35:40 2010 (r214054) @@ -388,7 +388,6 @@ hardware address. An example .Pa /etc/bootptab file follows: -.Pp .Bd -literal -offset indent # Sample bootptab file (domain=andrew.cmu.edu) Modified: head/sbin/routed/routed.8 ============================================================================== --- head/sbin/routed/routed.8 Tue Oct 19 11:55:58 2010 (r214053) +++ head/sbin/routed/routed.8 Tue Oct 19 12:35:40 2010 (r214054) @@ -440,7 +440,6 @@ The file is comprised of a series of lines, each in one of the following two formats or consist of parameters described later. Blank lines and lines starting with '#' are comments. -.Pp .Bd -ragged .Cm net .Ar Nname[/mask] Modified: head/sbin/setkey/setkey.8 ============================================================================== --- head/sbin/setkey/setkey.8 Tue Oct 19 11:55:58 2010 (r214053) +++ head/sbin/setkey/setkey.8 Tue Oct 19 12:35:40 2010 (r214054) @@ -565,7 +565,6 @@ There are small, but important, differen See .Xr ipsec_set_policy 3 for details. -.Pp .El .Pp .\" @@ -583,7 +582,6 @@ in the of the .Ar protocol parameter: -.Pp .Bd -literal -offset indent algorithm keylen (bits) comment hmac-md5 128 ah: rfc2403 @@ -616,7 +614,6 @@ in the of the .Ar protocol parameter: -.Pp .Bd -literal -offset indent algorithm keylen (bits) comment des-cbc 64 esp-old: rfc1829, esp: rfc2405 @@ -643,7 +640,6 @@ in the of the .Ar protocol parameter: -.Pp .Bd -literal -offset indent algorithm comment deflate rfc2394 Modified: head/sbin/sunlabel/sunlabel.8 ============================================================================== --- head/sbin/sunlabel/sunlabel.8 Tue Oct 19 11:55:58 2010 (r214053) +++ head/sbin/sunlabel/sunlabel.8 Tue Oct 19 12:35:40 2010 (r214054) @@ -120,7 +120,6 @@ Options are listed in alphabetical order Note that only those option combinations listed under .Sx SYNOPSIS are allowable. -.Pp .Bl -tag -width ".Fl b Ar bootpath" .It Fl b Ar bootpath Specify that Modified: head/share/man/man4/man4.arm/mge.4 ============================================================================== --- head/share/man/man4/man4.arm/mge.4 Tue Oct 19 11:55:58 2010 (r214053) +++ head/share/man/man4/man4.arm/mge.4 Tue Oct 19 12:35:40 2010 (r214054) @@ -47,7 +47,6 @@ system-on-chip devices. The .Nm driver supports the following media types: -.Pp .Bl -tag -width xxxxxxxxxxxxxxxxxxxx .It autoselect Enable autoselection of the media type and options @@ -62,7 +61,6 @@ Set 1000baseT operation The .Nm driver supports the following media options: -.Pp .Bl -tag -width xxxxxxxxxxxxxxxxxxxx .It full-duplex Set full duplex operation Modified: head/share/man/man4/man4.i386/ep.4 ============================================================================== --- head/share/man/man4/man4.i386/ep.4 Tue Oct 19 11:55:58 2010 (r214053) +++ head/share/man/man4/man4.i386/ep.4 Tue Oct 19 12:35:40 2010 (r214054) @@ -57,7 +57,6 @@ Parallel Tasking chipset. .Pp Various models of these cards come with a different assortment of connectors: -.Pp .Bl -tag -width xxxxxxxxxxxxxxxxxxxx .It AUI/DIX Standard 15 pin connector, also known as 10base5 (thick-net) @@ -74,7 +73,6 @@ To override this, use the following medi or in your .Pa /etc/rc.conf file. -.Pp .Bl -tag -width xxxxxxxxxxxxxxxxxxxx .It 10base5/AUI Use the AUI port. Modified: head/share/man/man4/man4.i386/mse.4 ============================================================================== --- head/share/man/man4/man4.i386/mse.4 Tue Oct 19 11:55:58 2010 (r214053) +++ head/share/man/man4/man4.i386/mse.4 Tue Oct 19 12:35:40 2010 (r214054) @@ -147,7 +147,6 @@ or in the User Configuration Menu at the boot time (see .Xr boot 8 ) . -.Pp .Bl -tag -width MOUSE .It bit 4..7 ACCELERATION This flag controls the amount of acceleration effect. Modified: head/share/man/man4/man4.powerpc/tsec.4 ============================================================================== --- head/share/man/man4/man4.powerpc/tsec.4 Tue Oct 19 11:55:58 2010 (r214053) +++ head/share/man/man4/man4.powerpc/tsec.4 Tue Oct 19 12:35:40 2010 (r214054) @@ -47,7 +47,6 @@ some of the Freescale system-on-chip dev The .Nm driver supports the following media types: -.Pp .Bl -tag -width xxxxxxxxxxxxxxxxxxxx .It autoselect Enable autoselection of the media type and options @@ -62,7 +61,6 @@ Set 1000baseT operation The .Nm driver supports the following media options: -.Pp .Bl -tag -width xxxxxxxxxxxxxxxxxxxx .It full-duplex Set full duplex operation Modified: head/share/man/man5/freebsd-update.conf.5 ============================================================================== --- head/share/man/man5/freebsd-update.conf.5 Tue Oct 19 11:55:58 2010 (r214053) +++ head/share/man/man5/freebsd-update.conf.5 Tue Oct 19 12:35:40 2010 (r214054) @@ -47,7 +47,6 @@ Unless stated otherwise, specifying an o error. .Pp The possible options and their meanings are as follows: -.Pp .Bl -tag -width ".Cm BackupKernelSymbolFiles" .It Cm KeyPrint The single parameter following this keyword is the SHA256 hash Modified: head/sys/netinet/libalias/libalias.3 ============================================================================== --- head/sys/netinet/libalias/libalias.3 Tue Oct 19 11:55:58 2010 (r214053) +++ head/sys/netinet/libalias/libalias.3 Tue Oct 19 12:35:40 2010 (r214054) @@ -899,7 +899,6 @@ protocols (except for IP, TCP and UDP) t .Sh ACKNOWLEDGMENTS Listed below, in approximate chronological order, are individuals who have provided valuable comments and/or debugging assistance. -.Pp .Bd -ragged -offset indent .An -split .An Gary Roberts Modified: head/usr.sbin/apmd/apmd.8 ============================================================================== --- head/usr.sbin/apmd/apmd.8 Tue Oct 19 11:55:58 2010 (r214053) +++ head/usr.sbin/apmd/apmd.8 Tue Oct 19 12:35:40 2010 (r214054) @@ -143,7 +143,6 @@ The structure of the .Nm configuration file is quite simple. For example: -.Pp .Bd -literal apm_event SUSPENDREQ { exec "sync && sync && sync"; @@ -161,7 +160,6 @@ to receive the APM event command 3 times and wait for a while, then execute .Nm zzz ( Ns Nm apm Fl z ) to put the system in the suspend state. -.Pp .Bl -bullet .It The apm_event keyword Modified: head/usr.sbin/gpioctl/gpioctl.8 ============================================================================== --- head/usr.sbin/gpioctl/gpioctl.8 Tue Oct 19 11:55:58 2010 (r214053) +++ head/usr.sbin/gpioctl/gpioctl.8 Tue Oct 19 12:35:40 2010 (r214054) @@ -95,7 +95,6 @@ toggle value of provided pin number be verbose: for each listed pin print current configuration .El .Sh EXAMPLES -.Pp .Bl -bullet .It List pins available on GPIO controller defined by device /dev/gpioctl0 From owner-svn-src-head@FreeBSD.ORG Tue Oct 19 13:16: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 6376A106567A; Tue, 19 Oct 2010 13:16:08 +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 1AFBC8FC15; Tue, 19 Oct 2010 13:16:08 +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 863D646B7F; Tue, 19 Oct 2010 09:16:07 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 0BE368A01D; Tue, 19 Oct 2010 09:16:06 -0400 (EDT) From: John Baldwin To: Alexander Motin Date: Tue, 19 Oct 2010 08:36:37 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100819; KDE/4.4.5; amd64; ; ) References: <201010171646.o9HGks2U038501@svn.freebsd.org> <20101018213055.GP1416@alchemy.franken.de> <4CBCBF25.8010902@FreeBSD.org> In-Reply-To: <4CBCBF25.8010902@FreeBSD.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201010190836.37272.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Tue, 19 Oct 2010 09:16:06 -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, Marius Strobl Subject: Re: svn commit: r213985 - 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: Tue, 19 Oct 2010 13:16:08 -0000 On Monday, October 18, 2010 5:41:57 pm Alexander Motin wrote: > Marius Strobl wrote: > > On Mon, Oct 18, 2010 at 05:05:24PM -0400, John Baldwin wrote: > >> On Monday, October 18, 2010 4:52:24 pm Marius Strobl wrote: > >>> AFAICT this is not true; intr_event_handle() in sys/kern/kern_intr.c > >>> is what enters a critical section and f.e. on amd64 I don't see where > >>> anywhere in the path from ISR_VEC() to intr_execute_handlers() > >>> calling intr_event_handle() a critical section would be entered, > >>> which also means that in intr_execute_handlers() td_intr_nesting_level > >>> is incremented outside of a critical section. > >> Not all of the clock interrupts use intr_event_handle(). The local APIC > >> timer uses its own interrupt entry point on x86 for example and uses an > >> explicit critical section as a result. I suspect the sparc64 tick interrupt > >> is closer to the local APIC timer case and doesn't use intr_event_handle(). > > > > Correct; but still you can't say that the MD interrupt code enters a > > critical section in general, neither is incrementing td_intr_nesting_level > > in intr_execute_handlers() protected by a critical section. > > > >> The fact that some clock interrupts do use intr_event_handle() (e.g. the > >> atrtc driver on x86 now) does indicate that the low-level interrupt code > >> probably does not belong in the time events code but in the caller. > > > > Well, I agree that entering a critical section in the time events > > code would mean entering a nested critical section unnecessarily in > > case the clock driver uses a regular "fast" interrupt handler and > > that should be avoided. Still I don't think the event time front-end > > actually should need to worry about wrapping the callback in a > > critical section. > > Interrupt frame, required for hard-/stat-/profclock() operation is > stored in curthread. So critical section is effectively mandatory there > now. Correct td_intr_nesting_level value is also important for proper > interrupt threads scheduling - one more reason to have critical section > there. It is indeed strange that td_intr_nesting_level in > intr_event_handle() is not covered by critical section, but probably it > should. I don't see why the interrupt frame logic requires bumping td_intr_nesting_level. I agree with bde@ that in general td_intr_nesting_level is useless (it is always 0 for most code and always 1 for filters and the ithread code that schedules an ithread). It does not need any protection for interrupts since the CPU has already disabled nesting interrupts. The critical_enter()'s sole purpose is to avoid a kind of priority inversion to ensure that the very high priority interrupt code (filters, etc.) is not preempted by an ithread. As far as the interrupt frame logic, the logic should have no need of td_intr_nesting_level. An interrupt should just save the current value of td_intr_frame before setting it and restore the saved value afterwards. No need for dealing with td_intr_nesting_level at all. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Tue Oct 19 13:31: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 9B5B8106564A; Tue, 19 Oct 2010 13:31: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 89C958FC0A; Tue, 19 Oct 2010 13:31: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 o9JDVhfg016117; Tue, 19 Oct 2010 13:31:43 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9JDVh2R016115; Tue, 19 Oct 2010 13:31:43 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201010191331.o9JDVh2R016115@svn.freebsd.org> From: Rui Paulo Date: Tue, 19 Oct 2010 13:31: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: r214056 - head/sys/modules/wlan 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, 19 Oct 2010 13:31:43 -0000 Author: rpaulo Date: Tue Oct 19 13:31:43 2010 New Revision: 214056 URL: http://svn.freebsd.org/changeset/base/214056 Log: Revert r206418 Modified: head/sys/modules/wlan/Makefile Modified: head/sys/modules/wlan/Makefile ============================================================================== --- head/sys/modules/wlan/Makefile Tue Oct 19 13:06:26 2010 (r214055) +++ head/sys/modules/wlan/Makefile Tue Oct 19 13:31:43 2010 (r214056) @@ -3,13 +3,13 @@ .PATH: ${.CURDIR}/../../net80211 KMOD= wlan -SRCS= ieee80211.c ieee80211_action.c ieee80211_ageq.c ieee80211_amrr.c \ +SRCS= ieee80211.c ieee80211_action.c ieee80211_ageq.c \ ieee80211_crypto.c ieee80211_crypto_none.c ieee80211_dfs.c \ ieee80211_freebsd.c ieee80211_input.c ieee80211_ioctl.c \ ieee80211_mesh.c ieee80211_node.c ieee80211_output.c ieee80211_phy.c \ ieee80211_power.c ieee80211_proto.c ieee80211_scan.c \ ieee80211_scan_sta.c ieee80211_radiotap.c ieee80211_ratectl.c \ - ieee80211_regdomain.c ieee80211_rssadapt.c \ + ieee80211_regdomain.c \ ieee80211_ht.c ieee80211_hwmp.c ieee80211_adhoc.c ieee80211_hostap.c \ ieee80211_monitor.c ieee80211_sta.c ieee80211_wds.c ieee80211_ddb.c SRCS+= bus_if.h device_if.h opt_inet.h opt_inet6.h opt_ipx.h opt_wlan.h \ From owner-svn-src-head@FreeBSD.ORG Tue Oct 19 13:37: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 A53C01065679; Tue, 19 Oct 2010 13:37:25 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-bw0-f54.google.com (mail-bw0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id 9AE278FC12; Tue, 19 Oct 2010 13:37:24 +0000 (UTC) Received: by bwz15 with SMTP id 15so228482bwz.13 for ; Tue, 19 Oct 2010 06:37:23 -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=Y+A0uN4tQc7LYBs1Wm9MWmo9oKofIGsLaeWo3+xofsY=; b=H2kltqWN6Ooj93hp/udvrfgkgk39TlLTP6O3/zqNXoe0K3Q6lqs3HEFeiZxuW4nlts KajdA0NlEbmF5uFm/RByFCXN5OUFmvE3HbfgHicCgdUpbppAHOStK7GsGgI4pt0LC0ou rNvUxaxc7ioTAZDhQ5FWgYc6RohcAa7uUJOrs= 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=XzKGBEN0qro2p3UYc7Puw6sk/8E+RklOalwSmQ9rdGXIeg9SlQJG1UPHkmTa/tPxsV 9j3dxduWF186fNBc+WygDQ8wHHLYm5SwDdff9n3JUg096FqGhFa6XTnpFCSlr+M3In3/ XdduQFBQHUGFY9du8Txri6Ik5II1WVWgPlMIg= Received: by 10.204.42.4 with SMTP id q4mr2587542bke.47.1287495442996; Tue, 19 Oct 2010 06:37:22 -0700 (PDT) Received: from mavbook2.mavhome.dp.ua (pc.mavhome.dp.ua [212.86.226.226]) by mx.google.com with ESMTPS id g8sm13153303bkg.11.2010.10.19.06.37.19 (version=SSLv3 cipher=RC4-MD5); Tue, 19 Oct 2010 06:37:20 -0700 (PDT) Sender: Alexander Motin Message-ID: <4CBD9F0B.80701@FreeBSD.org> Date: Tue, 19 Oct 2010 16:37:15 +0300 From: Alexander Motin User-Agent: Thunderbird 2.0.0.23 (X11/20091212) MIME-Version: 1.0 To: John Baldwin References: <201010171646.o9HGks2U038501@svn.freebsd.org> <20101018213055.GP1416@alchemy.franken.de> <4CBCBF25.8010902@FreeBSD.org> <201010190836.37272.jhb@freebsd.org> In-Reply-To: <201010190836.37272.jhb@freebsd.org> X-Enigmail-Version: 0.96.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Marius Strobl Subject: Re: svn commit: r213985 - 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: Tue, 19 Oct 2010 13:37:25 -0000 John Baldwin wrote: > On Monday, October 18, 2010 5:41:57 pm Alexander Motin wrote: >> Marius Strobl wrote: >>> On Mon, Oct 18, 2010 at 05:05:24PM -0400, John Baldwin wrote: >>>> On Monday, October 18, 2010 4:52:24 pm Marius Strobl wrote: >>>>> AFAICT this is not true; intr_event_handle() in sys/kern/kern_intr.c >>>>> is what enters a critical section and f.e. on amd64 I don't see where >>>>> anywhere in the path from ISR_VEC() to intr_execute_handlers() >>>>> calling intr_event_handle() a critical section would be entered, >>>>> which also means that in intr_execute_handlers() td_intr_nesting_level >>>>> is incremented outside of a critical section. >>>> Not all of the clock interrupts use intr_event_handle(). The local APIC >>>> timer uses its own interrupt entry point on x86 for example and uses an >>>> explicit critical section as a result. I suspect the sparc64 tick interrupt >>>> is closer to the local APIC timer case and doesn't use intr_event_handle(). >>> Correct; but still you can't say that the MD interrupt code enters a >>> critical section in general, neither is incrementing td_intr_nesting_level >>> in intr_execute_handlers() protected by a critical section. >>> >>>> The fact that some clock interrupts do use intr_event_handle() (e.g. the >>>> atrtc driver on x86 now) does indicate that the low-level interrupt code >>>> probably does not belong in the time events code but in the caller. >>> Well, I agree that entering a critical section in the time events >>> code would mean entering a nested critical section unnecessarily in >>> case the clock driver uses a regular "fast" interrupt handler and >>> that should be avoided. Still I don't think the event time front-end >>> actually should need to worry about wrapping the callback in a >>> critical section. >> Interrupt frame, required for hard-/stat-/profclock() operation is >> stored in curthread. So critical section is effectively mandatory there >> now. Correct td_intr_nesting_level value is also important for proper >> interrupt threads scheduling - one more reason to have critical section >> there. It is indeed strange that td_intr_nesting_level in >> intr_event_handle() is not covered by critical section, but probably it >> should. > > I don't see why the interrupt frame logic requires bumping > td_intr_nesting_level. It doesn't. It was two different sentences. I've just noticed that td_intr_nesting_level used by SCHED_ULE to bind interrupt threads on their CPUs. I agree that it may be not a very good idea, but it is what we have now. -- Alexander Motin From owner-svn-src-head@FreeBSD.ORG Tue Oct 19 14:12: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 920631065675; Tue, 19 Oct 2010 14:12:31 +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 4EFA08FC18; Tue, 19 Oct 2010 14:12:31 +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 DA13746B86; Tue, 19 Oct 2010 10:12:30 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id D7C9D8A009; Tue, 19 Oct 2010 10:12:29 -0400 (EDT) From: John Baldwin To: Alexander Motin Date: Tue, 19 Oct 2010 09:46:56 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100819; KDE/4.4.5; amd64; ; ) References: <201010171646.o9HGks2U038501@svn.freebsd.org> <201010190836.37272.jhb@freebsd.org> <4CBD9F0B.80701@FreeBSD.org> In-Reply-To: <4CBD9F0B.80701@FreeBSD.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201010190946.56535.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Tue, 19 Oct 2010 10:12:29 -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, Marius Strobl Subject: Re: svn commit: r213985 - 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: Tue, 19 Oct 2010 14:12:31 -0000 On Tuesday, October 19, 2010 9:37:15 am Alexander Motin wrote: > John Baldwin wrote: > > On Monday, October 18, 2010 5:41:57 pm Alexander Motin wrote: > >> Marius Strobl wrote: > >>> On Mon, Oct 18, 2010 at 05:05:24PM -0400, John Baldwin wrote: > >>>> On Monday, October 18, 2010 4:52:24 pm Marius Strobl wrote: > >>>>> AFAICT this is not true; intr_event_handle() in sys/kern/kern_intr.c > >>>>> is what enters a critical section and f.e. on amd64 I don't see where > >>>>> anywhere in the path from ISR_VEC() to intr_execute_handlers() > >>>>> calling intr_event_handle() a critical section would be entered, > >>>>> which also means that in intr_execute_handlers() td_intr_nesting_level > >>>>> is incremented outside of a critical section. > >>>> Not all of the clock interrupts use intr_event_handle(). The local APIC > >>>> timer uses its own interrupt entry point on x86 for example and uses an > >>>> explicit critical section as a result. I suspect the sparc64 tick interrupt > >>>> is closer to the local APIC timer case and doesn't use intr_event_handle(). > >>> Correct; but still you can't say that the MD interrupt code enters a > >>> critical section in general, neither is incrementing td_intr_nesting_level > >>> in intr_execute_handlers() protected by a critical section. > >>> > >>>> The fact that some clock interrupts do use intr_event_handle() (e.g. the > >>>> atrtc driver on x86 now) does indicate that the low-level interrupt code > >>>> probably does not belong in the time events code but in the caller. > >>> Well, I agree that entering a critical section in the time events > >>> code would mean entering a nested critical section unnecessarily in > >>> case the clock driver uses a regular "fast" interrupt handler and > >>> that should be avoided. Still I don't think the event time front-end > >>> actually should need to worry about wrapping the callback in a > >>> critical section. > >> Interrupt frame, required for hard-/stat-/profclock() operation is > >> stored in curthread. So critical section is effectively mandatory there > >> now. Correct td_intr_nesting_level value is also important for proper > >> interrupt threads scheduling - one more reason to have critical section > >> there. It is indeed strange that td_intr_nesting_level in > >> intr_event_handle() is not covered by critical section, but probably it > >> should. > > > > I don't see why the interrupt frame logic requires bumping > > td_intr_nesting_level. > > It doesn't. It was two different sentences. I've just noticed that > td_intr_nesting_level used by SCHED_ULE to bind interrupt threads on > their CPUs. I agree that it may be not a very good idea, but it is what > we have now. FWIW, my new interrupt thread code makes that binding explicit in the interrupt code and not in the scheduler. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Tue Oct 19 15:12: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 41622106564A; Tue, 19 Oct 2010 15:12:17 +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 2F57D8FC17; Tue, 19 Oct 2010 15:12: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 o9JFCHCa018662; Tue, 19 Oct 2010 15:12:17 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9JFCHR4018660; Tue, 19 Oct 2010 15:12:17 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201010191512.o9JFCHR4018660@svn.freebsd.org> From: Ed Maste Date: Tue, 19 Oct 2010 15:12: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: r214059 - 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: Tue, 19 Oct 2010 15:12:17 -0000 Author: emaste Date: Tue Oct 19 15:12:16 2010 New Revision: 214059 URL: http://svn.freebsd.org/changeset/base/214059 Log: Minor cleanup, including sysctl -n instead of sed to remove the sysctl name. Reviewed by: imp Modified: head/usr.sbin/pc-sysinstall/backend-query/sys-mem.sh Modified: head/usr.sbin/pc-sysinstall/backend-query/sys-mem.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend-query/sys-mem.sh Tue Oct 19 14:11:50 2010 (r214058) +++ head/usr.sbin/pc-sysinstall/backend-query/sys-mem.sh Tue Oct 19 15:12:16 2010 (r214059) @@ -25,7 +25,4 @@ # # $FreeBSD$ -MEM=`sysctl hw.realmem | sed "s|hw.realmem: ||g"` -MEM=`expr $MEM / 1024` -MEM=`expr $MEM / 1024` -echo $MEM +expr $(sysctl -n hw.realmem) / 1048576 From owner-svn-src-head@FreeBSD.ORG Tue Oct 19 15:18: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 AA975106564A; Tue, 19 Oct 2010 15:18:40 +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 989068FC12; Tue, 19 Oct 2010 15:18: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 o9JFIeu9018818; Tue, 19 Oct 2010 15:18:40 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9JFIeAh018816; Tue, 19 Oct 2010 15:18:40 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201010191518.o9JFIeAh018816@svn.freebsd.org> From: Ed Maste Date: Tue, 19 Oct 2010 15:18: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: r214060 - 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: Tue, 19 Oct 2010 15:18:40 -0000 Author: emaste Date: Tue Oct 19 15:18:40 2010 New Revision: 214060 URL: http://svn.freebsd.org/changeset/base/214060 Log: Simplify and significantly speed up the timezone listing backend script. Reviewed by: imp Modified: head/usr.sbin/pc-sysinstall/backend-query/list-tzones.sh Modified: head/usr.sbin/pc-sysinstall/backend-query/list-tzones.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend-query/list-tzones.sh Tue Oct 19 15:12:16 2010 (r214059) +++ head/usr.sbin/pc-sysinstall/backend-query/list-tzones.sh Tue Oct 19 15:18:40 2010 (r214060) @@ -25,19 +25,10 @@ # # $FreeBSD$ -rm ${TMPDIR}/.tzonetmp >/dev/null 2>/dev/null - # Backend script which lists all the available timezones for front-ends to display -while read line -do - echo "$line" | grep "^#" >/dev/null 2>/dev/null - if [ "$?" != "0" ] - then - echo "$line" | tr -s "\t" ":" | cut -d ":" -f 3-4 >>${TMPDIR}/.tzonetmp - fi -done < /usr/share/zoneinfo/zone.tab - -sort ${TMPDIR}/.tzonetmp -rm -f ${TMPDIR}/.tzonetmp >/dev/null 2>/dev/null +egrep -v '^#' /usr/share/zoneinfo/zone.tab |\ + tr -s "\t" ":" |\ + cut -d ":" -f 3-4 |\ + sort exit 0 From owner-svn-src-head@FreeBSD.ORG Tue Oct 19 15:26: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 6CF33106564A; Tue, 19 Oct 2010 15:26:08 +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 5B7368FC1F; Tue, 19 Oct 2010 15:26: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 o9JFQ8E6019027; Tue, 19 Oct 2010 15:26:08 GMT (envelope-from uqs@svn.freebsd.org) Received: (from uqs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9JFQ8Ua019025; Tue, 19 Oct 2010 15:26:08 GMT (envelope-from uqs@svn.freebsd.org) Message-Id: <201010191526.o9JFQ8Ua019025@svn.freebsd.org> From: Ulrich Spoerlein Date: Tue, 19 Oct 2010 15:26: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: r214061 - 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: Tue, 19 Oct 2010 15:26:08 -0000 Author: uqs Date: Tue Oct 19 15:26:08 2010 New Revision: 214061 URL: http://svn.freebsd.org/changeset/base/214061 Log: mdoc: fix markup typo MFC after: 1 week (together with r213983) Modified: head/share/man/man9/vrele.9 Modified: head/share/man/man9/vrele.9 ============================================================================== --- head/share/man/man9/vrele.9 Tue Oct 19 15:18:40 2010 (r214060) +++ head/share/man/man9/vrele.9 Tue Oct 19 15:26:08 2010 (r214061) @@ -59,7 +59,7 @@ The .Fn vrele function takes an unlocked vnode and returns with the vnode unlocked. .Pp -.The +The .Fn vput function should be given a locked vnode as argument, the vnode is unlocked after the function returned. From owner-svn-src-head@FreeBSD.ORG Tue Oct 19 16: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 092DA106564A; Tue, 19 Oct 2010 16:06:01 +0000 (UTC) (envelope-from mdf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EB7AB8FC19; Tue, 19 Oct 2010 16:06: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 o9JG604p019822; Tue, 19 Oct 2010 16:06:00 GMT (envelope-from mdf@svn.freebsd.org) Received: (from mdf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9JG60DC019819; Tue, 19 Oct 2010 16:06:00 GMT (envelope-from mdf@svn.freebsd.org) Message-Id: <201010191606.o9JG60DC019819@svn.freebsd.org> From: Matthew D Fleming Date: Tue, 19 Oct 2010 16:06:00 +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: r214062 - in head: share/man/man9 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: Tue, 19 Oct 2010 16:06:01 -0000 Author: mdf Date: Tue Oct 19 16:06:00 2010 New Revision: 214062 URL: http://svn.freebsd.org/changeset/base/214062 Log: uma_zfree(zone, NULL) should do nothing, to match free(9). Noticed by: Ron Steinke MFC after: 3 days Modified: head/share/man/man9/zone.9 head/sys/vm/uma_core.c Modified: head/share/man/man9/zone.9 ============================================================================== --- head/share/man/man9/zone.9 Tue Oct 19 15:26:08 2010 (r214061) +++ head/share/man/man9/zone.9 Tue Oct 19 16:06:00 2010 (r214062) @@ -153,6 +153,13 @@ Items are released back to the zone from calling .Fn uma_zfree with a pointer to the zone and a pointer to the item. +If +.Fa item +is +.Dv NULL , +then +.Fn uma_zfree +does nothing. .Pp The variations .Fn uma_zalloc_arg Modified: head/sys/vm/uma_core.c ============================================================================== --- head/sys/vm/uma_core.c Tue Oct 19 15:26:08 2010 (r214061) +++ head/sys/vm/uma_core.c Tue Oct 19 16:06:00 2010 (r214062) @@ -2517,6 +2517,10 @@ uma_zfree_arg(uma_zone_t zone, void *ite CTR2(KTR_UMA, "uma_zfree_arg thread %x zone %s", curthread, zone->uz_name); + /* uma_zfree(..., NULL) does nothing, to match free(9). */ + if (item == NULL) + return; + if (zone->uz_dtor) zone->uz_dtor(item, zone->uz_size, udata); From owner-svn-src-head@FreeBSD.ORG Tue Oct 19 16:48: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 32BB9106566C; Tue, 19 Oct 2010 16:48:50 +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 216958FC13; Tue, 19 Oct 2010 16:48: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 o9JGmobA020737; Tue, 19 Oct 2010 16:48:50 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9JGmoUZ020735; Tue, 19 Oct 2010 16:48:50 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201010191648.o9JGmoUZ020735@svn.freebsd.org> From: Jaakko Heinonen Date: Tue, 19 Oct 2010 16:48: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: r214063 - head/sys/geom 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, 19 Oct 2010 16:48:50 -0000 Author: jh Date: Tue Oct 19 16:48:49 2010 New Revision: 214063 URL: http://svn.freebsd.org/changeset/base/214063 Log: Use make_dev_p(9) with the MAKEDEV_CHECKNAME flag instead of make_dev(9) and print a diagnostic if the call fails. This avoids a panic when a device with an invalid name is attempted to be registered. For example the label class gets device names from untrusted input. Reviewed by: freebsd-geom Modified: head/sys/geom/geom_dev.c Modified: head/sys/geom/geom_dev.c ============================================================================== --- head/sys/geom/geom_dev.c Tue Oct 19 16:06:00 2010 (r214062) +++ head/sys/geom/geom_dev.c Tue Oct 19 16:48:49 2010 (r214063) @@ -126,8 +126,16 @@ g_dev_taste(struct g_class *mp, struct g error = g_attach(cp, pp); KASSERT(error == 0, ("g_dev_taste(%s) failed to g_attach, err=%d", pp->name, error)); - dev = make_dev(&g_dev_cdevsw, 0, - UID_ROOT, GID_OPERATOR, 0640, "%s", gp->name); + error = make_dev_p(MAKEDEV_CHECKNAME | MAKEDEV_WAITOK, &dev, + &g_dev_cdevsw, NULL, UID_ROOT, GID_OPERATOR, 0640, "%s", gp->name); + if (error != 0) { + printf("%s: make_dev_p() failed (gp->name=%s, error=%d)\n", + __func__, gp->name, error); + g_detach(cp); + g_destroy_consumer(cp); + g_destroy_geom(gp); + return (NULL); + } if (pp->flags & G_PF_CANDELETE) dev->si_flags |= SI_CANDELETE; dev->si_iosize_max = MAXPHYS; From owner-svn-src-head@FreeBSD.ORG Tue Oct 19 17:05: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 C150F106566C; Tue, 19 Oct 2010 17:05:51 +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 AED0A8FC0A; Tue, 19 Oct 2010 17:05: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 o9JH5ppD021163; Tue, 19 Oct 2010 17:05:51 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9JH5pdS021161; Tue, 19 Oct 2010 17:05:51 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201010191705.o9JH5pdS021161@svn.freebsd.org> From: Jung-uk Kim Date: Tue, 19 Oct 2010 17:05: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: r214064 - head/sys/dev/pci 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, 19 Oct 2010 17:05:51 -0000 Author: jkim Date: Tue Oct 19 17:05:51 2010 New Revision: 214064 URL: http://svn.freebsd.org/changeset/base/214064 Log: Do not apply do_power_resume for suspending case. When do_powerstate was splitted into do_power_resume and do_power_nodriver, it became stale. Modified: head/sys/dev/pci/pci.c Modified: head/sys/dev/pci/pci.c ============================================================================== --- head/sys/dev/pci/pci.c Tue Oct 19 16:48:49 2010 (r214063) +++ head/sys/dev/pci/pci.c Tue Oct 19 17:05:51 2010 (r214064) @@ -2911,9 +2911,6 @@ pci_set_power_children(device_t dev, dev struct pci_devinfo *dinfo; int dstate, i; - if (!pci_do_power_resume) - return; - /* * Set the device to the given state. If the firmware suggests * a different power state, use it instead. If power management @@ -2976,7 +2973,9 @@ pci_resume(device_t dev) */ if ((error = device_get_children(dev, &devlist, &numdevs)) != 0) return (error); - pci_set_power_children(dev, devlist, numdevs, PCI_POWERSTATE_D0); + if (pci_do_power_resume) + pci_set_power_children(dev, devlist, numdevs, + PCI_POWERSTATE_D0); /* Now the device is powered up, restore its config space. */ for (i = 0; i < numdevs; i++) { From owner-svn-src-head@FreeBSD.ORG Tue Oct 19 17:15: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 624E61065693; Tue, 19 Oct 2010 17:15:22 +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 511178FC28; Tue, 19 Oct 2010 17:15:22 +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 o9JHFMi8021420; Tue, 19 Oct 2010 17:15:22 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9JHFMYV021418; Tue, 19 Oct 2010 17:15:22 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201010191715.o9JHFMYV021418@svn.freebsd.org> From: Jung-uk Kim Date: Tue, 19 Oct 2010 17:15:22 +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: r214065 - head/sys/dev/pci 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, 19 Oct 2010 17:15:22 -0000 Author: jkim Date: Tue Oct 19 17:15:22 2010 New Revision: 214065 URL: http://svn.freebsd.org/changeset/base/214065 Log: Remove PCI header type 0 restriction from power state changes. PCI config. registers for bridges are saved and restored since r200341. OK'ed by: imp, jhb Modified: head/sys/dev/pci/pci.c Modified: head/sys/dev/pci/pci.c ============================================================================== --- head/sys/dev/pci/pci.c Tue Oct 19 17:05:51 2010 (r214064) +++ head/sys/dev/pci/pci.c Tue Oct 19 17:15:22 2010 (r214065) @@ -2916,7 +2916,7 @@ pci_set_power_children(device_t dev, dev * a different power state, use it instead. If power management * is not present, the firmware is responsible for managing * device power. Skip children who aren't attached since they - * are handled separately. Only manage type 0 devices for now. + * are handled separately. */ pcib = device_get_parent(dev); for (i = 0; i < numdevs; i++) { @@ -2924,8 +2924,6 @@ pci_set_power_children(device_t dev, dev dinfo = device_get_ivars(child); dstate = state; if (device_is_attached(child) && - (dinfo->cfg.hdrtype & PCIM_HDRTYPE) == - PCIM_HDRTYPE_NORMAL && PCIB_POWER_FOR_SLEEP(pcib, dev, &dstate) == 0) pci_set_powerstate(child, dstate); } From owner-svn-src-head@FreeBSD.ORG Tue Oct 19 17:49: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 E92B0106564A; Tue, 19 Oct 2010 17:49:55 +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 D7D9D8FC19; Tue, 19 Oct 2010 17:49: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 o9JHntM2022205; Tue, 19 Oct 2010 17:49:55 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9JHntjH022203; Tue, 19 Oct 2010 17:49:55 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201010191749.o9JHntjH022203@svn.freebsd.org> From: Xin LI Date: Tue, 19 Oct 2010 17:49: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: r214066 - 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, 19 Oct 2010 17:49:56 -0000 Author: delphij Date: Tue Oct 19 17:49:55 2010 New Revision: 214066 URL: http://svn.freebsd.org/changeset/base/214066 Log: Clarify that lagg(4) sends/receives on active port, not the master port. Note that this still seems to be a little bit confusing as the concept of "master" is different from what people would expect on a networking equipment. Modified: head/share/man/man4/lagg.4 Modified: head/share/man/man4/lagg.4 ============================================================================== --- head/share/man/man4/lagg.4 Tue Oct 19 17:15:22 2010 (r214065) +++ head/share/man/man4/lagg.4 Tue Oct 19 17:49:55 2010 (r214066) @@ -16,7 +16,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 8, 2010 +.Dd October 18, 2010 .Dt LAGG 4 .Os .Sh NAME @@ -73,14 +73,14 @@ The interface link state is used to vali not. .Bl -tag -width loadbalance .It Ic failover -Sends traffic only through the master port. +Sends traffic only through the active port. If the master port becomes unavailable, the next active port is used. The first interface added is the master port; any interfaces added after that are used as failover devices. .Pp By default, received traffic is only accepted when they are received -through the master port. +through the active port. This constraint can be relaxed by setting the .Va net.link.lagg.failover_rx_all .Xr sysctl 8 From owner-svn-src-head@FreeBSD.ORG Tue Oct 19 18:32: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 984F0106566B; Tue, 19 Oct 2010 18:32:01 +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 872DF8FC13; Tue, 19 Oct 2010 18:32: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 o9JIW1lw023312; Tue, 19 Oct 2010 18:32:01 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9JIW121023310; Tue, 19 Oct 2010 18:32:01 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201010191832.o9JIW121023310@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Tue, 19 Oct 2010 18:32: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: r214067 - 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: Tue, 19 Oct 2010 18:32:01 -0000 Author: ae Date: Tue Oct 19 18:32:01 2010 New Revision: 214067 URL: http://svn.freebsd.org/changeset/base/214067 Log: ZFS pool name is not a real device in devfs. Do not wait for device appear when mounting root from ZFS. Reviewed by: marcel Approved by: mav (mentor) Modified: head/sys/kern/vfs_mountroot.c Modified: head/sys/kern/vfs_mountroot.c ============================================================================== --- head/sys/kern/vfs_mountroot.c Tue Oct 19 17:49:55 2010 (r214066) +++ head/sys/kern/vfs_mountroot.c Tue Oct 19 18:32:01 2010 (r214067) @@ -713,7 +713,8 @@ parse_mount(char **conf) goto out; } - if (dev[0] != '\0' && !parse_mount_dev_present(dev)) { + if (strcmp(fs, "zfs") != 0 && dev[0] != '\0' && + !parse_mount_dev_present(dev)) { printf("mountroot: waiting for device %s ...\n", dev); delay = hz / 10; timeout = root_mount_timeout * hz; From owner-svn-src-head@FreeBSD.ORG Tue Oct 19 18:43: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 5B531106564A; Tue, 19 Oct 2010 18:43:11 +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 4A1AB8FC16; Tue, 19 Oct 2010 18:43: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 o9JIhBPY023573; Tue, 19 Oct 2010 18:43:11 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9JIhBwK023571; Tue, 19 Oct 2010 18:43:11 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201010191843.o9JIhBwK023571@svn.freebsd.org> From: Jung-uk Kim Date: Tue, 19 Oct 2010 18:43: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: r214068 - 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, 19 Oct 2010 18:43:11 -0000 Author: jkim Date: Tue Oct 19 18:43:11 2010 New Revision: 214068 URL: http://svn.freebsd.org/changeset/base/214068 Log: Make any PCI devices enumerated in ACPI tree honor do_power_resume as well. Modified: head/sys/dev/acpica/acpi_pci.c Modified: head/sys/dev/acpica/acpi_pci.c ============================================================================== --- head/sys/dev/acpica/acpi_pci.c Tue Oct 19 18:32:01 2010 (r214067) +++ head/sys/dev/acpica/acpi_pci.c Tue Oct 19 18:43:11 2010 (r214068) @@ -190,7 +190,7 @@ acpi_pci_set_powerstate_method(device_t device_printf(dev, "Failed to set ACPI power state D%d on %s: %s\n", state, acpi_name(h), AcpiFormatException(status)); - if (old_state > state) + if (old_state > state && pci_do_power_resume) error = pci_set_powerstate_method(dev, child, state); out: From owner-svn-src-head@FreeBSD.ORG Tue Oct 19 18:49: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 A1BB5106566B; Tue, 19 Oct 2010 18:49:26 +0000 (UTC) (envelope-from bschmidt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8EDE98FC1B; Tue, 19 Oct 2010 18:49: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 o9JInQAH023737; Tue, 19 Oct 2010 18:49:26 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9JInQwX023731; Tue, 19 Oct 2010 18:49:26 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201010191849.o9JInQwX023731@svn.freebsd.org> From: Bernhard Schmidt Date: Tue, 19 Oct 2010 18:49: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: r214069 - in head/sys: conf modules/wlan net80211 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, 19 Oct 2010 18:49:26 -0000 Author: bschmidt Date: Tue Oct 19 18:49:26 2010 New Revision: 214069 URL: http://svn.freebsd.org/changeset/base/214069 Log: Fix an undefined behaviour if the desired ratectl algo is not available. This can happen if the algos are built as modules but are not loaded. If the selected ratectl algo is not available, try to load it (The load module functions does nothing currently). Add a dummy ratectl algo which always selects the first available rate. Use that one if the desired algo is not available. MFC after: 1 week Added: head/sys/net80211/ieee80211_ratectl_none.c (contents, props changed) Modified: head/sys/conf/files head/sys/modules/wlan/Makefile head/sys/net80211/ieee80211_ratectl.c head/sys/net80211/ieee80211_ratectl.h Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Tue Oct 19 18:43:11 2010 (r214068) +++ head/sys/conf/files Tue Oct 19 18:49:26 2010 (r214069) @@ -2453,6 +2453,7 @@ net80211/ieee80211_power.c optional wlan net80211/ieee80211_proto.c optional wlan net80211/ieee80211_radiotap.c optional wlan net80211/ieee80211_ratectl.c optional wlan +net80211/ieee80211_ratectl_none.c optional wlan net80211/ieee80211_regdomain.c optional wlan net80211/ieee80211_rssadapt.c optional wlan wlan_rssadapt net80211/ieee80211_scan.c optional wlan Modified: head/sys/modules/wlan/Makefile ============================================================================== --- head/sys/modules/wlan/Makefile Tue Oct 19 18:43:11 2010 (r214068) +++ head/sys/modules/wlan/Makefile Tue Oct 19 18:49:26 2010 (r214069) @@ -9,7 +9,7 @@ SRCS= ieee80211.c ieee80211_action.c iee ieee80211_mesh.c ieee80211_node.c ieee80211_output.c ieee80211_phy.c \ ieee80211_power.c ieee80211_proto.c ieee80211_scan.c \ ieee80211_scan_sta.c ieee80211_radiotap.c ieee80211_ratectl.c \ - ieee80211_regdomain.c \ + ieee80211_ratectl_none.c ieee80211_regdomain.c \ ieee80211_ht.c ieee80211_hwmp.c ieee80211_adhoc.c ieee80211_hostap.c \ ieee80211_monitor.c ieee80211_sta.c ieee80211_wds.c ieee80211_ddb.c SRCS+= bus_if.h device_if.h opt_inet.h opt_inet6.h opt_ipx.h opt_wlan.h \ Modified: head/sys/net80211/ieee80211_ratectl.c ============================================================================== --- head/sys/net80211/ieee80211_ratectl.c Tue Oct 19 18:43:11 2010 (r214068) +++ head/sys/net80211/ieee80211_ratectl.c Tue Oct 19 18:49:26 2010 (r214069) @@ -39,6 +39,14 @@ __FBSDID("$FreeBSD$"); static const struct ieee80211_ratectl *ratectls[IEEE80211_RATECTL_MAX]; +static const char *ratectl_modnames[IEEE80211_RATECTL_MAX] = { + [IEEE80211_RATECTL_AMRR] = "wlan_amrr", + [IEEE80211_RATECTL_RSSADAPT] = "wlan_rssadapt", + [IEEE80211_RATECTL_ONOE] = "wlan_onoe", + [IEEE80211_RATECTL_SAMPLE] = "wlan_sample", + [IEEE80211_RATECTL_NONE] = "wlan_none", +}; + MALLOC_DEFINE(M_80211_RATECTL, "80211ratectl", "802.11 rate control"); void @@ -62,5 +70,15 @@ ieee80211_ratectl_set(struct ieee80211va { if (type >= IEEE80211_RATECTL_MAX) return; + if (ratectls[type] == NULL) { + ieee80211_load_module(ratectl_modnames[type]); + if (ratectls[type] == NULL) { + IEEE80211_DPRINTF(vap, IEEE80211_MSG_RATECTL, + "%s: unable to load algo %u, module %s\n", + __func__, type, ratectl_modnames[type]); + vap->iv_rate = ratectls[IEEE80211_RATECTL_NONE]; + return; + } + } vap->iv_rate = ratectls[type]; } Modified: head/sys/net80211/ieee80211_ratectl.h ============================================================================== --- head/sys/net80211/ieee80211_ratectl.h Tue Oct 19 18:43:11 2010 (r214068) +++ head/sys/net80211/ieee80211_ratectl.h Tue Oct 19 18:49:26 2010 (r214069) @@ -26,10 +26,11 @@ */ enum ieee80211_ratealgs { - IEEE80211_RATECTL_AMRR = 0, + IEEE80211_RATECTL_AMRR = 0, IEEE80211_RATECTL_RSSADAPT = 1, IEEE80211_RATECTL_ONOE = 2, IEEE80211_RATECTL_SAMPLE = 3, + IEEE80211_RATECTL_NONE = 4, IEEE80211_RATECTL_MAX }; Added: head/sys/net80211/ieee80211_ratectl_none.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/net80211/ieee80211_ratectl_none.c Tue Oct 19 18:49:26 2010 (r214069) @@ -0,0 +1,113 @@ +/*- + * Copyright (c) 2010 Bernhard Schmidt + * 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 ``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 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_wlan.h" + +#include +#include +#include +#include +#include + +#include +#include + +#ifdef INET +#include +#include +#endif + +#include +#include + +static void +none_init(struct ieee80211vap *vap) +{ +} + +static void +none_deinit(struct ieee80211vap *vap) +{ + free(vap->iv_rs, M_80211_RATECTL); +} + +static void +none_node_init(struct ieee80211_node *ni) +{ +} + +static void +none_node_deinit(struct ieee80211_node *ni) +{ +} + +static int +none_rate(struct ieee80211_node *ni, void *arg __unused, uint32_t iarg __unused) +{ + int rix = 0; + + ni->ni_txrate = ni->ni_rates.rs_rates[rix] & IEEE80211_RATE_VAL; + return rix; +} + +static void +none_tx_complete(const struct ieee80211vap *vap, + const struct ieee80211_node *ni, int ok, + void *arg1, void *arg2 __unused) +{ +} + +static void +none_tx_update(const struct ieee80211vap *vap, const struct ieee80211_node *ni, + void *arg1, void *arg2, void *arg3) +{ +} + +static void +none_setinterval(const struct ieee80211vap *vap, int msecs) +{ +} + +/* number of references from net80211 layer */ +static int nrefs = 0; + +static const struct ieee80211_ratectl none = { + .ir_name = "none", + .ir_attach = NULL, + .ir_detach = NULL, + .ir_init = none_init, + .ir_deinit = none_deinit, + .ir_node_init = none_node_init, + .ir_node_deinit = none_node_deinit, + .ir_rate = none_rate, + .ir_tx_complete = none_tx_complete, + .ir_tx_update = none_tx_update, + .ir_setinterval = none_setinterval, +}; +IEEE80211_RATECTL_MODULE(ratectl_none, 1); +IEEE80211_RATECTL_ALG(none, IEEE80211_RATECTL_NONE, none); From owner-svn-src-head@FreeBSD.ORG Tue Oct 19 19:11: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 CFA79106566B; Tue, 19 Oct 2010 19:11:36 +0000 (UTC) (envelope-from bschmidt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BE7E58FC18; Tue, 19 Oct 2010 19:11: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 o9JJBabV024212; Tue, 19 Oct 2010 19:11:36 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9JJBaQe024210; Tue, 19 Oct 2010 19:11:36 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201010191911.o9JJBaQe024210@svn.freebsd.org> From: Bernhard Schmidt Date: Tue, 19 Oct 2010 19:11: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: r214070 - head/sys/dev/if_ndis 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, 19 Oct 2010 19:11:36 -0000 Author: bschmidt Date: Tue Oct 19 19:11:36 2010 New Revision: 214070 URL: http://svn.freebsd.org/changeset/base/214070 Log: There is no reason to call rt_ifmsg(), remove it. Submitted by: Paul B Mahol MFC after: 1 week Modified: head/sys/dev/if_ndis/if_ndis.c Modified: head/sys/dev/if_ndis/if_ndis.c ============================================================================== --- head/sys/dev/if_ndis/if_ndis.c Tue Oct 19 18:49:26 2010 (r214069) +++ head/sys/dev/if_ndis/if_ndis.c Tue Oct 19 19:11:36 2010 (r214070) @@ -1644,10 +1644,6 @@ ndis_linksts_done(adapter) default: break; } - - /* Notify possible listners of interface change. */ - - rt_ifmsg(ifp); } static void From owner-svn-src-head@FreeBSD.ORG Tue Oct 19 19:44: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 058FD1065679; Tue, 19 Oct 2010 19:44:06 +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 E74BB8FC1F; Tue, 19 Oct 2010 19:44: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 o9JJi56u024973; Tue, 19 Oct 2010 19:44:05 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9JJi5jM024969; Tue, 19 Oct 2010 19:44:05 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201010191944.o9JJi5jM024969@svn.freebsd.org> From: Marius Strobl Date: Tue, 19 Oct 2010 19:44: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: r214071 - in head/sys/sparc64: include 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: Tue, 19 Oct 2010 19:44:06 -0000 Author: marius Date: Tue Oct 19 19:44:05 2010 New Revision: 214071 URL: http://svn.freebsd.org/changeset/base/214071 Log: - Wrap exchanging td_intr_frame and calling the event timer callback in a critical section as apparently required by both. I don't think either belongs in the event timer front-ends but the callback should handle this as necessary instead just like for example intr_event_handle() does but this is how the other architectures currently handle it, either explicitly or implicitly. - Further rename and reword references to hardclock as this front-end no longer has a notion of actually calling it. Modified: head/sys/sparc64/include/tick.h head/sys/sparc64/sparc64/mp_machdep.c head/sys/sparc64/sparc64/tick.c Modified: head/sys/sparc64/include/tick.h ============================================================================== --- head/sys/sparc64/include/tick.h Tue Oct 19 19:11:36 2010 (r214070) +++ head/sys/sparc64/include/tick.h Tue Oct 19 19:44:05 2010 (r214071) @@ -29,7 +29,7 @@ #ifndef _MACHINE_TICK_H_ #define _MACHINE_TICK_H_ -extern u_int hardclock_use_stick; +extern u_int tick_et_use_stick; void tick_clear(u_int cpu_impl); void tick_stop(u_int cpu_impl); Modified: head/sys/sparc64/sparc64/mp_machdep.c ============================================================================== --- head/sys/sparc64/sparc64/mp_machdep.c Tue Oct 19 19:11:36 2010 (r214070) +++ head/sys/sparc64/sparc64/mp_machdep.c Tue Oct 19 19:44:05 2010 (r214071) @@ -318,7 +318,7 @@ ap_start(phandle_t node, u_int mid, u_in if (OF_getprop(node, "clock-frequency", &clock, sizeof(clock)) <= 0) panic("%s: couldn't determine CPU frequency", __func__); if (clock != PCPU_GET(clock)) - hardclock_use_stick = 1; + tick_et_use_stick = 1; csa = &cpu_start_args; csa->csa_state = 0; Modified: head/sys/sparc64/sparc64/tick.c ============================================================================== --- head/sys/sparc64/sparc64/tick.c Tue Oct 19 19:11:36 2010 (r214070) +++ head/sys/sparc64/sparc64/tick.c Tue Oct 19 19:44:05 2010 (r214071) @@ -74,9 +74,9 @@ static int adjust_ticks = 0; SYSCTL_INT(_machdep_tick, OID_AUTO, adjust_ticks, CTLFLAG_RD, &adjust_ticks, 0, "total number of tick interrupts with adjustment"); -u_int hardclock_use_stick = 0; -SYSCTL_INT(_machdep_tick, OID_AUTO, hardclock_use_stick, CTLFLAG_RD, - &hardclock_use_stick, 0, "hardclock uses STICK instead of TICK timer"); +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"); static struct timecounter stick_tc; static struct timecounter tick_tc; @@ -96,9 +96,9 @@ static int tick_et_start(struct eventtim static int tick_et_stop(struct eventtimer *et); static void tick_intr(struct trapframe *tf); static void tick_intr_bbwar(struct trapframe *tf); -static inline void tick_hardclock_periodic(struct trapframe *tf, u_long tick, - u_long tick_increment, u_long adj); 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 uint64_t @@ -127,7 +127,7 @@ cpu_initclocks(void) * Given that the STICK timers typically are driven at rather low * frequencies they shouldn't be used except when really necessary. */ - if (hardclock_use_stick != 0) { + if (tick_et_use_stick != 0) { intr_setup(PIL_TICK, stick_intr, -1, NULL, NULL); /* * We don't provide a CPU ticker as long as the frequency @@ -180,11 +180,11 @@ cpu_initclocks(void) #endif tc_init(&stick_tc); } - tick_et.et_name = hardclock_use_stick ? "stick" : "tick"; + tick_et.et_name = tick_et_use_stick ? "stick" : "tick"; tick_et.et_flags = ET_FLAGS_PERIODIC | ET_FLAGS_ONESHOT | ET_FLAGS_PERCPU; tick_et.et_quality = 1000; - tick_et.et_frequency = hardclock_use_stick ? sclock : clock; + tick_et.et_frequency = tick_et_use_stick ? sclock : clock; tick_et.et_min_period.sec = 0; tick_et.et_min_period.frac = 0x00010000LLU << 32; /* To be safe. */ tick_et.et_max_period.sec = 3600 * 24; /* No practical limit. */ @@ -203,6 +203,7 @@ tick_process(struct trapframe *tf) struct trapframe *oldframe; struct thread *td; + critical_enter(); if (tick_et.et_active) { td = curthread; oldframe = td->td_intr_frame; @@ -210,13 +211,14 @@ tick_process(struct trapframe *tf) tick_et.et_event_cb(&tick_et, tick_et.et_arg); td->td_intr_frame = oldframe; } + 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 hardclock to stop. + * could be written in the worst case, causing the periodic timer to stop. */ static void @@ -232,7 +234,7 @@ tick_intr(struct trapframe *tf) tick = rd(tick); wr(tick_cmpr, tick + tick_increment - adj, 0); intr_restore(s); - tick_hardclock_periodic(tf, tick, tick_increment, adj); + tick_process_periodic(tf, tick, tick_increment, adj); } else { intr_restore(s); tick_process(tf); @@ -252,7 +254,7 @@ tick_intr_bbwar(struct trapframe *tf) tick = rd(tick); wrtickcmpr(tick + tick_increment - adj, 0); intr_restore(s); - tick_hardclock_periodic(tf, tick, tick_increment, adj); + tick_process_periodic(tf, tick, tick_increment, adj); } else { intr_restore(s); tick_process(tf); @@ -272,7 +274,7 @@ stick_intr(struct trapframe *tf) stick = rdstick(); wrstickcmpr(stick + tick_increment - adj, 0); intr_restore(s); - tick_hardclock_periodic(tf, stick, tick_increment, adj); + tick_process_periodic(tf, stick, tick_increment, adj); } else { intr_restore(s); tick_process(tf); @@ -280,7 +282,7 @@ stick_intr(struct trapframe *tf) } static inline void -tick_hardclock_periodic(struct trapframe *tf, u_long tick, +tick_process_periodic(struct trapframe *tf, u_long tick, u_long tick_increment, u_long adj) { u_long ref; @@ -385,7 +387,7 @@ tick_et_start(struct eventtimer *et, str * out one tick to make sure that it is not missed. */ s = intr_disable(); - if (hardclock_use_stick != 0) + if (tick_et_use_stick != 0) base = rdstick(); else base = rd(tick); @@ -394,7 +396,7 @@ tick_et_start(struct eventtimer *et, str base = roundup(base, div); } PCPU_SET(tickref, base); - if (hardclock_use_stick != 0) + if (tick_et_use_stick != 0) wrstickcmpr(base + fdiv, 0); else wrtickcmpr(base + fdiv, 0); From owner-svn-src-head@FreeBSD.ORG Tue Oct 19 19:53: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 056D51065670; Tue, 19 Oct 2010 19:53:07 +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 E6F7A8FC0C; Tue, 19 Oct 2010 19:53: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 o9JJr6DQ025167; Tue, 19 Oct 2010 19:53:06 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9JJr6Fr025163; Tue, 19 Oct 2010 19:53:06 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201010191953.o9JJr6Fr025163@svn.freebsd.org> From: Jung-uk Kim Date: Tue, 19 Oct 2010 19:53: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: r214072 - 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, 19 Oct 2010 19:53:07 -0000 Author: jkim Date: Tue Oct 19 19:53:06 2010 New Revision: 214072 URL: http://svn.freebsd.org/changeset/base/214072 Log: Remove PCI_SET_POWERSTATE method from acpi.c and eradicate all PCI-specific knowledges from the file. All PCI devices enumerated in ACPI tree must use correct one from acpi_pci.c any way. Reduce duplicate codes as we did for pci.c in r213905. Do not return ESRCH from PCIB_POWER_FOR_SLEEP method. When the method is not found, just return zero without modifying the given default value as it is completely optional. As a side effect, the return state must not be NULL. Note there is actually no functional change by removing ESRCH because acpi_pcib_power_for_sleep() always returns zero. Adjust debugging messages and add new ones under bootverbose to help debugging device power state related issues. Reviewed by: jhb, imp (earlier versions) Modified: head/sys/dev/acpica/acpi.c head/sys/dev/acpica/acpi_if.m head/sys/dev/acpica/acpi_pci.c Modified: head/sys/dev/acpica/acpi.c ============================================================================== --- head/sys/dev/acpica/acpi.c Tue Oct 19 19:44:05 2010 (r214071) +++ head/sys/dev/acpica/acpi.c Tue Oct 19 19:53:06 2010 (r214072) @@ -66,10 +66,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include "pci_if.h" -#include -#include - #include MALLOC_DEFINE(M_ACPIDEV, "acpidev", "ACPI devices"); @@ -133,8 +129,7 @@ static ACPI_STATUS acpi_device_scan_cb(A void *context, void **retval); static ACPI_STATUS acpi_device_scan_children(device_t bus, device_t dev, int max_depth, acpi_scan_cb_t user_fn, void *arg); -static int acpi_set_powerstate_method(device_t bus, device_t child, - int state); +static int acpi_set_powerstate(device_t child, int state); static int acpi_isa_pnp_probe(device_t bus, device_t child, struct isa_pnp_id *ids); static void acpi_probe_children(device_t bus); @@ -205,9 +200,6 @@ static device_method_t acpi_methods[] = DEVMETHOD(acpi_pwr_for_sleep, acpi_device_pwr_for_sleep), DEVMETHOD(acpi_scan_children, acpi_device_scan_children), - /* PCI emulation */ - DEVMETHOD(pci_set_powerstate, acpi_set_powerstate_method), - /* ISA emulation */ DEVMETHOD(isa_pnp_probe, acpi_isa_pnp_probe), @@ -668,45 +660,46 @@ acpi_attach(device_t dev) return_VALUE (error); } +static void +acpi_set_power_children(device_t dev, int state) +{ + device_t child, parent; + device_t *devlist; + struct pci_devinfo *dinfo; + int dstate, i, numdevs; + + if (!acpi_do_powerstate) + return; + + if (device_get_children(dev, &devlist, &numdevs) != 0) + return; + + /* + * Retrieve and set D-state for the sleep state if _SxD is present. + * Skip children who aren't attached since they are handled separately. + */ + parent = device_get_parent(dev); + for (i = 0; i < numdevs; i++) { + child = devlist[i]; + dinfo = device_get_ivars(child); + dstate = state; + if (device_is_attached(child) && + acpi_device_pwr_for_sleep(parent, dev, &dstate) == 0) + acpi_set_powerstate(child, dstate); + } + free(devlist, M_TEMP); +} + static int acpi_suspend(device_t dev) { - device_t child, *devlist; - int error, i, numdevs, pstate; + int error; GIANT_REQUIRED; - /* First give child devices a chance to suspend. */ error = bus_generic_suspend(dev); - if (error) - return (error); - - /* - * Now, set them into the appropriate power state, usually D3. If the - * device has an _SxD method for the next sleep state, use that power - * state instead. - */ - error = device_get_children(dev, &devlist, &numdevs); - if (error) - return (error); - for (i = 0; i < numdevs; i++) { - /* If the device is not attached, we've powered it down elsewhere. */ - child = devlist[i]; - if (!device_is_attached(child)) - continue; - - /* - * Default to D3 for all sleep states. The _SxD method is optional - * so set the powerstate even if it's absent. - */ - pstate = PCI_POWERSTATE_D3; - error = acpi_device_pwr_for_sleep(device_get_parent(child), - child, &pstate); - if ((error == 0 || error == ESRCH) && acpi_do_powerstate) - pci_set_powerstate(child, pstate); - } - free(devlist, M_TEMP); - error = 0; + if (error == 0) + acpi_set_power_children(dev, ACPI_STATE_D3); return (error); } @@ -714,28 +707,10 @@ acpi_suspend(device_t dev) static int acpi_resume(device_t dev) { - ACPI_HANDLE handle; - int i, numdevs, error; - device_t child, *devlist; GIANT_REQUIRED; - /* - * Put all devices in D0 before resuming them. Call _S0D on each one - * since some systems expect this. - */ - error = device_get_children(dev, &devlist, &numdevs); - if (error) - return (error); - for (i = 0; i < numdevs; i++) { - child = devlist[i]; - handle = acpi_get_handle(child); - if (handle) - AcpiEvaluateObject(handle, "_S0D", NULL, NULL); - if (device_is_attached(child) && acpi_do_powerstate) - pci_set_powerstate(child, PCI_POWERSTATE_D0); - } - free(devlist, M_TEMP); + acpi_set_power_children(dev, ACPI_STATE_D0); return (bus_generic_resume(dev)); } @@ -811,7 +786,7 @@ static void acpi_probe_nomatch(device_t bus, device_t child) { #ifdef ACPI_ENABLE_POWERDOWN_NODRIVER - pci_set_powerstate(child, PCI_POWERSTATE_D3); + acpi_set_powerstate(child, ACPI_STATE_D3); #endif } @@ -833,9 +808,9 @@ acpi_driver_added(device_t dev, driver_t child = devlist[i]; if (device_get_state(child) == DS_NOTPRESENT) { #ifdef ACPI_ENABLE_POWERDOWN_NODRIVER - pci_set_powerstate(child, PCI_POWERSTATE_D0); + acpi_set_powerstate(child, ACPI_STATE_D0); if (device_probe_and_attach(child) != 0) - pci_set_powerstate(child, PCI_POWERSTATE_D3); + acpi_set_powerstate(child, ACPI_STATE_D3); #else device_probe_and_attach(child); #endif @@ -1401,9 +1376,7 @@ acpi_device_pwr_for_sleep(device_t bus, ACPI_HANDLE handle; ACPI_STATUS status; char sxd[8]; - int error; - sc = device_get_softc(bus); handle = acpi_get_handle(dev); /* @@ -1412,7 +1385,7 @@ acpi_device_pwr_for_sleep(device_t bus, * set to D3 and it appears that such legacy devices may * need special handling in their drivers. */ - if (handle == NULL || + if (dstate == NULL || handle == NULL || acpi_MatchHid(handle, "PNP0500") || acpi_MatchHid(handle, "PNP0501") || acpi_MatchHid(handle, "PNP0502") || @@ -1421,28 +1394,19 @@ acpi_device_pwr_for_sleep(device_t bus, return (ENXIO); /* - * Override next state with the value from _SxD, if present. If no - * dstate argument was provided, don't fetch the return value. + * Override next state with the value from _SxD, if present. + * Note illegal _S0D is evaluated because some systems expect this. */ + sc = device_get_softc(bus); snprintf(sxd, sizeof(sxd), "_S%dD", sc->acpi_sstate); - if (dstate) - status = acpi_GetInteger(handle, sxd, dstate); - else - status = AcpiEvaluateObject(handle, sxd, NULL, NULL); - - switch (status) { - case AE_OK: - error = 0; - break; - case AE_NOT_FOUND: - error = ESRCH; - break; - default: - error = ENXIO; - break; + status = acpi_GetInteger(handle, sxd, dstate); + if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { + device_printf(dev, "failed to get %s on %s: %s\n", sxd, + acpi_name(handle), AcpiFormatException(status)); + return (ENXIO); } - return (error); + return (0); } /* Callback arg for our implementation of walking the namespace. */ @@ -1524,13 +1488,14 @@ acpi_device_scan_children(device_t bus, * device power states since it's close enough to ACPI. */ static int -acpi_set_powerstate_method(device_t bus, device_t child, int state) +acpi_set_powerstate(device_t child, int state) { ACPI_HANDLE h; ACPI_STATUS status; - int error; - error = 0; + if (!acpi_do_powerstate) + return (0); + h = acpi_get_handle(child); if (state < ACPI_STATE_D0 || state > ACPI_D_STATES_MAX) return (EINVAL); @@ -1539,12 +1504,16 @@ acpi_set_powerstate_method(device_t bus, /* Ignore errors if the power methods aren't present. */ status = acpi_pwr_switch_consumer(h, state); - if (ACPI_FAILURE(status) && status != AE_NOT_FOUND - && status != AE_BAD_PARAMETER) - device_printf(bus, "failed to set ACPI power state D%d on %s: %s\n", - state, acpi_name(h), AcpiFormatException(status)); + if (ACPI_SUCCESS(status)) { + if (bootverbose) + device_printf(child, "set ACPI power state D%d on %s\n", + state, acpi_name(h)); + } else if (status != AE_NOT_FOUND) + device_printf(child, + "failed to set ACPI power state D%d on %s: %s\n", state, + acpi_name(h), AcpiFormatException(status)); - return (error); + return (0); } static int Modified: head/sys/dev/acpica/acpi_if.m ============================================================================== --- head/sys/dev/acpica/acpi_if.m Tue Oct 19 19:44:05 2010 (r214071) +++ head/sys/dev/acpica/acpi_if.m Tue Oct 19 19:53:06 2010 (r214072) @@ -123,8 +123,7 @@ METHOD ACPI_STATUS evaluate_object { # # int *dstate: if successful, contains the highest valid sleep state # -# Returns: 0 on success, ESRCH if device has no special state, or -# some other error value. +# Returns: 0 on success or some other error value. # METHOD int pwr_for_sleep { device_t bus; Modified: head/sys/dev/acpica/acpi_pci.c ============================================================================== --- head/sys/dev/acpica/acpi_pci.c Tue Oct 19 19:44:05 2010 (r214071) +++ head/sys/dev/acpica/acpi_pci.c Tue Oct 19 19:53:06 2010 (r214072) @@ -186,9 +186,13 @@ acpi_pci_set_powerstate_method(device_t } h = acpi_get_handle(child); status = acpi_pwr_switch_consumer(h, state); - if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) + if (ACPI_SUCCESS(status)) { + if (bootverbose) + device_printf(dev, "set ACPI power state D%d on %s\n", + state, acpi_name(h)); + } else if (status != AE_NOT_FOUND) device_printf(dev, - "Failed to set ACPI power state D%d on %s: %s\n", + "failed to set ACPI power state D%d on %s: %s\n", state, acpi_name(h), AcpiFormatException(status)); if (old_state > state && pci_do_power_resume) error = pci_set_powerstate_method(dev, child, state); From owner-svn-src-head@FreeBSD.ORG Tue Oct 19 20: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 9ADA31065670; Tue, 19 Oct 2010 20:05:25 +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 899BA8FC25; Tue, 19 Oct 2010 20: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 o9JK5P5x025469; Tue, 19 Oct 2010 20:05:25 GMT (envelope-from brucec@svn.freebsd.org) Received: (from brucec@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9JK5PET025466; Tue, 19 Oct 2010 20:05:25 GMT (envelope-from brucec@svn.freebsd.org) Message-Id: <201010192005.o9JK5PET025466@svn.freebsd.org> From: Bruce Cran Date: Tue, 19 Oct 2010 20: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: r214073 - 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: Tue, 19 Oct 2010 20:05:25 -0000 Author: brucec Date: Tue Oct 19 20:05:25 2010 New Revision: 214073 URL: http://svn.freebsd.org/changeset/base/214073 Log: Stop disallowing device nodes to be passed to camcontrol(8) since libcam already allows both device names and nodes to be specified. Reviewed by: avg Modified: head/sbin/camcontrol/camcontrol.8 head/sbin/camcontrol/camcontrol.c Modified: head/sbin/camcontrol/camcontrol.8 ============================================================================== --- head/sbin/camcontrol/camcontrol.8 Tue Oct 19 19:53:06 2010 (r214072) +++ head/sbin/camcontrol/camcontrol.8 Tue Oct 19 20:05:25 2010 (r214073) @@ -207,9 +207,6 @@ A device identifier can take one of thre .Bl -tag -width 14n .It deviceUNIT Specify a device name and unit number combination, like "da5" or "cd3". -Note that character device node names (e.g.\& /dev/da0) are -.Em not -allowed here. .It bus:target Specify a bus number and target id. The bus number can be determined from Modified: head/sbin/camcontrol/camcontrol.c ============================================================================== --- head/sbin/camcontrol/camcontrol.c Tue Oct 19 19:53:06 2010 (r214072) +++ head/sbin/camcontrol/camcontrol.c Tue Oct 19 20:05:25 2010 (r214073) @@ -4605,15 +4605,7 @@ main(int argc, char **argv) char name[30]; int rv; - /* - * First catch people who try to do things like: - * camcontrol tur /dev/da0 - * camcontrol doesn't take device nodes as arguments. - */ - if (argv[2][0] == '/') { - warnx("%s is not a valid device identifier", argv[2]); - errx(1, "please read the camcontrol(8) man page"); - } else if (isdigit(argv[2][0])) { + if (isdigit(argv[2][0])) { /* device specified as bus:target[:lun] */ rv = parse_btl(argv[2], &bus, &target, &lun, &arglist); if (rv < 2) From owner-svn-src-head@FreeBSD.ORG Tue Oct 19 20:38: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 9E8A81065673; Tue, 19 Oct 2010 20:38:21 +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 8D5CC8FC16; Tue, 19 Oct 2010 20:38: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 o9JKcLMI026295; Tue, 19 Oct 2010 20:38:21 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9JKcLah026293; Tue, 19 Oct 2010 20:38:21 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201010192038.o9JKcLah026293@svn.freebsd.org> From: Jung-uk Kim Date: Tue, 19 Oct 2010 20:38: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: r214076 - 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, 19 Oct 2010 20:38:21 -0000 Author: jkim Date: Tue Oct 19 20:38:21 2010 New Revision: 214076 URL: http://svn.freebsd.org/changeset/base/214076 Log: Remove undocumented and stale debug.acpi.do_powerstate tunable. It was added with hw.pci.do_powerstate but the PCI version was splitted into two separate tunables later and now this is completely stale. To make it worse, PCI devices enumerated in ACPI tree ignore this tunable as it is handled by a function in acpi_pci.c instead. Modified: head/sys/dev/acpica/acpi.c Modified: head/sys/dev/acpica/acpi.c ============================================================================== --- head/sys/dev/acpica/acpi.c Tue Oct 19 20:17:17 2010 (r214075) +++ head/sys/dev/acpica/acpi.c Tue Oct 19 20:38:21 2010 (r214076) @@ -254,12 +254,6 @@ TUNABLE_INT("debug.acpi.interpreter_slac SYSCTL_INT(_debug_acpi, OID_AUTO, interpreter_slack, CTLFLAG_RDTUN, &acpi_interpreter_slack, 1, "Turn on interpreter slack mode."); -/* Power devices off and on in suspend and resume. XXX Remove once tested. */ -static int acpi_do_powerstate = 1; -TUNABLE_INT("debug.acpi.do_powerstate", &acpi_do_powerstate); -SYSCTL_INT(_debug_acpi, OID_AUTO, do_powerstate, CTLFLAG_RW, - &acpi_do_powerstate, 1, "Turn off devices when suspending."); - /* Reset system clock while resuming. XXX Remove once tested. */ static int acpi_reset_clock = 1; TUNABLE_INT("debug.acpi.reset_clock", &acpi_reset_clock); @@ -668,9 +662,6 @@ acpi_set_power_children(device_t dev, in struct pci_devinfo *dinfo; int dstate, i, numdevs; - if (!acpi_do_powerstate) - return; - if (device_get_children(dev, &devlist, &numdevs) != 0) return; @@ -1493,9 +1484,6 @@ acpi_set_powerstate(device_t child, int ACPI_HANDLE h; ACPI_STATUS status; - if (!acpi_do_powerstate) - return (0); - h = acpi_get_handle(child); if (state < ACPI_STATE_D0 || state > ACPI_D_STATES_MAX) return (EINVAL); From owner-svn-src-head@FreeBSD.ORG Tue Oct 19 20:53: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 403FB10656BD; Tue, 19 Oct 2010 20:53:31 +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 2A9BD8FC08; Tue, 19 Oct 2010 20:53:31 +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 o9JKrVgw026734; Tue, 19 Oct 2010 20:53:31 GMT (envelope-from gibbs@svn.freebsd.org) Received: (from gibbs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9JKrV0u026729; Tue, 19 Oct 2010 20:53:31 GMT (envelope-from gibbs@svn.freebsd.org) Message-Id: <201010192053.o9JKrV0u026729@svn.freebsd.org> From: "Justin T. Gibbs" Date: Tue, 19 Oct 2010 20:53: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: r214077 - in head/sys: conf dev/xen/balloon dev/xen/blkback dev/xen/blkfront dev/xen/control dev/xen/netfront dev/xen/xenpci i386/xen xen xen/evtchn xen/interface xen/interface/hvm xen/... 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, 19 Oct 2010 20:53:31 -0000 Author: gibbs Date: Tue Oct 19 20:53:30 2010 New Revision: 214077 URL: http://svn.freebsd.org/changeset/base/214077 Log: Improve the Xen para-virtualized device infrastructure of FreeBSD: o Add support for backend devices (e.g. blkback) o Implement extensions to the Xen para-virtualized block API to allow for larger and more outstanding I/Os. o Import a completely rewritten block back driver with support for fronting I/O to both raw devices and files. o General cleanup and documentation of the XenBus and XenStore support code. o Robustness and performance updates for the block front driver. o Fixes to the netfront driver. Sponsored by: Spectra Logic Corporation sys/xen/xenbus/init.txt: Deleted: This file explains the Linux method for XenBus device enumeration and thus does not apply to FreeBSD's NewBus approach. sys/xen/xenbus/xenbus_probe_backend.c: Deleted: Linux version of backend XenBus service routines. It was never ported to FreeBSD. See xenbusb.c, xenbusb_if.m, xenbusb_front.c xenbusb_back.c for details of FreeBSD's XenBus support. sys/xen/xenbus/xenbusvar.h: sys/xen/xenbus/xenbus_xs.c: sys/xen/xenbus/xenbus_comms.c: sys/xen/xenbus/xenbus_comms.h: sys/xen/xenstore/xenstorevar.h: sys/xen/xenstore/xenstore.c: Split XenStore into its own tree. XenBus is a software layer built on top of XenStore. The old arrangement and the naming of some structures and functions blurred these lines making it difficult to discern what services are provided by which layer and at what times these services are available (e.g. during system startup and shutdown). sys/xen/xenbus/xenbus_client.c: sys/xen/xenbus/xenbus.c: sys/xen/xenbus/xenbus_probe.c: sys/xen/xenbus/xenbusb.c: sys/xen/xenbus/xenbusb.h: Split up XenBus code into methods available for use by client drivers (xenbus.c) and code used by the XenBus "bus code" to enumerate, attach, detach, and service bus drivers. sys/xen/reboot.c: sys/dev/xen/control/control.c: Add a XenBus front driver for handling shutdown, reboot, suspend, and resume events published in the XenStore. Move all PV suspend/reboot support from reboot.c into this driver. sys/xen/blkif.h: New file from Xen vendor with macros and structures used by a block back driver to service requests from a VM running a different ABI (e.g. amd64 back with i386 front). sys/conf/files: Adjust kernel build spec for new XenBus/XenStore layout and added Xen functionality. sys/dev/xen/balloon/balloon.c: sys/dev/xen/netfront/netfront.c: sys/dev/xen/blkfront/blkfront.c: sys/xen/xenbus/... sys/xen/xenstore/... o Rename XenStore APIs and structures from xenbus_* to xs_*. o Adjust to use of M_XENBUS and M_XENSTORE malloc types for allocation of objects returned by these APIs. o Adjust for changes in the bus interface for Xen drivers. sys/xen/xenbus/... sys/xen/xenstore/... Add Doxygen comments for these interfaces and the code that implements them. sys/dev/xen/blkback/blkback.c: o Rewrite the Block Back driver to attach properly via newbus, operate correctly in both PV and HVM mode regardless of domain (e.g. can be in a DOM other than 0), and to deal with the latest metadata available in XenStore for block devices. o Allow users to specify a file as a backend to blkback, in addition to character devices. Use the namei lookup of the backend path to automatically configure, based on file type, the appropriate backend method. The current implementation is limited to a single outstanding I/O at a time to file backed storage. sys/dev/xen/blkback/blkback.c: sys/xen/interface/io/blkif.h: sys/xen/blkif.h: sys/dev/xen/blkfront/blkfront.c: sys/dev/xen/blkfront/block.h: Extend the Xen blkif API: Negotiable request size and number of requests. This change extends the information recorded in the XenStore allowing block front/back devices to negotiate for optimal I/O parameters. This has been achieved without sacrificing backward compatibility with drivers that are unaware of these protocol enhancements. The extensions center around the connection protocol which now includes these additions: o The back-end device publishes its maximum supported values for, request I/O size, the number of page segments that can be associated with a request, the maximum number of requests that can be concurrently active, and the maximum number of pages that can be in the shared request ring. These values are published before the back-end enters the XenbusStateInitWait state. o The front-end waits for the back-end to enter either the InitWait or Initialize state. At this point, the front end limits it's own capabilities to the lesser of the values it finds published by the backend, it's own maximums, or, should any back-end data be missing in the store, the values supported by the original protocol. It then initializes it's internal data structures including allocation of the shared ring, publishes its maximum capabilities to the XenStore and transitions to the Initialized state. o The back-end waits for the front-end to enter the Initalized state. At this point, the back end limits it's own capabilities to the lesser of the values it finds published by the frontend, it's own maximums, or, should any front-end data be missing in the store, the values supported by the original protocol. It then initializes it's internal data structures, attaches to the shared ring and transitions to the Connected state. o The front-end waits for the back-end to enter the Connnected state, transitions itself to the connected state, and can commence I/O. Although an updated front-end driver must be aware of the back-end's InitWait state, the back-end has been coded such that it can tolerate a front-end that skips this step and transitions directly to the Initialized state without waiting for the back-end. sys/xen/interface/io/blkif.h: o Increase BLKIF_MAX_SEGMENTS_PER_REQUEST to 255. This is the maximum number possible without changing the blkif request header structure (nr_segs is a uint8_t). o Add two new constants: BLKIF_MAX_SEGMENTS_PER_HEADER_BLOCK, and BLKIF_MAX_SEGMENTS_PER_SEGMENT_BLOCK. These respectively indicate the number of segments that can fit in the first ring-buffer entry of a request, and for each subsequent (sg element only) ring-buffer entry associated with the "header" ring-buffer entry of the request. o Add the blkif_request_segment_t typedef for segment elements. o Add the BLKRING_GET_SG_REQUEST() macro which wraps the RING_GET_REQUEST() macro and returns a properly cast pointer to an array of blkif_request_segment_ts. o Add the BLKIF_SEGS_TO_BLOCKS() macro which calculates the number of ring entries that will be consumed by a blkif request with the given number of segments. sys/xen/blkif.h: o Update for changes in interface/io/blkif.h macros. o Update the BLKIF_MAX_RING_REQUESTS() macro to take the ring size as an argument to allow this calculation on multi-page rings. o Add a companion macro to BLKIF_MAX_RING_REQUESTS(), BLKIF_RING_PAGES(). This macro determines the number of ring pages required in order to support a ring with the supplied number of request blocks. sys/dev/xen/blkback/blkback.c: sys/dev/xen/blkfront/blkfront.c: sys/dev/xen/blkfront/block.h: o Negotiate with the other-end with the following limits: Reqeust Size: MAXPHYS Max Segments: (MAXPHYS/PAGE_SIZE) + 1 Max Requests: 256 Max Ring Pages: Sufficient to support Max Requests with Max Segments. o Dynamically allocate request pools and segemnts-per-request. o Update ring allocation/attachment code to support a multi-page shared ring. o Update routines that access the shared ring to handle multi-block requests. sys/dev/xen/blkfront/blkfront.c: o Track blkfront allocations in a blkfront driver specific malloc pool. o Strip out XenStore transaction retry logic in the connection code. Transactions only need to be used when the update to multiple XenStore nodes must be atomic. That is not the case here. o Fully disable blkif_resume() until it can be fixed properly (it didn't work before this change). o Destroy bus-dma objects during device instance tear-down. o Properly handle backend devices with powef-of-2 sector sizes larger than 512b. sys/dev/xen/blkback/blkback.c: Advertise support for and implement the BLKIF_OP_WRITE_BARRIER and BLKIF_OP_FLUSH_DISKCACHE blkif opcodes using BIO_FLUSH and the BIO_ORDERED attribute of bios. sys/dev/xen/blkfront/blkfront.c: sys/dev/xen/blkfront/block.h: Fix various bugs in blkfront. o gnttab_alloc_grant_references() returns 0 for success and non-zero for failure. The check for < 0 is a leftover Linuxism. o When we negotiate with blkback and have to reduce some of our capabilities, print out the original and reduced capability before changing the local capability. So the user now gets the correct information. o Fix blkif_restart_queue_callback() formatting. Make sure we hold the mutex in that function before calling xb_startio(). o Fix a couple of KASSERT()s. o Fix a check in the xb_remove_* macro to be a little more specific. sys/xen/gnttab.h: sys/xen/gnttab.c: Define GNTTAB_LIST_END publicly as GRANT_REF_INVALID. sys/dev/xen/netfront/netfront.c: Use GRANT_REF_INVALID instead of driver private definitions of the same constant. sys/xen/gnttab.h: sys/xen/gnttab.c: Add the gnttab_end_foreign_access_references() API. This API allows a client to batch the release of an array of grant references, instead of coding a private for loop. The implementation takes advantage of this batching to reduce lock overhead to one acquisition and release per-batch instead of per-freed grant reference. While here, reduce the duration the gnttab_list_lock is held during gnttab_free_grant_references() operations. The search to find the tail of the incoming free list does not rely on global state and so can be performed without holding the lock. sys/dev/xen/xenpci/evtchn.c: sys/dev/xen/evtchn/evtchn.c: sys/xen/xen_intr.h: o Implement the bind_interdomain_evtchn_to_irqhandler API for HVM mode. This allows an HVM domain to serve back end devices to other domains. This API is already implemented for PV mode. o Synchronize the API between HVM and PV. sys/dev/xen/xenpci/xenpci.c: o Scan the full region of CPUID space in which the Xen VMM interface may be implemented. On systems using SuSE as a Dom0 where the Viridian API is also exported, the VMM interface is above the region we used to search. o Pass through bus_alloc_resource() calls so that XenBus drivers attaching on an HVM system can allocate unused physical address space from the nexus. The block back driver makes use of this facility. sys/i386/xen/xen_machdep.c: Use the correct type for accessing the statically mapped xenstore metadata. sys/xen/interface/hvm/params.h: sys/xen/xenstore/xenstore.c: Move hvm_get_parameter() to the correct global header file instead of as a private method to the XenStore. sys/xen/interface/io/protocols.h: Sync with vendor. sys/xeninterface/io/ring.h: Add macro for calculating the number of ring pages needed for an N deep ring. To avoid duplication within the macros, create and use the new __RING_HEADER_SIZE() macro. This macro calculates the size of the ring book keeping struct (producer/consumer indexes, etc.) that resides at the head of the ring. Add the __RING_PAGES() macro which calculates the number of shared ring pages required to support a ring with the given number of requests. These APIs are used to support the multi-page ring version of the Xen block API. sys/xeninterface/io/xenbus.h: Add Comments. sys/xen/xenbus/... o Refactor the FreeBSD XenBus support code to allow for both front and backend device attachments. o Make use of new config_intr_hook capabilities to allow front and back devices to be probed/attached in parallel. o Fix bugs in probe/attach state machine that could cause the system to hang when confronted with a failure either in the local domain or in a remote domain to which one of our driver instances is attaching. o Publish all required state to the XenStore on device detach and failure. The majority of the missing functionality was for serving as a back end since the typical "hot-plug" scripts in Dom0 don't handle the case of cleaning up for a "service domain" that is not itself. o Add dynamic sysctl nodes exposing the generic ivars of XenBus devices. o Add doxygen style comments to the majority of the code. o Cleanup types, formatting, etc. sys/xen/xenbus/xenbusb.c: Common code used by both front and back XenBus busses. sys/xen/xenbus/xenbusb_if.m: Method definitions for a XenBus bus. sys/xen/xenbus/xenbusb_front.c: sys/xen/xenbus/xenbusb_back.c: XenBus bus specialization for front and back devices. MFC after: 1 month Added: head/sys/dev/xen/control/ head/sys/dev/xen/control/control.c (contents, props changed) head/sys/xen/blkif.h (contents, props changed) head/sys/xen/xenbus/xenbus.c - copied, changed from r212768, head/sys/xen/xenbus/xenbus_client.c head/sys/xen/xenbus/xenbusb.c - copied, changed from r212768, head/sys/xen/xenbus/xenbus_probe.c head/sys/xen/xenbus/xenbusb.h - copied, changed from r212768, head/sys/xen/xenbus/xenbus_probe.c head/sys/xen/xenbus/xenbusb_back.c (contents, props changed) head/sys/xen/xenbus/xenbusb_front.c (contents, props changed) head/sys/xen/xenbus/xenbusb_if.m (contents, props changed) head/sys/xen/xenstore/ head/sys/xen/xenstore/xenstore.c - copied, changed from r212768, head/sys/xen/xenbus/xenbus_xs.c head/sys/xen/xenstore/xenstore_dev.c - copied, changed from r212768, head/sys/xen/xenbus/xenbus_dev.c head/sys/xen/xenstore/xenstore_internal.h (contents, props changed) head/sys/xen/xenstore/xenstorevar.h - copied, changed from r212768, head/sys/xen/xenbus/xenbusvar.h Deleted: head/sys/xen/reboot.c head/sys/xen/xenbus/init.txt head/sys/xen/xenbus/xenbus_client.c head/sys/xen/xenbus/xenbus_comms.c head/sys/xen/xenbus/xenbus_comms.h head/sys/xen/xenbus/xenbus_dev.c head/sys/xen/xenbus/xenbus_probe.c head/sys/xen/xenbus/xenbus_probe_backend.c head/sys/xen/xenbus/xenbus_xs.c Modified: head/sys/conf/files head/sys/dev/xen/balloon/balloon.c head/sys/dev/xen/blkback/blkback.c head/sys/dev/xen/blkfront/blkfront.c head/sys/dev/xen/blkfront/block.h head/sys/dev/xen/netfront/netfront.c head/sys/dev/xen/xenpci/evtchn.c head/sys/dev/xen/xenpci/xenpci.c head/sys/i386/xen/xen_machdep.c head/sys/xen/evtchn/evtchn.c head/sys/xen/gnttab.c head/sys/xen/gnttab.h head/sys/xen/interface/grant_table.h head/sys/xen/interface/hvm/params.h head/sys/xen/interface/io/blkif.h head/sys/xen/interface/io/protocols.h head/sys/xen/interface/io/ring.h head/sys/xen/interface/io/xenbus.h head/sys/xen/xen_intr.h head/sys/xen/xenbus/xenbus_if.m head/sys/xen/xenbus/xenbusvar.h Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Tue Oct 19 20:38:21 2010 (r214076) +++ head/sys/conf/files Tue Oct 19 20:53:30 2010 (r214077) @@ -3008,19 +3008,20 @@ xen/gnttab.c optional xen | xenhvm xen/features.c optional xen | xenhvm xen/evtchn/evtchn.c optional xen xen/evtchn/evtchn_dev.c optional xen | xenhvm -xen/reboot.c optional xen -xen/xenbus/xenbus_client.c optional xen | xenhvm -xen/xenbus/xenbus_comms.c optional xen | xenhvm -xen/xenbus/xenbus_dev.c optional xen | xenhvm xen/xenbus/xenbus_if.m optional xen | xenhvm -xen/xenbus/xenbus_probe.c optional xen | xenhvm -#xen/xenbus/xenbus_probe_backend.c optional xen -xen/xenbus/xenbus_xs.c optional xen | xenhvm +xen/xenbus/xenbus.c optional xen | xenhvm +xen/xenbus/xenbusb_if.m optional xen | xenhvm +xen/xenbus/xenbusb.c optional xen | xenhvm +xen/xenbus/xenbusb_front.c optional xen | xenhvm +xen/xenbus/xenbusb_back.c optional xen | xenhvm +xen/xenstore/xenstore.c optional xen | xenhvm +xen/xenstore/xenstore_dev.c optional xen | xenhvm dev/xen/balloon/balloon.c optional xen | xenhvm +dev/xen/blkfront/blkfront.c optional xen | xenhvm +dev/xen/blkback/blkback.c optional xen | xenhvm dev/xen/console/console.c optional xen dev/xen/console/xencons_ring.c optional xen -dev/xen/blkfront/blkfront.c optional xen | xenhvm +dev/xen/control/control.c optional xen | xenhvm dev/xen/netfront/netfront.c optional xen | xenhvm dev/xen/xenpci/xenpci.c optional xenpci dev/xen/xenpci/evtchn.c optional xenpci -dev/xen/xenpci/machine_reboot.c optional xenpci Modified: head/sys/dev/xen/balloon/balloon.c ============================================================================== --- head/sys/dev/xen/balloon/balloon.c Tue Oct 19 20:38:21 2010 (r214076) +++ head/sys/dev/xen/balloon/balloon.c Tue Oct 19 20:53:30 2010 (r214077) @@ -44,7 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include #include @@ -406,20 +406,20 @@ set_new_target(unsigned long target) wakeup(balloon_process); } -static struct xenbus_watch target_watch = +static struct xs_watch target_watch = { .node = "memory/target" }; /* React to a change in the target key */ static void -watch_target(struct xenbus_watch *watch, +watch_target(struct xs_watch *watch, const char **vec, unsigned int len) { unsigned long long new_target; int err; - err = xenbus_scanf(XBT_NIL, "memory", "target", NULL, + err = xs_scanf(XST_NIL, "memory", "target", NULL, "%llu", &new_target); if (err) { /* This is ok (for domain0 at least) - so just return */ @@ -438,7 +438,7 @@ balloon_init_watcher(void *arg) { int err; - err = register_xenbus_watch(&target_watch); + err = xs_register_watch(&target_watch); if (err) printf("Failed to set balloon watcher\n"); Modified: head/sys/dev/xen/blkback/blkback.c ============================================================================== --- head/sys/dev/xen/blkback/blkback.c Tue Oct 19 20:38:21 2010 (r214076) +++ head/sys/dev/xen/blkback/blkback.c Tue Oct 19 20:53:30 2010 (r214077) @@ -1,1055 +1,1919 @@ -/* - * Copyright (c) 2006, Cisco Systems, Inc. +/*- + * Copyright (c) 2009-2010 Spectra Logic Corporation * All rights reserved. * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions + * 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, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon + * including a substantially similar Disclaimer requirement for further + * binary redistribution. * - * 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 Cisco Systems, Inc. nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES. + * + * Authors: Justin T. Gibbs (Spectra Logic Corporation) + * Ken Merry (Spectra Logic Corporation) */ - #include __FBSDID("$FreeBSD$"); +/** + * \file blkback.c + * + * \brief Device driver supporting the vending of block storage from + * a FreeBSD domain to other domains. + */ + #include #include -#include -#include #include -#include -#include -#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include -#include +#include +#include +#include #include -#include -#include -#include - -#include -#include -#include +#include #include +#include +#include + +#include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include + +#include +#include + +#include + +/*--------------------------- Compile-time Tunables --------------------------*/ +/** + * The maximum number of outstanding request blocks (request headers plus + * additional segment blocks) we will allow in a negotiated block-front/back + * communication channel. + */ +#define XBB_MAX_REQUESTS 256 + +/** + * \brief Define to force all I/O to be performed on memory owned by the + * backend device, with a copy-in/out to the remote domain's memory. + * + * \note This option is currently required when this driver's domain is + * operating in HVM mode on a system using an IOMMU. + * + * This driver uses Xen's grant table API to gain access to the memory of + * the remote domains it serves. When our domain is operating in PV mode, + * the grant table mechanism directly updates our domain's page table entries + * to point to the physical pages of the remote domain. This scheme guarantees + * that blkback and the backing devices it uses can safely perform DMA + * operations to satisfy requests. In HVM mode, Xen may use a HW IOMMU to + * insure that our domain cannot DMA to pages owned by another domain. As + * of Xen 4.0, IOMMU mappings for HVM guests are not updated via the grant + * table API. For this reason, in HVM mode, we must bounce all requests into + * memory that is mapped into our domain at domain startup and thus has + * valid IOMMU mappings. + */ +#define XBB_USE_BOUNCE_BUFFERS + +/** + * \brief Define to enable rudimentary request logging to the console. + */ +#undef XBB_DEBUG +/*---------------------------------- Macros ----------------------------------*/ +/** + * Custom malloc type for all driver allocations. + */ +MALLOC_DEFINE(M_XENBLOCKBACK, "xbbd", "Xen Block Back Driver Data"); -#if XEN_BLKBACK_DEBUG +#ifdef XBB_DEBUG #define DPRINTF(fmt, args...) \ - printf("blkback (%s:%d): " fmt, __FUNCTION__, __LINE__, ##args) + printf("xbb(%s:%d): " fmt, __FUNCTION__, __LINE__, ##args) #else -#define DPRINTF(fmt, args...) ((void)0) +#define DPRINTF(fmt, args...) do {} while(0) #endif -#define WPRINTF(fmt, args...) \ - printf("blkback (%s:%d): " fmt, __FUNCTION__, __LINE__, ##args) +/** + * The maximum mapped region size per request we will allow in a negotiated + * block-front/back communication channel. + */ +#define XBB_MAX_REQUEST_SIZE \ + MIN(MAXPHYS, BLKIF_MAX_SEGMENTS_PER_REQUEST * PAGE_SIZE) -#define BLKBACK_INVALID_HANDLE (~0) +/** + * The maximum number of segments (within a request header and accompanying + * segment blocks) per request we will allow in a negotiated block-front/back + * communication channel. + */ +#define XBB_MAX_SEGMENTS_PER_REQUEST \ + (MIN(UIO_MAXIOV, \ + MIN(BLKIF_MAX_SEGMENTS_PER_REQUEST, \ + (XBB_MAX_REQUEST_SIZE / PAGE_SIZE) + 1))) + +/** + * The maximum number of shared memory ring pages we will allow in a + * negotiated block-front/back communication channel. Allow enough + * ring space for all requests to be XBB_MAX_REQUEST_SIZE'd. + */ +#define XBB_MAX_RING_PAGES \ + BLKIF_RING_PAGES(BLKIF_SEGS_TO_BLOCKS(XBB_MAX_SEGMENTS_PER_REQUEST) \ + * XBB_MAX_REQUESTS) + +/*--------------------------- Forward Declarations ---------------------------*/ +struct xbb_softc; + +static void xbb_attach_failed(struct xbb_softc *xbb, int err, const char *fmt, + ...) __attribute__((format(printf, 3, 4))); +static int xbb_shutdown(struct xbb_softc *xbb); +static int xbb_detach(device_t dev); + +/*------------------------------ Data Structures -----------------------------*/ +/** + * \brief Object tracking an in-flight I/O from a Xen VBD consumer. + */ +struct xbb_xen_req { + /** + * Linked list links used to aggregate idle request in the + * request free pool (xbb->request_free_slist). + */ + SLIST_ENTRY(xbb_xen_req) links; + + /** + * Back reference to the parent block back instance for this + * request. Used during bio_done handling. + */ + struct xbb_softc *xbb; + + /** + * The remote domain's identifier for this I/O request. + */ + uint64_t id; + + /** + * Kernel virtual address space reserved for this request + * structure and used to map the remote domain's pages for + * this I/O, into our domain's address space. + */ + uint8_t *kva; + +#ifdef XBB_USE_BOUNCE_BUFFERS + /** + * Pre-allocated domain local memory used to proxy remote + * domain memory during I/O operations. + */ + uint8_t *bounce; +#endif -struct ring_ref { - vm_offset_t va; - grant_handle_t handle; - uint64_t bus_addr; + /** + * Base, psuedo-physical address, corresponding to the start + * of this request's kva region. + */ + uint64_t gnt_base; + + /** + * The number of pages currently mapped for this request. + */ + int nr_pages; + + /** + * The number of 512 byte sectors comprising this requests. + */ + int nr_512b_sectors; + + /** + * The number of struct bio requests still outstanding for this + * request on the backend device. This field is only used for + * device (rather than file) backed I/O. + */ + int pendcnt; + + /** + * BLKIF_OP code for this request. + */ + int operation; + + /** + * BLKIF_RSP status code for this request. + * + * This field allows an error status to be recorded even if the + * delivery of this status must be deferred. Deferred reporting + * is necessary, for example, when an error is detected during + * completion processing of one bio when other bios for this + * request are still outstanding. + */ + int status; + + /** + * Device statistics request ordering type (ordered or simple). + */ + devstat_tag_type ds_tag_type; + + /** + * Device statistics request type (read, write, no_data). + */ + devstat_trans_flags ds_trans_type; + + /** + * The start time for this request. + */ + struct bintime ds_t0; + + /** + * Array of grant handles (one per page) used to map this request. + */ + grant_handle_t *gnt_handles; }; +SLIST_HEAD(xbb_xen_req_slist, xbb_xen_req); -typedef struct blkback_info { - - /* Schedule lists */ - STAILQ_ENTRY(blkback_info) next_req; - int on_req_sched_list; - - struct xenbus_device *xdev; - XenbusState frontend_state; - - domid_t domid; - - int state; - int ring_connected; - struct ring_ref rr; - blkif_back_ring_t ring; - evtchn_port_t evtchn; - int irq; - void *irq_cookie; - - int ref_cnt; - - int handle; - char *mode; - char *type; - char *dev_name; - - struct vnode *vn; - struct cdev *cdev; - struct cdevsw *csw; - u_int sector_size; - int sector_size_shift; - off_t media_size; - u_int media_num_sectors; - int major; - int minor; - int read_only; - - struct mtx blk_ring_lock; - - device_t ndev; - - /* Stats */ - int st_rd_req; - int st_wr_req; - int st_oo_req; - int st_err_req; -} blkif_t; - -/* - * These are rather arbitrary. They are fairly large because adjacent requests - * pulled from a communication ring are quite likely to end up being part of - * the same scatter/gather request at the disc. - * - * ** TRY INCREASING 'blkif_reqs' IF WRITE SPEEDS SEEM TOO LOW ** - * - * This will increase the chances of being able to write whole tracks. - * 64 should be enough to keep us competitive with Linux. +/** + * \brief Configuration data for the shared memory request ring + * used to communicate with the front-end client of this + * this driver. */ -static int blkif_reqs = 64; -TUNABLE_INT("xen.vbd.blkif_reqs", &blkif_reqs); +struct xbb_ring_config { + /** KVA address where ring memory is mapped. */ + vm_offset_t va; + + /** The pseudo-physical address where ring memory is mapped.*/ + uint64_t gnt_addr; + + /** + * Grant table handles, one per-ring page, returned by the + * hyperpervisor upon mapping of the ring and required to + * unmap it when a connection is torn down. + */ + grant_handle_t handle[XBB_MAX_RING_PAGES]; + + /** + * The device bus address returned by the hypervisor when + * mapping the ring and required to unmap it when a connection + * is torn down. + */ + uint64_t bus_addr[XBB_MAX_RING_PAGES]; + + /** The number of ring pages mapped for the current connection. */ + u_int ring_pages; + + /** + * The grant references, one per-ring page, supplied by the + * front-end, allowing us to reference the ring pages in the + * front-end's domain and to map these pages into our own domain. + */ + grant_ref_t ring_ref[XBB_MAX_RING_PAGES]; -static int mmap_pages; + /** The interrupt driven even channel used to signal ring events. */ + evtchn_port_t evtchn; +}; -/* - * Each outstanding request that we've passed to the lower device layers has a - * 'pending_req' allocated to it. Each buffer_head that completes decrements - * the pendcnt towards zero. When it hits zero, the specified domain has a - * response queued for it, with the saved 'id' passed back. +/** + * Per-instance connection state flags. */ -typedef struct pending_req { - blkif_t *blkif; - uint64_t id; - int nr_pages; - int pendcnt; - unsigned short operation; - int status; - STAILQ_ENTRY(pending_req) free_list; -} pending_req_t; - -static pending_req_t *pending_reqs; -static STAILQ_HEAD(pending_reqs_list, pending_req) pending_free = - STAILQ_HEAD_INITIALIZER(pending_free); -static struct mtx pending_free_lock; - -static STAILQ_HEAD(blkback_req_sched_list, blkback_info) req_sched_list = - STAILQ_HEAD_INITIALIZER(req_sched_list); -static struct mtx req_sched_list_lock; - -static unsigned long mmap_vstart; -static unsigned long *pending_vaddrs; -static grant_handle_t *pending_grant_handles; - -static struct task blk_req_task; - -/* Protos */ -static void disconnect_ring(blkif_t *blkif); -static int vbd_add_dev(struct xenbus_device *xdev); - -static inline int vaddr_pagenr(pending_req_t *req, int seg) +typedef enum { - return (req - pending_reqs) * BLKIF_MAX_SEGMENTS_PER_REQUEST + seg; -} + /** + * The front-end requested a read-only mount of the + * back-end device/file. + */ + XBBF_READ_ONLY = 0x01, + + /** Communication with the front-end has been established. */ + XBBF_RING_CONNECTED = 0x02, + + /** + * Front-end requests exist in the ring and are waiting for + * xbb_xen_req objects to free up. + */ + XBBF_RESOURCE_SHORTAGE = 0x04, + + /** Connection teardown in progress. */ + XBBF_SHUTDOWN = 0x08 +} xbb_flag_t; + +/** Backend device type. */ +typedef enum { + /** Backend type unknown. */ + XBB_TYPE_NONE = 0x00, + + /** + * Backend type disk (access via cdev switch + * strategy routine). + */ + XBB_TYPE_DISK = 0x01, + + /** Backend type file (access vnode operations.). */ + XBB_TYPE_FILE = 0x02 +} xbb_type; + +/** + * \brief Structure used to memoize information about a per-request + * scatter-gather list. + * + * The chief benefit of using this data structure is it avoids having + * to reparse the possibly discontiguous S/G list in the original + * request. Due to the way that the mapping of the memory backing an + * I/O transaction is handled by Xen, a second pass is unavoidable. + * At least this way the second walk is a simple array traversal. + * + * \note A single Scatter/Gather element in the block interface covers + * at most 1 machine page. In this context a sector (blkif + * nomenclature, not what I'd choose) is a 512b aligned unit + * of mapping within the machine page referenced by an S/G + * element. + */ +struct xbb_sg { + /** The number of 512b data chunks mapped in this S/G element. */ + int16_t nsect; + + /** + * The index (0 based) of the first 512b data chunk mapped + * in this S/G element. + */ + uint8_t first_sect; + + /** + * The index (0 based) of the last 512b data chunk mapped + * in this S/G element. + */ + uint8_t last_sect; +}; -static inline unsigned long vaddr(pending_req_t *req, int seg) -{ - return pending_vaddrs[vaddr_pagenr(req, seg)]; -} +/** + * Character device backend specific configuration data. + */ +struct xbb_dev_data { + /** Cdev used for device backend access. */ + struct cdev *cdev; -#define pending_handle(_req, _seg) \ - (pending_grant_handles[vaddr_pagenr(_req, _seg)]) + /** Cdev switch used for device backend access. */ + struct cdevsw *csw; -static unsigned long -alloc_empty_page_range(unsigned long nr_pages) -{ - void *pages; - int i = 0, j = 0; - multicall_entry_t mcl[17]; - unsigned long mfn_list[16]; - struct xen_memory_reservation reservation = { - .extent_start = mfn_list, - .nr_extents = 0, - .address_bits = 0, - .extent_order = 0, - .domid = DOMID_SELF - }; + /** Used to hold a reference on opened cdev backend devices. */ + int dev_ref; +}; - pages = malloc(nr_pages*PAGE_SIZE, M_DEVBUF, M_NOWAIT); - if (pages == NULL) - return 0; +/** + * File backend specific configuration data. + */ +struct xbb_file_data { + /** Credentials to use for vnode backed (file based) I/O. */ + struct ucred *cred; + + /** + * \brief Array of io vectors used to process file based I/O. + * + * Only a single file based request is outstanding per-xbb instance, + * so we only need one of these. + */ + struct iovec xiovecs[XBB_MAX_SEGMENTS_PER_REQUEST]; +#ifdef XBB_USE_BOUNCE_BUFFERS + + /** + * \brief Array of io vectors used to handle bouncing of file reads. + * + * Vnode operations are free to modify uio data during their + * exectuion. In the case of a read with bounce buffering active, + * we need some of the data from the original uio in order to + * bounce-out the read data. This array serves as the temporary + * storage for this saved data. + */ + struct iovec saved_xiovecs[XBB_MAX_SEGMENTS_PER_REQUEST]; + + /** + * \brief Array of memoized bounce buffer kva offsets used + * in the file based backend. + * + * Due to the way that the mapping of the memory backing an + * I/O transaction is handled by Xen, a second pass through + * the request sg elements is unavoidable. We memoize the computed + * bounce address here to reduce the cost of the second walk. + */ + void *xiovecs_vaddr[XBB_MAX_SEGMENTS_PER_REQUEST]; +#endif /* XBB_USE_BOUNCE_BUFFERS */ +}; - memset(mcl, 0, sizeof(mcl)); +/** + * Collection of backend type specific data. + */ +union xbb_backend_data { + struct xbb_dev_data dev; + struct xbb_file_data file; +}; - while (i < nr_pages) { - unsigned long va = (unsigned long)pages + (i++ * PAGE_SIZE); +/** + * Function signature of backend specific I/O handlers. + */ +typedef int (*xbb_dispatch_t)(struct xbb_softc *xbb, blkif_request_t *ring_req, + struct xbb_xen_req *req, int nseg, + int operation, int flags); - mcl[j].op = __HYPERVISOR_update_va_mapping; - mcl[j].args[0] = va; +/** + * Per-instance configuration data. + */ +struct xbb_softc { - mfn_list[j++] = vtomach(va) >> PAGE_SHIFT; + /** + * Task-queue used to process I/O requests. + */ + struct taskqueue *io_taskqueue; + + /** + * Single "run the request queue" task enqueued + * on io_taskqueue. + */ + struct task io_task; + + /** Device type for this instance. */ + xbb_type device_type; + + /** NewBus device corresponding to this instance. */ + device_t dev; + + /** Backend specific dispatch routine for this instance. */ + xbb_dispatch_t dispatch_io; + + /** The number of requests outstanding on the backend device/file. */ + u_int active_request_count; + + /** Free pool of request tracking structures. */ + struct xbb_xen_req_slist request_free_slist; + + /** Array, sized at connection time, of request tracking structures. */ + struct xbb_xen_req *requests; + + /** + * Global pool of kva used for mapping remote domain ring + * and I/O transaction data. + */ + vm_offset_t kva; + + /** Psuedo-physical address corresponding to kva. */ + uint64_t gnt_base_addr; + + /** The size of the global kva pool. */ + int kva_size; + + /** + * \brief Cached value of the front-end's domain id. + * + * This value is used at once for each mapped page in + * a transaction. We cache it to avoid incuring the + * cost of an ivar access every time this is needed. + */ + domid_t otherend_id; + + /** + * \brief The blkif protocol abi in effect. + * + * There are situations where the back and front ends can + * have a different, native abi (e.g. intel x86_64 and + * 32bit x86 domains on the same machine). The back-end + * always accomodates the front-end's native abi. That + * value is pulled from the XenStore and recorded here. + */ + int abi; + + /** + * \brief The maximum number of requests allowed to be in + * flight at a time. + * + * This value is negotiated via the XenStore. + */ + uint32_t max_requests; + + /** + * \brief The maximum number of segments (1 page per segment) + * that can be mapped by a request. + * + * This value is negotiated via the XenStore. + */ + uint32_t max_request_segments; + + /** + * The maximum size of any request to this back-end + * device. + * + * This value is negotiated via the XenStore. + */ + uint32_t max_request_size; + + /** Various configuration and state bit flags. */ + xbb_flag_t flags; + + /** Ring mapping and interrupt configuration data. */ + struct xbb_ring_config ring_config; + + /** Runtime, cross-abi safe, structures for ring access. */ + blkif_back_rings_t rings; + + /** IRQ mapping for the communication ring event channel. */ + int irq; + + /** + * \brief Backend access mode flags (e.g. write, or read-only). + * + * This value is passed to us by the front-end via the XenStore. + */ + char *dev_mode; + + /** + * \brief Backend device type (e.g. "disk", "cdrom", "floppy"). + * + * This value is passed to us by the front-end via the XenStore. + * Currently unused. + */ + char *dev_type; + + /** + * \brief Backend device/file identifier. + * + * This value is passed to us by the front-end via the XenStore. + * We expect this to be a POSIX path indicating the file or + * device to open. + */ + char *dev_name; + + /** + * Vnode corresponding to the backend device node or file + * we are acessing. + */ + struct vnode *vn; + + union xbb_backend_data backend; + /** The native sector size of the backend. */ + u_int sector_size; + + /** log2 of sector_size. */ + u_int sector_size_shift; + + /** Size in bytes of the backend device or file. */ + off_t media_size; + + /** + * \brief media_size expressed in terms of the backend native + * sector size. + * + * (e.g. xbb->media_size >> xbb->sector_size_shift). + */ + uint64_t media_num_sectors; + + /** + * \brief Array of memoized scatter gather data computed during the + * conversion of blkif ring requests to internal xbb_xen_req + * structures. + * + * Ring processing is serialized so we only need one of these. + */ + struct xbb_sg xbb_sgs[XBB_MAX_SEGMENTS_PER_REQUEST]; + + /** Mutex protecting per-instance data. */ + struct mtx lock; + +#ifdef XENHVM + /** + * Resource representing allocated physical address space + * associated with our per-instance kva region. + */ + struct resource *pseudo_phys_res; - xen_phys_machine[(vtophys(va) >> PAGE_SHIFT)] = INVALID_P2M_ENTRY; + /** Resource id for allocated physical address space. */ + int pseudo_phys_res_id; +#endif - if (j == 16 || i == nr_pages) { - mcl[j-1].args[MULTI_UVMFLAGS_INDEX] = UVMF_TLB_FLUSH|UVMF_LOCAL; + /** I/O statistics. */ + struct devstat *xbb_stats; +}; - reservation.nr_extents = j; +/*---------------------------- Request Processing ----------------------------*/ +/** + * Allocate an internal transaction tracking structure from the free pool. + * + * \param xbb Per-instance xbb configuration structure. + * + * \return On success, a pointer to the allocated xbb_xen_req structure. + * Otherwise NULL. + */ +static inline struct xbb_xen_req * +xbb_get_req(struct xbb_softc *xbb) +{ + struct xbb_xen_req *req; - mcl[j].op = __HYPERVISOR_memory_op; - mcl[j].args[0] = XENMEM_decrease_reservation; - mcl[j].args[1] = (unsigned long)&reservation; - - (void)HYPERVISOR_multicall(mcl, j+1); + req = NULL; + mtx_lock(&xbb->lock); - mcl[j-1].args[MULTI_UVMFLAGS_INDEX] = 0; - j = 0; + /* + * Do not allow new requests to be allocated while we + * are shutting down. + */ + if ((xbb->flags & XBBF_SHUTDOWN) == 0) { + if ((req = SLIST_FIRST(&xbb->request_free_slist)) != NULL) { + SLIST_REMOVE_HEAD(&xbb->request_free_slist, links); + xbb->active_request_count++; + } else { + xbb->flags |= XBBF_RESOURCE_SHORTAGE; } } - - return (unsigned long)pages; -} - -static pending_req_t * -alloc_req(void) -{ - pending_req_t *req; - mtx_lock(&pending_free_lock); - if ((req = STAILQ_FIRST(&pending_free))) { - STAILQ_REMOVE(&pending_free, req, pending_req, free_list); - STAILQ_NEXT(req, free_list) = NULL; - } - mtx_unlock(&pending_free_lock); - return req; + mtx_unlock(&xbb->lock); + return (req); } -static void -free_req(pending_req_t *req) +/** + * Return an allocated transaction tracking structure to the free pool. + * + * \param xbb Per-instance xbb configuration structure. + * \param req The request structure to free. + */ +static inline void +xbb_release_req(struct xbb_softc *xbb, struct xbb_xen_req *req) { - int was_empty; - - mtx_lock(&pending_free_lock); - was_empty = STAILQ_EMPTY(&pending_free); - STAILQ_INSERT_TAIL(&pending_free, req, free_list); - mtx_unlock(&pending_free_lock); - if (was_empty) - taskqueue_enqueue(taskqueue_swi, &blk_req_task); -} + int wake_thread; -static void -fast_flush_area(pending_req_t *req) -{ - struct gnttab_unmap_grant_ref unmap[BLKIF_MAX_SEGMENTS_PER_REQUEST]; - unsigned int i, invcount = 0; - grant_handle_t handle; - int ret; + mtx_lock(&xbb->lock); + wake_thread = xbb->flags & XBBF_RESOURCE_SHORTAGE; + xbb->flags &= ~XBBF_RESOURCE_SHORTAGE; + SLIST_INSERT_HEAD(&xbb->request_free_slist, req, links); + xbb->active_request_count--; - for (i = 0; i < req->nr_pages; i++) { - handle = pending_handle(req, i); - if (handle == BLKBACK_INVALID_HANDLE) - continue; - unmap[invcount].host_addr = vaddr(req, i); - unmap[invcount].dev_bus_addr = 0; - unmap[invcount].handle = handle; - pending_handle(req, i) = BLKBACK_INVALID_HANDLE; - invcount++; + if ((xbb->flags & XBBF_SHUTDOWN) != 0) { + /* + * Shutdown is in progress. See if we can + * progress further now that one more request + * has completed and been returned to the + * free pool. + */ + xbb_shutdown(xbb); } + mtx_unlock(&xbb->lock); - ret = HYPERVISOR_grant_table_op( - GNTTABOP_unmap_grant_ref, unmap, invcount); - PANIC_IF(ret); + if (wake_thread != 0) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Tue Oct 19 21:53: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 EB801106566C; Tue, 19 Oct 2010 21:53:32 +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 925078FC13; Tue, 19 Oct 2010 21:53:32 +0000 (UTC) Received: from mail.geekcn.org (tarsier.geekcn.org [211.166.10.233]) by tarsier.geekcn.org (Postfix) with ESMTP id 8DD17A7DFC3; Wed, 20 Oct 2010 05:53:31 +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 PfthPO4JHYIR; Wed, 20 Oct 2010 05:53:25 +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 81976A7DF9D; Wed, 20 Oct 2010 05:53:24 +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=A8mKxtMESN2UCuKb6dEt+nXUQoEKDhdSVRAjj5s1EvXUnZ0mTPsqYTerRZxN5Bnjt F6us1HoNTyK9l5LJVsRJA== Message-ID: <4CBE1351.8040407@delphij.net> Date: Tue, 19 Oct 2010 14:53:21 -0700 From: Xin LI Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.1.12) Gecko/20100920 Thunderbird/3.0.8 ThunderBrowse/3.3.2 MIME-Version: 1.0 To: Warner Losh References: <201010131634.o9DGY9bF093160@svn.freebsd.org> In-Reply-To: <201010131634.o9DGY9bF093160@svn.freebsd.org> X-Enigmail-Version: 1.0.1 OpenPGP: id=3FCA37C1; url=http://www.delphij.net/delphij.asc 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: r213784 - head/lib/libz 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: Tue, 19 Oct 2010 21:53:33 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 On 10/13/10 09:34, Warner Losh wrote: > Author: imp > Date: Wed Oct 13 16:34:08 2010 > New Revision: 213784 > URL: http://svn.freebsd.org/changeset/base/213784 > > Log: > Revert 212517 to restore pristine state of this file Thanks! - -- Xin LI http://www.delphij.net/ FreeBSD - The Power to Serve! Live free or die -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (FreeBSD) iQEcBAEBCAAGBQJMvhNRAAoJEATO+BI/yjfBWasIALq1Pu6yb2RF4pfqY2AOyq06 EfV4MpWhY2+KYTYkS5zViAN9+hR9f/ncmMpIDemBXX5i/0Zq57KpuaYN/t26zDQ/ uoHj/jK2nxR8RmCNx4lWJ0LoShhkKLA+Gx1z0C1Ebg1iOIe0Ni/ekcvU6+80WX3e zKq/TqBSnIJaR0CS/MES/vrnf/MJn0EfLXSKArH/urC9HZUz9aiacbVDpmFBoSPR WJdsfshHOeG7GSHP2ExZewKl+EgBG1JGRFExHtxEKecGwgihu9k0AlBEukrlb8A1 mEXGUXT5bHCZTvkkrnYiSZaFUiukNe+GsMDkJ7K5Y1eL5g8ZQbq6gY7UwlAnOrY= =NFxi -----END PGP SIGNATURE----- From owner-svn-src-head@FreeBSD.ORG Tue Oct 19 22: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 621FE106566B; Tue, 19 Oct 2010 22:10:07 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mail.cksoft.de (mail.cksoft.de [IPv6:2001:4068:10::3]) by mx1.freebsd.org (Postfix) with ESMTP id 139F98FC17; Tue, 19 Oct 2010 22:10:07 +0000 (UTC) Received: from localhost (amavis.fra.cksoft.de [192.168.74.71]) by mail.cksoft.de (Postfix) with ESMTP id 6F6C541C75D; Wed, 20 Oct 2010 00:10: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 cvyqk79tI9ox; Wed, 20 Oct 2010 00:10:05 +0200 (CEST) Received: by mail.cksoft.de (Postfix, from userid 66) id AC1CB41C75C; Wed, 20 Oct 2010 00: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 BA6604448F3; Tue, 19 Oct 2010 22:06:09 +0000 (UTC) Date: Tue, 19 Oct 2010 22:06:09 +0000 (UTC) From: "Bjoern A. Zeeb" X-X-Sender: bz@maildrop.int.zabbadoz.net To: Bernhard Schmidt In-Reply-To: <201010191911.o9JJBaQe024210@svn.freebsd.org> Message-ID: <20101019220455.D46881@maildrop.int.zabbadoz.net> References: <201010191911.o9JJBaQe024210@svn.freebsd.org> 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: r214070 - head/sys/dev/if_ndis 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, 19 Oct 2010 22:10:07 -0000 On Tue, 19 Oct 2010, Bernhard Schmidt wrote: > Author: bschmidt > Date: Tue Oct 19 19:11:36 2010 > New Revision: 214070 > URL: http://svn.freebsd.org/changeset/base/214070 > > Log: > There is no reason to call rt_ifmsg(), remove it. While it's indeed very uncommon to have that in a driver, I don't know how much black magic if_ndis(4) is. Have you verified that you still get the events from elsewhere on the routing socket when loading/unloading if_ndif.ko? > Submitted by: Paul B Mahol > MFC after: 1 week > > Modified: > head/sys/dev/if_ndis/if_ndis.c > > Modified: head/sys/dev/if_ndis/if_ndis.c > ============================================================================== > --- head/sys/dev/if_ndis/if_ndis.c Tue Oct 19 18:49:26 2010 (r214069) > +++ head/sys/dev/if_ndis/if_ndis.c Tue Oct 19 19:11:36 2010 (r214070) > @@ -1644,10 +1644,6 @@ ndis_linksts_done(adapter) > default: > break; > } > - > - /* Notify possible listners of interface change. */ > - > - rt_ifmsg(ifp); > } > > static void > -- Bjoern A. Zeeb Welcome a new stage of life. From owner-svn-src-head@FreeBSD.ORG Tue Oct 19 23:04: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 47E14106564A; Tue, 19 Oct 2010 23:04:24 +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 35CCC8FC15; Tue, 19 Oct 2010 23:04: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 o9JN4O9J030099; Tue, 19 Oct 2010 23:04:24 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9JN4ORq030096; Tue, 19 Oct 2010 23:04:24 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201010192304.o9JN4ORq030096@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 19 Oct 2010 23:04:24 +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: r214087 - 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: Tue, 19 Oct 2010 23:04:24 -0000 Author: yongari Date: Tue Oct 19 23:04:23 2010 New Revision: 214087 URL: http://svn.freebsd.org/changeset/base/214087 Log: Add workaround for BCM5906 controller silicon bug. If device receive two back-to-back send BDs with less than or equal to 8 total bytes then the device may hang. The two back-to-back send BDs must be in the same frame for this failure to occur. Thanks to davidch for detailed errata information. Reviewed by: davidch 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 Tue Oct 19 22:11:50 2010 (r214086) +++ head/sys/dev/bge/if_bge.c Tue Oct 19 23:04:23 2010 (r214087) @@ -374,6 +374,7 @@ static void bge_tick(void *); static void bge_stats_clear_regs(struct bge_softc *); static void bge_stats_update(struct bge_softc *); 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 *); static int bge_encap(struct bge_softc *, struct mbuf **, uint32_t *); @@ -2633,6 +2634,8 @@ bge_attach(device_t dev) case BGE_ASICREV_BCM5752: case BGE_ASICREV_BCM5906: sc->bge_flags |= BGE_FLAG_575X_PLUS; + if (sc->bge_asicrev == BGE_ASICREV_BCM5906) + sc->bge_flags |= BGE_FLAG_SHORT_DMA_BUG; /* FALLTHROUGH */ case BGE_ASICREV_BCM5705: sc->bge_flags |= BGE_FLAG_5705_PLUS; @@ -4060,6 +4063,39 @@ bge_cksum_pad(struct mbuf *m) } static struct mbuf * +bge_check_short_dma(struct mbuf *m) +{ + struct mbuf *n; + int found; + + /* + * If device receive two back-to-back send BDs with less than + * or equal to 8 total bytes then the device may hang. The two + * back-to-back send BDs must in the same frame for this failure + * to occur. Scan mbuf chains and see whether two back-to-back + * send BDs are there. If this is the case, allocate new mbuf + * and copy the frame to workaround the silicon bug. + */ + for (n = m, found = 0; n != NULL; n = n->m_next) { + if (n->m_len < 8) { + found++; + if (found > 1) + break; + continue; + } + found = 0; + } + + if (found > 1) { + n = m_defrag(m, M_DONTWAIT); + if (n == NULL) + m_freem(m); + } else + n = m; + return (n); +} + +static struct mbuf * bge_setup_tso(struct bge_softc *sc, struct mbuf *m, uint16_t *mss) { struct ip *ip; @@ -4132,6 +4168,13 @@ bge_encap(struct bge_softc *sc, struct m csum_flags = 0; mss = 0; vlan_tag = 0; + if ((sc->bge_flags & BGE_FLAG_SHORT_DMA_BUG) != 0 && + m->m_next != NULL) { + *m_head = bge_check_short_dma(m); + if (*m_head == NULL) + return (ENOBUFS); + m = *m_head; + } if ((m->m_pkthdr.csum_flags & CSUM_TSO) != 0) { *m_head = m = bge_setup_tso(sc, m, &mss); if (*m_head == NULL) Modified: head/sys/dev/bge/if_bgereg.h ============================================================================== --- head/sys/dev/bge/if_bgereg.h Tue Oct 19 22:11:50 2010 (r214086) +++ head/sys/dev/bge/if_bgereg.h Tue Oct 19 23:04:23 2010 (r214087) @@ -2727,6 +2727,7 @@ struct bge_softc { #define BGE_FLAG_40BIT_BUG 0x01000000 #define BGE_FLAG_4G_BNDRY_BUG 0x02000000 #define BGE_FLAG_RX_ALIGNBUG 0x04000000 +#define BGE_FLAG_SHORT_DMA_BUG 0x08000000 uint32_t bge_phy_flags; #define BGE_PHY_WIRESPEED 0x00000001 #define BGE_PHY_ADC_BUG 0x00000002 From owner-svn-src-head@FreeBSD.ORG Wed Oct 20 00:19: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 15654106564A; Wed, 20 Oct 2010 00:19:26 +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 03B468FC15; Wed, 20 Oct 2010 00:19: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 o9K0JPQr031710; Wed, 20 Oct 2010 00:19:25 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9K0JPRi031708; Wed, 20 Oct 2010 00:19:25 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201010200019.o9K0JPRi031708@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 20 Oct 2010 00:19: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: r214089 - head/sys/dev/sis 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, 20 Oct 2010 00:19:26 -0000 Author: yongari Date: Wed Oct 20 00:19:25 2010 New Revision: 214089 URL: http://svn.freebsd.org/changeset/base/214089 Log: Correct handling of shared interrupt in sis_intr(). r212116 incorrectly released a drver lock for shared interrupt case such that it caused panic. While I'm here check whether driver is still running before serving TX/RX handler. Reported by: Jerahmy Pocott < QUAKENET1 <> optusnet dot com dot au > Tested by: Jerahmy Pocott < QUAKENET1 <> optusnet dot com dot au > MFC after: 3 days Modified: head/sys/dev/sis/if_sis.c Modified: head/sys/dev/sis/if_sis.c ============================================================================== --- head/sys/dev/sis/if_sis.c Tue Oct 19 23:57:34 2010 (r214088) +++ head/sys/dev/sis/if_sis.c Wed Oct 20 00:19:25 2010 (r214089) @@ -1795,12 +1795,15 @@ sis_intr(void *arg) if ((status & SIS_INTRS) == 0) { /* Not ours. */ SIS_UNLOCK(sc); + return; } /* Disable interrupts. */ CSR_WRITE_4(sc, SIS_IER, 0); for (;(status & SIS_INTRS) != 0;) { + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) + break; if (status & (SIS_ISR_TX_DESC_OK | SIS_ISR_TX_ERR | SIS_ISR_TX_OK | SIS_ISR_TX_IDLE) ) @@ -1825,11 +1828,13 @@ sis_intr(void *arg) status = CSR_READ_4(sc, SIS_ISR); } - /* Re-enable interrupts. */ - CSR_WRITE_4(sc, SIS_IER, 1); + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + /* Re-enable interrupts. */ + CSR_WRITE_4(sc, SIS_IER, 1); - if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) - sis_startl(ifp); + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) + sis_startl(ifp); + } SIS_UNLOCK(sc); } From owner-svn-src-head@FreeBSD.ORG Wed Oct 20 00:41: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 9F7A8106566B; Wed, 20 Oct 2010 00:41:38 +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 8D88B8FC16; Wed, 20 Oct 2010 00:41: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 o9K0fccE032227; Wed, 20 Oct 2010 00:41:38 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9K0fcJT032225; Wed, 20 Oct 2010 00:41:38 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201010200041.o9K0fcJT032225@svn.freebsd.org> From: David Xu Date: Wed, 20 Oct 2010 00:41: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: r214091 - 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, 20 Oct 2010 00:41:38 -0000 Author: davidxu Date: Wed Oct 20 00:41:38 2010 New Revision: 214091 URL: http://svn.freebsd.org/changeset/base/214091 Log: - Don't include sx.h, it is not needed. - Check NULL pointer, move timeout calculation code outside of process lock. Modified: head/sys/kern/kern_thr.c Modified: head/sys/kern/kern_thr.c ============================================================================== --- head/sys/kern/kern_thr.c Wed Oct 20 00:24:30 2010 (r214090) +++ head/sys/kern/kern_thr.c Wed Oct 20 00:41:38 2010 (r214091) @@ -45,7 +45,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -431,40 +430,40 @@ thr_suspend(struct thread *td, struct th int kern_thr_suspend(struct thread *td, struct timespec *tsp) { + struct proc *p = td->td_proc; struct timeval tv; int error = 0; int timo = 0; - if (tsp != NULL) { - if (tsp->tv_nsec < 0 || tsp->tv_nsec > 1000000000) - return (EINVAL); - } - if (td->td_pflags & TDP_WAKEUP) { td->td_pflags &= ~TDP_WAKEUP; return (0); } - PROC_LOCK(td->td_proc); - if ((td->td_flags & TDF_THRWAKEUP) == 0) { + if (tsp != NULL) { + if (tsp->tv_nsec < 0 || tsp->tv_nsec > 1000000000) + return (EINVAL); if (tsp->tv_sec == 0 && tsp->tv_nsec == 0) error = EWOULDBLOCK; else { TIMESPEC_TO_TIMEVAL(&tv, tsp); timo = tvtohz(&tv); - error = msleep((void *)td, &td->td_proc->p_mtx, - PCATCH, "lthr", timo); } } + PROC_LOCK(p); + if (error == 0 && (td->td_flags & TDF_THRWAKEUP) == 0) + error = msleep((void *)td, &p->p_mtx, + PCATCH, "lthr", timo); + if (td->td_flags & TDF_THRWAKEUP) { thread_lock(td); td->td_flags &= ~TDF_THRWAKEUP; thread_unlock(td); - PROC_UNLOCK(td->td_proc); + PROC_UNLOCK(p); return (0); } - PROC_UNLOCK(td->td_proc); + PROC_UNLOCK(p); if (error == EWOULDBLOCK) error = ETIMEDOUT; else if (error == ERESTART) { From owner-svn-src-head@FreeBSD.ORG Wed Oct 20 02:34: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 709F0106566B; Wed, 20 Oct 2010 02:34:02 +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 5E3B38FC0A; Wed, 20 Oct 2010 02:34: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 o9K2Y2wU034907; Wed, 20 Oct 2010 02:34:02 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9K2Y2uF034900; Wed, 20 Oct 2010 02:34:02 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201010200234.o9K2Y2uF034900@svn.freebsd.org> From: David Xu Date: Wed, 20 Oct 2010 02:34: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: r214093 - in head/lib: libc/include libthr 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, 20 Oct 2010 02:34:02 -0000 Author: davidxu Date: Wed Oct 20 02:34:02 2010 New Revision: 214093 URL: http://svn.freebsd.org/changeset/base/214093 Log: Revert revision 214007, I realized that MySQL wants to resolve a silly rwlock deadlock problem, the deadlock is caused by writer waiters, if a thread has already locked a reader lock, and wants to acquire another reader lock, it will be blocked by writer waiters, but we had already fixed it years ago. Modified: head/lib/libc/include/namespace.h head/lib/libc/include/un-namespace.h head/lib/libthr/pthread.map head/lib/libthr/thread/thr_private.h head/lib/libthr/thread/thr_rwlock.c head/lib/libthr/thread/thr_rwlockattr.c Modified: head/lib/libc/include/namespace.h ============================================================================== --- head/lib/libc/include/namespace.h Wed Oct 20 01:22:04 2010 (r214092) +++ head/lib/libc/include/namespace.h Wed Oct 20 02:34:02 2010 (r214093) @@ -177,10 +177,8 @@ #define pthread_rwlock_unlock _pthread_rwlock_unlock #define pthread_rwlock_wrlock _pthread_rwlock_wrlock #define pthread_rwlockattr_destroy _pthread_rwlockattr_destroy -#define pthread_rwlockattr_getkind_np _pthread_rwlockattr_getkind_np #define pthread_rwlockattr_getpshared _pthread_rwlockattr_getpshared #define pthread_rwlockattr_init _pthread_rwlockattr_init -#define pthread_rwlockattr_setkind_np _pthread_rwlockattr_setkind_np #define pthread_rwlockattr_setpshared _pthread_rwlockattr_setpshared #define pthread_self _pthread_self #define pthread_set_name_np _pthread_set_name_np Modified: head/lib/libc/include/un-namespace.h ============================================================================== --- head/lib/libc/include/un-namespace.h Wed Oct 20 01:22:04 2010 (r214092) +++ head/lib/libc/include/un-namespace.h Wed Oct 20 02:34:02 2010 (r214093) @@ -158,10 +158,8 @@ #undef pthread_rwlock_unlock #undef pthread_rwlock_wrlock #undef pthread_rwlockattr_destroy -#undef pthread_rwlockattr_getkind_np #undef pthread_rwlockattr_getpshared #undef pthread_rwlockattr_init -#undef pthread_rwlockattr_setkind_np #undef pthread_rwlockattr_setpshared #undef pthread_self #undef pthread_set_name_np Modified: head/lib/libthr/pthread.map ============================================================================== --- head/lib/libthr/pthread.map Wed Oct 20 01:22:04 2010 (r214092) +++ head/lib/libthr/pthread.map Wed Oct 20 02:34:02 2010 (r214093) @@ -318,9 +318,7 @@ FBSDprivate_1.0 { _pthread_rwlock_wrlock; _pthread_rwlockattr_destroy; _pthread_rwlockattr_getpshared; - _pthread_rwlockattr_getkind_np; _pthread_rwlockattr_init; - _pthread_rwlockattr_setkind_np; _pthread_rwlockattr_setpshared; _pthread_self; _pthread_set_name_np; @@ -403,8 +401,6 @@ FBSD_1.1 { FBSD_1.2 { openat; - pthread_rwlockattr_getkind_np; - pthread_rwlockattr_setkind_np; setcontext; swapcontext; }; Modified: head/lib/libthr/thread/thr_private.h ============================================================================== --- head/lib/libthr/thread/thr_private.h Wed Oct 20 01:22:04 2010 (r214092) +++ head/lib/libthr/thread/thr_private.h Wed Oct 20 02:34:02 2010 (r214093) @@ -285,14 +285,11 @@ struct pthread_prio { struct pthread_rwlockattr { int pshared; - int kind; }; struct pthread_rwlock { struct urwlock lock; struct pthread *owner; - int recurse; - int kind; }; /* Modified: head/lib/libthr/thread/thr_rwlock.c ============================================================================== --- head/lib/libthr/thread/thr_rwlock.c Wed Oct 20 01:22:04 2010 (r214092) +++ head/lib/libthr/thread/thr_rwlock.c Wed Oct 20 02:34:02 2010 (r214093) @@ -63,19 +63,13 @@ __weak_reference(_pthread_rwlock_timedwr */ static int -rwlock_init(pthread_rwlock_t *rwlock, const pthread_rwlockattr_t *attr) +rwlock_init(pthread_rwlock_t *rwlock, const pthread_rwlockattr_t *attr __unused) { pthread_rwlock_t prwlock; prwlock = (pthread_rwlock_t)calloc(1, sizeof(struct pthread_rwlock)); if (prwlock == NULL) return (ENOMEM); - if (attr != NULL) - prwlock->kind = (*attr)->kind; - else - prwlock->kind = PTHREAD_RWLOCK_DEFAULT_NP; - if (prwlock->kind == PTHREAD_RWLOCK_PREFER_READER_NP) - prwlock->lock.rw_flags |= URWLOCK_PREFER_READER; *rwlock = prwlock; return (0); } @@ -118,7 +112,7 @@ init_static(struct pthread *thread, pthr } int -_pthread_rwlock_init(pthread_rwlock_t *rwlock, const pthread_rwlockattr_t *attr) +_pthread_rwlock_init (pthread_rwlock_t *rwlock, const pthread_rwlockattr_t *attr) { *rwlock = NULL; return (rwlock_init(rwlock, attr)); @@ -266,14 +260,6 @@ rwlock_wrlock_common (pthread_rwlock_t * CHECK_AND_INIT_RWLOCK - if (__predict_false(prwlock->owner == curthread)) { - if (__predict_false( - prwlock->kind == PTHREAD_RWLOCK_PREFER_WRITER_NP)) { - prwlock->recurse++; - return (0); - } - } - /* * POSIX said the validity of the abstimeout parameter need * not be checked if the lock can be immediately acquired. @@ -349,13 +335,6 @@ _pthread_rwlock_unlock (pthread_rwlock_t if (state & URWLOCK_WRITE_OWNER) { if (__predict_false(prwlock->owner != curthread)) return (EPERM); - if (__predict_false( - prwlock->kind == PTHREAD_RWLOCK_PREFER_WRITER_NP)) { - if (prwlock->recurse > 0) { - prwlock->recurse--; - return (0); - } - } prwlock->owner = NULL; } Modified: head/lib/libthr/thread/thr_rwlockattr.c ============================================================================== --- head/lib/libthr/thread/thr_rwlockattr.c Wed Oct 20 01:22:04 2010 (r214092) +++ head/lib/libthr/thread/thr_rwlockattr.c Wed Oct 20 02:34:02 2010 (r214093) @@ -36,10 +36,8 @@ __weak_reference(_pthread_rwlockattr_destroy, pthread_rwlockattr_destroy); __weak_reference(_pthread_rwlockattr_getpshared, pthread_rwlockattr_getpshared); -__weak_reference(_pthread_rwlockattr_getkind_np, pthread_rwlockattr_getkind_np); __weak_reference(_pthread_rwlockattr_init, pthread_rwlockattr_init); __weak_reference(_pthread_rwlockattr_setpshared, pthread_rwlockattr_setpshared); -__weak_reference(_pthread_rwlockattr_setkind_np, pthread_rwlockattr_setkind_np); int _pthread_rwlockattr_destroy(pthread_rwlockattr_t *rwlockattr) @@ -83,7 +81,6 @@ _pthread_rwlockattr_init(pthread_rwlocka return(ENOMEM); prwlockattr->pshared = PTHREAD_PROCESS_PRIVATE; - prwlockattr->kind = PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP; *rwlockattr = prwlockattr; return(0); @@ -100,22 +97,3 @@ _pthread_rwlockattr_setpshared(pthread_r return(0); } - -int -_pthread_rwlockattr_setkind_np(pthread_rwlockattr_t *attr, int kind) -{ - if (kind != PTHREAD_RWLOCK_PREFER_READER_NP && - kind != PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP && - kind != PTHREAD_RWLOCK_PREFER_WRITER_NP) { - return (EINVAL); - } - (*attr)->kind = kind; - return (0); -} - -int -_pthread_rwlockattr_getkind_np(const pthread_rwlockattr_t *attr, int *kind) -{ - *kind = (*attr)->kind; - return (0); -} From owner-svn-src-head@FreeBSD.ORG Wed Oct 20 04:53: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 04B9F106566C; Wed, 20 Oct 2010 04:53:04 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E765D8FC16; Wed, 20 Oct 2010 04:53: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 o9K4r3SU037826; Wed, 20 Oct 2010 04:53:03 GMT (envelope-from maxim@svn.freebsd.org) Received: (from maxim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9K4r3KB037824; Wed, 20 Oct 2010 04:53:03 GMT (envelope-from maxim@svn.freebsd.org) Message-Id: <201010200453.o9K4r3KB037824@svn.freebsd.org> From: Maxim Konovalov Date: Wed, 20 Oct 2010 04:53: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: r214094 - 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: Wed, 20 Oct 2010 04:53:04 -0000 Author: maxim Date: Wed Oct 20 04:53:03 2010 New Revision: 214094 URL: http://svn.freebsd.org/changeset/base/214094 Log: o Put missed w/space back. Submitted by: Garrett Cooper MFC after: 3 days Modified: head/share/man/man5/device.hints.5 Modified: head/share/man/man5/device.hints.5 ============================================================================== --- head/share/man/man5/device.hints.5 Wed Oct 20 02:34:02 2010 (r214093) +++ head/share/man/man5/device.hints.5 Wed Oct 20 04:53:03 2010 (r214094) @@ -161,7 +161,7 @@ hint.acpi.0.disabled="1" .Sh SEE ALSO .Xr kenv 1 , .Xr loader.conf 5 , -.Xr loader 8, +.Xr loader 8 , .Xr resource_int_value 9 . .Sh HISTORY The From owner-svn-src-head@FreeBSD.ORG Wed Oct 20 05: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 49E991065670; Wed, 20 Oct 2010 05:17:24 +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 2D1538FC0C; Wed, 20 Oct 2010 05:17: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 o9K5HONJ038352; Wed, 20 Oct 2010 05:17:24 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9K5HOa4038347; Wed, 20 Oct 2010 05:17:24 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201010200517.o9K5HOa4038347@svn.freebsd.org> From: Andriy Gapon Date: Wed, 20 Oct 2010 05:17:24 +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: r214095 - in head: share/man/man9 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: Wed, 20 Oct 2010 05:17:24 -0000 Author: avg Date: Wed Oct 20 05:17:23 2010 New Revision: 214095 URL: http://svn.freebsd.org/changeset/base/214095 Log: PG_BUSY -> VPO_BUSY, PG_WANTED -> VPO_WANTED in manual pages and comments Reviewed by: alc MFC after: 4 days Modified: head/share/man/man9/vm_page_io.9 head/share/man/man9/vm_page_sleep_busy.9 head/share/man/man9/vm_page_wakeup.9 head/sys/vm/swap_pager.c Modified: head/share/man/man9/vm_page_io.9 ============================================================================== --- head/share/man/man9/vm_page_io.9 Wed Oct 20 04:53:03 2010 (r214094) +++ head/share/man/man9/vm_page_io.9 Wed Oct 20 05:17:23 2010 (r214095) @@ -52,9 +52,9 @@ function lowers the busy count on the pa count is zero, a .Xr wakeup 9 will be issued if the page has been marked -.Dv PG_WANTED . +.Dv VPO_WANTED . A page is typically marked -.Dv PG_WANTED +.Dv VPO_WANTED by a thread to register its interest in the page to either complete I/O or becoming available for general use. .Sh AUTHORS Modified: head/share/man/man9/vm_page_sleep_busy.9 ============================================================================== --- head/share/man/man9/vm_page_sleep_busy.9 Wed Oct 20 04:53:03 2010 (r214094) +++ head/share/man/man9/vm_page_sleep_busy.9 Wed Oct 20 05:17:23 2010 (r214095) @@ -42,7 +42,7 @@ The .Fn vm_page_sleep_busy function waits until the -.Dv PG_BUSY +.Dv VPO_BUSY flag is cleared. If .Fa also_m_busy Modified: head/share/man/man9/vm_page_wakeup.9 ============================================================================== --- head/share/man/man9/vm_page_wakeup.9 Wed Oct 20 04:53:03 2010 (r214094) +++ head/share/man/man9/vm_page_wakeup.9 Wed Oct 20 05:17:23 2010 (r214095) @@ -50,20 +50,20 @@ of a page. .Pp .Fn vm_page_busy sets the -.Dv PG_BUSY +.Dv VPO_BUSY flag in the page. .Pp .Fn vm_page_flash checks to see if there is anybody waiting on the page -.Dv ( PG_WANTED +.Dv ( VPO_WANTED will be set), and if so, clears the -.Dv PG_WANTED +.Dv VPO_WANTED flag and notifies whoever is waiting via .Fn wakeup . .Pp .Fn vm_page_wakeup clears the -.Dv PG_BUSY +.Dv VPO_BUSY flag on the page, and calls .Fn vm_page_flash in case somebody has been waiting for it. Modified: head/sys/vm/swap_pager.c ============================================================================== --- head/sys/vm/swap_pager.c Wed Oct 20 04:53:03 2010 (r214094) +++ head/sys/vm/swap_pager.c Wed Oct 20 05:17:23 2010 (r214095) @@ -1460,8 +1460,8 @@ swap_pager_putpages(vm_object_t object, * Completion routine for asynchronous reads and writes from/to swap. * Also called manually by synchronous code to finish up a bp. * - * For READ operations, the pages are PG_BUSY'd. For WRITE operations, - * the pages are vm_page_t->busy'd. For READ operations, we PG_BUSY + * For READ operations, the pages are VPO_BUSY'd. For WRITE operations, + * the pages are vm_page_t->busy'd. For READ operations, we VPO_BUSY * unbusy all pages except the 'main' request page. For WRITE * operations, we vm_page_t->busy'd unbusy all pages ( we can do this * because we marked them all VM_PAGER_PEND on return from putpages ). From owner-svn-src-head@FreeBSD.ORG Wed Oct 20 05:57: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 66131106566B; Wed, 20 Oct 2010 05:57:55 +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 3A2268FC0A; Wed, 20 Oct 2010 05:57: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 o9K5vt63039135; Wed, 20 Oct 2010 05:57:55 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9K5vtPw039133; Wed, 20 Oct 2010 05:57:55 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201010200557.o9K5vtPw039133@svn.freebsd.org> From: Andriy Gapon Date: Wed, 20 Oct 2010 05:57: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: r214096 - 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: Wed, 20 Oct 2010 05:57:55 -0000 Author: avg Date: Wed Oct 20 05:57:54 2010 New Revision: 214096 URL: http://svn.freebsd.org/changeset/base/214096 Log: VOP_GETPAGES.9: clarify and correct description of parameters and requirements In cooperation with alc and kib, who provided valuable insights and suggestions. Reviewed by: alc, kib (earlier version) MFC after: 4 days Modified: head/share/man/man9/VOP_GETPAGES.9 Modified: head/share/man/man9/VOP_GETPAGES.9 ============================================================================== --- head/share/man/man9/VOP_GETPAGES.9 Wed Oct 20 05:17:23 2010 (r214095) +++ head/share/man/man9/VOP_GETPAGES.9 Wed Oct 20 05:57:54 2010 (r214096) @@ -41,9 +41,9 @@ .In sys/vnode.h .In vm/vm.h .Ft int -.Fn VOP_GETPAGES "struct vnode *vp" "vm_page_t *m" "int count" "int reqpage" "vm_ooffset_t offset" +.Fn VOP_GETPAGES "struct vnode *vp" "vm_page_t *ma" "int count" "int reqpage" "vm_ooffset_t offset" .Ft int -.Fn VOP_PUTPAGES "struct vnode *vp" "vm_page_t *m" "int count" "int sync" "int *rtvals" "vm_ooffset_t offset" +.Fn VOP_PUTPAGES "struct vnode *vp" "vm_page_t *ma" "int count" "int sync" "int *rtvals" "vm_ooffset_t offset" .Sh DESCRIPTION The .Fn VOP_GETPAGES @@ -66,11 +66,11 @@ The arguments are: .Bl -tag -width reqpage .It Fa vp The file to access. -.It Fa m -Pointer to the first element of an array of contiguous pages representing a +.It Fa ma +Pointer to the first element of an array of pages representing a contiguous region of the file to be read or written. .It Fa count -The number of pages in the array. +The number of bytes that should be read into the pages of the array. .It Fa sync .Dv VM_PAGER_PUT_SYNC if the write should be synchronous. @@ -123,22 +123,27 @@ The page was not handled by this request The .Fn VOP_GETPAGES method is expected to release any pages in -.Fa m +.Fa ma that it does not successfully handle, by calling .Xr vm_page_free 9 . When it succeeds, .Fn VOP_GETPAGES -must set the valid bits appropriately, clear the dirty bit -(using -.Xr vm_page_undirty 9 ) , -either activate the page (if its wanted bit is set) +must set the valid bits appropriately. +.Fn VOP_GETPAGES +must keep +.Fa reqpage +busy. +It must unbusy all other successfully handled pages and put them +on appropriate page queue(s). +For example, +.Fn VOP_GETPAGES +may either activate a page (if its wanted bit is set) or deactivate it (otherwise), and finally call .Xr vm_page_wakeup 9 -to arouse any threads currently waiting for the page to be faulted in, -for each page read. +to arouse any threads currently waiting for the page to be faulted in. .Sh RETURN VALUES If it successfully reads -.Fa m[reqpage] , +.Fa ma[reqpage] , .Fn VOP_GETPAGES returns .Dv VM_PAGER_OK ; From owner-svn-src-head@FreeBSD.ORG Wed Oct 20 06:29: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 C5DB11065672; Wed, 20 Oct 2010 06:29:11 +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 B3C218FC08; Wed, 20 Oct 2010 06:29: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 o9K6TBs4039851; Wed, 20 Oct 2010 06:29:11 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9K6TB1m039846; Wed, 20 Oct 2010 06:29:11 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201010200629.o9K6TB1m039846@svn.freebsd.org> From: Andriy Gapon Date: Wed, 20 Oct 2010 06:29: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: r214097 - in 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: Wed, 20 Oct 2010 06:29:12 -0000 Author: avg Date: Wed Oct 20 06:29:11 2010 New Revision: 214097 URL: http://svn.freebsd.org/changeset/base/214097 Log: catch up manual pages with rename of vm_page_sleep_busy to vm_page_sleep_if_busy Suggested by: alc MFC after: 4 days Added: head/share/man/man9/vm_page_sleep_if_busy.9 - copied, changed from r214095, head/share/man/man9/vm_page_sleep_busy.9 Deleted: head/share/man/man9/vm_page_sleep_busy.9 Modified: head/ObsoleteFiles.inc head/share/man/man9/Makefile head/share/man/man9/vm_page_wakeup.9 Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Wed Oct 20 05:57:54 2010 (r214096) +++ head/ObsoleteFiles.inc Wed Oct 20 06:29:11 2010 (r214097) @@ -14,6 +14,8 @@ # The file is partitioned: OLD_FILES first, then OLD_LIBS and OLD_DIRS last. # +# 20101020: catch up with vm_page_sleep_if_busy rename +OLD_FILES+=usr/share/man/man9/vm_page_sleep_busy.9.gz # 20101011: removed subblock.h from liblzma OLD_FILES+=usr/include/lzma/subblock.h # 20101002: removed manpath.config Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Wed Oct 20 05:57:54 2010 (r214096) +++ head/share/man/man9/Makefile Wed Oct 20 06:29:11 2010 (r214097) @@ -324,7 +324,7 @@ MAN= accept_filter.9 \ vm_page_lookup.9 \ vm_page_protect.9 \ vm_page_rename.9 \ - vm_page_sleep_busy.9 \ + vm_page_sleep_if_busy.9 \ vm_page_wakeup.9 \ vm_page_wire.9 \ vm_page_zero_fill.9 \ Copied and modified: head/share/man/man9/vm_page_sleep_if_busy.9 (from r214095, head/share/man/man9/vm_page_sleep_busy.9) ============================================================================== --- head/share/man/man9/vm_page_sleep_busy.9 Wed Oct 20 05:17:23 2010 (r214095, copy source) +++ head/share/man/man9/vm_page_sleep_if_busy.9 Wed Oct 20 06:29:11 2010 (r214097) @@ -27,20 +27,20 @@ .\" $FreeBSD$ .\" .Dd July 13, 2001 -.Dt VM_PAGE_SLEEP_BUSY 9 +.Dt VM_PAGE_SLEEP_IF_BUSY 9 .Os .Sh NAME -.Nm vm_page_sleep_busy +.Nm vm_page_sleep_if_busy .Nd "wait for a busy page to become unbusy" .Sh SYNOPSIS .In sys/param.h .In vm/vm.h .In vm/vm_page.h .Ft int -.Fn vm_page_sleep_busy "vm_page_t m" "int also_m_busy" "const char *wmesg" +.Fn vm_page_sleep_if_busy "vm_page_t m" "int also_m_busy" "const char *wmesg" .Sh DESCRIPTION The -.Fn vm_page_sleep_busy +.Fn vm_page_sleep_if_busy function waits until the .Dv VPO_BUSY flag is cleared. @@ -51,7 +51,7 @@ is non-zero, it also waits for to become zero. .Sh RETURN VALUES If -.Fn vm_page_sleep_busy +.Fn vm_page_sleep_if_busy finds the page busy it returns .Dv TRUE . If not, it returns @@ -59,7 +59,7 @@ If not, it returns Returning .Dv TRUE does not necessary mean that -.Fn vm_page_sleep_busy +.Fn vm_page_sleep_if_busy slept, but only that .Fn splvm was called. Modified: head/share/man/man9/vm_page_wakeup.9 ============================================================================== --- head/share/man/man9/vm_page_wakeup.9 Wed Oct 20 05:57:54 2010 (r214096) +++ head/share/man/man9/vm_page_wakeup.9 Wed Oct 20 06:29:11 2010 (r214097) @@ -68,7 +68,7 @@ flag on the page, and calls .Fn vm_page_flash in case somebody has been waiting for it. .Sh SEE ALSO -.Xr vm_page_sleep_busy 9 , +.Xr vm_page_sleep_if_busy 9 , .Xr wakeup 9 .Sh AUTHORS This manual page was written by From owner-svn-src-head@FreeBSD.ORG Wed Oct 20 07:02: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 93B8C1065674; Wed, 20 Oct 2010 07:02:03 +0000 (UTC) (envelope-from onemda@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 C4EF88FC13; Wed, 20 Oct 2010 07:02:02 +0000 (UTC) Received: by wwb13 with SMTP id 13so2472023wwb.31 for ; Wed, 20 Oct 2010 00:02:01 -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=J+0lDj/r1wYto3kLIB0WyC1l9G+3hLsYE4KaJhdWOKQ=; b=GM+2Qg7rpw6EnWtoAOfEsydb5E1g6nwrbi47FJN+7Kk6j0t+hIN/Xro/COoo+imqKQ d6Tnq56+NecClV4uECpsk0boCA3yryommmtOrVG1hGaQwt7tchhrQ4g6kWJN43ponVfI DCL8MInlPzK1mbss+v483NmjzjyHZ/OTHfeiM= 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=FVFqVYPUrG/0tlaJnBDn9bC1sK1mqkcCLm9o0ZFKghFOIxyCBxFRTBMRUECOFMg49n iupAEdi9B6Z7cVWE5wzonJHqVlyTvcI+jL3JAJ76C2IzfeL2cEbIIX8MI4eZpeks7gSL TdfDyEmhhr4nTxxU5hAakp+R85ZSAV7Z3Rt0Y= MIME-Version: 1.0 Received: by 10.216.16.85 with SMTP id g63mr7648469weg.114.1287558121482; Wed, 20 Oct 2010 00:02:01 -0700 (PDT) Received: by 10.216.183.146 with HTTP; Wed, 20 Oct 2010 00:02:01 -0700 (PDT) In-Reply-To: <20101019220455.D46881@maildrop.int.zabbadoz.net> References: <201010191911.o9JJBaQe024210@svn.freebsd.org> <20101019220455.D46881@maildrop.int.zabbadoz.net> Date: Wed, 20 Oct 2010 09:02:01 +0200 Message-ID: From: Paul B Mahol To: "Bjoern A. Zeeb" Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Bernhard Schmidt Subject: Re: svn commit: r214070 - head/sys/dev/if_ndis 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, 20 Oct 2010 07:02:03 -0000 On 10/20/10, Bjoern A. Zeeb wrote: > On Tue, 19 Oct 2010, Bernhard Schmidt wrote: > >> Author: bschmidt >> Date: Tue Oct 19 19:11:36 2010 >> New Revision: 214070 >> URL: http://svn.freebsd.org/changeset/base/214070 >> >> Log: >> There is no reason to call rt_ifmsg(), remove it. > > While it's indeed very uncommon to have that in a driver, I don't know > how much black magic if_ndis(4) is. Have you verified that you still > get the events from elsewhere on the routing socket when > loading/unloading if_ndif.ko? ^if_ndis.ko If you want to ask if we got notified if wlan0 is put down/up or if we disconnected/associated and etc. then answer is yes and have nothing to do with unloading if_ndis but with miniport driver (generated via ndisgen). I unload/load ndis/if_ndis/miniport combo multiple times with/without loadi/unload of other drivers and did not encounter any regression when removing rt_ifmsg(). One more thing, currently when interface wlanX is bring up/down we will send events to ndisX instead, this caused breakdown with one of CURRENT revisions, but that revision was reverted later. Also, currently if user put wlan0 interface down(via ifconfig) we will get down event only after bringing same interface up. Both of this cases where not fixed with rt_ifmsg() call. I already have pach for both cases, and will send them to net@ shortly. If you have more time to review my code, please visit http://gitorious.org/NDISulator Comments are welcome. >> Submitted by: Paul B Mahol >> MFC after: 1 week >> >> Modified: >> head/sys/dev/if_ndis/if_ndis.c >> >> Modified: head/sys/dev/if_ndis/if_ndis.c >> ============================================================================== >> --- head/sys/dev/if_ndis/if_ndis.c Tue Oct 19 18:49:26 2010 (r214069) >> +++ head/sys/dev/if_ndis/if_ndis.c Tue Oct 19 19:11:36 2010 (r214070) >> @@ -1644,10 +1644,6 @@ ndis_linksts_done(adapter) >> default: >> break; >> } >> - >> - /* Notify possible listners of interface change. */ >> - >> - rt_ifmsg(ifp); >> } >> >> static void >> > > -- > Bjoern A. Zeeb Welcome a new stage of life. > _______________________________________________ > svn-src-head@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" > From owner-svn-src-head@FreeBSD.ORG Wed Oct 20 07:22: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 C34231065673; Wed, 20 Oct 2010 07:22:34 +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 B018F8FC19; Wed, 20 Oct 2010 07: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 o9K7MYTR041069; Wed, 20 Oct 2010 07:22:34 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9K7MYmT041065; Wed, 20 Oct 2010 07:22:34 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201010200722.o9K7MYmT041065@svn.freebsd.org> From: Alexander Motin Date: Wed, 20 Oct 2010 07: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: r214099 - head/sys/dev/mvs 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, 20 Oct 2010 07:22:34 -0000 Author: mav Date: Wed Oct 20 07:22:34 2010 New Revision: 214099 URL: http://svn.freebsd.org/changeset/base/214099 Log: Some style cleanup: - remove commented debugging code; - wrap long lines. Modified: head/sys/dev/mvs/mvs.c head/sys/dev/mvs/mvs_pci.c head/sys/dev/mvs/mvs_soc.c Modified: head/sys/dev/mvs/mvs.c ============================================================================== --- head/sys/dev/mvs/mvs.c Wed Oct 20 06:38:54 2010 (r214098) +++ head/sys/dev/mvs/mvs.c Wed Oct 20 07:22:34 2010 (r214099) @@ -57,7 +57,8 @@ static int mvs_ch_deinit(device_t dev); static int mvs_ch_suspend(device_t dev); static int mvs_ch_resume(device_t dev); static void mvs_dmainit(device_t dev); -static void mvs_dmasetupc_cb(void *xsc, bus_dma_segment_t *segs, int nsegs, int error); +static void mvs_dmasetupc_cb(void *xsc, + bus_dma_segment_t *segs, int nsegs, int error); static void mvs_dmafini(device_t dev); static void mvs_slotsalloc(device_t dev); static void mvs_slotsfree(device_t dev); @@ -79,7 +80,8 @@ static void mvs_crbq_intr(device_t dev); static void mvs_begin_transaction(device_t dev, union ccb *ccb); static void mvs_legacy_execute_transaction(struct mvs_slot *slot); static void mvs_timeout(struct mvs_slot *slot); -static void mvs_dmasetprd(void *arg, bus_dma_segment_t *segs, int nsegs, int error); +static void mvs_dmasetprd(void *arg, + bus_dma_segment_t *segs, int nsegs, int error); static void mvs_requeue_frozen(device_t dev); static void mvs_execute_transaction(struct mvs_slot *slot); static void mvs_end_transaction(struct mvs_slot *slot, enum mvs_err_type et); @@ -314,9 +316,11 @@ mvs_dmainit(device_t dev) if (bus_dmamem_alloc(ch->dma.workrq_tag, (void **)&ch->dma.workrq, 0, &ch->dma.workrq_map)) goto error; - if (bus_dmamap_load(ch->dma.workrq_tag, ch->dma.workrq_map, ch->dma.workrq, - MVS_WORKRQ_SIZE, mvs_dmasetupc_cb, &dcba, 0) || dcba.error) { - bus_dmamem_free(ch->dma.workrq_tag, ch->dma.workrq, ch->dma.workrq_map); + if (bus_dmamap_load(ch->dma.workrq_tag, ch->dma.workrq_map, + ch->dma.workrq, MVS_WORKRQ_SIZE, mvs_dmasetupc_cb, &dcba, 0) || + dcba.error) { + bus_dmamem_free(ch->dma.workrq_tag, + ch->dma.workrq, ch->dma.workrq_map); goto error; } ch->dma.workrq_bus = dcba.maddr; @@ -329,9 +333,11 @@ mvs_dmainit(device_t dev) if (bus_dmamem_alloc(ch->dma.workrp_tag, (void **)&ch->dma.workrp, 0, &ch->dma.workrp_map)) goto error; - if (bus_dmamap_load(ch->dma.workrp_tag, ch->dma.workrp_map, ch->dma.workrp, - MVS_WORKRP_SIZE, mvs_dmasetupc_cb, &dcba, 0) || dcba.error) { - bus_dmamem_free(ch->dma.workrp_tag, ch->dma.workrp, ch->dma.workrp_map); + if (bus_dmamap_load(ch->dma.workrp_tag, ch->dma.workrp_map, + ch->dma.workrp, MVS_WORKRP_SIZE, mvs_dmasetupc_cb, &dcba, 0) || + dcba.error) { + bus_dmamem_free(ch->dma.workrp_tag, + ch->dma.workrp, ch->dma.workrp_map); goto error; } ch->dma.workrp_bus = dcba.maddr; @@ -371,7 +377,8 @@ mvs_dmafini(device_t dev) } if (ch->dma.workrp_bus) { bus_dmamap_unload(ch->dma.workrp_tag, ch->dma.workrp_map); - bus_dmamem_free(ch->dma.workrp_tag, ch->dma.workrp, ch->dma.workrp_map); + bus_dmamem_free(ch->dma.workrp_tag, + ch->dma.workrp, ch->dma.workrp_map); ch->dma.workrp_bus = 0; ch->dma.workrp_map = NULL; ch->dma.workrp = NULL; @@ -382,7 +389,8 @@ mvs_dmafini(device_t dev) } if (ch->dma.workrq_bus) { bus_dmamap_unload(ch->dma.workrq_tag, ch->dma.workrq_map); - bus_dmamem_free(ch->dma.workrq_tag, ch->dma.workrq, ch->dma.workrq_map); + bus_dmamem_free(ch->dma.workrq_tag, + ch->dma.workrq, ch->dma.workrq_map); ch->dma.workrq_bus = 0; ch->dma.workrq_map = NULL; ch->dma.workrq = NULL; @@ -444,14 +452,16 @@ mvs_setup_edma_queues(device_t dev) ATA_OUTL(ch->r_mem, EDMA_REQQBAH, work >> 32); ATA_OUTL(ch->r_mem, EDMA_REQQIP, work & 0xffffffff); ATA_OUTL(ch->r_mem, EDMA_REQQOP, work & 0xffffffff); - bus_dmamap_sync(ch->dma.workrq_tag, ch->dma.workrq_map, BUS_DMASYNC_PREWRITE); + bus_dmamap_sync(ch->dma.workrq_tag, ch->dma.workrq_map, + BUS_DMASYNC_PREWRITE); /* Reponses queue. */ bzero(ch->dma.workrp, 256); work = ch->dma.workrp_bus; ATA_OUTL(ch->r_mem, EDMA_RESQBAH, work >> 32); ATA_OUTL(ch->r_mem, EDMA_RESQIP, work & 0xffffffff); ATA_OUTL(ch->r_mem, EDMA_RESQOP, work & 0xffffffff); - bus_dmamap_sync(ch->dma.workrp_tag, ch->dma.workrp_map, BUS_DMASYNC_PREREAD); + bus_dmamap_sync(ch->dma.workrp_tag, ch->dma.workrp_map, + BUS_DMASYNC_PREREAD); ch->out_idx = 0; ch->in_idx = 0; } @@ -678,20 +688,15 @@ mvs_ch_intr(void *data) int i, ccs, port = -1, selfdis = 0; int edma = (ch->numtslots != 0 || ch->numdslots != 0); -//device_printf(dev, "irq cause %02x EDMA %d IEC %08x\n", -// arg->cause, edma, ATA_INL(ch->r_mem, EDMA_IEC)); /* New item in response queue. */ if ((arg->cause & 2) && edma) mvs_crbq_intr(dev); /* Some error or special event. */ if (arg->cause & 1) { iec = ATA_INL(ch->r_mem, EDMA_IEC); -//device_printf(dev, "irq cause %02x EDMA %d IEC %08x\n", -// arg->cause, edma, iec); if (iec & EDMA_IE_SERRINT) { serr = ATA_INL(ch->r_mem, SATA_SE); ATA_OUTL(ch->r_mem, SATA_SE, serr); -//device_printf(dev, "SERR %08x\n", serr); } /* EDMA self-disabled due to error. */ if (iec & EDMA_IE_ESELFDIS) @@ -706,7 +711,6 @@ mvs_ch_intr(void *data) fisic = SATA_FISC_FISWAIT4HOSTRDYEN_B1; else /* For Gen-IIe - read FIS interrupt cause. */ fisic = ATA_INL(ch->r_mem, SATA_FISIC); -//device_printf(dev, "FISIC %08x\n", fisic); } if (selfdis) ch->curr_mode = MVS_EDMA_UNKNOWN; @@ -745,7 +749,6 @@ mvs_ch_intr(void *data) } } } -//device_printf(dev, "err slot %d port %d\n", ccs, port); mvs_requeue_frozen(dev); for (i = 0; i < MVS_MAX_SLOTS; i++) { /* XXX: reqests in loading state. */ @@ -771,7 +774,8 @@ mvs_ch_intr(void *data) ch->fatalerr = 1; } } else if (iec & 0xfc1e9000) { - if (ch->numtslots == 0 && i != ccs && port != -2) + if (ch->numtslots == 0 && + i != ccs && port != -2) et = MVS_ERR_INNOCENT; else et = MVS_ERR_SATA; @@ -823,8 +827,6 @@ mvs_legacy_intr(device_t dev) /* Clear interrupt and get status. */ status = mvs_getstatus(dev, 1); -// device_printf(dev, "Legacy intr status %02x\n", -// status); if (slot->state < MVS_SLOT_RUNNING) return; port = ccb->ccb_h.target_id & 0x0f; @@ -867,7 +869,8 @@ mvs_legacy_intr(device_t dev) /* If data write command - put them */ if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_OUT) { if (mvs_wait(dev, ATA_S_DRQ, ATA_S_BUSY, 1000) < 0) { - device_printf(dev, "timeout waiting for write DRQ\n"); + device_printf(dev, + "timeout waiting for write DRQ\n"); et = MVS_ERR_TIMEOUT; goto end_finished; } @@ -890,19 +893,18 @@ mvs_legacy_intr(device_t dev) ATA_OUTL(ch->r_mem, DMA_C, 0); goto end_finished; } else { /* ATAPI PIO */ - length = ATA_INB(ch->r_mem,ATA_CYL_LSB) | (ATA_INB(ch->r_mem,ATA_CYL_MSB) << 8); + length = ATA_INB(ch->r_mem,ATA_CYL_LSB) | + (ATA_INB(ch->r_mem,ATA_CYL_MSB) << 8); ireason = ATA_INB(ch->r_mem,ATA_IREASON); -//device_printf(dev, "status %02x, ireason %02x, length %d\n", status, ireason, length); switch ((ireason & (ATA_I_CMD | ATA_I_IN)) | (status & ATA_S_DRQ)) { case ATAPI_P_CMDOUT: -device_printf(dev, "ATAPI CMDOUT\n"); + device_printf(dev, "ATAPI CMDOUT\n"); /* Return wait for interrupt */ return; case ATAPI_P_WRITE: -//device_printf(dev, "ATAPI WRITE\n"); if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) { device_printf(dev, "trying to write on read buffer\n"); et = MVS_ERR_TFE; @@ -920,7 +922,6 @@ device_printf(dev, "ATAPI CMDOUT\n"); return; case ATAPI_P_READ: -//device_printf(dev, "ATAPI READ\n"); if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_OUT) { device_printf(dev, "trying to read on write buffer\n"); et = MVS_ERR_TFE; @@ -937,7 +938,6 @@ device_printf(dev, "ATAPI CMDOUT\n"); return; case ATAPI_P_DONEDRQ: -device_printf(dev, "ATAPI DONEDRQ\n"); device_printf(dev, "WARNING - DONEDRQ non conformant device\n"); if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) { @@ -958,13 +958,13 @@ device_printf(dev, "ATAPI DONEDRQ\n"); case ATAPI_P_ABORT: case ATAPI_P_DONE: -//device_printf(dev, "ATAPI ABORT/DONE\n"); if (status & (ATA_S_ERROR | ATA_S_DWF)) et = MVS_ERR_TFE; goto end_finished; default: - device_printf(dev, "unknown transfer phase (status %02x, ireason %02x)\n", + device_printf(dev, "unknown transfer phase" + " (status %02x, ireason %02x)\n", status, ireason); et = MVS_ERR_TFE; } @@ -1266,8 +1266,6 @@ mvs_legacy_execute_transaction(struct mv ch->rslots |= (1 << slot->slot); ATA_OUTB(ch->r_mem, SATA_SATAICTL, port << SATA_SATAICTL_PMPTX_SHIFT); if (ccb->ccb_h.func_code == XPT_ATA_IO) { -// device_printf(dev, "%d Legacy command %02x size %d\n", -// port, ccb->ataio.cmd.command, ccb->ataio.dxfer_len); mvs_tfd_write(dev, ccb); /* Device reset doesn't interrupt. */ if (ccb->ataio.cmd.command == ATA_DEVICE_RESET) { @@ -1287,7 +1285,8 @@ mvs_legacy_execute_transaction(struct mv /* If data write command - output the data */ if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_OUT) { if (mvs_wait(dev, ATA_S_DRQ, ATA_S_BUSY, 1000) < 0) { - device_printf(dev, "timeout waiting for write DRQ\n"); + device_printf(dev, + "timeout waiting for write DRQ\n"); mvs_end_transaction(slot, MVS_ERR_TIMEOUT); return; } @@ -1296,9 +1295,6 @@ mvs_legacy_execute_transaction(struct mv ch->transfersize / 2); } } else { -// device_printf(dev, "%d ATAPI command %02x size %d dma %d\n", -// port, ccb->csio.cdb_io.cdb_bytes[0], ccb->csio.dxfer_len, -// ch->basic_dma); ch->donecount = 0; ch->transfersize = min(ccb->csio.dxfer_len, ch->curr[port].bytecount); @@ -1331,7 +1327,8 @@ mvs_legacy_execute_transaction(struct mv DELAY(20); } if (timeout <= 0) { - device_printf(dev, "timeout waiting for ATAPI command ready\n"); + device_printf(dev, + "timeout waiting for ATAPI command ready\n"); mvs_end_transaction(slot, MVS_ERR_TIMEOUT); return; } @@ -1371,8 +1368,6 @@ mvs_execute_transaction(struct mvs_slot int port = ccb->ccb_h.target_id & 0x0f; int i; -// device_printf(dev, "%d EDMA command %02x size %d slot %d tag %d\n", -// port, ccb->ataio.cmd.command, ccb->ataio.dxfer_len, slot->slot, slot->tag); /* Get address of the prepared EPRD */ eprd = ch->dma.workrq_bus + MVS_EPRD_OFFSET + (MVS_EPRD_SIZE * slot->slot); /* Prepare CRQB. Gen IIe uses different CRQB format. */ @@ -1554,7 +1549,6 @@ mvs_end_transaction(struct mvs_slot *slo union ccb *ccb = slot->ccb; int lastto; -//device_printf(dev, "cmd done status %d\n", et); bus_dmamap_sync(ch->dma.workrq_tag, ch->dma.workrq_map, BUS_DMASYNC_POSTWRITE); /* Read result registers to the result struct @@ -1792,7 +1786,8 @@ mvs_process_read_log(device_t dev, union if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) device_printf(dev, "Error while READ LOG EXT\n"); else if ((data[0] & 0x80) == 0) { - device_printf(dev, "Non-queued command error in READ LOG EXT\n"); + device_printf(dev, + "Non-queued command error in READ LOG EXT\n"); } for (i = 0; i < MVS_MAX_SLOTS; i++) { if (!ch->hold[i]) Modified: head/sys/dev/mvs/mvs_pci.c ============================================================================== --- head/sys/dev/mvs/mvs_pci.c Wed Oct 20 06:38:54 2010 (r214098) +++ head/sys/dev/mvs/mvs_pci.c Wed Oct 20 07:22:34 2010 (r214099) @@ -339,7 +339,6 @@ mvs_intr(void *data) u_int32_t ic, aic; ic = ATA_INL(ctlr->r_mem, CHIP_MIC); -//device_printf(ctlr->dev, "irq MIC:%08x\n", ic); if (ctlr->msi) { /* We have to to mask MSI during processing. */ mtx_lock(&ctlr->mtx); Modified: head/sys/dev/mvs/mvs_soc.c ============================================================================== --- head/sys/dev/mvs/mvs_soc.c Wed Oct 20 06:38:54 2010 (r214098) +++ head/sys/dev/mvs/mvs_soc.c Wed Oct 20 07:22:34 2010 (r214099) @@ -295,7 +295,6 @@ mvs_intr(void *data) u_int32_t ic, aic; ic = ATA_INL(ctlr->r_mem, CHIP_SOC_MIC); -//device_printf(ctlr->dev, "irq MIC:%08x\n", ic); if ((ic & IC_HC0) == 0) return; /* Acknowledge interrupts of this HC. */ From owner-svn-src-head@FreeBSD.ORG Wed Oct 20 07:44: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 0558B106566B; Wed, 20 Oct 2010 07:44:31 +0000 (UTC) (envelope-from bschmidt@techwires.net) Received: from mail-bw0-f54.google.com (mail-bw0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id 395B58FC16; Wed, 20 Oct 2010 07:44:29 +0000 (UTC) Received: by bwz15 with SMTP id 15so1036071bwz.13 for ; Wed, 20 Oct 2010 00:44:29 -0700 (PDT) Received: by 10.204.84.216 with SMTP id k24mr6532877bkl.132.1287559237696; Wed, 20 Oct 2010 00:20:37 -0700 (PDT) Received: from jessie.localnet (p5B0E15E3.dip0.t-ipconnect.de [91.14.21.227]) by mx.google.com with ESMTPS id r21sm11129610bkj.22.2010.10.20.00.20.35 (version=SSLv3 cipher=RC4-MD5); Wed, 20 Oct 2010 00:20:36 -0700 (PDT) Sender: Bernhard Schmidt From: Bernhard Schmidt To: "Bjoern A. Zeeb" Date: Wed, 20 Oct 2010 09:20:34 +0200 User-Agent: KMail/1.13.2 (Linux/2.6.32-25-generic; KDE/4.4.2; i686; ; ) References: <201010191911.o9JJBaQe024210@svn.freebsd.org> <20101019220455.D46881@maildrop.int.zabbadoz.net> In-Reply-To: <20101019220455.D46881@maildrop.int.zabbadoz.net> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201010200920.34413.bschmidt@freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r214070 - head/sys/dev/if_ndis X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: bschmidt@freebsd.org 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, 20 Oct 2010 07:44:31 -0000 On Wednesday, October 20, 2010 00:06:09 Bjoern A. Zeeb wrote: > On Tue, 19 Oct 2010, Bernhard Schmidt wrote: > > Author: bschmidt > > Date: Tue Oct 19 19:11:36 2010 > > New Revision: 214070 > > URL: http://svn.freebsd.org/changeset/base/214070 > > > > Log: > > There is no reason to call rt_ifmsg(), remove it. > > While it's indeed very uncommon to have that in a driver, I don't know > how much black magic if_ndis(4) is. Have you verified that you still > get the events from elsewhere on the routing socket when > loading/unloading if_ndif.ko? I followed the function calls, and the affected ndis_linksts_done() function is only a wrapper around others. Those functions do all call if_link_state_change() which itself calls rt_ifmsg(). It seems the call is just a leftover from the the transition to if_link_state_change(). -- Bernhard From owner-svn-src-head@FreeBSD.ORG Wed Oct 20 07:47: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 573CC1065675; Wed, 20 Oct 2010 07:47:31 +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 45A1F8FC18; Wed, 20 Oct 2010 07:47:31 +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 o9K7lVLI041770; Wed, 20 Oct 2010 07:47:31 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9K7lV22041768; Wed, 20 Oct 2010 07:47:31 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201010200747.o9K7lV22041768@svn.freebsd.org> From: Alexander Motin Date: Wed, 20 Oct 2010 07:47:31 +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: r214102 - head/sys/dev/mvs 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, 20 Oct 2010 07:47:31 -0000 Author: mav Date: Wed Oct 20 07:47:31 2010 New Revision: 214102 URL: http://svn.freebsd.org/changeset/base/214102 Log: Workaround strange situation when EDMA_RESQIP register returns zero instead of proper value. It caused bunch of "EMPTY CRPB" messages and potentially may cause premature requests completion, which could cause data corruption. For most cases it seems enough to just reread register to get proper value. To protect against worse cases - erase processed queue entries with impossible values and ignore them if problem still happen. Modified: head/sys/dev/mvs/mvs.c Modified: head/sys/dev/mvs/mvs.c ============================================================================== --- head/sys/dev/mvs/mvs.c Wed Oct 20 07:40:23 2010 (r214101) +++ head/sys/dev/mvs/mvs.c Wed Oct 20 07:47:31 2010 (r214102) @@ -455,7 +455,7 @@ mvs_setup_edma_queues(device_t dev) bus_dmamap_sync(ch->dma.workrq_tag, ch->dma.workrq_map, BUS_DMASYNC_PREWRITE); /* Reponses queue. */ - bzero(ch->dma.workrp, 256); + memset(ch->dma.workrp, 0xff, MVS_WORKRP_SIZE); work = ch->dma.workrp_bus; ATA_OUTL(ch->r_mem, EDMA_RESQBAH, work >> 32); ATA_OUTL(ch->r_mem, EDMA_RESQIP, work & 0xffffffff); @@ -980,38 +980,54 @@ mvs_crbq_intr(device_t dev) struct mvs_channel *ch = device_get_softc(dev); struct mvs_crpb *crpb; union ccb *ccb; - int in_idx, cin_idx, slot; + int in_idx, fin_idx, cin_idx, slot; + uint32_t val; uint16_t flags; - in_idx = (ATA_INL(ch->r_mem, EDMA_RESQIP) & EDMA_RESQP_ERPQP_MASK) >> + val = ATA_INL(ch->r_mem, EDMA_RESQIP); + if (val == 0) + val = ATA_INL(ch->r_mem, EDMA_RESQIP); + in_idx = (val & EDMA_RESQP_ERPQP_MASK) >> EDMA_RESQP_ERPQP_SHIFT; bus_dmamap_sync(ch->dma.workrp_tag, ch->dma.workrp_map, BUS_DMASYNC_POSTREAD); - cin_idx = ch->in_idx; + fin_idx = cin_idx = ch->in_idx; ch->in_idx = in_idx; while (in_idx != cin_idx) { crpb = (struct mvs_crpb *) - (ch->dma.workrp + MVS_CRPB_OFFSET + (MVS_CRPB_SIZE * cin_idx)); + (ch->dma.workrp + MVS_CRPB_OFFSET + + (MVS_CRPB_SIZE * cin_idx)); slot = le16toh(crpb->id) & MVS_CRPB_TAG_MASK; flags = le16toh(crpb->rspflg); -//device_printf(dev, "CRPB %d %d %04x\n", cin_idx, slot, flags); /* * Handle only successfull completions here. * Errors will be handled by main intr handler. */ - if (ch->numtslots != 0 || (flags & EDMA_IE_EDEVERR) == 0) { -if ((flags >> 8) & ATA_S_ERROR) -device_printf(dev, "ERROR STATUS CRPB %d %d %04x\n", cin_idx, slot, flags); + if (crpb->id == 0xffff && crpb->rspflg == 0xffff) { + device_printf(dev, "Unfilled CRPB " + "%d (%d->%d) tag %d flags %04x rs %08x\n", + cin_idx, fin_idx, in_idx, slot, flags, ch->rslots); + } else if (ch->numtslots != 0 || + (flags & EDMA_IE_EDEVERR) == 0) { + crpb->id = 0xffff; + crpb->rspflg = 0xffff; if (ch->slot[slot].state >= MVS_SLOT_RUNNING) { ccb = ch->slot[slot].ccb; - ccb->ataio.res.status = (flags & MVS_CRPB_ATASTS_MASK) >> + ccb->ataio.res.status = + (flags & MVS_CRPB_ATASTS_MASK) >> MVS_CRPB_ATASTS_SHIFT; mvs_end_transaction(&ch->slot[slot], MVS_ERR_NONE); - } else -device_printf(dev, "EMPTY CRPB %d (->%d) %d %04x\n", cin_idx, in_idx, slot, flags); - } else -device_printf(dev, "ERROR FLAGS CRPB %d %d %04x\n", cin_idx, slot, flags); - + } else { + device_printf(dev, "Unused tag in CRPB " + "%d (%d->%d) tag %d flags %04x rs %08x\n", + cin_idx, fin_idx, in_idx, slot, flags, + ch->rslots); + } + } else { + device_printf(dev, + "CRPB with error %d tag %d flags %04x\n", + cin_idx, slot, flags); + } cin_idx = (cin_idx + 1) & (MVS_MAX_SLOTS - 1); } bus_dmamap_sync(ch->dma.workrp_tag, ch->dma.workrp_map, From owner-svn-src-head@FreeBSD.ORG Wed Oct 20 09:35: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 4E0621065672; Wed, 20 Oct 2010 09:35:21 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3C86B8FC1C; Wed, 20 Oct 2010 09:35: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 o9K9ZLha044516; Wed, 20 Oct 2010 09:35:21 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9K9ZLdd044514; Wed, 20 Oct 2010 09:35:21 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201010200935.o9K9ZLdd044514@svn.freebsd.org> From: Ed Schouten Date: Wed, 20 Oct 2010 09:35: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: r214105 - head/usr.bin/truss 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, 20 Oct 2010 09:35:21 -0000 Author: ed Date: Wed Oct 20 09:35:20 2010 New Revision: 214105 URL: http://svn.freebsd.org/changeset/base/214105 Log: Remove setpgid() call before executing child process. Using a separate process group here is bad, since (for example) job control in the TTY layer prevents interaction with the TTY, causing the child process to hang. Mentioned on: current@ MFC after: 2 weeks Modified: head/usr.bin/truss/setup.c Modified: head/usr.bin/truss/setup.c ============================================================================== --- head/usr.bin/truss/setup.c Wed Oct 20 07:54:43 2010 (r214104) +++ head/usr.bin/truss/setup.c Wed Oct 20 09:35:20 2010 (r214105) @@ -78,7 +78,6 @@ setup_and_wait(char *command[]) } if (pid == 0) { /* Child */ ptrace(PT_TRACE_ME, 0, 0, 0); - setpgid (0, 0); execvp(command[0], command); err(1, "execvp %s", command[0]); } From owner-svn-src-head@FreeBSD.ORG Wed Oct 20 09:41: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 54CA9106564A; Wed, 20 Oct 2010 09:41:36 +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 430D38FC1F; Wed, 20 Oct 2010 09:41: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 o9K9faGS044656; Wed, 20 Oct 2010 09:41:36 GMT (envelope-from jchandra@svn.freebsd.org) Received: (from jchandra@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9K9fauM044654; Wed, 20 Oct 2010 09:41:36 GMT (envelope-from jchandra@svn.freebsd.org) Message-Id: <201010200941.o9K9fauM044654@svn.freebsd.org> From: "Jayachandran C." Date: Wed, 20 Oct 2010 09:41: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: r214106 - head/sys/mips/rmi 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, 20 Oct 2010 09:41:36 -0000 Author: jchandra Date: Wed Oct 20 09:41:36 2010 New Revision: 214106 URL: http://svn.freebsd.org/changeset/base/214106 Log: On uniprocessor, warn and fixup hardware cpu mask if more than on CPU is enabled by the bootloader. Modified: head/sys/mips/rmi/xlr_machdep.c Modified: head/sys/mips/rmi/xlr_machdep.c ============================================================================== --- head/sys/mips/rmi/xlr_machdep.c Wed Oct 20 09:35:20 2010 (r214105) +++ head/sys/mips/rmi/xlr_machdep.c Wed Oct 20 09:41:36 2010 (r214106) @@ -167,6 +167,14 @@ xlr_parse_mmu_options(void) */ xlr_ncores = 1; cpu_map = xlr_boot1_info.cpu_online_map; + +#ifndef SMP /* Uniprocessor! */ + if (cpu_map != 0x1) { + printf("WARNING: Starting uniprocessor kernel on cpumask [0x%lx]!\n" + "WARNING: Other CPUs will be unused.\n", (u_long)cpu_map); + cpu_map = 0x1; + } +#endif core0_thr_mask = cpu_map & 0xf; switch (core0_thr_mask) { case 1: @@ -188,9 +196,9 @@ xlr_parse_mmu_options(void) xlr_ncores++; } } + xlr_hw_thread_mask = cpu_map; /* setup hardware processor id to cpu id mapping */ - xlr_hw_thread_mask = xlr_boot1_info.cpu_online_map; for (i = 0; i< MAXCPU; i++) xlr_cpuid_to_hwtid[i] = xlr_hwtid_to_cpuid [i] = -1; From owner-svn-src-head@FreeBSD.ORG Wed Oct 20 09:50: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 D935B1065670; Wed, 20 Oct 2010 09:50:11 +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 C71308FC14; Wed, 20 Oct 2010 09:50: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 o9K9oBN9044883; Wed, 20 Oct 2010 09:50:11 GMT (envelope-from jchandra@svn.freebsd.org) Received: (from jchandra@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9K9oBEb044880; Wed, 20 Oct 2010 09:50:11 GMT (envelope-from jchandra@svn.freebsd.org) Message-Id: <201010200950.o9K9oBEb044880@svn.freebsd.org> From: "Jayachandran C." Date: Wed, 20 Oct 2010 09:50: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: r214107 - in head/sys/mips/rmi: . dev/nlge 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, 20 Oct 2010 09:50:11 -0000 Author: jchandra Date: Wed Oct 20 09:50:11 2010 New Revision: 214107 URL: http://svn.freebsd.org/changeset/base/214107 Log: Network driver updates - Fix network driver issue on a XLS eval board (major# 8). - Fix issue uncovered by r213475 in check for XGMII Submitted by: Sriram Gorti (srgorti at netlogicmicro dot com) Modified: head/sys/mips/rmi/board.c head/sys/mips/rmi/dev/nlge/if_nlge.c Modified: head/sys/mips/rmi/board.c ============================================================================== --- head/sys/mips/rmi/board.c Wed Oct 20 09:41:36 2010 (r214106) +++ head/sys/mips/rmi/board.c Wed Oct 20 09:50:11 2010 (r214107) @@ -283,14 +283,14 @@ xls_board_specific_overrides(struct xlr_ break; case RMI_XLR_BOARD_ARIZONA_VIII: - - if (blk1->enabled) { + if (blk1->enabled) { /* There is just one Octal PHY on the board and it is * connected to the MII interface for NA Quad 0. */ - blk1->gmac_port[0].mii_addr = XLR_IO_GMAC_0_OFFSET; - blk1->gmac_port[1].mii_addr = XLR_IO_GMAC_0_OFFSET; - blk1->gmac_port[2].mii_addr = XLR_IO_GMAC_0_OFFSET; - blk1->gmac_port[3].mii_addr = XLR_IO_GMAC_0_OFFSET; + for (i = 0; i < 4; i++) { + blk1->gmac_port[i].mii_addr = + XLR_IO_GMAC_0_OFFSET; + blk1->gmac_port[i].mdint_id = 0; + } } break; Modified: head/sys/mips/rmi/dev/nlge/if_nlge.c ============================================================================== --- head/sys/mips/rmi/dev/nlge/if_nlge.c Wed Oct 20 09:41:36 2010 (r214106) +++ head/sys/mips/rmi/dev/nlge/if_nlge.c Wed Oct 20 09:50:11 2010 (r214107) @@ -861,7 +861,7 @@ nlge_mii_read(struct device *dev, int ph int val; sc = device_get_softc(dev); - val = (sc->port_type != XLR_XGMII) ? (0xffff) : + val = (sc->port_type == XLR_XGMII) ? (0xffff) : nlge_mii_read_internal(sc->mii_base, phyaddr, regidx); return (val); From owner-svn-src-head@FreeBSD.ORG Wed Oct 20 16:40: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 7156010656CC; Wed, 20 Oct 2010 16:40:14 +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 603768FC27; Wed, 20 Oct 2010 16:40: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 o9KGeEWV062819; Wed, 20 Oct 2010 16:40:14 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9KGeEG6062817; Wed, 20 Oct 2010 16:40:14 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201010201640.o9KGeEG6062817@svn.freebsd.org> From: Jung-uk Kim Date: Wed, 20 Oct 2010 16:40: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: r214109 - head/sys/dev/pci 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, 20 Oct 2010 16:40:14 -0000 Author: jkim Date: Wed Oct 20 16:40:14 2010 New Revision: 214109 URL: http://svn.freebsd.org/changeset/base/214109 Log: Do not apply do_power_resume for suspending P2P bridge as we did in r214064. Modified: head/sys/dev/pci/pci_pci.c Modified: head/sys/dev/pci/pci_pci.c ============================================================================== --- head/sys/dev/pci/pci_pci.c Wed Oct 20 12:38:05 2010 (r214108) +++ head/sys/dev/pci/pci_pci.c Wed Oct 20 16:40:14 2010 (r214109) @@ -447,7 +447,7 @@ pcib_suspend(device_t dev) pcib_cfg_save(device_get_softc(dev)); error = bus_generic_suspend(dev); - if (error == 0 && pci_do_power_resume) { + if (error == 0) { dstate = PCI_POWERSTATE_D3; pcib = device_get_parent(device_get_parent(dev)); if (PCIB_POWER_FOR_SLEEP(pcib, dev, &dstate) == 0) From owner-svn-src-head@FreeBSD.ORG Wed Oct 20 16:47: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 1BE8C106566B; Wed, 20 Oct 2010 16:47:10 +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 F30B88FC12; Wed, 20 Oct 2010 16:47: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 o9KGl9dR062989; Wed, 20 Oct 2010 16:47:09 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9KGl9SM062984; Wed, 20 Oct 2010 16:47:09 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201010201647.o9KGl9SM062984@svn.freebsd.org> From: Jung-uk Kim Date: Wed, 20 Oct 2010 16:47: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: r214110 - in head/sys/dev: acpica pci 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, 20 Oct 2010 16:47:10 -0000 Author: jkim Date: Wed Oct 20 16:47:09 2010 New Revision: 214110 URL: http://svn.freebsd.org/changeset/base/214110 Log: Introduce a new tunable 'hw.pci.do_power_suspend'. This tunable lets you avoid PCI power state transition from D0 to D3 for suspending case. Default is 1 or enabled. Modified: head/sys/dev/acpica/acpi_pci.c head/sys/dev/pci/pci.c head/sys/dev/pci/pci_pci.c head/sys/dev/pci/pci_private.h Modified: head/sys/dev/acpica/acpi_pci.c ============================================================================== --- head/sys/dev/acpica/acpi_pci.c Wed Oct 20 16:40:14 2010 (r214109) +++ head/sys/dev/acpica/acpi_pci.c Wed Oct 20 16:47:09 2010 (r214110) @@ -179,7 +179,7 @@ acpi_pci_set_powerstate_method(device_t */ ACPI_SERIAL_BEGIN(pci_powerstate); old_state = pci_get_powerstate(child); - if (old_state < state) { + if (old_state < state && pci_do_power_suspend) { error = pci_set_powerstate_method(dev, child, state); if (error) goto out; Modified: head/sys/dev/pci/pci.c ============================================================================== --- head/sys/dev/pci/pci.c Wed Oct 20 16:40:14 2010 (r214109) +++ head/sys/dev/pci/pci.c Wed Oct 20 16:47:09 2010 (r214110) @@ -257,6 +257,12 @@ SYSCTL_INT(_hw_pci, OID_AUTO, do_power_r &pci_do_power_resume, 1, "Transition from D3 -> D0 on resume."); +int pci_do_power_suspend = 1; +TUNABLE_INT("hw.pci.do_power_suspend", &pci_do_power_suspend); +SYSCTL_INT(_hw_pci, OID_AUTO, do_power_suspend, CTLFLAG_RW, + &pci_do_power_suspend, 1, + "Transition from D0 -> D3 on suspend."); + static int pci_do_msi = 1; TUNABLE_INT("hw.pci.enable_msi", &pci_do_msi); SYSCTL_INT(_hw_pci, OID_AUTO, enable_msi, CTLFLAG_RW, &pci_do_msi, 1, @@ -2954,7 +2960,9 @@ pci_suspend(device_t dev) free(devlist, M_TEMP); return (error); } - pci_set_power_children(dev, devlist, numdevs, PCI_POWERSTATE_D3); + if (pci_do_power_suspend) + pci_set_power_children(dev, devlist, numdevs, + PCI_POWERSTATE_D3); free(devlist, M_TEMP); return (0); } Modified: head/sys/dev/pci/pci_pci.c ============================================================================== --- head/sys/dev/pci/pci_pci.c Wed Oct 20 16:40:14 2010 (r214109) +++ head/sys/dev/pci/pci_pci.c Wed Oct 20 16:47:09 2010 (r214110) @@ -447,7 +447,7 @@ pcib_suspend(device_t dev) pcib_cfg_save(device_get_softc(dev)); error = bus_generic_suspend(dev); - if (error == 0) { + if (error == 0 && pci_do_power_suspend) { dstate = PCI_POWERSTATE_D3; pcib = device_get_parent(device_get_parent(dev)); if (PCIB_POWER_FOR_SLEEP(pcib, dev, &dstate) == 0) Modified: head/sys/dev/pci/pci_private.h ============================================================================== --- head/sys/dev/pci/pci_private.h Wed Oct 20 16:40:14 2010 (r214109) +++ head/sys/dev/pci/pci_private.h Wed Oct 20 16:47:09 2010 (r214110) @@ -39,6 +39,7 @@ DECLARE_CLASS(pci_driver); extern int pci_do_power_resume; +extern int pci_do_power_suspend; void pci_add_children(device_t dev, int domain, int busno, size_t dinfo_size); From owner-svn-src-head@FreeBSD.ORG Wed Oct 20 17:05:03 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 8724C106566C; Wed, 20 Oct 2010 17:05:02 +0000 (UTC) (envelope-from jkim@FreeBSD.org) From: Jung-uk Kim To: src-committers@FreeBSD.org Date: Wed, 20 Oct 2010 13:04:35 -0400 User-Agent: KMail/1.6.2 References: <201010201647.o9KGl9SM062984@svn.freebsd.org> In-Reply-To: <201010201647.o9KGl9SM062984@svn.freebsd.org> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201010201304.55051.jkim@FreeBSD.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r214110 - in head/sys/dev: acpica pci 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, 20 Oct 2010 17:05:03 -0000 On Wednesday 20 October 2010 12:47 pm, Jung-uk Kim wrote: > Author: jkim > Date: Wed Oct 20 16:47:09 2010 > New Revision: 214110 > URL: http://svn.freebsd.org/changeset/base/214110 > > Log: > Introduce a new tunable 'hw.pci.do_power_suspend'. This tunable > lets you avoid PCI power state transition from D0 to D3 for > suspending case. Default is 1 or enabled. ^ when it is set to zero Jung-uk Kim From owner-svn-src-head@FreeBSD.ORG Wed Oct 20 19:52: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 68E71106564A; Wed, 20 Oct 2010 19:52:27 +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 57CE78FC12; Wed, 20 Oct 2010 19:52: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 o9KJqRG1067159; Wed, 20 Oct 2010 19:52:27 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9KJqRMs067157; Wed, 20 Oct 2010 19:52:27 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201010201952.o9KJqRMs067157@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Wed, 20 Oct 2010 19:52: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: r214114 - head/sys/boot/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: Wed, 20 Oct 2010 19:52:27 -0000 Author: pjd Date: Wed Oct 20 19:52:27 2010 New Revision: 214114 URL: http://svn.freebsd.org/changeset/base/214114 Log: Correct typos. Modified: head/sys/boot/common/gpt.c Modified: head/sys/boot/common/gpt.c ============================================================================== --- head/sys/boot/common/gpt.c Wed Oct 20 18:25:00 2010 (r214113) +++ head/sys/boot/common/gpt.c Wed Oct 20 19:52:27 2010 (r214114) @@ -49,7 +49,7 @@ static int curent, bootonce; /* * Buffer below 64kB passed on gptread(), which can hold at least - * one sector od data (512 bytes). + * one sector of data (512 bytes). */ static char *secbuf; @@ -62,7 +62,7 @@ gptupdate(const char *which, struct dsk /* * We need to update the following for both primary and backup GPT: - * 1. Sector on disk that contains curent partition. + * 1. Sector on disk that contains current partition. * 2. Partition table checksum. * 3. Header checksum. * 4. Header on disk. From owner-svn-src-head@FreeBSD.ORG Wed Oct 20 19:53: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 1049610656E7; Wed, 20 Oct 2010 19:53:30 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D88678FC12; Wed, 20 Oct 2010 19:53: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 o9KJrTfC067216; Wed, 20 Oct 2010 19:53:29 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9KJrTki067214; Wed, 20 Oct 2010 19:53:29 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201010201953.o9KJrTki067214@svn.freebsd.org> From: Ed Schouten Date: Wed, 20 Oct 2010 19:53: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: r214115 - head/usr.bin/login 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, 20 Oct 2010 19:53:30 -0000 Author: ed Date: Wed Oct 20 19:53:29 2010 New Revision: 214115 URL: http://svn.freebsd.org/changeset/base/214115 Log: Get rid of hand-rolled closefrom(3). Modified: head/usr.bin/login/login.c Modified: head/usr.bin/login/login.c ============================================================================== --- head/usr.bin/login/login.c Wed Oct 20 19:52:27 2010 (r214114) +++ head/usr.bin/login/login.c Wed Oct 20 19:53:29 2010 (r214115) @@ -233,8 +233,7 @@ main(int argc, char *argv[]) setproctitle("-%s", getprogname()); - for (cnt = getdtablesize(); cnt > 2; cnt--) - (void)close(cnt); + closefrom(3); /* * Get current TTY From owner-svn-src-head@FreeBSD.ORG Wed Oct 20 20:01: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 CCECB106566B; Wed, 20 Oct 2010 20:01:45 +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 A153E8FC0A; Wed, 20 Oct 2010 20:01: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 o9KK1jnN067463; Wed, 20 Oct 2010 20:01:45 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9KK1jWg067459; Wed, 20 Oct 2010 20:01:45 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201010202001.o9KK1jWg067459@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Wed, 20 Oct 2010 20:01: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: r214116 - head/sys/geom/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: Wed, 20 Oct 2010 20:01:45 -0000 Author: pjd Date: Wed Oct 20 20:01:45 2010 New Revision: 214116 URL: http://svn.freebsd.org/changeset/base/214116 Log: - Add missing comments. - Make a comment consistent with others. Modified: head/sys/geom/eli/g_eli.c head/sys/geom/eli/g_eli_integrity.c head/sys/geom/eli/g_eli_privacy.c Modified: head/sys/geom/eli/g_eli.c ============================================================================== --- head/sys/geom/eli/g_eli.c Wed Oct 20 19:53:29 2010 (r214115) +++ head/sys/geom/eli/g_eli.c Wed Oct 20 20:01:45 2010 (r214116) @@ -245,8 +245,10 @@ g_eli_orphan(struct g_consumer *cp) } /* - * BIO_READ : G_ELI_START -> g_io_request -> g_eli_read_done -> g_eli_crypto_run -> g_eli_crypto_read_done -> g_io_deliver - * BIO_WRITE: G_ELI_START -> g_eli_crypto_run -> g_eli_crypto_write_done -> g_io_request -> g_eli_write_done -> g_io_deliver + * BIO_READ: + * G_ELI_START -> g_io_request -> g_eli_read_done -> g_eli_crypto_run -> g_eli_crypto_read_done -> g_io_deliver + * BIO_WRITE: + * G_ELI_START -> g_eli_crypto_run -> g_eli_crypto_write_done -> g_io_request -> g_eli_write_done -> g_io_deliver */ static void g_eli_start(struct bio *bp) Modified: head/sys/geom/eli/g_eli_integrity.c ============================================================================== --- head/sys/geom/eli/g_eli_integrity.c Wed Oct 20 19:53:29 2010 (r214115) +++ head/sys/geom/eli/g_eli_integrity.c Wed Oct 20 20:01:45 2010 (r214116) @@ -392,6 +392,11 @@ g_eli_auth_read(struct g_eli_softc *sc, /* * This is the main function responsible for cryptography (ie. communication * with crypto(9) subsystem). + * + * BIO_READ: + * g_eli_start -> g_eli_auth_read -> g_io_request -> g_eli_read_done -> G_ELI_AUTH_RUN -> g_eli_auth_read_done -> g_io_deliver + * BIO_WRITE: + * g_eli_start -> G_ELI_AUTH_RUN -> g_eli_auth_write_done -> g_io_request -> g_eli_write_done -> g_io_deliver */ void g_eli_auth_run(struct g_eli_worker *wr, struct bio *bp) Modified: head/sys/geom/eli/g_eli_privacy.c ============================================================================== --- head/sys/geom/eli/g_eli_privacy.c Wed Oct 20 19:53:29 2010 (r214115) +++ head/sys/geom/eli/g_eli_privacy.c Wed Oct 20 20:01:45 2010 (r214116) @@ -166,6 +166,11 @@ g_eli_crypto_write_done(struct cryptop * /* * This is the main function responsible for cryptography (ie. communication * with crypto(9) subsystem). + * + * BIO_READ: + * g_eli_start -> g_io_request -> g_eli_read_done -> G_ELI_CRYPTO_RUN -> g_eli_crypto_read_done -> g_io_deliver + * BIO_WRITE: + * g_eli_start -> G_ELI_CRYPTO_RUN -> g_eli_crypto_write_done -> g_io_request -> g_eli_write_done -> g_io_deliver */ void g_eli_crypto_run(struct g_eli_worker *wr, struct bio *bp) From owner-svn-src-head@FreeBSD.ORG Wed Oct 20 20:50: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 ADCF0106564A; Wed, 20 Oct 2010 20:50:55 +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 9A43B8FC18; Wed, 20 Oct 2010 20:50: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 o9KKotYq068520; Wed, 20 Oct 2010 20:50:55 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9KKot6o068512; Wed, 20 Oct 2010 20:50:55 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201010202050.o9KKot6o068512@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Wed, 20 Oct 2010 20:50: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: r214118 - in head: sbin/geom/class/eli sys/geom/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: Wed, 20 Oct 2010 20:50:55 -0000 Author: pjd Date: Wed Oct 20 20:50:55 2010 New Revision: 214118 URL: http://svn.freebsd.org/changeset/base/214118 Log: Bring in geli suspend/resume functionality (finally). Before this change if you wanted to suspend your laptop and be sure that your encryption keys are safe, you had to stop all processes that use file system stored on encrypted device, unmount the file system and detach geli provider. This isn't very handy. If you are a lucky user of a laptop where suspend/resume actually works with FreeBSD (I'm not!) you most likely want to suspend your laptop, because you don't want to start everything over again when you turn your laptop back on. And this is where geli suspend/resume steps in. When you execute: # geli suspend -a geli will wait for all in-flight I/O requests, suspend new I/O requests, remove all geli sensitive data from the kernel memory (like encryption keys) and will wait for either 'geli resume' or 'geli detach'. Now with no keys in memory you can suspend your laptop without stopping any processes or unmounting any file systems. When you resume your laptop you have to resume geli devices using 'geli resume' command. You need to provide your passphrase, etc. again so the keys can be restored and suspended I/O requests released. Of course you need to remember that 'geli suspend' won't clear file system cache and other places where data from your geli-encrypted file system might be present. But to get rid of those stopping processes and unmounting file system won't help either - you have to turn your laptop off. Be warned. Also note, that suspending geli device which contains file system with geli utility (or anything used by 'geli resume') is not very good idea, as you won't be able to resume it - when you execute geli(8), the kernel will try to read it and this read I/O request will be suspended. Modified: head/sbin/geom/class/eli/geli.8 head/sbin/geom/class/eli/geom_eli.c head/sys/geom/eli/g_eli.c head/sys/geom/eli/g_eli.h head/sys/geom/eli/g_eli_ctl.c head/sys/geom/eli/g_eli_integrity.c head/sys/geom/eli/g_eli_privacy.c Modified: head/sbin/geom/class/eli/geli.8 ============================================================================== --- head/sbin/geom/class/eli/geli.8 Wed Oct 20 20:42:33 2010 (r214117) +++ head/sbin/geom/class/eli/geli.8 Wed Oct 20 20:50:55 2010 (r214118) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 25, 2010 +.Dd October 20, 2010 .Dt GELI 8 .Os .Sh NAME @@ -119,6 +119,16 @@ utility: .Ar file .Ar prov .Nm +.Cm suspend +.Op Fl v +.Fl a | Ar prov ... +.Nm +.Cm resume +.Op Fl pv +.Op Fl j Ar passfile +.Op Fl k Ar keyfile +.Ar prov +.Nm .Cm resize .Op Fl v .Fl s Ar oldsize @@ -207,6 +217,8 @@ Allows to attach a provider with a rando partitions and temporary file systems. .It Allows to verify data integrity (data authentication). +.It +Allows to suspend and resume encrypted devices. .El .Pp The first argument to @@ -458,6 +470,8 @@ will not be detached even if all keys wi It can be even rescued with the .Cm setkey subcommand. +.Pp +Additional options include: .Bl -tag -width ".Fl a Ar keyno" .It Fl a Destroy all keys (does not need @@ -482,6 +496,8 @@ backup, your data is gone for good. In case the provider was attached with the .Fl r flag, the keys will not be destroyed, only the provider will be detached. +.Pp +Additional options include: .Bl -tag -width ".Fl a" .It Fl a If specified, all currently attached providers will be killed. @@ -490,6 +506,8 @@ If specified, all currently attached pro Backup metadata from the given provider to the given file. .It Cm restore Restore metadata from the given file to the given provider. +.Pp +Additional options include: .Bl -tag -width ".Fl f" .It Fl f Metadata contains the size of the provider to ensure that the correct @@ -508,12 +526,73 @@ through and .Cm restore . .El +.It Cm suspend +Suspend device by waiting for all inflight request to finish, clearing all +sensitive informations (like keys) from the kernel memory and blocking all +further I/O requests until the +.Cm resume +subcommand is executed. +This functionality is useful for eg. laptops - when one wants to suspend a +laptop, one does not want to leave encrypted device attached. +Instead of closing all files and directories opened from a file system placed +on an encrypted device, unmounting the file system and detaching the device, +the +.Cm suspend +subcommand can be used. +Any access to the encrypted device will be blocked until the keys are +recovered through +.Cm resume +subcommand, thus there is no need to close nor unmount anything. +The +.Cm suspend +subcommand does not work with devices created with the +.Cm onetime +subcommand. +Please note that sensitive data might still be present in memory after +suspending encrypted device, because of file system cache, etc. +.Pp +Additional options include: +.Bl -tag -width ".Fl a" +.It Fl a +Suspend all +.Nm +devices. +.El +.It Cm resume +Resume previously suspended device. +The caller must ensure that executing this subcommand won't try to access +suspended device, which will lead to a deadlock. +For example suspending device, which contains file system where the +.Nm +utility is stored is bad idea. +.Pp +Additional options include: +.Bl -tag -width ".Fl j Ar passfile" +.It Fl j Ar passfile +Specifies a file which contains the passphrase or its part. +For more information see the description of the +.Fl J +option for the +.Cm init +subcommand. +.It Fl k Ar keyfile +Specifies a file which contains part of the key. +For more information see the description of the +.Fl K +option for the +.Cm init +subcommand. +.It Fl p +Do not use passphrase as the key component. +.El .It Cm resize Inform .Nm that the provider has been resized. The old metadata block is relocated to the correct position at the end of the provider and the provider size is updated. +.Pp +Additional options include: .Bl -tag -width ".Fl s Ar oldsize" .It Fl s Ar oldsize The size of the provider before it was resized. @@ -746,6 +825,19 @@ prompt: # geli attach da0 Enter passphrase: foobar .Ed +.Pp +Suspend all +.Nm +devices, suspend a laptop, then resume devices one by one after resuming a +laptop: +.Bd -literal -offset indent +# geli suspend -a +# zzz + +# geli resume -p -k keyfile gpt/secret +# geli resume gpt/private +Enter passphrase: +.Ed .Sh ENCRYPTION MODES .Nm supports two encryption modes: Modified: head/sbin/geom/class/eli/geom_eli.c ============================================================================== --- head/sbin/geom/class/eli/geom_eli.c Wed Oct 20 20:42:33 2010 (r214117) +++ head/sbin/geom/class/eli/geom_eli.c Wed Oct 20 20:50:55 2010 (r214118) @@ -67,6 +67,7 @@ static void eli_attach(struct gctl_req * static void eli_configure(struct gctl_req *req); static void eli_setkey(struct gctl_req *req); static void eli_delkey(struct gctl_req *req); +static void eli_resume(struct gctl_req *req); static void eli_kill(struct gctl_req *req); static void eli_backup(struct gctl_req *req); static void eli_restore(struct gctl_req *req); @@ -89,6 +90,8 @@ static int eli_backup_create(struct gctl * configure [-bB] prov ... * setkey [-pPv] [-n keyno] [-j passfile] [-J newpassfile] [-k keyfile] [-K newkeyfile] prov * delkey [-afv] [-n keyno] prov + * suspend [-v] -a | prov ... + * resume [-pv] [-j passfile] [-k keyfile] prov * kill [-av] [prov ...] * backup [-v] prov file * restore [-fv] file prov @@ -198,6 +201,22 @@ struct g_command class_commands[] = { }, "[-afv] [-n keyno] prov" }, + { "suspend", G_FLAG_VERBOSE, NULL, + { + { 'a', "all", NULL, G_TYPE_BOOL }, + G_OPT_SENTINEL + }, + "[-v] -a | prov ..." + }, + { "resume", G_FLAG_VERBOSE, eli_main, + { + { 'j', "passfile", G_VAL_OPTIONAL, G_TYPE_STRING | G_TYPE_MULTI }, + { 'k', "keyfile", G_VAL_OPTIONAL, G_TYPE_STRING | G_TYPE_MULTI }, + { 'p', "nopassphrase", NULL, G_TYPE_BOOL }, + G_OPT_SENTINEL + }, + "[-pv] [-j passfile] [-k keyfile] prov" + }, { "kill", G_FLAG_VERBOSE, eli_main, { { 'a', "all", NULL, G_TYPE_BOOL }, @@ -280,6 +299,8 @@ eli_main(struct gctl_req *req, unsigned eli_setkey(req); else if (strcmp(name, "delkey") == 0) eli_delkey(req); + else if (strcmp(name, "resume") == 0) + eli_resume(req); else if (strcmp(name, "kill") == 0) eli_kill(req); else if (strcmp(name, "backup") == 0) @@ -1118,6 +1139,44 @@ eli_delkey(struct gctl_req *req) eli_delkey_detached(req, prov); } +static void +eli_resume(struct gctl_req *req) +{ + struct g_eli_metadata md; + unsigned char key[G_ELI_USERKEYLEN]; + const char *prov; + off_t mediasize; + int nargs; + + nargs = gctl_get_int(req, "nargs"); + if (nargs != 1) { + gctl_error(req, "Invalid number of arguments."); + return; + } + prov = gctl_get_ascii(req, "arg0"); + + if (eli_metadata_read(req, prov, &md) == -1) + return; + + mediasize = g_get_mediasize(prov); + if (md.md_provsize != (uint64_t)mediasize) { + gctl_error(req, "Provider size mismatch."); + return; + } + + if (eli_genkey(req, &md, key, false) == NULL) { + bzero(key, sizeof(key)); + return; + } + + gctl_ro_param(req, "key", sizeof(key), key); + if (gctl_issue(req) == NULL) { + if (verbose) + printf("Resumed %s.\n", prov); + } + bzero(key, sizeof(key)); +} + static int eli_trash_metadata(struct gctl_req *req, const char *prov, int fd, off_t offset) { Modified: head/sys/geom/eli/g_eli.c ============================================================================== --- head/sys/geom/eli/g_eli.c Wed Oct 20 20:42:33 2010 (r214117) +++ head/sys/geom/eli/g_eli.c Wed Oct 20 20:50:55 2010 (r214118) @@ -106,7 +106,7 @@ struct g_class g_eli_class = { /* * Code paths: * BIO_READ: - * g_eli_start -> g_io_request -> g_eli_read_done -> g_eli_crypto_run -> g_eli_crypto_read_done -> g_io_deliver + * g_eli_start -> g_eli_crypto_read -> g_io_request -> g_eli_read_done -> g_eli_crypto_run -> g_eli_crypto_read_done -> g_io_deliver * BIO_WRITE: * g_eli_start -> g_eli_crypto_run -> g_eli_crypto_write_done -> g_io_request -> g_eli_write_done -> g_io_deliver */ @@ -148,7 +148,7 @@ g_eli_crypto_rerun(struct cryptop *crp) /* * The function is called afer reading encrypted data from the provider. * - * g_eli_start -> g_io_request -> G_ELI_READ_DONE -> g_eli_crypto_run -> g_eli_crypto_read_done -> g_io_deliver + * g_eli_start -> g_eli_crypto_read -> g_io_request -> G_ELI_READ_DONE -> g_eli_crypto_run -> g_eli_crypto_read_done -> g_io_deliver */ void g_eli_read_done(struct bio *bp) @@ -167,6 +167,7 @@ g_eli_read_done(struct bio *bp) if (pbp->bio_inbed < pbp->bio_children) return; g_destroy_bio(bp); + sc = pbp->bio_to->geom->softc; if (pbp->bio_error != 0) { G_ELI_LOGREQ(0, pbp, "%s() failed", __func__); pbp->bio_completed = 0; @@ -175,9 +176,9 @@ g_eli_read_done(struct bio *bp) pbp->bio_driver2 = NULL; } g_io_deliver(pbp, pbp->bio_error); + atomic_subtract_int(&sc->sc_inflight, 1); return; } - sc = pbp->bio_to->geom->softc; mtx_lock(&sc->sc_queue_mtx); bioq_insert_tail(&sc->sc_queue, pbp); mtx_unlock(&sc->sc_queue_mtx); @@ -192,6 +193,7 @@ g_eli_read_done(struct bio *bp) void g_eli_write_done(struct bio *bp) { + struct g_eli_softc *sc; struct bio *pbp; G_ELI_LOGREQ(2, bp, "Request done."); @@ -218,7 +220,9 @@ g_eli_write_done(struct bio *bp) * Write is finished, send it up. */ pbp->bio_completed = pbp->bio_length; + sc = pbp->bio_to->geom->softc; g_io_deliver(pbp, pbp->bio_error); + atomic_subtract_int(&sc->sc_inflight, 1); } /* @@ -241,12 +245,12 @@ g_eli_orphan(struct g_consumer *cp) sc = cp->geom->softc; if (sc == NULL) return; - g_eli_destroy(sc, 1); + g_eli_destroy(sc, TRUE); } /* * BIO_READ: - * G_ELI_START -> g_io_request -> g_eli_read_done -> g_eli_crypto_run -> g_eli_crypto_read_done -> g_io_deliver + * G_ELI_START -> g_eli_crypto_read -> g_io_request -> g_eli_read_done -> g_eli_crypto_run -> g_eli_crypto_read_done -> g_io_deliver * BIO_WRITE: * G_ELI_START -> g_eli_crypto_run -> g_eli_crypto_write_done -> g_io_request -> g_eli_write_done -> g_io_deliver */ @@ -284,24 +288,16 @@ g_eli_start(struct bio *bp) g_io_deliver(bp, ENOMEM); return; } + bp->bio_driver1 = cbp; + bp->bio_pflags = G_ELI_NEW_BIO; switch (bp->bio_cmd) { case BIO_READ: if (!(sc->sc_flags & G_ELI_FLAG_AUTH)) { - bp->bio_driver2 = NULL; - cbp->bio_done = g_eli_read_done; - cp = LIST_FIRST(&sc->sc_geom->consumer); - cbp->bio_to = cp->provider; - G_ELI_LOGREQ(2, cbp, "Sending request."); - /* - * Read encrypted data from provider. - */ - g_io_request(cbp, cp); + g_eli_crypto_read(sc, bp, 0); break; } - bp->bio_pflags = 255; /* FALLTHROUGH */ case BIO_WRITE: - bp->bio_driver1 = cbp; mtx_lock(&sc->sc_queue_mtx); bioq_insert_tail(&sc->sc_queue, bp); mtx_unlock(&sc->sc_queue_mtx); @@ -318,6 +314,41 @@ g_eli_start(struct bio *bp) } } +static void +g_eli_cancel(struct g_eli_softc *sc) +{ + struct bio *bp; + + mtx_assert(&sc->sc_queue_mtx, MA_OWNED); + + while ((bp = bioq_takefirst(&sc->sc_queue)) != NULL) { + KASSERT(bp->bio_pflags == G_ELI_NEW_BIO, + ("Not new bio when canceling (bp=%p).", bp)); + g_io_deliver(bp, ENXIO); + } +} + +static struct bio * +g_eli_takefirst(struct g_eli_softc *sc) +{ + struct bio *bp; + + mtx_assert(&sc->sc_queue_mtx, MA_OWNED); + + if (!(sc->sc_flags & G_ELI_FLAG_SUSPEND)) + return (bioq_takefirst(&sc->sc_queue)); + /* + * Device suspended, so we skip new I/O requests. + */ + TAILQ_FOREACH(bp, &sc->sc_queue.queue, bio_queue) { + if (bp->bio_pflags != G_ELI_NEW_BIO) + break; + } + if (bp != NULL) + bioq_remove(&sc->sc_queue, bp); + return (bp); +} + /* * This is the main function for kernel worker thread when we don't have * hardware acceleration and we have to do cryptography in software. @@ -351,9 +382,11 @@ g_eli_worker(void *arg) for (;;) { mtx_lock(&sc->sc_queue_mtx); - bp = bioq_takefirst(&sc->sc_queue); +again: + bp = g_eli_takefirst(sc); if (bp == NULL) { if (sc->sc_flags & G_ELI_FLAG_DESTROY) { + g_eli_cancel(sc); LIST_REMOVE(wr, w_next); crypto_freesession(wr->w_sid); free(wr, M_ELI); @@ -363,16 +396,54 @@ g_eli_worker(void *arg) mtx_unlock(&sc->sc_queue_mtx); kproc_exit(0); } + while (sc->sc_flags & G_ELI_FLAG_SUSPEND) { + if (sc->sc_inflight > 0) { + G_ELI_DEBUG(0, "inflight=%d", sc->sc_inflight); + /* + * We still have inflight BIOs, so + * sleep and retry. + */ + msleep(sc, &sc->sc_queue_mtx, PRIBIO, + "geli:inf", hz / 5); + goto again; + } + /* + * Suspend requested, mark the worker as + * suspended and go to sleep. + */ + wr->w_active = 0; + wakeup(&sc->sc_workers); + msleep(sc, &sc->sc_queue_mtx, PRIBIO, + "geli:suspend", 0); + if (!(sc->sc_flags & G_ELI_FLAG_SUSPEND)) + wr->w_active = 1; + goto again; + } msleep(sc, &sc->sc_queue_mtx, PDROP, "geli:w", 0); continue; } + if (bp->bio_pflags == G_ELI_NEW_BIO) + atomic_add_int(&sc->sc_inflight, 1); mtx_unlock(&sc->sc_queue_mtx); - if (bp->bio_cmd == BIO_READ && bp->bio_pflags == 255) - g_eli_auth_read(sc, bp); - else if (sc->sc_flags & G_ELI_FLAG_AUTH) - g_eli_auth_run(wr, bp); - else - g_eli_crypto_run(wr, bp); + if (bp->bio_pflags == G_ELI_NEW_BIO) { + bp->bio_pflags = 0; + if (sc->sc_flags & G_ELI_FLAG_AUTH) { + if (bp->bio_cmd == BIO_READ) + g_eli_auth_read(sc, bp); + else + g_eli_auth_run(wr, bp); + } else { + if (bp->bio_cmd == BIO_READ) + g_eli_crypto_read(sc, bp, 1); + else + g_eli_crypto_run(wr, bp); + } + } else { + if (sc->sc_flags & G_ELI_FLAG_AUTH) + g_eli_auth_run(wr, bp); + else + g_eli_crypto_run(wr, bp); + } } } @@ -502,7 +573,7 @@ g_eli_last_close(struct g_eli_softc *sc) gp = sc->sc_geom; pp = LIST_FIRST(&gp->provider); strlcpy(ppname, pp->name, sizeof(ppname)); - error = g_eli_destroy(sc, 1); + error = g_eli_destroy(sc, TRUE); KASSERT(error == 0, ("Cannot detach %s on last close (error=%d).", ppname, error)); G_ELI_DEBUG(0, "Detached %s on last close.", ppname); @@ -586,6 +657,7 @@ g_eli_create(struct gctl_req *req, struc else gp->access = g_std_access; + sc->sc_inflight = 0; sc->sc_crypto = G_ELI_CRYPTO_SW; sc->sc_flags = md->md_flags; /* Backward compatibility. */ @@ -730,6 +802,7 @@ g_eli_create(struct gctl_req *req, struc wr = malloc(sizeof(*wr), M_ELI, M_WAITOK | M_ZERO); wr->w_softc = sc; wr->w_number = i; + wr->w_active = TRUE; /* * If this is the first pass, try to get hardware support. @@ -877,7 +950,7 @@ g_eli_destroy_geom(struct gctl_req *req struct g_eli_softc *sc; sc = gp->softc; - return (g_eli_destroy(sc, 0)); + return (g_eli_destroy(sc, FALSE)); } static int @@ -1108,6 +1181,7 @@ g_eli_dumpconf(struct sbuf *sb, const ch sbuf_printf(sb, name); \ } \ } while (0) + ADD_FLAG(G_ELI_FLAG_SUSPEND, "SUSPEND"); ADD_FLAG(G_ELI_FLAG_SINGLE_KEY, "SINGLE-KEY"); ADD_FLAG(G_ELI_FLAG_NATIVE_BYTE_ORDER, "NATIVE-BYTE-ORDER"); ADD_FLAG(G_ELI_FLAG_ONETIME, "ONETIME"); @@ -1169,7 +1243,7 @@ g_eli_shutdown_pre_sync(void *arg, int h pp = LIST_FIRST(&gp->provider); KASSERT(pp != NULL, ("No provider? gp=%p (%s)", gp, gp->name)); if (pp->acr + pp->acw + pp->ace == 0) - error = g_eli_destroy(sc, 1); + error = g_eli_destroy(sc, TRUE); else { sc->sc_flags |= G_ELI_FLAG_RW_DETACH; gp->access = g_eli_access; Modified: head/sys/geom/eli/g_eli.h ============================================================================== --- head/sys/geom/eli/g_eli.h Wed Oct 20 20:42:33 2010 (r214117) +++ head/sys/geom/eli/g_eli.h Wed Oct 20 20:50:55 2010 (r214118) @@ -86,6 +86,10 @@ #define G_ELI_FLAG_NATIVE_BYTE_ORDER 0x00040000 /* Provider uses single encryption key. */ #define G_ELI_FLAG_SINGLE_KEY 0x00080000 +/* Device suspended. */ +#define G_ELI_FLAG_SUSPEND 0x00100000 + +#define G_ELI_NEW_BIO 255 #define SHA512_MDLEN 64 #define G_ELI_AUTH_SECKEYLEN SHA256_DIGEST_LENGTH @@ -140,6 +144,7 @@ struct g_eli_worker { struct proc *w_proc; u_int w_number; uint64_t w_sid; + boolean_t w_active; LIST_ENTRY(g_eli_worker) w_next; }; @@ -160,6 +165,7 @@ struct g_eli_softc { SHA256_CTX sc_ivctx; int sc_nkey; uint32_t sc_flags; + int sc_inflight; off_t sc_mediasize; size_t sc_sectorsize; u_int sc_bytes_per_sector; @@ -499,6 +505,7 @@ uint8_t *g_eli_crypto_key(struct g_eli_s void g_eli_crypto_ivgen(struct g_eli_softc *sc, off_t offset, u_char *iv, size_t size); +void g_eli_crypto_read(struct g_eli_softc *sc, struct bio *bp, boolean_t fromworker); void g_eli_crypto_run(struct g_eli_worker *wr, struct bio *bp); void g_eli_auth_read(struct g_eli_softc *sc, struct bio *bp); Modified: head/sys/geom/eli/g_eli_ctl.c ============================================================================== --- head/sys/geom/eli/g_eli_ctl.c Wed Oct 20 20:42:33 2010 (r214117) +++ head/sys/geom/eli/g_eli_ctl.c Wed Oct 20 20:50:55 2010 (r214118) @@ -217,7 +217,7 @@ g_eli_ctl_detach(struct gctl_req *req, s sc->sc_flags |= G_ELI_FLAG_RW_DETACH; sc->sc_geom->access = g_eli_access; } else { - error = g_eli_destroy(sc, *force); + error = g_eli_destroy(sc, *force ? TRUE : FALSE); if (error != 0) { gctl_error(req, "Cannot destroy device %s (error=%d).", @@ -700,6 +700,213 @@ g_eli_ctl_delkey(struct gctl_req *req, s } static int +g_eli_suspend_one(struct g_eli_softc *sc) +{ + struct g_eli_worker *wr; + + g_topology_assert(); + + if (sc == NULL) + return (ENOENT); + if (sc->sc_flags & G_ELI_FLAG_ONETIME) + return (EOPNOTSUPP); + + mtx_lock(&sc->sc_queue_mtx); + if (sc->sc_flags & G_ELI_FLAG_SUSPEND) { + mtx_unlock(&sc->sc_queue_mtx); + return (EALREADY); + } + sc->sc_flags |= G_ELI_FLAG_SUSPEND; + wakeup(sc); + for (;;) { + LIST_FOREACH(wr, &sc->sc_workers, w_next) { + if (wr->w_active) + break; + } + if (wr == NULL) + break; + /* Not all threads suspended. */ + msleep(&sc->sc_workers, &sc->sc_queue_mtx, PRIBIO, + "geli:suspend", 0); + } + /* + * Clear sensitive data on suspend, they will be recovered on resume. + */ + bzero(sc->sc_mkey, sizeof(sc->sc_mkey)); + bzero(sc->sc_ekeys, + sc->sc_nekeys * (sizeof(uint8_t *) + G_ELI_DATAKEYLEN)); + free(sc->sc_ekeys, M_ELI); + sc->sc_ekeys = NULL; + bzero(sc->sc_akey, sizeof(sc->sc_akey)); + bzero(&sc->sc_akeyctx, sizeof(sc->sc_akeyctx)); + bzero(sc->sc_ivkey, sizeof(sc->sc_ivkey)); + bzero(&sc->sc_ivctx, sizeof(sc->sc_ivctx)); + mtx_unlock(&sc->sc_queue_mtx); + G_ELI_DEBUG(0, "%s has been suspended.", sc->sc_name); + return (0); +} + +static void +g_eli_ctl_suspend(struct gctl_req *req, struct g_class *mp) +{ + struct g_eli_softc *sc; + int *all, *nargs; + int error; + + g_topology_assert(); + + nargs = gctl_get_paraml(req, "nargs", sizeof(*nargs)); + if (nargs == NULL) { + gctl_error(req, "No '%s' argument.", "nargs"); + return; + } + all = gctl_get_paraml(req, "all", sizeof(*all)); + if (all == NULL) { + gctl_error(req, "No '%s' argument.", "all"); + return; + } + if (!*all && *nargs == 0) { + gctl_error(req, "Too few arguments."); + return; + } + + if (*all) { + struct g_geom *gp, *gp2; + + LIST_FOREACH_SAFE(gp, &mp->geom, geom, gp2) { + sc = gp->softc; + if (sc->sc_flags & G_ELI_FLAG_ONETIME) + continue; + error = g_eli_suspend_one(sc); + if (error != 0) + gctl_error(req, "Not fully done."); + } + } else { + const char *prov; + char param[16]; + int i; + + for (i = 0; i < *nargs; i++) { + snprintf(param, sizeof(param), "arg%d", i); + prov = gctl_get_asciiparam(req, param); + if (prov == NULL) { + G_ELI_DEBUG(0, "No 'arg%d' argument.", i); + continue; + } + + sc = g_eli_find_device(mp, prov); + if (sc == NULL) { + G_ELI_DEBUG(0, "No such provider: %s.", prov); + continue; + } + error = g_eli_suspend_one(sc); + if (error != 0) + gctl_error(req, "Not fully done."); + } + } +} + +static void +g_eli_ctl_resume(struct gctl_req *req, struct g_class *mp) +{ + struct g_eli_metadata md; + struct g_eli_softc *sc; + struct g_provider *pp; + struct g_consumer *cp; + const char *name; + u_char *key, mkey[G_ELI_DATAIVKEYLEN]; + int *nargs, keysize, error; + u_int nkey; + + g_topology_assert(); + + nargs = gctl_get_paraml(req, "nargs", sizeof(*nargs)); + if (nargs == NULL) { + gctl_error(req, "No '%s' argument.", "nargs"); + return; + } + if (*nargs != 1) { + gctl_error(req, "Invalid number of arguments."); + return; + } + + name = gctl_get_asciiparam(req, "arg0"); + if (name == NULL) { + gctl_error(req, "No 'arg%u' argument.", 0); + return; + } + sc = g_eli_find_device(mp, name); + if (sc == NULL) { + gctl_error(req, "Provider %s is invalid.", name); + return; + } + if (!(sc->sc_flags & G_ELI_FLAG_SUSPEND)) { + gctl_error(req, "Provider %s not suspended.", name); + return; + } + cp = LIST_FIRST(&sc->sc_geom->consumer); + pp = cp->provider; + error = g_eli_read_metadata(mp, pp, &md); + if (error != 0) { + gctl_error(req, "Cannot read metadata from %s (error=%d).", + name, error); + return; + } + if (md.md_keys == 0x00) { + bzero(&md, sizeof(md)); + gctl_error(req, "No valid keys on %s.", pp->name); + return; + } + + key = gctl_get_param(req, "key", &keysize); + if (key == NULL || keysize != G_ELI_USERKEYLEN) { + bzero(&md, sizeof(md)); + gctl_error(req, "No '%s' argument.", "key"); + return; + } + + error = g_eli_mkey_decrypt(&md, key, mkey, &nkey); + bzero(key, keysize); + if (error == -1) { + bzero(&md, sizeof(md)); + gctl_error(req, "Wrong key for %s.", pp->name); + return; + } else if (error > 0) { + bzero(&md, sizeof(md)); + gctl_error(req, "Cannot decrypt Master Key for %s (error=%d).", + pp->name, error); + return; + } + G_ELI_DEBUG(1, "Using Master Key %u for %s.", nkey, pp->name); + + mtx_lock(&sc->sc_queue_mtx); + /* Restore sc_mkey, sc_ekeys, sc_akey and sc_ivkey. */ + g_eli_mkey_propagate(sc, mkey); + bzero(mkey, sizeof(mkey)); + bzero(&md, sizeof(md)); + /* Restore sc_akeyctx. */ + if (sc->sc_flags & G_ELI_FLAG_AUTH) { + SHA256_Init(&sc->sc_akeyctx); + SHA256_Update(&sc->sc_akeyctx, sc->sc_akey, + sizeof(sc->sc_akey)); + } + /* Restore sc_ivctx. */ + switch (sc->sc_ealgo) { + case CRYPTO_AES_XTS: + break; + default: + SHA256_Init(&sc->sc_ivctx); + SHA256_Update(&sc->sc_ivctx, sc->sc_ivkey, + sizeof(sc->sc_ivkey)); + break; + } + sc->sc_flags &= ~G_ELI_FLAG_SUSPEND; + mtx_unlock(&sc->sc_queue_mtx); + G_ELI_DEBUG(1, "Resumed %s.", pp->name); + wakeup(sc); +} + +static int g_eli_kill_one(struct g_eli_softc *sc) { struct g_provider *pp; @@ -749,7 +956,7 @@ g_eli_kill_one(struct g_eli_softc *sc) } if (error == 0) G_ELI_DEBUG(0, "%s has been killed.", pp->name); - g_eli_destroy(sc, 1); + g_eli_destroy(sc, TRUE); return (error); } @@ -839,6 +1046,10 @@ g_eli_config(struct gctl_req *req, struc g_eli_ctl_setkey(req, mp); else if (strcmp(verb, "delkey") == 0) g_eli_ctl_delkey(req, mp); + else if (strcmp(verb, "suspend") == 0) + g_eli_ctl_suspend(req, mp); + else if (strcmp(verb, "resume") == 0) + g_eli_ctl_resume(req, mp); else if (strcmp(verb, "kill") == 0) g_eli_ctl_kill(req, mp); else Modified: head/sys/geom/eli/g_eli_integrity.c ============================================================================== --- head/sys/geom/eli/g_eli_integrity.c Wed Oct 20 20:42:33 2010 (r214117) +++ head/sys/geom/eli/g_eli_integrity.c Wed Oct 20 20:50:55 2010 (r214118) @@ -129,6 +129,7 @@ g_eli_auth_keygen(struct g_eli_softc *sc static int g_eli_auth_read_done(struct cryptop *crp) { + struct g_eli_softc *sc; struct bio *bp; if (crp->crp_etype == EAGAIN) { @@ -152,8 +153,8 @@ g_eli_auth_read_done(struct cryptop *crp */ if (bp->bio_inbed < bp->bio_children) return (0); + sc = bp->bio_to->geom->softc; if (bp->bio_error == 0) { - struct g_eli_softc *sc; u_int i, lsec, nsec, data_secsize, decr_secsize, encr_secsize; u_char *srcdata, *dstdata, *auth; off_t coroff, corsize; @@ -161,7 +162,6 @@ g_eli_auth_read_done(struct cryptop *crp /* * Verify data integrity based on calculated and read HMACs. */ - sc = bp->bio_to->geom->softc; /* Sectorsize of decrypted provider eg. 4096. */ decr_secsize = bp->bio_to->sectorsize; /* The real sectorsize of encrypted provider, eg. 512. */ @@ -240,6 +240,7 @@ g_eli_auth_read_done(struct cryptop *crp * Read is finished, send it up. */ g_io_deliver(bp, bp->bio_error); + atomic_subtract_int(&sc->sc_inflight, 1); return (0); } @@ -276,6 +277,7 @@ g_eli_auth_write_done(struct cryptop *cr */ if (bp->bio_inbed < bp->bio_children) return (0); + sc = bp->bio_to->geom->softc; if (bp->bio_error != 0) { G_ELI_LOGREQ(0, bp, "Crypto WRITE request failed (error=%d).", bp->bio_error); @@ -285,9 +287,9 @@ g_eli_auth_write_done(struct cryptop *cr bp->bio_driver1 = NULL; g_destroy_bio(cbp); g_io_deliver(bp, bp->bio_error); + atomic_subtract_int(&sc->sc_inflight, 1); return (0); } - sc = bp->bio_to->geom->softc; cp = LIST_FIRST(&sc->sc_geom->consumer); cbp = bp->bio_driver1; bp->bio_driver1 = NULL; Modified: head/sys/geom/eli/g_eli_privacy.c ============================================================================== --- head/sys/geom/eli/g_eli_privacy.c Wed Oct 20 20:42:33 2010 (r214117) +++ head/sys/geom/eli/g_eli_privacy.c Wed Oct 20 20:50:55 2010 (r214118) @@ -53,7 +53,7 @@ __FBSDID("$FreeBSD$"); /* * Code paths: * BIO_READ: - * g_eli_start -> g_io_request -> g_eli_read_done -> g_eli_crypto_run -> g_eli_crypto_read_done -> g_io_deliver + * g_eli_start -> g_eli_crypto_read -> g_io_request -> g_eli_read_done -> g_eli_crypto_run -> g_eli_crypto_read_done -> g_io_deliver * BIO_WRITE: * g_eli_start -> g_eli_crypto_run -> g_eli_crypto_write_done -> g_io_request -> g_eli_write_done -> g_io_deliver */ @@ -63,11 +63,12 @@ MALLOC_DECLARE(M_ELI); /* * The function is called after we read and decrypt data. * - * g_eli_start -> g_io_request -> g_eli_read_done -> g_eli_crypto_run -> G_ELI_CRYPTO_READ_DONE -> g_io_deliver + * g_eli_start -> g_eli_crypto_read -> g_io_request -> g_eli_read_done -> g_eli_crypto_run -> G_ELI_CRYPTO_READ_DONE -> g_io_deliver */ static int g_eli_crypto_read_done(struct cryptop *crp) { + struct g_eli_softc *sc; struct bio *bp; if (crp->crp_etype == EAGAIN) { @@ -101,7 +102,9 @@ g_eli_crypto_read_done(struct cryptop *c /* * Read is finished, send it up. */ + sc = bp->bio_to->geom->softc; g_io_deliver(bp, bp->bio_error); + atomic_subtract_int(&sc->sc_inflight, 1); return (0); } @@ -113,6 +116,7 @@ g_eli_crypto_read_done(struct cryptop *c static int g_eli_crypto_write_done(struct cryptop *crp) { + struct g_eli_softc *sc; struct g_geom *gp; struct g_consumer *cp; struct bio *bp, *cbp; @@ -141,18 +145,20 @@ g_eli_crypto_write_done(struct cryptop * bp->bio_children = 1; cbp = bp->bio_driver1; bp->bio_driver1 = NULL; + gp = bp->bio_to->geom; if (bp->bio_error != 0) { G_ELI_LOGREQ(0, bp, "Crypto WRITE request failed (error=%d).", bp->bio_error); free(bp->bio_driver2, M_ELI); bp->bio_driver2 = NULL; g_destroy_bio(cbp); + sc = gp->softc; g_io_deliver(bp, bp->bio_error); + atomic_subtract_int(&sc->sc_inflight, 1); return (0); } cbp->bio_data = bp->bio_driver2; cbp->bio_done = g_eli_write_done; - gp = bp->bio_to->geom; cp = LIST_FIRST(&gp->consumer); cbp->bio_to = cp->provider; G_ELI_LOGREQ(2, cbp, "Sending request."); @@ -164,11 +170,55 @@ g_eli_crypto_write_done(struct cryptop * } /* + * The function is called to read encrypted data. + * + * g_eli_start -> G_ELI_CRYPTO_READ -> g_io_request -> g_eli_read_done -> g_eli_crypto_run -> g_eli_crypto_read_done -> g_io_deliver + */ +void +g_eli_crypto_read(struct g_eli_softc *sc, struct bio *bp, boolean_t fromworker) +{ + struct g_consumer *cp; + struct bio *cbp; + + if (!fromworker) { + /* + * We are not called from the worker thread, so check if + * device is suspended. + */ + mtx_lock(&sc->sc_queue_mtx); + if (sc->sc_flags & G_ELI_FLAG_SUSPEND) { + /* + * If device is suspended, we place the request onto + * the queue, so it can be handled after resume. + */ + G_ELI_DEBUG(0, "device suspended, move onto queue"); + bioq_insert_tail(&sc->sc_queue, bp); + mtx_unlock(&sc->sc_queue_mtx); + wakeup(sc); + return; + } + atomic_add_int(&sc->sc_inflight, 1); + mtx_unlock(&sc->sc_queue_mtx); + } + bp->bio_pflags = 0; + bp->bio_driver2 = NULL; + cbp = bp->bio_driver1; + cbp->bio_done = g_eli_read_done; + cp = LIST_FIRST(&sc->sc_geom->consumer); + cbp->bio_to = cp->provider; + G_ELI_LOGREQ(2, cbp, "Sending request."); + /* + * Read encrypted data from provider. + */ + g_io_request(cbp, cp); +} + +/* * This is the main function responsible for cryptography (ie. communication * with crypto(9) subsystem). * * BIO_READ: - * g_eli_start -> g_io_request -> g_eli_read_done -> G_ELI_CRYPTO_RUN -> g_eli_crypto_read_done -> g_io_deliver + * g_eli_start -> g_eli_crypto_read -> g_io_request -> g_eli_read_done -> G_ELI_CRYPTO_RUN -> g_eli_crypto_read_done -> g_io_deliver * BIO_WRITE: * g_eli_start -> G_ELI_CRYPTO_RUN -> g_eli_crypto_write_done -> g_io_request -> g_eli_write_done -> g_io_deliver */ From owner-svn-src-head@FreeBSD.ORG Wed Oct 20 21:10: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 CAC96106564A; Wed, 20 Oct 2010 21:10:01 +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 B420B8FC0A; Wed, 20 Oct 2010 21:10: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 o9KLA1Rb068933; Wed, 20 Oct 2010 21:10:01 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9KLA1wK068932; Wed, 20 Oct 2010 21:10:01 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201010202110.o9KLA1wK068932@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Wed, 20 Oct 2010 21:10: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: r214119 - 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: Wed, 20 Oct 2010 21:10:01 -0000 Author: pjd Date: Wed Oct 20 21:10:01 2010 New Revision: 214119 URL: http://svn.freebsd.org/changeset/base/214119 Log: Use closefrom(2) instead of close(2) in a loop. MFC after: 1 week Modified: head/sbin/hastd/hooks.c Modified: head/sbin/hastd/hooks.c ============================================================================== --- head/sbin/hastd/hooks.c Wed Oct 20 20:50:55 2010 (r214118) +++ head/sbin/hastd/hooks.c Wed Oct 20 21:10:01 2010 (r214119) @@ -88,32 +88,19 @@ static void hook_free(struct hookproc *h static void descriptors(void) { - long maxfd; int fd; /* - * Close all descriptors. + * Close all (or almost all) descriptors. */ - maxfd = sysconf(_SC_OPEN_MAX); - if (maxfd < 0) { - pjdlog_errno(LOG_WARNING, "sysconf(_SC_OPEN_MAX) failed"); - maxfd = 1024; - } - for (fd = 0; fd <= maxfd; fd++) { - switch (fd) { - case STDIN_FILENO: - case STDOUT_FILENO: - case STDERR_FILENO: - if (pjdlog_mode_get() == PJDLOG_MODE_STD) - break; - /* FALLTHROUGH */ - default: - close(fd); - break; - } - } - if (pjdlog_mode_get() == PJDLOG_MODE_STD) + if (pjdlog_mode_get() == PJDLOG_MODE_STD) { + closefrom(MAX(MAX(STDIN_FILENO, STDOUT_FILENO), + STDERR_FILENO) + 1); return; + } + + closefrom(0); + /* * Redirect stdin, stdout and stderr to /dev/null. */ From owner-svn-src-head@FreeBSD.ORG Wed Oct 20 23: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 E25C5106566B; Wed, 20 Oct 2010 23:41:16 +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 D02388FC12; Wed, 20 Oct 2010 23:41: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 o9KNfGSs071960; Wed, 20 Oct 2010 23:41:16 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9KNfGDC071956; Wed, 20 Oct 2010 23:41:16 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201010202341.o9KNfGDC071956@svn.freebsd.org> From: Jung-uk Kim Date: Wed, 20 Oct 2010 23:41: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: r214122 - head/sys/dev/pci 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, 20 Oct 2010 23:41:17 -0000 Author: jkim Date: Wed Oct 20 23:41:16 2010 New Revision: 214122 URL: http://svn.freebsd.org/changeset/base/214122 Log: Update PCI power management registers per PCI Bus Power Management Interface Specification Rev. 1.2. Rename pp_pcmcsr field of PM capabilities to pp_bse to avoid further confusions and adjust some comments accordingly. The real PMCSR (Power Management Control/Status Register) is PCIR_POWER_STATUS and it is actually BSE (PCI-to-PCI Bridge Support Extensions) register. Modified: head/sys/dev/pci/pci.c head/sys/dev/pci/pcireg.h head/sys/dev/pci/pcivar.h Modified: head/sys/dev/pci/pci.c ============================================================================== --- head/sys/dev/pci/pci.c Wed Oct 20 21:19:36 2010 (r214121) +++ head/sys/dev/pci/pci.c Wed Oct 20 23:41:16 2010 (r214122) @@ -600,7 +600,7 @@ pci_read_extcap(device_t pcib, pcicfgreg if (cfg->pp.pp_cap == 0) { cfg->pp.pp_cap = REG(ptr + PCIR_POWER_CAP, 2); cfg->pp.pp_status = ptr + PCIR_POWER_STATUS; - cfg->pp.pp_pmcsr = ptr + PCIR_POWER_PMCSR; + cfg->pp.pp_bse = ptr + PCIR_POWER_BSE; if ((nextptr - ptr) > PCIR_POWER_DATA) cfg->pp.pp_data = ptr + PCIR_POWER_DATA; } Modified: head/sys/dev/pci/pcireg.h ============================================================================== --- head/sys/dev/pci/pcireg.h Wed Oct 20 21:19:36 2010 (r214121) +++ head/sys/dev/pci/pcireg.h Wed Oct 20 23:41:16 2010 (r214122) @@ -427,12 +427,16 @@ #define PCIR_POWER_CAP 0x2 #define PCIM_PCAP_SPEC 0x0007 #define PCIM_PCAP_PMEREQCLK 0x0008 -#define PCIM_PCAP_PMEREQPWR 0x0010 #define PCIM_PCAP_DEVSPECINIT 0x0020 -#define PCIM_PCAP_DYNCLOCK 0x0040 -#define PCIM_PCAP_SECCLOCK 0x00c0 -#define PCIM_PCAP_CLOCKMASK 0x00c0 -#define PCIM_PCAP_REQFULLCLOCK 0x0100 +#define PCIM_PCAP_AUXPWR_0 0x0000 +#define PCIM_PCAP_AUXPWR_55 0x0040 +#define PCIM_PCAP_AUXPWR_100 0x0080 +#define PCIM_PCAP_AUXPWR_160 0x00c0 +#define PCIM_PCAP_AUXPWR_220 0x0100 +#define PCIM_PCAP_AUXPWR_270 0x0140 +#define PCIM_PCAP_AUXPWR_320 0x0180 +#define PCIM_PCAP_AUXPWR_375 0x01c0 +#define PCIM_PCAP_AUXPWRMASK 0x01c0 #define PCIM_PCAP_D1SUPP 0x0200 #define PCIM_PCAP_D2SUPP 0x0400 #define PCIM_PCAP_D0PME 0x0800 @@ -447,16 +451,17 @@ #define PCIM_PSTAT_D2 0x0002 #define PCIM_PSTAT_D3 0x0003 #define PCIM_PSTAT_DMASK 0x0003 -#define PCIM_PSTAT_REPENABLE 0x0010 +#define PCIM_PSTAT_NOSOFTRESET 0x0008 #define PCIM_PSTAT_PMEENABLE 0x0100 #define PCIM_PSTAT_D0POWER 0x0000 #define PCIM_PSTAT_D1POWER 0x0200 #define PCIM_PSTAT_D2POWER 0x0400 #define PCIM_PSTAT_D3POWER 0x0600 #define PCIM_PSTAT_D0HEAT 0x0800 -#define PCIM_PSTAT_D1HEAT 0x1000 -#define PCIM_PSTAT_D2HEAT 0x1200 -#define PCIM_PSTAT_D3HEAT 0x1400 +#define PCIM_PSTAT_D1HEAT 0x0a00 +#define PCIM_PSTAT_D2HEAT 0x0c00 +#define PCIM_PSTAT_D3HEAT 0x0e00 +#define PCIM_PSTAT_DATASELMASK 0x1e00 #define PCIM_PSTAT_DATAUNKN 0x0000 #define PCIM_PSTAT_DATADIV10 0x2000 #define PCIM_PSTAT_DATADIV100 0x4000 @@ -464,11 +469,10 @@ #define PCIM_PSTAT_DATADIVMASK 0x6000 #define PCIM_PSTAT_PME 0x8000 -#define PCIR_POWER_PMCSR 0x6 -#define PCIM_PMCSR_DCLOCK 0x10 -#define PCIM_PMCSR_B2SUPP 0x20 -#define PCIM_BMCSR_B3SUPP 0x40 -#define PCIM_BMCSR_BPCE 0x80 +#define PCIR_POWER_BSE 0x6 +#define PCIM_PMCSR_BSE_D3B3 0x00 +#define PCIM_PMCSR_BSE_D3B2 0x40 +#define PCIM_PMCSR_BSE_BPCCE 0x80 #define PCIR_POWER_DATA 0x7 Modified: head/sys/dev/pci/pcivar.h ============================================================================== --- head/sys/dev/pci/pcivar.h Wed Oct 20 21:19:36 2010 (r214121) +++ head/sys/dev/pci/pcivar.h Wed Oct 20 23:41:16 2010 (r214122) @@ -42,9 +42,9 @@ typedef uint64_t pci_addr_t; /* Interesting values for PCI power management */ struct pcicfg_pp { uint16_t pp_cap; /* PCI power management capabilities */ - uint8_t pp_status; /* config space address of PCI power status reg */ - uint8_t pp_pmcsr; /* config space address of PMCSR reg */ - uint8_t pp_data; /* config space address of PCI power data reg */ + uint8_t pp_status; /* conf. space addr. of PM control/status reg */ + uint8_t pp_bse; /* conf. space addr. of PM BSE reg */ + uint8_t pp_data; /* conf. space addr. of PM data reg */ }; struct vpd_readonly { From owner-svn-src-head@FreeBSD.ORG Thu Oct 21 06:25: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 AE8C1106564A; Thu, 21 Oct 2010 06:25:57 +0000 (UTC) (envelope-from rpaulo@freebsd.org) Received: from karen.lavabit.com (karen.lavabit.com [72.249.41.33]) by mx1.freebsd.org (Postfix) with ESMTP id 3FE448FC12; Thu, 21 Oct 2010 06:25:57 +0000 (UTC) Received: from b.earth.lavabit.com (b.earth.lavabit.com [192.168.111.11]) by karen.lavabit.com (Postfix) with ESMTP id 50FB811B961; Thu, 21 Oct 2010 01:25:56 -0500 (CDT) Received: from rui-macbook.lan (bl16-141-47.dsl.telepac.pt [188.81.141.47]) by lavabit.com with ESMTP id KJSQYMYDEVKC; Thu, 21 Oct 2010 01:25:56 -0500 References: <201010202050.o9KKot6o068512@svn.freebsd.org> In-Reply-To: <201010202050.o9KKot6o068512@svn.freebsd.org> Mime-Version: 1.0 (Apple Message framework v1081) Content-Type: text/plain; charset=us-ascii Message-Id: Content-Transfer-Encoding: quoted-printable From: Rui Paulo Date: Thu, 21 Oct 2010 07:25:53 +0100 To: Pawel Jakub Dawidek X-Mailer: Apple Mail (2.1081) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r214118 - in head: sbin/geom/class/eli sys/geom/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: Thu, 21 Oct 2010 06:25:57 -0000 Great work. Might be worth adding the geli commands to /etc/rc.suspend & = /etc/rc.resume. You could do something that requires the minimum user configuration, = like: --- geli list 2>&1 > /dev/null if [ $? -eq 0 ]; then geli suspend -a fi --- Regards, -- Rui Paulo From owner-svn-src-head@FreeBSD.ORG Thu Oct 21 06:52: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 49AC9106564A; Thu, 21 Oct 2010 06:52:15 +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 1D3AE8FC1B; Thu, 21 Oct 2010 06:52: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 o9L6qF5c081583; Thu, 21 Oct 2010 06:52:15 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9L6qFvq081581; Thu, 21 Oct 2010 06:52:15 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <201010210652.o9L6qFvq081581@svn.freebsd.org> From: Edwin Groothuis Date: Thu, 21 Oct 2010 06:52: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: r214124 - head/usr.sbin/lpr/lpr 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, 21 Oct 2010 06:52:15 -0000 Author: edwin Date: Thu Oct 21 06:52:14 2010 New Revision: 214124 URL: http://svn.freebsd.org/changeset/base/214124 Log: Fix printing of files located on ZFS filesystem with an st_dev or st_ino larger than 2**31. From the PR: Printing from a ZFS filesystem using 'lp' fails and returns an email reporting "Your printer job was not printed because it was not linked to the original file". In order to protect against files being switched when files are printed using 'lp' or 'lpr -s', the st_dev and st_ino values for the original file are saved by lpr and verified by lpd before the file is printed. Unfortunately, lpr prints both values using '%d' (although both fields are unsigned) and lpd(8) assumes a string of decimal digits. ZFS (at least) generates st_dev values greater than 2^31-1, resulting in negative values being printed - which lpd cannot parse, leading it to report that the file has been switched. A similar problem would occur with large inode numbers. How-To-Repeat: Find a file with either st_dev or st_ino greater than 2^31-1 (stat(1) will report both numbers) and print it with 'lpq -s'. This should generate an email reporting that the file could not be printed because it was not linked to the original file PR: bin/151567 Submitted by: Peter Jeremy MFC after: 1 week Modified: head/usr.sbin/lpr/lpr/lpr.c Modified: head/usr.sbin/lpr/lpr/lpr.c ============================================================================== --- head/usr.sbin/lpr/lpr/lpr.c Thu Oct 21 01:13:41 2010 (r214123) +++ head/usr.sbin/lpr/lpr/lpr.c Thu Oct 21 06:52:14 2010 (r214124) @@ -386,7 +386,7 @@ main(int argc, char *argv[]) continue; /* file unreasonable */ if (sflag && (cp = linked(arg)) != NULL) { - (void) snprintf(buf, sizeof(buf), "%d %d", statb.st_dev, + (void) snprintf(buf, sizeof(buf), "%u %u", statb.st_dev, statb.st_ino); card('S', buf); if (format == 'p') From owner-svn-src-head@FreeBSD.ORG Thu Oct 21 08:56: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 8E4DD1065670; Thu, 21 Oct 2010 08:56:32 +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 240218FC23; Thu, 21 Oct 2010 08:56:31 +0000 (UTC) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id 36E9145CD9; Thu, 21 Oct 2010 10:56:29 +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 C45B945684; Thu, 21 Oct 2010 10:56:23 +0200 (CEST) Date: Thu, 21 Oct 2010 10:55:51 +0200 From: Pawel Jakub Dawidek To: Rui Paulo Message-ID: <20101021085551.GC3838@garage.freebsd.pl> References: <201010202050.o9KKot6o068512@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="69pVuxX8awAiJ7fD" Content-Disposition: inline In-Reply-To: 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: r214118 - in head: sbin/geom/class/eli sys/geom/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: Thu, 21 Oct 2010 08:56:32 -0000 --69pVuxX8awAiJ7fD Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Oct 21, 2010 at 07:25:53AM +0100, Rui Paulo wrote: > Great work. Might be worth adding the geli commands to /etc/rc.suspend & = /etc/rc.resume. >=20 > You could do something that requires the minimum user configuration, like: >=20 > --- > geli list 2>&1 > /dev/null > if [ $? -eq 0 ]; then > geli suspend -a > fi Well, this is not always safe. As I mentioned in the commit message this will cause deadlock if geli(8) command is stored on encrypted file system (you won't be able to resume). Good example of such situation is when you encrypt even your root file system. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --69pVuxX8awAiJ7fD Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAkzAABcACgkQForvXbEpPzS64ACdFNcEt35L3/9G6OBhljGMaO6H xqwAnjSc+C9av87BzzM/8uQimLhSo1rc =c2Oq -----END PGP SIGNATURE----- --69pVuxX8awAiJ7fD-- From owner-svn-src-head@FreeBSD.ORG Thu Oct 21 08:57: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 44B521065674; Thu, 21 Oct 2010 08:57:26 +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 DF8D88FC21; Thu, 21 Oct 2010 08:57: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 o9L8vPRf084309; Thu, 21 Oct 2010 08:57:25 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9L8vPVQ084307; Thu, 21 Oct 2010 08:57:25 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201010210857.o9L8vPVQ084307@svn.freebsd.org> From: Xin LI Date: Thu, 21 Oct 2010 08:57: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: r214125 - 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, 21 Oct 2010 08:57:26 -0000 Author: delphij Date: Thu Oct 21 08:57:25 2010 New Revision: 214125 URL: http://svn.freebsd.org/changeset/base/214125 Log: In syscall_module_handler(): all switch branches return, remove unreached code as pointed out in a Chinese forum [1]. [1] http://www.freebsdchina.org/forum/viewtopic.php?t=50619 Pointed out by: btw616 MFC after: 1 month Modified: head/sys/kern/kern_syscalls.c Modified: head/sys/kern/kern_syscalls.c ============================================================================== --- head/sys/kern/kern_syscalls.c Thu Oct 21 06:52:14 2010 (r214124) +++ head/sys/kern/kern_syscalls.c Thu Oct 21 08:57:25 2010 (r214125) @@ -184,10 +184,7 @@ syscall_module_handler(struct module *mo return EOPNOTSUPP; } - if (data->chainevh) - return (data->chainevh(mod, what, data->chainarg)); - else - return (0); + /* NOTREACHED */ } int From owner-svn-src-head@FreeBSD.ORG Thu Oct 21 09:29: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 CB822106566C; Thu, 21 Oct 2010 09:29: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 0D2E28FC1A; Thu, 21 Oct 2010 09:29:53 +0000 (UTC) Received: by wyb38 with SMTP id 38so4935593wyb.13 for ; Thu, 21 Oct 2010 02:29: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=SOZ5g+R5TO+TbVCZzQSHLz1wp8tlOC7pQJzEDnVzeT4=; b=daF4Bj1eRVVrJ/ZV/GNJPOq9QrPwf7EnkNBf0e1LVQqVzNOOsGi2Eq/O+ehw2jsBXg 0Lcc3iSSpB2puPg/DkdMuhFrA3At9y57NpJTJb966hgDIj8mx5T1CE66FwNIxjLH1gLb trMTo3rd/21d64Ca23ZGrpBvbhyZ5blzlRPyU= 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=mVJ1zX5H7rVoSM2AFhpoBFr5dEnUIfB7LBaqbS4MVEK/NqqEaOfEbfURHM51ctxHlE Xn2wK6DpQZ8uGv5gBximeQHCR5+rY8+omq0kEulfvP/yyL4N4XxN0CChBOOXZEKUCaNv tIQ0EEMd2UtLwp0DujpNZlYPQdRzZ8MXDVtY0= MIME-Version: 1.0 Received: by 10.216.164.199 with SMTP id c49mr594531wel.107.1287651728686; Thu, 21 Oct 2010 02:02:08 -0700 (PDT) Sender: yanegomi@gmail.com Received: by 10.216.135.67 with HTTP; Thu, 21 Oct 2010 02:02:08 -0700 (PDT) In-Reply-To: <20101021085551.GC3838@garage.freebsd.pl> References: <201010202050.o9KKot6o068512@svn.freebsd.org> <20101021085551.GC3838@garage.freebsd.pl> Date: Thu, 21 Oct 2010 02:02:08 -0700 X-Google-Sender-Auth: qbKn7Uw8LYfgZhK6byvtGGqZV0c 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, Rui Paulo Subject: Re: svn commit: r214118 - in head: sbin/geom/class/eli sys/geom/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: Thu, 21 Oct 2010 09:29:54 -0000 On Thu, Oct 21, 2010 at 1:55 AM, Pawel Jakub Dawidek wrot= e: > On Thu, Oct 21, 2010 at 07:25:53AM +0100, Rui Paulo wrote: >> Great work. Might be worth adding the geli commands to /etc/rc.suspend &= /etc/rc.resume. >> >> You could do something that requires the minimum user configuration, lik= e: >> >> --- >> geli list 2>&1 > /dev/null >> if [ $? -eq 0 ]; then >> =A0 =A0 =A0 geli suspend -a >> fi > > Well, this is not always safe. As I mentioned in the commit message this > will cause deadlock if geli(8) command is stored on encrypted file > system (you won't be able to resume). Good example of such situation is > when you encrypt even your root file system. I think it's pretty safe to say that if the user understands this limitation that they can add the relevant code to the end of rc.resume. Maybe rc.{resume,suspend}.local script hooks should be added for user-defined commands like this? Thanks, -Garrett From owner-svn-src-head@FreeBSD.ORG Thu Oct 21 10:36: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 A38CC106564A; Thu, 21 Oct 2010 10:36:36 +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 91CEC8FC17; Thu, 21 Oct 2010 10:36: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 o9LAaaic088140; Thu, 21 Oct 2010 10:36:36 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9LAaaLk088138; Thu, 21 Oct 2010 10:36:36 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201010211036.o9LAaaLk088138@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 21 Oct 2010 10:36: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: r214128 - head/lib/libgeom 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, 21 Oct 2010 10:36:36 -0000 Author: pjd Date: Thu Oct 21 10:36:36 2010 New Revision: 214128 URL: http://svn.freebsd.org/changeset/base/214128 Log: - Simplify gctl_get_handle() a bit. - Prefer 'unsigned int' over 'u_int' in userland code. Modified: head/lib/libgeom/geom_ctl.c Modified: head/lib/libgeom/geom_ctl.c ============================================================================== --- head/lib/libgeom/geom_ctl.c Thu Oct 21 10:13:52 2010 (r214127) +++ head/lib/libgeom/geom_ctl.c Thu Oct 21 10:36:36 2010 (r214128) @@ -54,7 +54,7 @@ static char nomemmsg[] = "Could not allo void gctl_dump(struct gctl_req *req, FILE *f) { - u_int i; + unsigned int i; int j; struct gctl_req_arg *ap; @@ -126,10 +126,8 @@ gctl_check_alloc(struct gctl_req *req, v struct gctl_req * gctl_get_handle(void) { - struct gctl_req *rp; - rp = calloc(1, sizeof *rp); - return (rp); + return (calloc(1, sizeof(struct gctl_req))); } /* @@ -233,7 +231,7 @@ gctl_issue(struct gctl_req *req) void gctl_free(struct gctl_req *req) { - u_int i; + unsigned int i; if (req == NULL) return; From owner-svn-src-head@FreeBSD.ORG Thu Oct 21 10:38: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 CEC1C1065670; Thu, 21 Oct 2010 10:38:14 +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 A2A608FC0A; Thu, 21 Oct 2010 10:38: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 o9LAcEgF088215; Thu, 21 Oct 2010 10:38:14 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9LAcEEs088213; Thu, 21 Oct 2010 10:38:14 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201010211038.o9LAcEEs088213@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 21 Oct 2010 10:38: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: r214129 - head/lib/libgeom 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, 21 Oct 2010 10:38:14 -0000 Author: pjd Date: Thu Oct 21 10:38:14 2010 New Revision: 214129 URL: http://svn.freebsd.org/changeset/base/214129 Log: Remove code duplication by introducing static gctl_param_add() function which is now used by both gctl_ro_param() and gctl_rw_param(). Modified: head/lib/libgeom/geom_ctl.c Modified: head/lib/libgeom/geom_ctl.c ============================================================================== --- head/lib/libgeom/geom_ctl.c Thu Oct 21 10:36:36 2010 (r214128) +++ head/lib/libgeom/geom_ctl.c Thu Oct 21 10:38:14 2010 (r214129) @@ -150,8 +150,9 @@ gctl_new_arg(struct gctl_req *req) return (ap); } -void -gctl_ro_param(struct gctl_req *req, const char *name, int len, const void* value) +static void +gctl_param_add(struct gctl_req *req, const char *name, int len, void *value, + int flag) { struct gctl_req_arg *ap; @@ -165,8 +166,8 @@ gctl_ro_param(struct gctl_req *req, cons if (ap->name == NULL) return; ap->nlen = strlen(ap->name) + 1; - ap->value = __DECONST(void *, value); - ap->flag = GCTL_PARAM_RD; + ap->value = value; + ap->flag = flag; if (len >= 0) ap->len = len; else if (len < 0) { @@ -176,26 +177,17 @@ gctl_ro_param(struct gctl_req *req, cons } void -gctl_rw_param(struct gctl_req *req, const char *name, int len, void* value) +gctl_ro_param(struct gctl_req *req, const char *name, int len, const void* value) { - struct gctl_req_arg *ap; - if (req == NULL || req->error != NULL) - return; - ap = gctl_new_arg(req); - if (ap == NULL) - return; - ap->name = strdup(name); - gctl_check_alloc(req, ap->name); - if (ap->name == NULL) - return; - ap->nlen = strlen(ap->name) + 1; - ap->value = value; - ap->flag = GCTL_PARAM_RW; - if (len >= 0) - ap->len = len; - else if (len < 0) - ap->len = strlen(value) + 1; + gctl_param_add(req, name, len, __DECONST(void *, value), GCTL_PARAM_RD); +} + +void +gctl_rw_param(struct gctl_req *req, const char *name, int len, void *value) +{ + + gctl_param_add(req, name, len, value, GCTL_PARAM_RW); } const char * From owner-svn-src-head@FreeBSD.ORG Thu Oct 21 10:38: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 01F9C1065672; Thu, 21 Oct 2010 10:38:53 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E47C18FC20; Thu, 21 Oct 2010 10:38: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 o9LAcqm4088260; Thu, 21 Oct 2010 10:38:52 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9LAcq6m088258; Thu, 21 Oct 2010 10:38:52 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201010211038.o9LAcq6m088258@svn.freebsd.org> From: Sergey Kandaurov Date: Thu, 21 Oct 2010 10:38: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: r214130 - head/sys/dev/mfi 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, 21 Oct 2010 10:38:53 -0000 Author: pluknet Date: Thu Oct 21 10:38:52 2010 New Revision: 214130 URL: http://svn.freebsd.org/changeset/base/214130 Log: Update PD state firmware definitions: add copyback, system. Reviewed by: jhb Approved by: avg (mentor) MFC after: 1 week Modified: head/sys/dev/mfi/mfireg.h Modified: head/sys/dev/mfi/mfireg.h ============================================================================== --- head/sys/dev/mfi/mfireg.h Thu Oct 21 10:38:14 2010 (r214129) +++ head/sys/dev/mfi/mfireg.h Thu Oct 21 10:38:52 2010 (r214130) @@ -975,7 +975,9 @@ enum mfi_pd_state { MFI_PD_STATE_OFFLINE = 0x10, MFI_PD_STATE_FAILED = 0x11, MFI_PD_STATE_REBUILD = 0x14, - MFI_PD_STATE_ONLINE = 0x18 + MFI_PD_STATE_ONLINE = 0x18, + MFI_PD_STATE_COPYBACK = 0x20, + MFI_PD_STATE_SYSTEM = 0x40 }; union mfi_ld_ref { From owner-svn-src-head@FreeBSD.ORG Thu Oct 21 10:46: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 8BBD11065672; Thu, 21 Oct 2010 10:46:18 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7A1018FC24; Thu, 21 Oct 2010 10:46: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 o9LAkIG3088502; Thu, 21 Oct 2010 10:46:18 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9LAkIcH088500; Thu, 21 Oct 2010 10:46:18 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201010211046.o9LAkIcH088500@svn.freebsd.org> From: Sergey Kandaurov Date: Thu, 21 Oct 2010 10:46: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: r214131 - 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: Thu, 21 Oct 2010 10:46:18 -0000 Author: pluknet Date: Thu Oct 21 10:46:18 2010 New Revision: 214131 URL: http://svn.freebsd.org/changeset/base/214131 Log: Enable copyback and system PD states. Reviewed by: jhb Approved by: avg (mentor) MFC after: 1 week X-MFC-After: r214130 Modified: head/usr.sbin/mfiutil/mfi_drive.c Modified: head/usr.sbin/mfiutil/mfi_drive.c ============================================================================== --- head/usr.sbin/mfiutil/mfi_drive.c Thu Oct 21 10:38:52 2010 (r214130) +++ head/usr.sbin/mfiutil/mfi_drive.c Thu Oct 21 10:46:18 2010 (r214131) @@ -65,6 +65,10 @@ mfi_pdstate(enum mfi_pd_state state) return ("REBUILD"); case MFI_PD_STATE_ONLINE: return ("ONLINE"); + case MFI_PD_STATE_COPYBACK: + return ("COPYBACK"); + case MFI_PD_STATE_SYSTEM: + return ("SYSTEM"); default: sprintf(buf, "PSTATE 0x%04x", state); return (buf); From owner-svn-src-head@FreeBSD.ORG Thu Oct 21 12:17: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 C41BC106566B; Thu, 21 Oct 2010 12:17:46 +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 925258FC13; Thu, 21 Oct 2010 12:17:46 +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 3860746B0C; Thu, 21 Oct 2010 08:17:46 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id EE0818A01D; Thu, 21 Oct 2010 08:17:44 -0400 (EDT) From: John Baldwin To: Xin LI Date: Thu, 21 Oct 2010 07:46:41 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100819; KDE/4.4.5; amd64; ; ) References: <201010210857.o9L8vPVQ084307@svn.freebsd.org> In-Reply-To: <201010210857.o9L8vPVQ084307@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201010210746.41227.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Thu, 21 Oct 2010 08:17:45 -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: r214125 - 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, 21 Oct 2010 12:17:47 -0000 On Thursday, October 21, 2010 4:57:25 am Xin LI wrote: > Author: delphij > Date: Thu Oct 21 08:57:25 2010 > New Revision: 214125 > URL: http://svn.freebsd.org/changeset/base/214125 > > Log: > In syscall_module_handler(): all switch branches return, remove > unreached code as pointed out in a Chinese forum [1]. > > [1] http://www.freebsdchina.org/forum/viewtopic.php?t=50619 > > Pointed out by: btw616 > MFC after: 1 month I think this exposes a bug though in that the default case doesn't pass through to chainevh. The default case should look more like the removed code (except returning EOPNOTSUPP instead of 0 if there is no chainevh). -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Thu Oct 21 12:27: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 78E981065693; Thu, 21 Oct 2010 12:27:14 +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 64E2A8FC20; Thu, 21 Oct 2010 12:27: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 o9LCREPq090464; Thu, 21 Oct 2010 12:27:14 GMT (envelope-from uqs@svn.freebsd.org) Received: (from uqs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9LCREQ2090452; Thu, 21 Oct 2010 12:27:14 GMT (envelope-from uqs@svn.freebsd.org) Message-Id: <201010211227.o9LCREQ2090452@svn.freebsd.org> From: Ulrich Spoerlein Date: Thu, 21 Oct 2010 12:27: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: r214132 - in head: lib/libc/sys sbin/fsirand sbin/ipfw sbin/restore share/man/man4 share/man/man5 share/man/man9 usr.bin/mesg usr.sbin/mtest 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, 21 Oct 2010 12:27:14 -0000 Author: uqs Date: Thu Oct 21 12:27:13 2010 New Revision: 214132 URL: http://svn.freebsd.org/changeset/base/214132 Log: mdoc: make pages render with mandoc It's a bit more pedantic regarding .Bl list elements. This has an added benefit of unbreaking the ipfw(8) manpage, where groff was silently skipping one list element. Modified: head/lib/libc/sys/getpriority.2 head/lib/libc/sys/pathconf.2 head/lib/libc/sys/stat.2 head/sbin/fsirand/fsirand.8 head/sbin/ipfw/ipfw.8 head/sbin/restore/restore.8 head/share/man/man4/iscsi_initiator.4 head/share/man/man5/elf.5 head/share/man/man9/sysctl_add_oid.9 head/usr.bin/mesg/mesg.1 head/usr.sbin/mtest/mtest.8 Modified: head/lib/libc/sys/getpriority.2 ============================================================================== --- head/lib/libc/sys/getpriority.2 Thu Oct 21 10:46:18 2010 (r214131) +++ head/lib/libc/sys/getpriority.2 Thu Oct 21 12:27:13 2010 (r214132) @@ -129,10 +129,10 @@ or .Dv PRIO_USER . .El .Pp -.Bl -tag -width Er In addition to the errors indicated above, .Fn setpriority will fail if: +.Bl -tag -width Er .It Bq Er EPERM A process was located, but neither its effective nor real user ID matched the effective user ID of the caller. Modified: head/lib/libc/sys/pathconf.2 ============================================================================== --- head/lib/libc/sys/pathconf.2 Thu Oct 21 10:46:18 2010 (r214131) +++ head/lib/libc/sys/pathconf.2 Thu Oct 21 12:27:13 2010 (r214132) @@ -89,7 +89,6 @@ returns information about the file the l The available values are as follows: .Pp .Bl -tag -width 6n -.Pp .It Li _PC_LINK_MAX The maximum file link count. .It Li _PC_MAX_CANON @@ -234,11 +233,11 @@ Too many symbolic links were encountered An I/O error occurred while reading from or writing to the file system. .El .Pp -.Bl -tag -width Er The .Fn fpathconf system call will fail if: +.Bl -tag -width Er .It Bq Er EBADF The .Fa fd Modified: head/lib/libc/sys/stat.2 ============================================================================== --- head/lib/libc/sys/stat.2 Thu Oct 21 10:46:18 2010 (r214131) +++ head/lib/libc/sys/stat.2 Thu Oct 21 12:27:13 2010 (r214132) @@ -345,10 +345,10 @@ represented correctly in the structure p .Fa sb . .El .Pp -.Bl -tag -width Er The .Fn fstat system call will fail if: +.Bl -tag -width Er .It Bq Er EBADF The .Fa fd Modified: head/sbin/fsirand/fsirand.8 ============================================================================== --- head/sbin/fsirand/fsirand.8 Thu Oct 21 10:46:18 2010 (r214131) +++ head/sbin/fsirand/fsirand.8 Thu Oct 21 12:27:13 2010 (r214132) @@ -73,8 +73,8 @@ The utility may be used on the root file system in single-user mode but the system should be rebooted via ``reboot -n'' afterwards. .Sh OPTIONS -.Bl -tag -width indent The available options are as follows: +.Bl -tag -width indent .It Fl b Use the default block size (usually 512 bytes) instead of the value gleaned from the disklabel. Modified: head/sbin/ipfw/ipfw.8 ============================================================================== --- head/sbin/ipfw/ipfw.8 Thu Oct 21 10:46:18 2010 (r214131) +++ head/sbin/ipfw/ipfw.8 Thu Oct 21 12:27:13 2010 (r214132) @@ -1009,11 +1009,11 @@ The second format with multiple addresses) is provided for convenience only and its use is discouraged. .It Ar addr : Oo Cm not Oc Bro -.Bl -tag -width indent .Cm any | me | me6 | .Cm table Ns Pq Ar number Ns Op , Ns Ar value .Ar | addr-list | addr-set .Brc +.Bl -tag -width indent .It Cm any matches any IP address. .It Cm me @@ -2176,7 +2176,6 @@ Finally, the following parameters can be pipes and queues: .Pp .Bl -tag -width XXXX -compact -.Pp .It Cm buckets Ar hash-table-size Specifies the size of the hash table used for storing the various queues. Modified: head/sbin/restore/restore.8 ============================================================================== --- head/sbin/restore/restore.8 Thu Oct 21 10:46:18 2010 (r214131) +++ head/sbin/restore/restore.8 Thu Oct 21 12:27:13 2010 (r214132) @@ -412,7 +412,6 @@ Most checks are self-explanatory or can Common errors are given below. .Pp .Bl -tag -width Ds -compact -.Pp .It : not found on tape The specified file name was listed in the tape directory, but was not found on the tape. Modified: head/share/man/man4/iscsi_initiator.4 ============================================================================== --- head/share/man/man4/iscsi_initiator.4 Thu Oct 21 10:46:18 2010 (r214131) +++ head/share/man/man4/iscsi_initiator.4 Thu Oct 21 12:27:13 2010 (r214132) @@ -90,8 +90,8 @@ see The .Nm driver creates the following: -.Bl -tag -width ".Pa /dev/iscsi%dxx" -compact .Pp +.Bl -tag -width ".Pa /dev/iscsi%dxx" -compact .It Pa /dev/iscsi used to create new sessions. .It Pa /dev/iscsi%d Modified: head/share/man/man5/elf.5 ============================================================================== --- head/share/man/man5/elf.5 Thu Oct 21 10:46:18 2010 (r214131) +++ head/share/man/man5/elf.5 Thu Oct 21 12:27:13 2010 (r214132) @@ -462,8 +462,8 @@ member in the total struct. .It Dv p_type This member of the Phdr struct tells what kind of segment this array element describes or how to interpret the array element's information. -.Bl -tag -width "PT_DYNAMIC" -compact .Pp +.Bl -tag -width "PT_DYNAMIC" -compact .It Dv PT_NULL The array element is unused and the other members' values are undefined. This lets the program header have ignored entries. Modified: head/share/man/man9/sysctl_add_oid.9 ============================================================================== --- head/share/man/man9/sysctl_add_oid.9 Thu Oct 21 10:46:18 2010 (r214131) +++ head/share/man/man9/sysctl_add_oid.9 Thu Oct 21 12:27:13 2010 (r214132) @@ -411,8 +411,8 @@ and to delete them later in orderly fash .Pp There is a set of macros defined that helps to create oids of given type. -.Bl -tag -width SYSCTL_ADD_STRINGXX They are as follows: +.Bl -tag -width SYSCTL_ADD_STRINGXX .It Fn SYSCTL_ADD_OID creates a raw oid. This macro is functionally equivalent to the Modified: head/usr.bin/mesg/mesg.1 ============================================================================== --- head/usr.bin/mesg/mesg.1 Thu Oct 21 10:46:18 2010 (r214131) +++ head/usr.bin/mesg/mesg.1 Thu Oct 21 12:27:13 2010 (r214132) @@ -70,8 +70,8 @@ displays the present message status to t The .Nm utility exits with one of the following values: -.Bl -tag -width flag -compact -offset indent .Pp +.Bl -tag -width flag -compact -offset indent .It Li "\ 0" Messages are allowed. .It Li "\ 1" Modified: head/usr.sbin/mtest/mtest.8 ============================================================================== --- head/usr.sbin/mtest/mtest.8 Thu Oct 21 10:46:18 2010 (r214131) +++ head/usr.sbin/mtest/mtest.8 Thu Oct 21 12:27:13 2010 (r214132) @@ -42,8 +42,8 @@ is a small program for testing multicast .Pp It accepts the following commands, interactively, or as part of a scripted input file (useful for automated testing): -.Bl -tag -width "a ifname e.e.e.e e.e.e.e" -compact -offset indent .Pp +.Bl -tag -width "a ifname e.e.e.e e.e.e.e" -compact -offset indent .\" .It Ic a Ar ifname Ar mac-addr Join the link-layer group address From owner-svn-src-head@FreeBSD.ORG Thu Oct 21 12:58: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 D3BEA106566B; Thu, 21 Oct 2010 12:58:26 +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 C2B098FC1E; Thu, 21 Oct 2010 12:58: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 o9LCwQ4X091170; Thu, 21 Oct 2010 12:58:26 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9LCwQbN091168; Thu, 21 Oct 2010 12:58:26 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201010211258.o9LCwQbN091168@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 21 Oct 2010 12:58: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: r214133 - head/sys/geom/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: Thu, 21 Oct 2010 12:58:26 -0000 Author: pjd Date: Thu Oct 21 12:58:26 2010 New Revision: 214133 URL: http://svn.freebsd.org/changeset/base/214133 Log: Fix a bug introduced in r213067 where we use authentication key before initializing it. Modified: head/sys/geom/eli/g_eli.c Modified: head/sys/geom/eli/g_eli.c ============================================================================== --- head/sys/geom/eli/g_eli.c Thu Oct 21 12:27:13 2010 (r214132) +++ head/sys/geom/eli/g_eli.c Thu Oct 21 12:58:26 2010 (r214133) @@ -686,14 +686,6 @@ g_eli_create(struct gctl_req *req, struc sc->sc_bytes_per_sector = (md->md_sectorsize - 1) / sc->sc_data_per_sector + 1; sc->sc_bytes_per_sector *= bpp->sectorsize; - /* - * Precalculate SHA256 for HMAC key generation. - * This is expensive operation and we can do it only once now or - * for every access to sector, so now will be much better. - */ - SHA256_Init(&sc->sc_akeyctx); - SHA256_Update(&sc->sc_akeyctx, sc->sc_akey, - sizeof(sc->sc_akey)); } gp->softc = sc; @@ -753,7 +745,16 @@ g_eli_create(struct gctl_req *req, struc */ g_eli_mkey_propagate(sc, mkey); sc->sc_ekeylen = md->md_keylen; - + if (sc->sc_flags & G_ELI_FLAG_AUTH) { + /* + * Precalculate SHA256 for HMAC key generation. + * This is expensive operation and we can do it only once now or + * for every access to sector, so now will be much better. + */ + SHA256_Init(&sc->sc_akeyctx); + SHA256_Update(&sc->sc_akeyctx, sc->sc_akey, + sizeof(sc->sc_akey)); + } /* * Precalculate SHA256 for IV generation. * This is expensive operation and we can do it only once now or for From owner-svn-src-head@FreeBSD.ORG Thu Oct 21 15:10: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 B67A6106566B; Thu, 21 Oct 2010 15:10:35 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 641F08FC17; Thu, 21 Oct 2010 15:10: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 o9LFAZdD094085; Thu, 21 Oct 2010 15:10:35 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9LFAZ5Y094083; Thu, 21 Oct 2010 15:10:35 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201010211510.o9LFAZ5Y094083@svn.freebsd.org> From: Ed Schouten Date: Thu, 21 Oct 2010 15:10: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: r214134 - head/lib/libc/gen 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, 21 Oct 2010 15:10:35 -0000 Author: ed Date: Thu Oct 21 15:10:35 2010 New Revision: 214134 URL: http://svn.freebsd.org/changeset/base/214134 Log: Fix error handling logic of pututxline(3). Instead of only returning NULL when the entry is invalid and can't be matched against the current database, also return it when it cannot open the log files properly. Modified: head/lib/libc/gen/pututxline.c Modified: head/lib/libc/gen/pututxline.c ============================================================================== --- head/lib/libc/gen/pututxline.c Thu Oct 21 12:58:26 2010 (r214133) +++ head/lib/libc/gen/pututxline.c Thu Oct 21 15:10:35 2010 (r214134) @@ -65,7 +65,7 @@ futx_open(const char *file) return (fp); } -static void +static int utx_active_add(const struct futx *fu) { FILE *fp; @@ -78,7 +78,7 @@ utx_active_add(const struct futx *fu) */ fp = futx_open(_PATH_UTX_ACTIVE); if (fp == NULL) - return; + return (1); while (fread(&fe, sizeof fe, 1, fp) == 1) { switch (fe.fu_type) { case USER_PROCESS: @@ -110,6 +110,7 @@ utx_active_add(const struct futx *fu) exact: fwrite(fu, sizeof *fu, 1, fp); fclose(fp); + return (0); } static int @@ -123,7 +124,7 @@ utx_active_remove(struct futx *fu) */ fp = futx_open(_PATH_UTX_ACTIVE); if (fp == NULL) - return (0); + return (1); while (fread(&fe, sizeof fe, 1, fp) == 1) { switch (fe.fu_type) { case USER_PROCESS: @@ -151,7 +152,7 @@ utx_active_purge(void) truncate(_PATH_UTX_ACTIVE, 0); } -static void +static int utx_lastlogin_add(const struct futx *fu) { FILE *fp; @@ -164,7 +165,7 @@ utx_lastlogin_add(const struct futx *fu) */ fp = futx_open(_PATH_UTX_LASTLOGIN); if (fp == NULL) - return; + return (1); while (fread(&fe, sizeof fe, 1, fp) == 1) { if (strncmp(fu->fu_user, fe.fu_user, sizeof fe.fu_user) != 0) continue; @@ -175,6 +176,7 @@ utx_lastlogin_add(const struct futx *fu) } fwrite(fu, sizeof *fu, 1, fp); fclose(fp); + return (0); } static void @@ -197,7 +199,7 @@ utx_lastlogin_upgrade(void) _close(fd); } -static void +static int utx_log_add(const struct futx *fu) { int fd; @@ -219,15 +221,17 @@ utx_log_add(const struct futx *fu) fd = _open(_PATH_UTX_LOG, O_CREAT|O_WRONLY|O_APPEND, 0644); if (fd < 0) - return; + return (1); _writev(fd, vec, 2); _close(fd); + return (0); } struct utmpx * pututxline(const struct utmpx *utmpx) { struct futx fu; + int bad = 0; utx_to_futx(utmpx, &fu); @@ -241,16 +245,21 @@ pututxline(const struct utmpx *utmpx) case NEW_TIME: break; case USER_PROCESS: - utx_active_add(&fu); - utx_lastlogin_add(&fu); + bad |= utx_active_add(&fu); + bad |= utx_lastlogin_add(&fu); break; #if 0 /* XXX: Are these records of any use to us? */ case INIT_PROCESS: case LOGIN_PROCESS: - utx_active_add(&fu); + bad |= utx_active_add(&fu); break; #endif case DEAD_PROCESS: + /* + * In case writing a logout entry fails, never attempt + * to write it to utx.log. The logout entry's ut_id + * might be invalid. + */ if (utx_active_remove(&fu) != 0) return (NULL); break; @@ -258,6 +267,6 @@ pututxline(const struct utmpx *utmpx) return (NULL); } - utx_log_add(&fu); - return (futx_to_utx(&fu)); + bad |= utx_log_add(&fu); + return (bad ? NULL : futx_to_utx(&fu)); } From owner-svn-src-head@FreeBSD.ORG Thu Oct 21 16:08: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 F3FB1106566B; Thu, 21 Oct 2010 16:08:31 +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 E1A788FC0C; Thu, 21 Oct 2010 16:08:31 +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 o9LG8Vvj095730; Thu, 21 Oct 2010 16:08:31 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9LG8VDG095728; Thu, 21 Oct 2010 16:08:31 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201010211608.o9LG8VDG095728@svn.freebsd.org> From: Robert Watson Date: Thu, 21 Oct 2010 16:08:31 +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: r214135 - 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: Thu, 21 Oct 2010 16:08:32 -0000 Author: rwatson Date: Thu Oct 21 16:08:31 2010 New Revision: 214135 URL: http://svn.freebsd.org/changeset/base/214135 Log: Improve the structure and implementation of the syscall_timing microbenchmark suite: - Use common benchmark_start/benchmark_stop routines to simplify individual benchmarks. - Add a central table of tests with names, where new tests can be hooked in easily. - Add new benchmarks for dup, shm_open, shm_open + fstat, fork, vfork, vfork + exec, chroot, setuid. - Accept a number of loops, not just a number of iterations. - Report results more usefully in a table. 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 Thu Oct 21 15:10:35 2010 (r214134) +++ head/tools/tools/syscall_timing/syscall_timing.c Thu Oct 21 16:08:31 2010 (r214135) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2003-2004 Robert N. M. Watson + * Copyright (c) 2003-2004, 2010 Robert N. M. Watson * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -27,26 +27,48 @@ */ #include +#include #include +#include #include +#include #include +#include +#include +#include #include #include #include #include -#define timespecsub(vvp, uvp) \ - do { \ - (vvp)->tv_sec -= (uvp)->tv_sec; \ - (vvp)->tv_nsec -= (uvp)->tv_nsec; \ - if ((vvp)->tv_nsec < 0) { \ - (vvp)->tv_sec--; \ - (vvp)->tv_nsec += 1000000000; \ - } \ - } while (0) +static struct timespec ts_start, ts_end; -inline void +#define timespecsub(vvp, uvp) \ + do { \ + (vvp)->tv_sec -= (uvp)->tv_sec; \ + (vvp)->tv_nsec -= (uvp)->tv_nsec; \ + if ((vvp)->tv_nsec < 0) { \ + (vvp)->tv_sec--; \ + (vvp)->tv_nsec += 1000000000; \ + } \ + } while (0) + +static void +benchmark_start(void) +{ + + assert(clock_gettime(CLOCK_REALTIME, &ts_start) == 0); +} + +static void +benchmark_stop(void) +{ + + assert(clock_gettime(CLOCK_REALTIME, &ts_end) == 0); +} + +void test_getuid(int num) { int i; @@ -55,11 +77,13 @@ test_getuid(int num) * Thread-local data should require no locking if system * call is MPSAFE. */ + benchmark_start(); for (i = 0; i < num; i++) getuid(); + benchmark_stop(); } -inline void +void test_getppid(int num) { int i; @@ -68,28 +92,28 @@ test_getppid(int num) * This is process-local, but can change, so will require a * lock. */ + benchmark_start(); for (i = 0; i < num; i++) getppid(); + benchmark_stop(); } -inline void +void test_clock_gettime(int num) { struct timespec ts; int i; - for (i = 0; i < num; i++) { - if (clock_gettime(CLOCK_REALTIME, &ts) == -1) { - perror("clock_gettime"); - exit(-1); - } - } + benchmark_start(); + for (i = 0; i < num; i++) + (void)clock_gettime(CLOCK_REALTIME, &ts); + benchmark_stop(); } -inline void +void test_pipe(int num) { - int i; + int fd[2], i; /* * pipe creation is expensive, as it will allocate a new file @@ -97,153 +121,397 @@ test_pipe(int num) * Destroying is also expensive, as we now have to free up * the file descriptors and return the pipe. */ + if (pipe(fd) < 0) + err(-1, "test_pipe: pipe"); + close(fd[0]); + close(fd[1]); + benchmark_start(); for (i = 0; i < num; i++) { - int fd[2]; - if (pipe(fd) == -1) { - perror("pipe"); - exit(-1); - } - + if (pipe(fd) == -1) + err(-1, "test_pipe: pipe"); close(fd[0]); close(fd[1]); } + benchmark_stop(); } -inline void +void test_socket_stream(int num) { int i, so; + so = socket(PF_LOCAL, SOCK_STREAM, 0); + if (so < 0) + err(-1, "test_socket_stream: socket"); + close(so); + benchmark_start(); for (i = 0; i < num; i++) { so = socket(PF_LOCAL, SOCK_STREAM, 0); - if (so == -1) { - perror("socket_stream"); - exit(-1); - } + if (so == -1) + err(-1, "test_socket_stream: socket"); close(so); } + benchmark_stop(); } -inline void +void test_socket_dgram(int num) { int i, so; + so = socket(PF_LOCAL, SOCK_DGRAM, 0); + if (so < 0) + err(-1, "test_socket_dgram: socket"); + close(so); + benchmark_start(); for (i = 0; i < num; i++) { so = socket(PF_LOCAL, SOCK_DGRAM, 0); - if (so == -1) { - perror("socket_dgram"); - exit(-1); - } + if (so == -1) + err(-1, "test_socket_dgram: socket"); close(so); } + benchmark_stop(); } -inline void +void test_socketpair_stream(int num) { int i, so[2]; + if (socketpair(PF_LOCAL, SOCK_STREAM, 0, so) == -1) + err(-1, "test_socketpair_stream: socketpair"); + close(so[0]); + close(so[1]); + benchmark_start(); for (i = 0; i < num; i++) { - if (socketpair(PF_LOCAL, SOCK_STREAM, 0, so) == -1) { - perror("socketpair_stream"); - exit(-1); - } + if (socketpair(PF_LOCAL, SOCK_STREAM, 0, so) == -1) + err(-1, "test_socketpair_stream: socketpair"); close(so[0]); close(so[1]); } + benchmark_stop(); } -inline void +void test_socketpair_dgram(int num) { int i, so[2]; + if (socketpair(PF_LOCAL, SOCK_DGRAM, 0, so) == -1) + err(-1, "test_socketpair_dgram: socketpair"); + close(so[0]); + close(so[1]); + benchmark_start(); for (i = 0; i < num; i++) { - if (socketpair(PF_LOCAL, SOCK_DGRAM, 0, so) == -1) { - perror("socketpair_dgram"); - exit(-1); - } + if (socketpair(PF_LOCAL, SOCK_DGRAM, 0, so) == -1) + err(-1, "test_socketpair_dgram: socketpair"); close(so[0]); close(so[1]); } + benchmark_stop(); } +void +test_dup(int num) +{ + int fd, i, shmfd; + + shmfd = shm_open(SHM_ANON, O_CREAT | O_RDWR, 0600); + if (shmfd < 0) + err(-1, "test_dup: shm_open"); + fd = dup(shmfd); + if (fd >= 0) + close(fd); + benchmark_start(); + for (i = 0; i < num; i++) { + fd = dup(shmfd); + if (fd >= 0) + close(fd); + } + benchmark_stop(); + close(shmfd); +} + +void +test_shmfd(int num) +{ + int i, shmfd; + + shmfd = shm_open(SHM_ANON, O_CREAT | O_RDWR, 0600); + if (shmfd < 0) + err(-1, "test_shmfd: shm_open"); + close(shmfd); + benchmark_start(); + for (i = 0; i < num; i++) { + shmfd = shm_open(SHM_ANON, O_CREAT | O_RDWR, 0600); + if (shmfd < 0) + err(-1, "test_shmfd: shm_open"); + close(shmfd); + } + benchmark_stop(); +} + +void +test_fstat_shmfd(int num) +{ + struct stat sb; + int i, shmfd; + + shmfd = shm_open(SHM_ANON, O_CREAT | O_RDWR, 0600); + if (shmfd < 0) + err(-1, "test_fstat_shmfd: shm_open"); + if (fstat(shmfd, &sb) < 0) + err(-1, "test_fstat_shmfd: fstat"); + benchmark_start(); + for (i = 0; i < num; i++) + (void)fstat(shmfd, &sb); + benchmark_stop(); + close(shmfd); +} + +void +test_fork(int num) +{ + pid_t pid; + int i; + + pid = fork(); + if (pid < 0) + err(-1, "test_fork: fork"); + if (pid == 0) + _exit(0); + if (waitpid(pid, NULL, 0) < 0) + err(-1, "test_fork: waitpid"); + benchmark_start(); + for (i = 0; i < num; i++) { + pid = fork(); + if (pid < 0) + err(-1, "test_fork: fork"); + if (pid == 0) + _exit(0); + if (waitpid(pid, NULL, 0) < 0) + err(-1, "test_fork: waitpid"); + } + benchmark_stop(); +} + +void +test_vfork(int num) +{ + pid_t pid; + int i; + + pid = vfork(); + if (pid < 0) + err(-1, "test_vfork: vfork"); + if (pid == 0) + _exit(0); + if (waitpid(pid, NULL, 0) < 0) + err(-1, "test_vfork: waitpid"); + benchmark_start(); + for (i = 0; i < num; i++) { + pid = vfork(); + if (pid < 0) + err(-1, "test_vfork: vfork"); + if (pid == 0) + _exit(0); + if (waitpid(pid, NULL, 0) < 0) + err(-1, "test_vfork: waitpid"); + } + benchmark_stop(); +} + +#define USR_BIN_TRUE "/usr/bin/true" +static char *execve_args[] = { USR_BIN_TRUE, NULL}; +extern char **environ; + +void +test_fork_exec(int num) +{ + pid_t pid; + int i; + + pid = fork(); + if (pid < 0) + err(-1, "test_fork_exec: fork"); + if (pid == 0) { + (void)execve(USR_BIN_TRUE, execve_args, environ); + err(-1, "execve"); + } + if (waitpid(pid, NULL, 0) < 0) + err(-1, "test_fork: waitpid"); + benchmark_start(); + for (i = 0; i < num; i++) { + pid = fork(); + if (pid < 0) + err(-1, "test_fork_exec: fork"); + if (pid == 0) { + (void)execve(USR_BIN_TRUE, execve_args, environ); + err(-1, "test_fork_exec: execve"); + } + if (waitpid(pid, NULL, 0) < 0) + err(-1, "test_fork_exec: waitpid"); + } + benchmark_stop(); +} + +void +test_vfork_exec(int num) +{ + pid_t pid; + int i; + + pid = vfork(); + if (pid < 0) + err(-1, "test_vfork_exec: vfork"); + if (pid == 0) { + (void)execve(USR_BIN_TRUE, execve_args, environ); + err(-1, "test_vfork_exec: execve"); + } + if (waitpid(pid, NULL, 0) < 0) + err(-1, "test_vfork_exec: waitpid"); + benchmark_start(); + for (i = 0; i < num; i++) { + pid = vfork(); + if (pid < 0) + err(-1, "test_vfork_exec: vfork"); + if (pid == 0) { + (void)execve(USR_BIN_TRUE, execve_args, environ); + err(-1, "execve"); + } + if (waitpid(pid, NULL, 0) < 0) + err(-1, "test_vfork_exec: waitpid"); + } + benchmark_stop(); +} + +void +test_chroot(int num) +{ + int i; + + if (chroot("/") < 0) + err(-1, "test_chroot: chroot"); + benchmark_start(); + for (i = 0; i < num; i++) { + if (chroot("/") < 0) + err(-1, "test_chroot: chroot"); + } + benchmark_stop(); +} + +void +test_setuid(int num) +{ + uid_t uid; + int i; + + uid = getuid(); + if (setuid(uid) < 0) + err(-1, "test_setuid: setuid"); + benchmark_start(); + for (i = 0; i < num; i++) { + if (setuid(uid) < 0) + err(-1, "test_setuid: setuid"); + } + benchmark_stop(); +} + +struct test { + const char *t_name; + void (*t_func)(int); +}; + +static const struct test tests[] = { + { "getuid", test_getuid }, + { "getppid", test_getppid }, + { "clock_gettime", test_clock_gettime }, + { "pipe", test_pipe }, + { "socket_stream", test_socket_stream }, + { "socket_dgram", test_socket_dgram }, + { "socketpair_stream", test_socketpair_stream }, + { "socketpair_dgram", test_socketpair_dgram }, + { "dup", test_dup }, + { "shmfd", test_shmfd }, + { "fstat_shmfd", test_fstat_shmfd }, + { "fork", test_fork }, + { "vfork", test_vfork }, + { "fork_exec", test_fork_exec }, + { "vfork_exec", test_vfork_exec }, + { "chroot", test_chroot }, + { "setuid", test_setuid }, +}; +static const int tests_count = sizeof(tests) / sizeof(tests[0]); + static void usage(void) { + int i; - fprintf(stderr, "syscall_timing [iterations] [test]\n"); - fprintf(stderr, - "supported tests: getuid getppid clock_gettime pipe\n" - "socket_stream socket_dgram socketpair_stream\n" - "socketpair_dgram\n"); + fprintf(stderr, "syscall_timing [iterations] [loops] [test]\n"); + for (i = 0; i < tests_count; i++) + fprintf(stderr, " %s\n", tests[i].t_name); exit(-1); } int main(int argc, char *argv[]) { - struct timespec ts_start, ts_end, ts_res; - int count; + struct timespec ts_res; + const struct test *the_test; + long long ll; + char *endp; + int i, j, k; + int iterations, loops; - if (argc != 3) + if (argc < 4) usage(); - count = atoi(argv[1]); - - assert(clock_getres(CLOCK_REALTIME, &ts_res) == 0); - printf("Clock resolution: %d.%09lu\n", ts_res.tv_sec, ts_res.tv_nsec); - if (strcmp(argv[2], "getuid") == 0) { - assert(clock_gettime(CLOCK_REALTIME, &ts_start) == 0); - test_getuid(count); - assert(clock_gettime(CLOCK_REALTIME, &ts_end) == 0); - } else if (strcmp(argv[2], "getppid") == 0) { - assert(clock_gettime(CLOCK_REALTIME, &ts_start) == 0); - test_getppid(count); - assert(clock_gettime(CLOCK_REALTIME, &ts_end) == 0); - } else if (strcmp(argv[2], "clock_gettime") == 0) { - assert(clock_gettime(CLOCK_REALTIME, &ts_start) == 0); - test_clock_gettime(count); - assert(clock_gettime(CLOCK_REALTIME, &ts_end) == 0); - } else if (strcmp(argv[2], "pipe") == 0) { - assert(clock_gettime(CLOCK_REALTIME, &ts_start) == 0); - test_pipe(count); - assert(clock_gettime(CLOCK_REALTIME, &ts_end) == 0); - } else if (strcmp(argv[2], "socket_stream") == 0) { - assert(clock_gettime(CLOCK_REALTIME, &ts_start) == 0); - test_socket_stream(count); - assert(clock_gettime(CLOCK_REALTIME, &ts_end) == 0); - } else if (strcmp(argv[2], "socket_dgram") == 0) { - assert(clock_gettime(CLOCK_REALTIME, &ts_start) == 0); - test_socket_dgram(count); - assert(clock_gettime(CLOCK_REALTIME, &ts_end) == 0); - } else if (strcmp(argv[2], "socketpair_stream") == 0) { - assert(clock_gettime(CLOCK_REALTIME, &ts_start) == 0); - test_socketpair_stream(count); - assert(clock_gettime(CLOCK_REALTIME, &ts_end) == 0); - } else if (strcmp(argv[2], "socketpair_dgram") == 0) { - assert(clock_gettime(CLOCK_REALTIME, &ts_start) == 0); - test_socketpair_dgram(count); - assert(clock_gettime(CLOCK_REALTIME, &ts_end) == 0); - } else + ll = strtoll(argv[1], &endp, 10); + if (*endp != 0 || ll < 0 || ll > 100000) usage(); + iterations = ll; - timespecsub(&ts_end, &ts_start); - - printf("test: %s\n", argv[2]); + ll = strtoll(argv[2], &endp, 10); + if (*endp != 0 || ll < 0 || ll > 100000) + usage(); + loops = ll; - printf("%d.%09lu for %d iterations\n", ts_end.tv_sec, - ts_end.tv_nsec, count); + assert(clock_getres(CLOCK_REALTIME, &ts_res) == 0); + printf("Clock resolution: %ju.%ju\n", (uintmax_t)ts_res.tv_sec, + (uintmax_t)ts_res.tv_nsec); + printf("test\tloop\ttotal\titerations\tperiteration\n"); + + for (j = 3; j < argc; j++) { + the_test = NULL; + for (i = 0; i < tests_count; i++) { + if (strcmp(argv[j], tests[i].t_name) == 0) + the_test = &tests[i]; + } + if (the_test == NULL) + usage(); - /* - * Note. This assumes that each iteration takes less than - * a second, and that our total nanoseconds doesn't exceed - * the room in our arithmetic unit. Fine for system calls, - * but not for long things. - */ - ts_end.tv_sec *= 1000000000 / count; - printf("0.%09lu per/iteration\n", - ts_end.tv_sec + ts_end.tv_nsec / count); + /* + * Run one warmup, then do the real thing (loops) times. + */ + the_test->t_func(iterations); + for (k = 0; k < loops; k++) { + the_test->t_func(iterations); + timespecsub(&ts_end, &ts_start); + printf("%s\t%d\t", the_test->t_name, k); + printf("%ju.%09ju\t%d\t", (uintmax_t)ts_end.tv_sec, + (uintmax_t)ts_end.tv_nsec, iterations); + + /* + * Note. This assumes that each iteration takes less than + * a second, and that our total nanoseconds doesn't exceed + * the room in our arithmetic unit. Fine for system calls, + * but not for long things. + */ + ts_end.tv_sec *= 1000000000 / iterations; + printf("0.%09ju\n", (uintmax_t)(ts_end.tv_sec + + ts_end.tv_nsec / iterations)); + } + } return (0); } From owner-svn-src-head@FreeBSD.ORG Thu Oct 21 16:20: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 59A16106564A; Thu, 21 Oct 2010 16:20:49 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 48B2C8FC23; Thu, 21 Oct 2010 16:20: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 o9LGKnMn096046; Thu, 21 Oct 2010 16:20:49 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9LGKnmT096042; Thu, 21 Oct 2010 16:20:49 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201010211620.o9LGKnmT096042@svn.freebsd.org> From: Sergey Kandaurov Date: Thu, 21 Oct 2010 16:20: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: r214136 - in head/sys: net 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: Thu, 21 Oct 2010 16:20:49 -0000 Author: pluknet Date: Thu Oct 21 16:20:48 2010 New Revision: 214136 URL: http://svn.freebsd.org/changeset/base/214136 Log: Reshuffle SIOCGIFCONF32 handler from r155224. - move all the chunks into one file, which allows to hide SIOCGIFCONF32 global definition as well. - replace __amd64__ with proper COMPAT_FREEBSD32 around. - handle 32bit capacity before going into the handler itself instead of doing internal 32bit specific changes within it (e.g. as it's done for SIOCGDEFIFACE32_IN6). - use explicitely sized types for ABI compat. Approved by: kib (mentor) MFC after: 2 weeks Modified: head/sys/net/if.c head/sys/net/if.h head/sys/sys/sockio.h Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Thu Oct 21 16:08:31 2010 (r214135) +++ head/sys/net/if.c Thu Oct 21 16:20:48 2010 (r214136) @@ -92,6 +92,11 @@ #include +#ifdef COMPAT_FREEBSD32 +#include +#include +#endif + struct ifindex_entry { struct ifnet *ife_ifnet; }; @@ -2402,6 +2407,17 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, return (error); } +#ifdef COMPAT_FREEBSD32 +struct ifconf32 { + int32_t ifc_len; + union { + uint32_t ifcu_buf; + uint32_t ifcu_req; + } ifc_ifcu; +}; +#define SIOCGIFCONF32 _IOWR('i', 36, struct ifconf32) +#endif + /* * Interface ioctls. */ @@ -2416,10 +2432,21 @@ ifioctl(struct socket *so, u_long cmd, c switch (cmd) { case SIOCGIFCONF: case OSIOCGIFCONF: -#ifdef __amd64__ + return (ifconf(cmd, data)); + +#ifdef COMPAT_FREEBSD32 case SIOCGIFCONF32: + { + struct ifconf32 *ifc32; + struct ifconf ifc; + + ifc32 = (struct ifconf32 *)data; + ifc.ifc_len = ifc32->ifc_len; + ifc.ifc_buf = PTRIN(ifc32->ifc_buf); + + return (ifconf(SIOCGIFCONF, (void *)&ifc)); + } #endif - return (ifconf(cmd, data)); } ifr = (struct ifreq *)data; @@ -2646,23 +2673,12 @@ static int ifconf(u_long cmd, caddr_t data) { struct ifconf *ifc = (struct ifconf *)data; -#ifdef __amd64__ - struct ifconf32 *ifc32 = (struct ifconf32 *)data; - struct ifconf ifc_swab; -#endif struct ifnet *ifp; struct ifaddr *ifa; struct ifreq ifr; struct sbuf *sb; int error, full = 0, valid_len, max_len; -#ifdef __amd64__ - if (cmd == SIOCGIFCONF32) { - ifc_swab.ifc_len = ifc32->ifc_len; - ifc_swab.ifc_buf = (caddr_t)(uintptr_t)ifc32->ifc_buf; - ifc = &ifc_swab; - } -#endif /* Limit initial buffer size to MAXPHYS to avoid DoS from userspace. */ max_len = MAXPHYS - 1; @@ -2752,10 +2768,6 @@ again: } ifc->ifc_len = valid_len; -#ifdef __amd64__ - if (cmd == SIOCGIFCONF32) - ifc32->ifc_len = valid_len; -#endif sbuf_finish(sb); error = copyout(sbuf_data(sb), ifc->ifc_req, ifc->ifc_len); sbuf_delete(sb); Modified: head/sys/net/if.h ============================================================================== --- head/sys/net/if.h Thu Oct 21 16:08:31 2010 (r214135) +++ head/sys/net/if.h Thu Oct 21 16:20:48 2010 (r214136) @@ -391,16 +391,6 @@ struct ifconf { #define ifc_req ifc_ifcu.ifcu_req /* array of structures returned */ }; -#if defined (__amd64__) -struct ifconf32 { - int ifc_len; /* size of associated buffer */ - union { - u_int ifcu_buf; - u_int ifcu_req; - } ifc_ifcu; -}; -#endif - /* * interface groups */ Modified: head/sys/sys/sockio.h ============================================================================== --- head/sys/sys/sockio.h Thu Oct 21 16:08:31 2010 (r214135) +++ head/sys/sys/sockio.h Thu Oct 21 16:20:48 2010 (r214136) @@ -62,9 +62,6 @@ #define SIOCSIFBRDADDR _IOW('i', 19, struct ifreq) /* set broadcast addr */ #define OSIOCGIFCONF _IOWR('i', 20, struct ifconf) /* get ifnet list */ #define SIOCGIFCONF _IOWR('i', 36, struct ifconf) /* get ifnet list */ -#if defined (__amd64__) -#define SIOCGIFCONF32 _IOWR('i', 36, struct ifconf32) /* get ifnet list */ -#endif #define OSIOCGIFNETMASK _IOWR('i', 21, struct ifreq) /* get net addr mask */ #define SIOCGIFNETMASK _IOWR('i', 37, struct ifreq) /* get net addr mask */ #define SIOCSIFNETMASK _IOW('i', 22, struct ifreq) /* set net addr mask */ From owner-svn-src-head@FreeBSD.ORG Thu Oct 21 17:05: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 2DEE6106566C; Thu, 21 Oct 2010 17:05:16 +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 1D8668FC17; Thu, 21 Oct 2010 17:05: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 o9LH5Gva097262; Thu, 21 Oct 2010 17:05:16 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9LH5GH5097260; Thu, 21 Oct 2010 17:05:16 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201010211705.o9LH5GH5097260@svn.freebsd.org> From: Gleb Smirnoff Date: Thu, 21 Oct 2010 17:05: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: r214137 - head/usr.bin/unzip 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, 21 Oct 2010 17:05:16 -0000 Author: glebius Date: Thu Oct 21 17:05:15 2010 New Revision: 214137 URL: http://svn.freebsd.org/changeset/base/214137 Log: Make it possible to read input from stdin. Without this change I don't see a way to unpack a multivolume archive without wasting disk space for a temporary file. Modified: head/usr.bin/unzip/unzip.c Modified: head/usr.bin/unzip/unzip.c ============================================================================== --- head/usr.bin/unzip/unzip.c Thu Oct 21 16:20:48 2010 (r214136) +++ head/usr.bin/unzip/unzip.c Thu Oct 21 17:05:15 2010 (r214137) @@ -859,7 +859,9 @@ unzip(const char *fn) int fd, ret; uintmax_t total_size, file_count, error_count; - if ((fd = open(fn, O_RDONLY)) < 0) + if (strcmp(fn, "-") == 0) + fd = STDIN_FILENO; + else if ((fd = open(fn, O_RDONLY)) < 0) error("%s", fn); if ((a = archive_read_new()) == NULL) @@ -913,7 +915,7 @@ unzip(const char *fn) ac(archive_read_close(a)); (void)archive_read_finish(a); - if (close(fd) != 0) + if (fd != STDIN_FILENO && close(fd) != 0) error("%s", fn); if (t_opt) { From owner-svn-src-head@FreeBSD.ORG Thu Oct 21 17:14: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 0BE75106566B; Thu, 21 Oct 2010 17:14:45 +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 EFC488FC15; Thu, 21 Oct 2010 17:14: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 o9LHEibC097505; Thu, 21 Oct 2010 17:14:44 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9LHEiAK097503; Thu, 21 Oct 2010 17:14:44 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201010211714.o9LHEiAK097503@svn.freebsd.org> From: Warner Losh Date: Thu, 21 Oct 2010 17:14: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: r214138 - head/usr.sbin/pc-sysinstall/backend 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, 21 Oct 2010 17:14:45 -0000 Author: imp Date: Thu Oct 21 17:14:44 2010 New Revision: 214138 URL: http://svn.freebsd.org/changeset/base/214138 Log: This small patch updates the "geli setkey" flags pc-sysinstall uses when saving a users passphrase, to make it work in HEAD with recent geli improvements. Submitted by: Kris Moore PR: 151002 Modified: head/usr.sbin/pc-sysinstall/backend/functions-cleanup.sh Modified: head/usr.sbin/pc-sysinstall/backend/functions-cleanup.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend/functions-cleanup.sh Thu Oct 21 17:05:15 2010 (r214137) +++ head/usr.sbin/pc-sysinstall/backend/functions-cleanup.sh Thu Oct 21 17:14:44 2010 (r214138) @@ -296,7 +296,7 @@ setup_geli_loading() # If we have a passphrase, set it up now if [ -e "${PARTDIR}-enc/${PART}-encpass" ] ; then - cat ${PARTDIR}-enc/${PART}-encpass | geli setkey -S -n 0 -p -k ${KEYFILE} -K ${KEYFILE} ${PART} + geli setkey -J ${PARTDIR}-enc/${PART}-encpass -n 0 -p -k ${KEYFILE} -K ${KEYFILE} ${PART} geli configure -b ${PART} fi From owner-svn-src-head@FreeBSD.ORG Thu Oct 21 17:20: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 054BA106566C; Thu, 21 Oct 2010 17:20:38 +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 DFBC38FC1E; Thu, 21 Oct 2010 17:20: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 o9LHKb8J097654; Thu, 21 Oct 2010 17:20:37 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9LHKbdg097652; Thu, 21 Oct 2010 17:20:37 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201010211720.o9LHKbdg097652@svn.freebsd.org> From: Warner Losh Date: Thu, 21 Oct 2010 17:20: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: r214139 - head/usr.sbin/pc-sysinstall/backend 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, 21 Oct 2010 17:20:38 -0000 Author: imp Date: Thu Oct 21 17:20:37 2010 New Revision: 214139 URL: http://svn.freebsd.org/changeset/base/214139 Log: This is an updated patch to the last patch to do this which fixes a local variable issue. This patch decompresses compressed images to the stdout when writing to a device to avoid running out of space issues. Submitted by: John Hixson Pr: 151049 Modified: head/usr.sbin/pc-sysinstall/backend/functions.sh Modified: head/usr.sbin/pc-sysinstall/backend/functions.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend/functions.sh Thu Oct 21 17:14:44 2010 (r214138) +++ head/usr.sbin/pc-sysinstall/backend/functions.sh Thu Oct 21 17:20:37 2010 (r214139) @@ -325,64 +325,8 @@ get_compression_type() export VAL } -decompress_file() -{ - local FILE - local COMPRESSION - - FILE="$1" - COMPRESSION="$2" - - if [ -n "${COMPRESSION}" ] - then - case "${COMPRESSION}" in - lzw) - rc_halt "uncompress ${FILE}" - VAL="${FILE%.Z}" - ;; - - lzo) - rc_halt "lzop -d ${FILE}" - VAL="${FILE%.lzo}" - ;; - - lzma) - rc_halt "lzma -d ${FILE}" - VAL="${FILE%.lzma}" - ;; - - gzip) - rc_halt "gunzip ${FILE}" - VAL="${FILE%.gz}" - ;; - - bzip2) - rc_halt "bunzip2 ${FILE}" - VAL="${FILE%.bz2}" - ;; - - xz) - rc_halt "xz -d ${FILE}" - VAL="${FILE%.xz}" - ;; - - zip) - rc_halt "unzip ${FILE}" - VAL="${FILE%.zip}" - ;; - - *) - exit_err "ERROR: ${COMPRESSION} compression is not supported" - ;; - esac - fi - - export VAL -} - write_image() { - local IMAGE_FILE local DEVICE_FILE IMAGE_FILE="$1" @@ -418,11 +362,51 @@ write_image() get_compression_type "${IMAGE_FILE}" COMPRESSION="${VAL}" - decompress_file "${IMAGE_FILE}" "${COMPRESSION}" - IMAGE_FILE="${VAL}" - fi + case "${COMPRESSION}" in + lzw) + rc_halt "uncompress ${IMAGE_FILE} -c | dd of=${DEVICE_FILE} bs=128k" + IMAGE_FILE="${IMAGE_FILE%.Z}" + ;; + + lzo) + rc_halt "lzop -d $IMAGE_{FILE} -c | dd of=${DEVICE_FILE} bs=128k" + IMAGE_FILE="${IMAGE_FILE%.lzo}" + ;; + + lzma) + rc_halt "lzma -d ${IMAGE_FILE} -c | dd of=${DEVICE_FILE} bs=128k" + IMAGE_FILE="${IMAGE_FILE%.lzma}" + ;; + + gzip) + rc_halt "gunzip ${IMAGE_FILE} -c | dd of=${DEVICE_FILE} bs=128k" + IMAGE_FILE="${IMAGE_FILE%.gz}" + ;; - rc_halt "dd if=${IMAGE_FILE} of=${DEVICE_FILE} bs=128k" + bzip2) + rc_halt "bunzip2 ${IMAGE_FILE} -c | dd of=${DEVICE_FILE} bs=128k" + IMAGE_FILE="${IMAGE_FILE%.bz2}" + ;; + + xz) + rc_halt "xz -d ${IMAGE_FILE} -c | dd of=${DEVICE_FILE} bs=128k" + IMAGE_FILE="${IMAGE_FILE%.xz}" + ;; + + zip) + rc_halt "unzip ${IMAGE_FILE} -c | dd of=${DEVICE_FILE} bs=128k" + IMAGE_FILE="${IMAGE_FILE%.zip}" + ;; + + *) + exit_err "ERROR: ${COMPRESSION} compression is not supported" + ;; + esac + + else + rc_halt "dd if=${IMAGE_FILE} of=${DEVICE_FILE} bs=128k" + + fi }; install_fresh() From owner-svn-src-head@FreeBSD.ORG Thu Oct 21 17:23: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 90E70106566C; Thu, 21 Oct 2010 17:23:09 +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 808948FC13; Thu, 21 Oct 2010 17:23: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 o9LHN9hb097756; Thu, 21 Oct 2010 17:23:09 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9LHN9Wn097754; Thu, 21 Oct 2010 17:23:09 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201010211723.o9LHN9Wn097754@svn.freebsd.org> From: Gleb Smirnoff Date: Thu, 21 Oct 2010 17:23: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: r214140 - head/usr.bin/unzip 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, 21 Oct 2010 17:23:09 -0000 Author: glebius Date: Thu Oct 21 17:23:09 2010 New Revision: 214140 URL: http://svn.freebsd.org/changeset/base/214140 Log: Document possibility to read from stdin. Modified: head/usr.bin/unzip/unzip.1 Modified: head/usr.bin/unzip/unzip.1 ============================================================================== --- head/usr.bin/unzip/unzip.1 Thu Oct 21 17:20:37 2010 (r214139) +++ head/usr.bin/unzip/unzip.1 Thu Oct 21 17:23:09 2010 (r214140) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 16, 2010 +.Dd October 21, 2010 .Dt UNZIP 1 .Os .Sh NAME @@ -111,6 +111,10 @@ Note that only one of and .Fl u may be specified. +Is specified filename is +.Va Qq - , +then data is read from +.Va stdin . .Sh ENVIRONMENT If the .Ev UNZIP_DEBUG From owner-svn-src-head@FreeBSD.ORG Thu Oct 21 17:23: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 63CE91065670; Thu, 21 Oct 2010 17:23:48 +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 535E18FC21; Thu, 21 Oct 2010 17:23:48 +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 o9LHNmGE097809; Thu, 21 Oct 2010 17:23:48 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9LHNmNE097807; Thu, 21 Oct 2010 17:23:48 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201010211723.o9LHNmNE097807@svn.freebsd.org> From: Warner Losh Date: Thu, 21 Oct 2010 17:23:48 +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: r214141 - 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, 21 Oct 2010 17:23:48 -0000 Author: imp Date: Thu Oct 21 17:23:48 2010 New Revision: 214141 URL: http://svn.freebsd.org/changeset/base/214141 Log: This patch will only list components if the directory exists. The directory exist on PC-BSD but not FreeBSD, so an extra check is made. Submitted by: John Hixson PR: 151461 Modified: head/usr.sbin/pc-sysinstall/backend-query/list-components.sh Modified: head/usr.sbin/pc-sysinstall/backend-query/list-components.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend-query/list-components.sh Thu Oct 21 17:23:09 2010 (r214140) +++ head/usr.sbin/pc-sysinstall/backend-query/list-components.sh Thu Oct 21 17:23:48 2010 (r214141) @@ -32,23 +32,24 @@ echo "Available Components:" -cd ${COMPDIR} -for i in `ls -d *` -do - if [ -e "${i}/component.cfg" -a -e "${i}/install.sh" -a -e "${i}/distfiles" ] - then - NAME="`grep 'name:' ${i}/component.cfg | cut -d ':' -f 2`" - DESC="`grep 'description:' ${i}/component.cfg | cut -d ':' -f 2`" - TYPE="`grep 'type:' ${i}/component.cfg | cut -d ':' -f 2`" - echo " " - echo "name: ${i}" - echo "desc:${DESC}" - echo "type:${TYPE}" - if [ -e "${i}/component.png" ] +if [ -d "${COMPDIR}" ] +then + cd ${COMPDIR} + for i in `ls -d *` + do + if [ -e "${i}/component.cfg" -a -e "${i}/install.sh" -a -e "${i}/distfiles" ] then - echo "icon: ${COMPDIR}/${i}/component.png" + NAME="`grep 'name:' ${i}/component.cfg | cut -d ':' -f 2`" + DESC="`grep 'description:' ${i}/component.cfg | cut -d ':' -f 2`" + TYPE="`grep 'type:' ${i}/component.cfg | cut -d ':' -f 2`" + echo " " + echo "name: ${i}" + echo "desc:${DESC}" + echo "type:${TYPE}" + if [ -e "${i}/component.png" ] + then + echo "icon: ${COMPDIR}/${i}/component.png" + fi fi - fi - -done - + done +fi From owner-svn-src-head@FreeBSD.ORG Thu Oct 21 17:27: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 EBC29106564A; Thu, 21 Oct 2010 17:27:39 +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 D9C718FC22; Thu, 21 Oct 2010 17:27: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 o9LHRdOL097914; Thu, 21 Oct 2010 17:27:39 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9LHRdpe097912; Thu, 21 Oct 2010 17:27:39 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201010211727.o9LHRdpe097912@svn.freebsd.org> From: Robert Watson Date: Thu, 21 Oct 2010 17:27: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: r214142 - 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: Thu, 21 Oct 2010 17:27:40 -0000 Author: rwatson Date: Thu Oct 21 17:27:39 2010 New Revision: 214142 URL: http://svn.freebsd.org/changeset/base/214142 Log: Further enhancements to syscall_timing: - Use getopt rather than hand-parsed arguments - Allow iterations to be specified and/or a new number of seconds bound on the number of iterations - Fix printout of timer resolution - Add new tests, such as TCP and UDP socket creation, and open/read/close of /dev/zero and /dev/null. 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 Thu Oct 21 17:23:48 2010 (r214141) +++ head/tools/tools/syscall_timing/syscall_timing.c Thu Oct 21 17:27:39 2010 (r214142) @@ -37,12 +37,16 @@ #include #include #include +#include +#include #include #include #include #include static struct timespec ts_start, ts_end; +static int alarm_timeout; +static volatile int alarm_fired; #define timespecsub(vvp, uvp) \ do { \ @@ -55,9 +59,21 @@ static struct timespec ts_start, ts_end; } while (0) static void +alarm_handler(int signum) +{ + + alarm_fired = 1; +} + +static void benchmark_start(void) { + alarm_fired = 0; + if (alarm_timeout) { + signal(SIGALRM, alarm_handler); + alarm(alarm_timeout); + } assert(clock_gettime(CLOCK_REALTIME, &ts_start) == 0); } @@ -68,50 +84,62 @@ benchmark_stop(void) assert(clock_gettime(CLOCK_REALTIME, &ts_end) == 0); } -void -test_getuid(int num) +uint64_t +test_getuid(uint64_t num, uint64_t int_arg, const char *string_arg) { - int i; + uint64_t i; /* * Thread-local data should require no locking if system * call is MPSAFE. */ benchmark_start(); - for (i = 0; i < num; i++) + for (i = 0; i < num; i++) { + if (alarm_fired) + break; getuid(); + } benchmark_stop(); + return (i); } -void -test_getppid(int num) +uint64_t +test_getppid(uint64_t num, uint64_t int_arg, const char *string_arg) { - int i; + uint64_t i; /* * This is process-local, but can change, so will require a * lock. */ benchmark_start(); - for (i = 0; i < num; i++) + for (i = 0; i < num; i++) { + if (alarm_fired) + break; getppid(); + } benchmark_stop(); + return (i); } -void -test_clock_gettime(int num) +uint64_t +test_clock_gettime(uint64_t num, uint64_t int_arg, const char *string_arg) { struct timespec ts; - int i; + uint64_t i; benchmark_start(); - for (i = 0; i < num; i++) + for (i = 0; i < num; i++) { + if (alarm_fired) + break; (void)clock_gettime(CLOCK_REALTIME, &ts); + } benchmark_stop(); + return (i); } -void -test_pipe(int num) +uint64_t +test_pipe(uint64_t num, uint64_t int_arg, const char *string_arg) { int fd[2], i; @@ -127,56 +155,66 @@ test_pipe(int num) close(fd[1]); benchmark_start(); for (i = 0; i < num; i++) { + if (alarm_fired) + break; if (pipe(fd) == -1) err(-1, "test_pipe: pipe"); close(fd[0]); close(fd[1]); } benchmark_stop(); + return (i); } -void -test_socket_stream(int num) +uint64_t +test_socket_stream(uint64_t num, uint64_t int_arg, const char *string_arg) { - int i, so; + uint64_t i, so; - so = socket(PF_LOCAL, SOCK_STREAM, 0); + so = socket(int_arg, SOCK_STREAM, 0); if (so < 0) err(-1, "test_socket_stream: socket"); close(so); benchmark_start(); for (i = 0; i < num; i++) { - so = socket(PF_LOCAL, SOCK_STREAM, 0); + if (alarm_fired) + break; + so = socket(int_arg, SOCK_STREAM, 0); if (so == -1) err(-1, "test_socket_stream: socket"); close(so); } benchmark_stop(); + return (i); } -void -test_socket_dgram(int num) +uint64_t +test_socket_dgram(uint64_t num, uint64_t int_arg, const char *string_arg) { - int i, so; + uint64_t i, so; - so = socket(PF_LOCAL, SOCK_DGRAM, 0); + so = socket(int_arg, SOCK_DGRAM, 0); if (so < 0) err(-1, "test_socket_dgram: socket"); close(so); benchmark_start(); for (i = 0; i < num; i++) { - so = socket(PF_LOCAL, SOCK_DGRAM, 0); + if (alarm_fired) + break; + so = socket(int_arg, SOCK_DGRAM, 0); if (so == -1) err(-1, "test_socket_dgram: socket"); close(so); } benchmark_stop(); + return (i); } -void -test_socketpair_stream(int num) +uint64_t +test_socketpair_stream(uint64_t num, uint64_t int_arg, const char *string_arg) { - int i, so[2]; + uint64_t i; + int so[2]; if (socketpair(PF_LOCAL, SOCK_STREAM, 0, so) == -1) err(-1, "test_socketpair_stream: socketpair"); @@ -184,18 +222,22 @@ test_socketpair_stream(int num) close(so[1]); benchmark_start(); for (i = 0; i < num; i++) { + if (alarm_fired) + break; if (socketpair(PF_LOCAL, SOCK_STREAM, 0, so) == -1) err(-1, "test_socketpair_stream: socketpair"); close(so[0]); close(so[1]); } benchmark_stop(); + return (i); } -void -test_socketpair_dgram(int num) +uint64_t +test_socketpair_dgram(uint64_t num, uint64_t int_arg, const char *string_arg) { - int i, so[2]; + uint64_t i; + int so[2]; if (socketpair(PF_LOCAL, SOCK_DGRAM, 0, so) == -1) err(-1, "test_socketpair_dgram: socketpair"); @@ -203,16 +245,71 @@ test_socketpair_dgram(int num) close(so[1]); benchmark_start(); for (i = 0; i < num; i++) { + if (alarm_fired) + break; if (socketpair(PF_LOCAL, SOCK_DGRAM, 0, so) == -1) err(-1, "test_socketpair_dgram: socketpair"); close(so[0]); close(so[1]); } benchmark_stop(); + return (i); +} + +uint64_t +test_open_close(uint64_t num, uint64_t int_arg, const char *string_arg) +{ + const char *path = string_arg; + uint64_t i; + int fd; + + fd = open(path, O_RDONLY); + if (fd < 0) + err(-1, "test_open_close: %s", path); + close(fd); + + benchmark_start(); + for (i = 0; i < num; i++) { + if (alarm_fired) + break; + fd = open(path, O_RDONLY); + if (fd < 0) + err(-1, "test_open_close: %s", path); + close(fd); + } + benchmark_stop(); + return (i); } -void -test_dup(int num) +uint64_t +test_open_read_close(uint64_t num, uint64_t int_arg, const char *string_arg) +{ + char buf[int_arg]; + uint64_t i; + int fd; + + fd = open(string_arg, O_RDONLY); + if (fd < 0) + err(-1, "test_open_close: %s", string_arg); + (void)read(fd, buf, int_arg); + close(fd); + + benchmark_start(); + for (i = 0; i < num; i++) { + if (alarm_fired) + break; + fd = open(string_arg, O_RDONLY); + if (fd < 0) + err(-1, "test_open_close: %s", string_arg); + (void)read(fd, buf, int_arg); + close(fd); + } + benchmark_stop(); + return (i); +} + +uint64_t +test_dup(uint64_t num, uint64_t int_arg, const char *string_arg) { int fd, i, shmfd; @@ -224,18 +321,21 @@ test_dup(int num) close(fd); benchmark_start(); for (i = 0; i < num; i++) { + if (alarm_fired) + break; fd = dup(shmfd); if (fd >= 0) close(fd); } benchmark_stop(); close(shmfd); + return (i); } -void -test_shmfd(int num) +uint64_t +test_shmfd(uint64_t num, uint64_t int_arg, const char *string_arg) { - int i, shmfd; + uint64_t i, shmfd; shmfd = shm_open(SHM_ANON, O_CREAT | O_RDWR, 0600); if (shmfd < 0) @@ -243,19 +343,22 @@ test_shmfd(int num) close(shmfd); benchmark_start(); for (i = 0; i < num; i++) { + if (alarm_fired) + break; shmfd = shm_open(SHM_ANON, O_CREAT | O_RDWR, 0600); if (shmfd < 0) err(-1, "test_shmfd: shm_open"); close(shmfd); } benchmark_stop(); + return (i); } -void -test_fstat_shmfd(int num) +uint64_t +test_fstat_shmfd(uint64_t num, uint64_t int_arg, const char *string_arg) { struct stat sb; - int i, shmfd; + uint64_t i, shmfd; shmfd = shm_open(SHM_ANON, O_CREAT | O_RDWR, 0600); if (shmfd < 0) @@ -263,17 +366,21 @@ test_fstat_shmfd(int num) if (fstat(shmfd, &sb) < 0) err(-1, "test_fstat_shmfd: fstat"); benchmark_start(); - for (i = 0; i < num; i++) + for (i = 0; i < num; i++) { + if (alarm_fired) + break; (void)fstat(shmfd, &sb); + } benchmark_stop(); close(shmfd); + return (i); } -void -test_fork(int num) +uint64_t +test_fork(uint64_t num, uint64_t int_arg, const char *string_arg) { pid_t pid; - int i; + uint64_t i; pid = fork(); if (pid < 0) @@ -284,6 +391,8 @@ test_fork(int num) err(-1, "test_fork: waitpid"); benchmark_start(); for (i = 0; i < num; i++) { + if (alarm_fired) + break; pid = fork(); if (pid < 0) err(-1, "test_fork: fork"); @@ -293,13 +402,14 @@ test_fork(int num) err(-1, "test_fork: waitpid"); } benchmark_stop(); + return (i); } -void -test_vfork(int num) +uint64_t +test_vfork(uint64_t num, uint64_t int_arg, const char *string_arg) { pid_t pid; - int i; + uint64_t i; pid = vfork(); if (pid < 0) @@ -310,6 +420,8 @@ test_vfork(int num) err(-1, "test_vfork: waitpid"); benchmark_start(); for (i = 0; i < num; i++) { + if (alarm_fired) + break; pid = vfork(); if (pid < 0) err(-1, "test_vfork: vfork"); @@ -319,17 +431,18 @@ test_vfork(int num) err(-1, "test_vfork: waitpid"); } benchmark_stop(); + return (i); } #define USR_BIN_TRUE "/usr/bin/true" static char *execve_args[] = { USR_BIN_TRUE, NULL}; extern char **environ; -void -test_fork_exec(int num) +uint64_t +test_fork_exec(uint64_t num, uint64_t int_arg, const char *string_arg) { pid_t pid; - int i; + uint64_t i; pid = fork(); if (pid < 0) @@ -342,6 +455,8 @@ test_fork_exec(int num) err(-1, "test_fork: waitpid"); benchmark_start(); for (i = 0; i < num; i++) { + if (alarm_fired) + break; pid = fork(); if (pid < 0) err(-1, "test_fork_exec: fork"); @@ -353,13 +468,14 @@ test_fork_exec(int num) err(-1, "test_fork_exec: waitpid"); } benchmark_stop(); + return (i); } -void -test_vfork_exec(int num) +uint64_t +test_vfork_exec(uint64_t num, uint64_t int_arg, const char *string_arg) { pid_t pid; - int i; + uint64_t i; pid = vfork(); if (pid < 0) @@ -372,6 +488,8 @@ test_vfork_exec(int num) err(-1, "test_vfork_exec: waitpid"); benchmark_start(); for (i = 0; i < num; i++) { + if (alarm_fired) + break; pid = vfork(); if (pid < 0) err(-1, "test_vfork_exec: vfork"); @@ -383,43 +501,52 @@ test_vfork_exec(int num) err(-1, "test_vfork_exec: waitpid"); } benchmark_stop(); + return (i); } -void -test_chroot(int num) +uint64_t +test_chroot(uint64_t num, uint64_t int_arg, const char *string_arg) { - int i; + uint64_t i; if (chroot("/") < 0) err(-1, "test_chroot: chroot"); benchmark_start(); for (i = 0; i < num; i++) { + if (alarm_fired) + break; if (chroot("/") < 0) err(-1, "test_chroot: chroot"); } benchmark_stop(); + return (i); } -void -test_setuid(int num) +uint64_t +test_setuid(uint64_t num, uint64_t int_arg, const char *string_arg) { uid_t uid; - int i; + uint64_t i; uid = getuid(); if (setuid(uid) < 0) err(-1, "test_setuid: setuid"); benchmark_start(); for (i = 0; i < num; i++) { + if (alarm_fired) + break; if (setuid(uid) < 0) err(-1, "test_setuid: setuid"); } benchmark_stop(); + return (i); } struct test { const char *t_name; - void (*t_func)(int); + uint64_t (*t_func)(uint64_t, uint64_t, const char *); + uint64_t t_int; + const char *t_string; }; static const struct test tests[] = { @@ -427,10 +554,26 @@ static const struct test tests[] = { { "getppid", test_getppid }, { "clock_gettime", test_clock_gettime }, { "pipe", test_pipe }, - { "socket_stream", test_socket_stream }, - { "socket_dgram", test_socket_dgram }, + { "socket_local_stream", test_socket_stream, .t_int = PF_LOCAL }, + { "socket_local_dgram", test_socket_dgram, .t_int = PF_LOCAL }, { "socketpair_stream", test_socketpair_stream }, { "socketpair_dgram", test_socketpair_dgram }, + { "socket_tcp", test_socket_stream, .t_int = PF_INET }, + { "socket_udp", test_socket_dgram, .t_int = PF_INET }, + { "open_close_devnull", test_open_close, .t_string = "/dev/null" }, + { "open_close_devzero", test_open_close, .t_string = "/dev/zero" }, + { "open_read_close_devzero_1", test_open_read_close, + .t_string = "/dev/zero", .t_int = 1 }, + { "open_read_close_devzero_10", test_open_read_close, + .t_string = "/dev/zero", .t_int = 10 }, + { "open_read_close_devzero_100", test_open_read_close, + .t_string = "/dev/zero", .t_int = 100 }, + { "open_read_close_devzero_1000", test_open_read_close, + .t_string = "/dev/zero", .t_int = 1000 }, + { "open_read_close_devzero_10000", test_open_read_close, + .t_string = "/dev/zero", .t_int = 10000 }, + { "open_read_close_devzero_100000", test_open_read_close, + .t_string = "/dev/zero", .t_int = 100000 }, { "dup", test_dup }, { "shmfd", test_shmfd }, { "fstat_shmfd", test_fstat_shmfd }, @@ -448,7 +591,8 @@ usage(void) { int i; - fprintf(stderr, "syscall_timing [iterations] [loops] [test]\n"); + fprintf(stderr, "syscall_timing [-i iterations] [-l loops] " + "[-s seconds] test\n"); for (i = 0; i < tests_count; i++) fprintf(stderr, " %s\n", tests[i].t_name); exit(-1); @@ -461,28 +605,61 @@ main(int argc, char *argv[]) const struct test *the_test; long long ll; char *endp; - int i, j, k; - int iterations, loops; + int ch, i, j, k; + uint64_t iterations, loops; - if (argc < 4) - usage(); + alarm_timeout = 0; + iterations = 0; + loops = 0; + while ((ch = getopt(argc, argv, "i:l:s:")) != -1) { + switch (ch) { + case 'i': + ll = strtol(optarg, &endp, 10); + if (*endp != 0 || ll < 1 || ll > 100000) + usage(); + iterations = ll; + break; + + case 'l': + ll = strtol(optarg, &endp, 10); + if (*endp != 0 || ll < 1 || ll > 100000) + usage(); + loops = ll; + break; + + case 's': + ll = strtol(optarg, &endp, 10); + if (*endp != 0 || ll < 1 || ll > 60*60) + usage(); + alarm_timeout = ll; + break; + + case '?': + default: + usage(); + } + } + argc -= optind; + argv += optind; - ll = strtoll(argv[1], &endp, 10); - if (*endp != 0 || ll < 0 || ll > 100000) + if (iterations < 1 && alarm_timeout < 1) usage(); - iterations = ll; + if (iterations < 1) + iterations = UINT64_MAX; + if (loops < 1) + loops = 1; - ll = strtoll(argv[2], &endp, 10); - if (*endp != 0 || ll < 0 || ll > 100000) + if (argc != 1) usage(); - loops = ll; assert(clock_getres(CLOCK_REALTIME, &ts_res) == 0); - printf("Clock resolution: %ju.%ju\n", (uintmax_t)ts_res.tv_sec, + printf("Clock resolution: %ju.%08ju\n", (uintmax_t)ts_res.tv_sec, (uintmax_t)ts_res.tv_nsec); printf("test\tloop\ttotal\titerations\tperiteration\n"); - for (j = 3; j < argc; j++) { + for (j = 0; j < argc; j++) { + uint64_t calls; + the_test = NULL; for (i = 0; i < tests_count; i++) { if (strcmp(argv[j], tests[i].t_name) == 0) @@ -494,13 +671,15 @@ main(int argc, char *argv[]) /* * Run one warmup, then do the real thing (loops) times. */ - the_test->t_func(iterations); + calls = the_test->t_func(iterations, the_test->t_int, + the_test->t_string); for (k = 0; k < loops; k++) { - the_test->t_func(iterations); + the_test->t_func(iterations, the_test->t_int, + the_test->t_string); timespecsub(&ts_end, &ts_start); printf("%s\t%d\t", the_test->t_name, k); printf("%ju.%09ju\t%d\t", (uintmax_t)ts_end.tv_sec, - (uintmax_t)ts_end.tv_nsec, iterations); + (uintmax_t)ts_end.tv_nsec, calls); /* * Note. This assumes that each iteration takes less than @@ -508,9 +687,9 @@ main(int argc, char *argv[]) * the room in our arithmetic unit. Fine for system calls, * but not for long things. */ - ts_end.tv_sec *= 1000000000 / iterations; + ts_end.tv_sec *= 1000000000 / calls; printf("0.%09ju\n", (uintmax_t)(ts_end.tv_sec + - ts_end.tv_nsec / iterations)); + ts_end.tv_nsec / calls)); } } return (0); From owner-svn-src-head@FreeBSD.ORG Thu Oct 21 17:29: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 6EB5F1065670; Thu, 21 Oct 2010 17:29:18 +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 5E0B28FC14; Thu, 21 Oct 2010 17:29: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 o9LHTIOo097993; Thu, 21 Oct 2010 17:29:18 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9LHTIEM097991; Thu, 21 Oct 2010 17:29:18 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201010211729.o9LHTIEM097991@svn.freebsd.org> From: Warner Losh Date: Thu, 21 Oct 2010 17:29: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: r214143 - head/usr.sbin/pc-sysinstall/backend 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, 21 Oct 2010 17:29:18 -0000 Author: imp Date: Thu Oct 21 17:29:18 2010 New Revision: 214143 URL: http://svn.freebsd.org/changeset/base/214143 Log: Left over from prior patch removed. Submitted by: John Hixon PR: 151442 (but the patch was backwards there) Modified: head/usr.sbin/pc-sysinstall/backend/functions-disk.sh Modified: head/usr.sbin/pc-sysinstall/backend/functions-disk.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend/functions-disk.sh Thu Oct 21 17:27:39 2010 (r214142) +++ head/usr.sbin/pc-sysinstall/backend/functions-disk.sh Thu Oct 21 17:29:18 2010 (r214143) @@ -507,17 +507,6 @@ setup_disk_slice() DEST="${DISK}" fi - if iscompressed "${IMAGE}" - then - local COMPRESSION - - get_compression_type "${IMAGE}" - COMPRESSION="${VAL}" - - decompress_file "${IMAGE}" "${COMPRESSION}" - IMAGE="${VAL}" - fi - write_image "${IMAGE}" "${DEST}" check_disk_layout "${DEST}" fi From owner-svn-src-head@FreeBSD.ORG Thu Oct 21 17:29: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 40FF710656B5; Thu, 21 Oct 2010 17:29:33 +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 310408FC1A; Thu, 21 Oct 2010 17:29: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 o9LHTX5b098035; Thu, 21 Oct 2010 17:29:33 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9LHTXEv098032; Thu, 21 Oct 2010 17:29:33 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201010211729.o9LHTXEv098032@svn.freebsd.org> From: John Baldwin Date: Thu, 21 Oct 2010 17:29: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: r214144 - 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: Thu, 21 Oct 2010 17:29:33 -0000 Author: jhb Date: Thu Oct 21 17:29:32 2010 New Revision: 214144 URL: http://svn.freebsd.org/changeset/base/214144 Log: - Make 'vm_refcnt' volatile so that compilers won't be tempted to treat its value as a loop invariant. Currently this is a no-op because 'atomic_cmpset_int()' clobbers all memory on current architectures. - Use atomic_fetchadd_int() instead of an atomic_cmpset_int() loop to drop a reference in vmspace_free(). Reviewed by: alc MFC after: 1 month Modified: head/sys/vm/vm_map.c head/sys/vm/vm_map.h Modified: head/sys/vm/vm_map.c ============================================================================== --- head/sys/vm/vm_map.c Thu Oct 21 17:29:18 2010 (r214143) +++ head/sys/vm/vm_map.c Thu Oct 21 17:29:32 2010 (r214144) @@ -339,15 +339,11 @@ vmspace_dofree(struct vmspace *vm) void vmspace_free(struct vmspace *vm) { - int refcnt; if (vm->vm_refcnt == 0) panic("vmspace_free: attempt to free already freed vmspace"); - do - refcnt = vm->vm_refcnt; - while (!atomic_cmpset_int(&vm->vm_refcnt, refcnt, refcnt - 1)); - if (refcnt == 1) + if (atomic_fetchadd_int(&vm->vm_refcnt, -1) == 1) vmspace_dofree(vm); } Modified: head/sys/vm/vm_map.h ============================================================================== --- head/sys/vm/vm_map.h Thu Oct 21 17:29:18 2010 (r214143) +++ head/sys/vm/vm_map.h Thu Oct 21 17:29:32 2010 (r214144) @@ -236,7 +236,7 @@ struct vmspace { caddr_t vm_taddr; /* (c) user virtual address of text */ caddr_t vm_daddr; /* (c) user virtual address of data */ caddr_t vm_maxsaddr; /* user VA at max stack growth */ - int vm_refcnt; /* number of references */ + volatile int vm_refcnt; /* number of references */ /* * Keep the PMAP last, so that CPU-specific variations of that * structure on a single architecture don't result in offset From owner-svn-src-head@FreeBSD.ORG Thu Oct 21 17:35: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 476FB106564A; Thu, 21 Oct 2010 17:35:09 +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 36F3A8FC12; Thu, 21 Oct 2010 17:35: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 o9LHZ9r7098218; Thu, 21 Oct 2010 17:35:09 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9LHZ9au098216; Thu, 21 Oct 2010 17:35:09 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201010211735.o9LHZ9au098216@svn.freebsd.org> From: Robert Watson Date: Thu, 21 Oct 2010 17:35: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: r214145 - 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: Thu, 21 Oct 2010 17:35:09 -0000 Author: rwatson Date: Thu Oct 21 17:35:08 2010 New Revision: 214145 URL: http://svn.freebsd.org/changeset/base/214145 Log: Fix bug in recent syscall_timing change: measure the number of iterations each loop, rather than once up front. The distinction is unimportant when doing a fix iteration count, but when using a timer, it should vary. 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 Thu Oct 21 17:29:32 2010 (r214144) +++ head/tools/tools/syscall_timing/syscall_timing.c Thu Oct 21 17:35:08 2010 (r214145) @@ -671,11 +671,12 @@ main(int argc, char *argv[]) /* * Run one warmup, then do the real thing (loops) times. */ - calls = the_test->t_func(iterations, the_test->t_int, + the_test->t_func(iterations, the_test->t_int, the_test->t_string); + calls = 0; for (k = 0; k < loops; k++) { - the_test->t_func(iterations, the_test->t_int, - the_test->t_string); + calls = the_test->t_func(iterations, + the_test->t_int, the_test->t_string); timespecsub(&ts_end, &ts_start); printf("%s\t%d\t", the_test->t_name, k); printf("%ju.%09ju\t%d\t", (uintmax_t)ts_end.tv_sec, From owner-svn-src-head@FreeBSD.ORG Thu Oct 21 17:46: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 1B7621065695; Thu, 21 Oct 2010 17:46:24 +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 0B5B58FC12; Thu, 21 Oct 2010 17:46: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 o9LHkNxg098454; Thu, 21 Oct 2010 17:46:23 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9LHkN95098452; Thu, 21 Oct 2010 17:46:23 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201010211746.o9LHkN95098452@svn.freebsd.org> From: John Baldwin Date: Thu, 21 Oct 2010 17: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: r214146 - head/sys/dev/pci 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, 21 Oct 2010 17:46:24 -0000 Author: jhb Date: Thu Oct 21 17:46:23 2010 New Revision: 214146 URL: http://svn.freebsd.org/changeset/base/214146 Log: Clarify a misleading comment. The test in pci_reserve_map() was meant to ignore BARs that are invalid due to having a size of zero, not to ignore BARs with an existing base of zero. While here, reorganize the code slightly to make the intent clearer. Reported by: avg MFC after: 1 week Modified: head/sys/dev/pci/pci.c Modified: head/sys/dev/pci/pci.c ============================================================================== --- head/sys/dev/pci/pci.c Thu Oct 21 17:35:08 2010 (r214145) +++ head/sys/dev/pci/pci.c Thu Oct 21 17:46:23 2010 (r214146) @@ -3664,9 +3664,15 @@ pci_reserve_map(device_t dev, device_t c res = NULL; pci_read_bar(child, *rid, &map, &testval); - /* Ignore a BAR with a base of 0. */ - if ((*rid == PCIR_BIOS && pci_rombase(testval) == 0) || - pci_mapbase(testval) == 0) + /* + * Determine the size of the BAR and ignore BARs with a size + * of 0. Device ROM BARs use a different mask value. + */ + if (*rid == PCIR_BIOS) + mapsize = pci_romsize(testval); + else + mapsize = pci_mapsize(testval); + if (mapsize == 0) goto out; if (PCI_BAR_MEM(testval) || *rid == PCIR_BIOS) { @@ -3695,13 +3701,7 @@ pci_reserve_map(device_t dev, device_t c * actually uses and we would otherwise have a * situation where we might allocate the excess to * another driver, which won't work. - * - * Device ROM BARs use a different mask value. */ - if (*rid == PCIR_BIOS) - mapsize = pci_romsize(testval); - else - mapsize = pci_mapsize(testval); count = 1UL << mapsize; if (RF_ALIGNMENT(flags) < mapsize) flags = (flags & ~RF_ALIGNMENT_MASK) | RF_ALIGNMENT_LOG2(mapsize); From owner-svn-src-head@FreeBSD.ORG Thu Oct 21 18: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 90132106567A; Thu, 21 Oct 2010 18:19:22 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from mx0.hoeg.nl (unknown [IPv6:2a01:4f8:101:5343::aa]) by mx1.freebsd.org (Postfix) with ESMTP id 178A18FC14; Thu, 21 Oct 2010 18:19:22 +0000 (UTC) Received: by mx0.hoeg.nl (Postfix, from userid 1000) id 6C4012A28D20; Thu, 21 Oct 2010 20:19:21 +0200 (CEST) Date: Thu, 21 Oct 2010 20:19:21 +0200 From: Ed Schouten To: John Baldwin Message-ID: <20101021181921.GG77125@hoeg.nl> References: <201010211729.o9LHTXEv098032@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="9/eUdp+dLtKXvemk" Content-Disposition: inline In-Reply-To: <201010211729.o9LHTXEv098032@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r214144 - 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: Thu, 21 Oct 2010 18:19:22 -0000 --9/eUdp+dLtKXvemk Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi John, * John Baldwin , 20101021 19:29: > + if (atomic_fetchadd_int(&vm->vm_refcnt, -1) =3D=3D 1) > vmspace_dofree(vm); Not that it's that useful, but maybe it would be good to use refcount_release() here? --=20 Ed Schouten WWW: http://80386.nl/ --9/eUdp+dLtKXvemk Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (FreeBSD) iEYEARECAAYFAkzAhCkACgkQ52SDGA2eCwU5RQCfft74i3D52CDSSGG6GDl2L/Uk xYwAn0nAZlfqfl3zcg1DoFXHYgK3EEr3 =S9MC -----END PGP SIGNATURE----- --9/eUdp+dLtKXvemk-- From owner-svn-src-head@FreeBSD.ORG Thu Oct 21 18:21: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 8FA4C106566B; Thu, 21 Oct 2010 18:21:19 +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 7F4D58FC0C; Thu, 21 Oct 2010 18:21: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 o9LILJJ6099141; Thu, 21 Oct 2010 18:21:19 GMT (envelope-from bcr@svn.freebsd.org) Received: (from bcr@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9LILJfG099139; Thu, 21 Oct 2010 18:21:19 GMT (envelope-from bcr@svn.freebsd.org) Message-Id: <201010211821.o9LILJfG099139@svn.freebsd.org> From: Benedict Reuschling Date: Thu, 21 Oct 2010 18:21: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: r214147 - head/lib/libc/stdlib 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, 21 Oct 2010 18:21:19 -0000 Author: bcr (doc committer) Date: Thu Oct 21 18:21:19 2010 New Revision: 214147 URL: http://svn.freebsd.org/changeset/base/214147 Log: Sync with OpenBSD rev. 1.13: strtonum does not require limits.h Obtained from: OpenBSD Discussed with: ru@ MFC after: 5 days Modified: head/lib/libc/stdlib/strtonum.3 Modified: head/lib/libc/stdlib/strtonum.3 ============================================================================== --- head/lib/libc/stdlib/strtonum.3 Thu Oct 21 17:46:23 2010 (r214146) +++ head/lib/libc/stdlib/strtonum.3 Thu Oct 21 18:21:19 2010 (r214147) @@ -12,7 +12,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.\" $OpenBSD: strtonum.3,v 1.12 2005/10/26 11:37:58 jmc Exp $ +.\" $OpenBSD: strtonum.3,v 1.13 2006/04/25 05:15:42 tedu Exp $ .\" $FreeBSD$ .\" .Dd April 29, 2004 @@ -23,7 +23,6 @@ .Nd "reliably convert string value to an integer" .Sh SYNOPSIS .In stdlib.h -.In limits.h .Ft long long .Fo strtonum .Fa "const char *nptr" From owner-svn-src-head@FreeBSD.ORG Thu Oct 21 18:30: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 3F0661065694; Thu, 21 Oct 2010 18:30:49 +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 2EFDA8FC27; Thu, 21 Oct 2010 18:30: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 o9LIUnYb099340; Thu, 21 Oct 2010 18:30:49 GMT (envelope-from bcr@svn.freebsd.org) Received: (from bcr@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9LIUnYA099338; Thu, 21 Oct 2010 18:30:49 GMT (envelope-from bcr@svn.freebsd.org) Message-Id: <201010211830.o9LIUnYA099338@svn.freebsd.org> From: Benedict Reuschling Date: Thu, 21 Oct 2010 18:30: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: r214148 - head/lib/libc/stdlib 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, 21 Oct 2010 18:30:49 -0000 Author: bcr (doc committer) Date: Thu Oct 21 18:30:48 2010 New Revision: 214148 URL: http://svn.freebsd.org/changeset/base/214148 Log: Document strtonum()s behavior of setting errno to 0 when no error is found. PR: docs/143330 Submitted by: Efstratios Karatzas (gpf dot kira at gmail dot com) Discussed with: ru@ MFC after: 7 days Modified: head/lib/libc/stdlib/strtonum.3 Modified: head/lib/libc/stdlib/strtonum.3 ============================================================================== --- head/lib/libc/stdlib/strtonum.3 Thu Oct 21 18:21:19 2010 (r214147) +++ head/lib/libc/stdlib/strtonum.3 Thu Oct 21 18:30:48 2010 (r214148) @@ -83,6 +83,8 @@ is set, and .Fa errstr will point to an error message. On success, +.Va errno +is set to 0 and .Fa *errstr will be set to .Dv NULL ; From owner-svn-src-head@FreeBSD.ORG Thu Oct 21 18:41: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 2035B1065696; Thu, 21 Oct 2010 18:41:32 +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 E66C08FC22; Thu, 21 Oct 2010 18:41:31 +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 84E5046B3B; Thu, 21 Oct 2010 14:41:31 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 9E05F8A009; Thu, 21 Oct 2010 14:41:30 -0400 (EDT) From: John Baldwin To: Ed Schouten Date: Thu, 21 Oct 2010 14:30:08 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100819; KDE/4.4.5; amd64; ; ) References: <201010211729.o9LHTXEv098032@svn.freebsd.org> <20101021181921.GG77125@hoeg.nl> In-Reply-To: <20101021181921.GG77125@hoeg.nl> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201010211430.08219.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Thu, 21 Oct 2010 14:41:30 -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: r214144 - 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: Thu, 21 Oct 2010 18:41:32 -0000 On Thursday, October 21, 2010 2:19:21 pm Ed Schouten wrote: > Hi John, > > * John Baldwin , 20101021 19:29: > > + if (atomic_fetchadd_int(&vm->vm_refcnt, -1) == 1) > > vmspace_dofree(vm); > > Not that it's that useful, but maybe it would be good to use > refcount_release() here? Not in this case because the other places do not use the refcount API. Specifically, the code in vmspace_exit() is a bit tortuous. I'd rather code only use the refcount API if it is going to always use it. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Thu Oct 21 18: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 7C66A1065672; Thu, 21 Oct 2010 18:49:12 +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 6BE628FC12; Thu, 21 Oct 2010 18:49: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 o9LInCIu099777; Thu, 21 Oct 2010 18:49:12 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9LInC4j099775; Thu, 21 Oct 2010 18:49:12 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201010211849.o9LInC4j099775@svn.freebsd.org> From: Rick Macklem Date: Thu, 21 Oct 2010 18:49: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: r214149 - head/sys/fs/nfsserver 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, 21 Oct 2010 18:49:12 -0000 Author: rmacklem Date: Thu Oct 21 18:49:12 2010 New Revision: 214149 URL: http://svn.freebsd.org/changeset/base/214149 Log: Modify the experimental NFS server in a manner analagous to r214049 for the regular NFS server, so that it will not do a VOP_LOOKUP() of ".." when at the root of a file system when performing a ReaddirPlus RPC. MFC after: 10 days Modified: head/sys/fs/nfsserver/nfs_nfsdport.c Modified: head/sys/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdport.c Thu Oct 21 18:30:48 2010 (r214148) +++ head/sys/fs/nfsserver/nfs_nfsdport.c Thu Oct 21 18:49:12 2010 (r214149) @@ -1933,7 +1933,15 @@ again: vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); - r = VOP_LOOKUP(vp, &nvp, &cn); + if ((vp->v_vflag & VV_ROOT) != 0 + && (cn.cn_flags & ISDOTDOT) + != 0) { + vref(vp); + nvp = vp; + r = 0; + } else + r = VOP_LOOKUP(vp, &nvp, + &cn); } } if (!r) { From owner-svn-src-head@FreeBSD.ORG Thu Oct 21 19:02: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 2837110656AC; Thu, 21 Oct 2010 19:02:00 +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 15F718FC26; Thu, 21 Oct 2010 19:02: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 o9LJ1xmK000320; Thu, 21 Oct 2010 19:01:59 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9LJ1x0b000318; Thu, 21 Oct 2010 19:01:59 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201010211901.o9LJ1x0b000318@svn.freebsd.org> From: Robert Watson Date: Thu, 21 Oct 2010 19:01: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: r214151 - 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: Thu, 21 Oct 2010 19:02:00 -0000 Author: rwatson Date: Thu Oct 21 19:01:59 2010 New Revision: 214151 URL: http://svn.freebsd.org/changeset/base/214151 Log: Further syscall_timing improvements: allow an arbitrary "path" string argument to be passed on the command line, allowing file-related tests to be pointed at wherever desired. 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 Thu Oct 21 18:59:05 2010 (r214150) +++ head/tools/tools/syscall_timing/syscall_timing.c Thu Oct 21 19:01:59 2010 (r214151) @@ -85,7 +85,7 @@ benchmark_stop(void) } uint64_t -test_getuid(uint64_t num, uint64_t int_arg, const char *string_arg) +test_getuid(uint64_t num, uint64_t int_arg, const char *path) { uint64_t i; @@ -104,7 +104,7 @@ test_getuid(uint64_t num, uint64_t int_a } uint64_t -test_getppid(uint64_t num, uint64_t int_arg, const char *string_arg) +test_getppid(uint64_t num, uint64_t int_arg, const char *path) { uint64_t i; @@ -123,7 +123,7 @@ test_getppid(uint64_t num, uint64_t int_ } uint64_t -test_clock_gettime(uint64_t num, uint64_t int_arg, const char *string_arg) +test_clock_gettime(uint64_t num, uint64_t int_arg, const char *path) { struct timespec ts; uint64_t i; @@ -139,7 +139,7 @@ test_clock_gettime(uint64_t num, uint64_ } uint64_t -test_pipe(uint64_t num, uint64_t int_arg, const char *string_arg) +test_pipe(uint64_t num, uint64_t int_arg, const char *path) { int fd[2], i; @@ -167,7 +167,7 @@ test_pipe(uint64_t num, uint64_t int_arg } uint64_t -test_socket_stream(uint64_t num, uint64_t int_arg, const char *string_arg) +test_socket_stream(uint64_t num, uint64_t int_arg, const char *path) { uint64_t i, so; @@ -189,7 +189,7 @@ test_socket_stream(uint64_t num, uint64_ } uint64_t -test_socket_dgram(uint64_t num, uint64_t int_arg, const char *string_arg) +test_socket_dgram(uint64_t num, uint64_t int_arg, const char *path) { uint64_t i, so; @@ -211,7 +211,7 @@ test_socket_dgram(uint64_t num, uint64_t } uint64_t -test_socketpair_stream(uint64_t num, uint64_t int_arg, const char *string_arg) +test_socketpair_stream(uint64_t num, uint64_t int_arg, const char *path) { uint64_t i; int so[2]; @@ -234,7 +234,7 @@ test_socketpair_stream(uint64_t num, uin } uint64_t -test_socketpair_dgram(uint64_t num, uint64_t int_arg, const char *string_arg) +test_socketpair_dgram(uint64_t num, uint64_t int_arg, const char *path) { uint64_t i; int so[2]; @@ -257,9 +257,8 @@ test_socketpair_dgram(uint64_t num, uint } uint64_t -test_open_close(uint64_t num, uint64_t int_arg, const char *string_arg) +test_open_close(uint64_t num, uint64_t int_arg, const char *path) { - const char *path = string_arg; uint64_t i; int fd; @@ -282,15 +281,15 @@ test_open_close(uint64_t num, uint64_t i } uint64_t -test_open_read_close(uint64_t num, uint64_t int_arg, const char *string_arg) +test_open_read_close(uint64_t num, uint64_t int_arg, const char *path) { char buf[int_arg]; uint64_t i; int fd; - fd = open(string_arg, O_RDONLY); + fd = open(path, O_RDONLY); if (fd < 0) - err(-1, "test_open_close: %s", string_arg); + err(-1, "test_open_close: %s", path); (void)read(fd, buf, int_arg); close(fd); @@ -298,9 +297,9 @@ test_open_read_close(uint64_t num, uint6 for (i = 0; i < num; i++) { if (alarm_fired) break; - fd = open(string_arg, O_RDONLY); + fd = open(path, O_RDONLY); if (fd < 0) - err(-1, "test_open_close: %s", string_arg); + err(-1, "test_open_close: %s", path); (void)read(fd, buf, int_arg); close(fd); } @@ -309,7 +308,7 @@ test_open_read_close(uint64_t num, uint6 } uint64_t -test_dup(uint64_t num, uint64_t int_arg, const char *string_arg) +test_dup(uint64_t num, uint64_t int_arg, const char *path) { int fd, i, shmfd; @@ -333,7 +332,7 @@ test_dup(uint64_t num, uint64_t int_arg, } uint64_t -test_shmfd(uint64_t num, uint64_t int_arg, const char *string_arg) +test_shmfd(uint64_t num, uint64_t int_arg, const char *path) { uint64_t i, shmfd; @@ -355,7 +354,7 @@ test_shmfd(uint64_t num, uint64_t int_ar } uint64_t -test_fstat_shmfd(uint64_t num, uint64_t int_arg, const char *string_arg) +test_fstat_shmfd(uint64_t num, uint64_t int_arg, const char *path) { struct stat sb; uint64_t i, shmfd; @@ -377,7 +376,7 @@ test_fstat_shmfd(uint64_t num, uint64_t } uint64_t -test_fork(uint64_t num, uint64_t int_arg, const char *string_arg) +test_fork(uint64_t num, uint64_t int_arg, const char *path) { pid_t pid; uint64_t i; @@ -406,7 +405,7 @@ test_fork(uint64_t num, uint64_t int_arg } uint64_t -test_vfork(uint64_t num, uint64_t int_arg, const char *string_arg) +test_vfork(uint64_t num, uint64_t int_arg, const char *path) { pid_t pid; uint64_t i; @@ -439,7 +438,7 @@ static char *execve_args[] = { USR_BIN_T extern char **environ; uint64_t -test_fork_exec(uint64_t num, uint64_t int_arg, const char *string_arg) +test_fork_exec(uint64_t num, uint64_t int_arg, const char *path) { pid_t pid; uint64_t i; @@ -472,7 +471,7 @@ test_fork_exec(uint64_t num, uint64_t in } uint64_t -test_vfork_exec(uint64_t num, uint64_t int_arg, const char *string_arg) +test_vfork_exec(uint64_t num, uint64_t int_arg, const char *path) { pid_t pid; uint64_t i; @@ -505,7 +504,7 @@ test_vfork_exec(uint64_t num, uint64_t i } uint64_t -test_chroot(uint64_t num, uint64_t int_arg, const char *string_arg) +test_chroot(uint64_t num, uint64_t int_arg, const char *path) { uint64_t i; @@ -523,7 +522,7 @@ test_chroot(uint64_t num, uint64_t int_a } uint64_t -test_setuid(uint64_t num, uint64_t int_arg, const char *string_arg) +test_setuid(uint64_t num, uint64_t int_arg, const char *path) { uid_t uid; uint64_t i; @@ -546,7 +545,6 @@ struct test { const char *t_name; uint64_t (*t_func)(uint64_t, uint64_t, const char *); uint64_t t_int; - const char *t_string; }; static const struct test tests[] = { @@ -560,20 +558,13 @@ 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 }, - { "open_close_devnull", test_open_close, .t_string = "/dev/null" }, - { "open_close_devzero", test_open_close, .t_string = "/dev/zero" }, - { "open_read_close_devzero_1", test_open_read_close, - .t_string = "/dev/zero", .t_int = 1 }, - { "open_read_close_devzero_10", test_open_read_close, - .t_string = "/dev/zero", .t_int = 10 }, - { "open_read_close_devzero_100", test_open_read_close, - .t_string = "/dev/zero", .t_int = 100 }, - { "open_read_close_devzero_1000", test_open_read_close, - .t_string = "/dev/zero", .t_int = 1000 }, - { "open_read_close_devzero_10000", test_open_read_close, - .t_string = "/dev/zero", .t_int = 10000 }, - { "open_read_close_devzero_100000", test_open_read_close, - .t_string = "/dev/zero", .t_int = 100000 }, + { "open_close", test_open_close }, + { "open_read_close_1", test_open_read_close, .t_int = 1 }, + { "open_read_close_10", test_open_read_close, .t_int = 10 }, + { "open_read_close_100", test_open_read_close, .t_int = 100 }, + { "open_read_close_1000", test_open_read_close, .t_int = 1000 }, + { "open_read_close_10000", test_open_read_close, .t_int = 10000 }, + { "open_read_close_100000", test_open_read_close, .t_int = 100000 }, { "dup", test_dup }, { "shmfd", test_shmfd }, { "fstat_shmfd", test_fstat_shmfd }, @@ -592,7 +583,7 @@ usage(void) int i; fprintf(stderr, "syscall_timing [-i iterations] [-l loops] " - "[-s seconds] test\n"); + "[-p path] [-s seconds] test\n"); for (i = 0; i < tests_count; i++) fprintf(stderr, " %s\n", tests[i].t_name); exit(-1); @@ -603,6 +594,7 @@ main(int argc, char *argv[]) { struct timespec ts_res; const struct test *the_test; + const char *path; long long ll; char *endp; int ch, i, j, k; @@ -611,7 +603,8 @@ main(int argc, char *argv[]) alarm_timeout = 0; iterations = 0; loops = 0; - while ((ch = getopt(argc, argv, "i:l:s:")) != -1) { + path = NULL; + while ((ch = getopt(argc, argv, "i:l:p:s:")) != -1) { switch (ch) { case 'i': ll = strtol(optarg, &endp, 10); @@ -627,6 +620,10 @@ main(int argc, char *argv[]) loops = ll; break; + case 'p': + path = optarg; + break; + case 's': ll = strtol(optarg, &endp, 10); if (*endp != 0 || ll < 1 || ll > 60*60) @@ -671,12 +668,11 @@ main(int argc, char *argv[]) /* * Run one warmup, then do the real thing (loops) times. */ - the_test->t_func(iterations, the_test->t_int, - the_test->t_string); + the_test->t_func(iterations, the_test->t_int, path); calls = 0; for (k = 0; k < loops; k++) { - calls = the_test->t_func(iterations, - the_test->t_int, the_test->t_string); + calls = the_test->t_func(iterations, the_test->t_int, + path); timespecsub(&ts_end, &ts_start); printf("%s\t%d\t", the_test->t_name, k); printf("%ju.%09ju\t%d\t", (uintmax_t)ts_end.tv_sec, From owner-svn-src-head@FreeBSD.ORG Thu Oct 21 19:03: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 621F710656A3; Thu, 21 Oct 2010 19:03:24 +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 51B638FC1D; Thu, 21 Oct 2010 19:03: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 o9LJ3Odp000463; Thu, 21 Oct 2010 19:03:24 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9LJ3O8D000461; Thu, 21 Oct 2010 19:03:24 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201010211903.o9LJ3O8D000461@svn.freebsd.org> From: Robert Watson Date: Thu, 21 Oct 2010 19:03:24 +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: r214154 - 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: Thu, 21 Oct 2010 19:03:24 -0000 Author: rwatson Date: Thu Oct 21 19:03:24 2010 New Revision: 214154 URL: http://svn.freebsd.org/changeset/base/214154 Log: Add Cambridge/Google tag since the copyright has been updated. 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 Thu Oct 21 19:03:13 2010 (r214153) +++ head/tools/tools/syscall_timing/syscall_timing.c Thu Oct 21 19:03:24 2010 (r214154) @@ -2,6 +2,9 @@ * Copyright (c) 2003-2004, 2010 Robert N. M. Watson * All rights reserved. * + * Portions of this software were developed at the University of Cambridge + * Computer Laboratory with support from a grant from Google, Inc. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: From owner-svn-src-head@FreeBSD.ORG Thu Oct 21 19:08: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 5393D106566B; Thu, 21 Oct 2010 19:08:29 +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 BE9108FC0C; Thu, 21 Oct 2010 19:08:28 +0000 (UTC) Received: from mail.geekcn.org (tarsier.geekcn.org [211.166.10.233]) by tarsier.geekcn.org (Postfix) with ESMTP id 5E197A7E65A; Fri, 22 Oct 2010 03:08:26 +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 ME7bAtVfFzo4; Fri, 22 Oct 2010 03:08:20 +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 3BF18A7E663; Fri, 22 Oct 2010 03:08:16 +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; b=v7VFcPZ0eNNpvcNNrNOShVfm1f6Jmud5h9pqYo7i/dz/tHVbavXAahRdNrNZzCnFp X+rD1NPCtWJc2rnW1ZPdQ== Message-ID: <4CC08F9C.5010804@delphij.net> Date: Thu, 21 Oct 2010 12:08:12 -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: John Baldwin References: <201010210857.o9L8vPVQ084307@svn.freebsd.org> <201010210746.41227.jhb@freebsd.org> In-Reply-To: <201010210746.41227.jhb@freebsd.org> X-Enigmail-Version: 1.0.1 OpenPGP: id=3FCA37C1; url=http://www.delphij.net/delphij.asc Content-Type: multipart/mixed; boundary="------------080107040006070001050407" Cc: svn-src-head@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, src-committers@FreeBSD.ORG, Xin LI Subject: Re: svn commit: r214125 - head/sys/kern 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: Thu, 21 Oct 2010 19:08:29 -0000 This is a multi-part message in MIME format. --------------080107040006070001050407 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 On 10/21/10 04:46, John Baldwin wrote: > On Thursday, October 21, 2010 4:57:25 am Xin LI wrote: >> Author: delphij >> Date: Thu Oct 21 08:57:25 2010 >> New Revision: 214125 >> URL: http://svn.freebsd.org/changeset/base/214125 >> >> Log: >> In syscall_module_handler(): all switch branches return, remove >> unreached code as pointed out in a Chinese forum [1]. >> >> [1] http://www.freebsdchina.org/forum/viewtopic.php?t=50619 >> >> Pointed out by: btw616 >> MFC after: 1 month > > I think this exposes a bug though in that the default case doesn't pass > through to chainevh. The default case should look more like the removed code > (except returning EOPNOTSUPP instead of 0 if there is no chainevh). Hmm... It sounds reasonable in theory (so that modules can handle events other than MOD_LOAD/UNLOAD) at least, while I don't think it's really being used anywhere. Will the attached patch look reasonable? (If data->chainevh is NULL then operation is not supported, if not then delegate to the module). 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) iQEcBAEBCAAGBQJMwI+cAAoJEATO+BI/yjfBADUH/21dtdgSziij8hNi8ef5xOZH QMbGRoHNUREVfuAnAevGNDotSonaRv+VEs5k9raRqqYFdtst6KzNjVQuumJsskmq +6j7rSPXQvAmgEf6JgEZmjU/WzRbs4lozMjUOx0TW6ZSTtiXq+PSvmMe7q9iydiT YKOj8E/itVFjKY2qMGNkAQ893qzIWvptDR9QGJP+m+8usTnYvAlk8vQw3XhfR/ws MNE726rDNwD2sblH2IZI0dt/xy8i6mD5Ef1aM4KEkeussBjGlLAktSS6qFB71lql JpGC9SCelhJRci6gLTvAbAyIe9hoFf8C7P+AbFXgVNMQxYWIHSzQr5BktwxSpc0= =C6jc -----END PGP SIGNATURE----- --------------080107040006070001050407 Content-Type: text/plain; name="kern_syscalls.c.diff" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="kern_syscalls.c.diff" SW5kZXg6IHN5cy9rZXJuL2tlcm5fc3lzY2FsbHMuYwo9PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBzeXMv a2Vybi9rZXJuX3N5c2NhbGxzLmMJKHJldmlzaW9uIDIxNDE0NikKKysrIHN5cy9rZXJuL2tl cm5fc3lzY2FsbHMuYwkod29ya2luZyBjb3B5KQpAQCAtMTgxLDcgKzE4MSw5IEBACiAJCWVy cm9yID0gc3lzY2FsbF9kZXJlZ2lzdGVyKGRhdGEtPm9mZnNldCwgJmRhdGEtPm9sZF9zeXNl bnQpOwogCQlyZXR1cm4gKGVycm9yKTsKIAlkZWZhdWx0OgotCQlyZXR1cm4gRU9QTk9UU1VQ UDsKKwkJaWYgKGRhdGEtPmNoYWluZXZoKQorCQkJcmV0dXJuIChkYXRhLT5jaGFpbmV2aCht b2QsIHdoYXQsIGRhdGEtPmNoYWluYXJnKSk7CisJCXJldHVybiAoRU9QTk9UU1VQUCk7CiAJ fQogCiAJLyogTk9UUkVBQ0hFRCAqLwo= --------------080107040006070001050407-- From owner-svn-src-head@FreeBSD.ORG Thu Oct 21 19:17: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 A43EF1065693; Thu, 21 Oct 2010 19:17:40 +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 92EBB8FC20; Thu, 21 Oct 2010 19:17: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 o9LJHeYn000951; Thu, 21 Oct 2010 19:17:40 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9LJHeYi000944; Thu, 21 Oct 2010 19:17:40 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201010211917.o9LJHeYi000944@svn.freebsd.org> From: John Baldwin Date: Thu, 21 Oct 2010 19:17: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: r214158 - in head/sys: kern 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: Thu, 21 Oct 2010 19:17:40 -0000 Author: jhb Date: Thu Oct 21 19:17:40 2010 New Revision: 214158 URL: http://svn.freebsd.org/changeset/base/214158 Log: - When disabling ktracing on a process, free any pending requests that may be left. This fixes a memory leak that can occur when tracing is disabled on a process via disabling tracing of a specific file (or if an I/O error occurs with the tracefile) if the process's next system call is exit(). The trace disabling code clears p_traceflag, so exit1() doesn't do any KTRACE-related cleanup leading to the leak. I chose to make the free'ing of pending records synchronous rather than patching exit1(). - Move KTRACE-specific logic out of kern_(exec|exit|fork).c and into kern_ktrace.c instead. Make ktrace_mtx private to kern_ktrace.c as a result. MFC after: 1 month Modified: head/sys/kern/kern_exec.c head/sys/kern/kern_exit.c head/sys/kern/kern_fork.c head/sys/kern/kern_ktrace.c head/sys/sys/ktrace.h Modified: head/sys/kern/kern_exec.c ============================================================================== --- head/sys/kern/kern_exec.c Thu Oct 21 19:11:14 2010 (r214157) +++ head/sys/kern/kern_exec.c Thu Oct 21 19:17:40 2010 (r214158) @@ -655,16 +655,8 @@ interpret: setsugid(p); #ifdef KTRACE - if (p->p_tracevp != NULL && - priv_check_cred(oldcred, PRIV_DEBUG_DIFFCRED, 0)) { - mtx_lock(&ktrace_mtx); - p->p_traceflag = 0; - tracevp = p->p_tracevp; - p->p_tracevp = NULL; - tracecred = p->p_tracecred; - p->p_tracecred = NULL; - mtx_unlock(&ktrace_mtx); - } + if (priv_check_cred(oldcred, PRIV_DEBUG_DIFFCRED, 0)) + ktrprocexec(p, &tracecred, &tracevp); #endif /* * Close any file descriptors 0..2 that reference procfs, Modified: head/sys/kern/kern_exit.c ============================================================================== --- head/sys/kern/kern_exit.c Thu Oct 21 19:11:14 2010 (r214157) +++ head/sys/kern/kern_exit.c Thu Oct 21 19:17:40 2010 (r214158) @@ -121,10 +121,6 @@ exit1(struct thread *td, int rv) struct proc *p, *nq, *q; struct vnode *vtmp; struct vnode *ttyvp = NULL; -#ifdef KTRACE - struct vnode *tracevp; - struct ucred *tracecred; -#endif struct plimit *plim; int locked; @@ -356,33 +352,7 @@ exit1(struct thread *td, int rv) if (ttyvp != NULL) vrele(ttyvp); #ifdef KTRACE - /* - * Disable tracing, then drain any pending records and release - * the trace file. - */ - if (p->p_traceflag != 0) { - PROC_LOCK(p); - mtx_lock(&ktrace_mtx); - p->p_traceflag = 0; - mtx_unlock(&ktrace_mtx); - PROC_UNLOCK(p); - ktrprocexit(td); - PROC_LOCK(p); - mtx_lock(&ktrace_mtx); - tracevp = p->p_tracevp; - p->p_tracevp = NULL; - tracecred = p->p_tracecred; - p->p_tracecred = NULL; - mtx_unlock(&ktrace_mtx); - PROC_UNLOCK(p); - if (tracevp != NULL) { - locked = VFS_LOCK_GIANT(tracevp->v_mount); - vrele(tracevp); - VFS_UNLOCK_GIANT(locked); - } - if (tracecred != NULL) - crfree(tracecred); - } + ktrprocexit(td); #endif /* * Release reference to text vnode Modified: head/sys/kern/kern_fork.c ============================================================================== --- head/sys/kern/kern_fork.c Thu Oct 21 19:11:14 2010 (r214157) +++ head/sys/kern/kern_fork.c Thu Oct 21 19:17:40 2010 (r214158) @@ -645,21 +645,7 @@ again: callout_init(&p2->p_itcallout, CALLOUT_MPSAFE); #ifdef KTRACE - /* - * Copy traceflag and tracefile if enabled. - */ - mtx_lock(&ktrace_mtx); - KASSERT(p2->p_tracevp == NULL, ("new process has a ktrace vnode")); - if (p1->p_traceflag & KTRFAC_INHERIT) { - p2->p_traceflag = p1->p_traceflag; - if ((p2->p_tracevp = p1->p_tracevp) != NULL) { - VREF(p2->p_tracevp); - KASSERT(p1->p_tracecred != NULL, - ("ktrace vnode with no cred")); - p2->p_tracecred = crhold(p1->p_tracecred); - } - } - mtx_unlock(&ktrace_mtx); + ktrprocfork(p1, p2); #endif /* Modified: head/sys/kern/kern_ktrace.c ============================================================================== --- head/sys/kern/kern_ktrace.c Thu Oct 21 19:11:14 2010 (r214157) +++ head/sys/kern/kern_ktrace.c Thu Oct 21 19:17:40 2010 (r214158) @@ -126,7 +126,7 @@ SYSCTL_UINT(_kern_ktrace, OID_AUTO, geni 0, "Maximum size of genio event payload"); static int print_message = 1; -struct mtx ktrace_mtx; +static struct mtx ktrace_mtx; static struct sx ktrace_sx; static void ktrace_init(void *dummy); @@ -134,7 +134,10 @@ static int sysctl_kern_ktrace_request_po static u_int ktrace_resize_pool(u_int newsize); static struct ktr_request *ktr_getrequest(int type); static void ktr_submitrequest(struct thread *td, struct ktr_request *req); +static void ktr_freeproc(struct proc *p, struct ucred **uc, + struct vnode **vp); static void ktr_freerequest(struct ktr_request *req); +static void ktr_freerequest_locked(struct ktr_request *req); static void ktr_writerequest(struct thread *td, struct ktr_request *req); static int ktrcanset(struct thread *,struct proc *); static int ktrsetchildren(struct thread *,struct proc *,int,int,struct vnode *); @@ -375,11 +378,43 @@ static void ktr_freerequest(struct ktr_request *req) { + mtx_lock(&ktrace_mtx); + ktr_freerequest_locked(req); + mtx_unlock(&ktrace_mtx); +} + +static void +ktr_freerequest_locked(struct ktr_request *req) +{ + + mtx_assert(&ktrace_mtx, MA_OWNED); if (req->ktr_buffer != NULL) free(req->ktr_buffer, M_KTRACE); - mtx_lock(&ktrace_mtx); STAILQ_INSERT_HEAD(&ktr_free, req, ktr_list); - mtx_unlock(&ktrace_mtx); +} + +/* + * Disable tracing for a process and release all associated resources. + * The caller is responsible for releasing a reference on the returned + * vnode and credentials. + */ +static void +ktr_freeproc(struct proc *p, struct ucred **uc, struct vnode **vp) +{ + struct ktr_request *req; + + PROC_LOCK_ASSERT(p, MA_OWNED); + mtx_assert(&ktrace_mtx, MA_OWNED); + *uc = p->p_tracecred; + p->p_tracecred = NULL; + if (vp != NULL) + *vp = p->p_tracevp; + p->p_tracevp = NULL; + p->p_traceflag = 0; + while ((req = STAILQ_FIRST(&p->p_ktr)) != NULL) { + STAILQ_REMOVE_HEAD(&p->p_ktr, ktr_list); + ktr_freerequest_locked(req); + } } void @@ -432,20 +467,79 @@ ktrsysret(code, error, retval) } /* - * When a process exits, drain per-process asynchronous trace records. + * When a setuid process execs, disable tracing. + * + * XXX: We toss any pending asynchronous records. + */ +void +ktrprocexec(struct proc *p, struct ucred **uc, struct vnode **vp) +{ + + PROC_LOCK_ASSERT(p, MA_OWNED); + mtx_lock(&ktrace_mtx); + ktr_freeproc(p, uc, vp); + mtx_unlock(&ktrace_mtx); +} + +/* + * When a process exits, drain per-process asynchronous trace records + * and disable tracing. */ void ktrprocexit(struct thread *td) { + struct proc *p; + struct ucred *cred; + struct vnode *vp; + int vfslocked; + + p = td->td_proc; + if (p->p_traceflag == 0) + return; ktrace_enter(td); sx_xlock(&ktrace_sx); ktr_drain(td); sx_xunlock(&ktrace_sx); + PROC_LOCK(p); + mtx_lock(&ktrace_mtx); + ktr_freeproc(p, &cred, &vp); + mtx_unlock(&ktrace_mtx); + PROC_UNLOCK(p); + if (vp != NULL) { + vfslocked = VFS_LOCK_GIANT(vp->v_mount); + vrele(vp); + VFS_UNLOCK_GIANT(vfslocked); + } + if (cred != NULL) + crfree(cred); ktrace_exit(td); } /* + * When a process forks, enable tracing in the new process if needed. + */ +void +ktrprocfork(struct proc *p1, struct proc *p2) +{ + + PROC_LOCK_ASSERT(p1, MA_OWNED); + PROC_LOCK_ASSERT(p2, MA_OWNED); + mtx_lock(&ktrace_mtx); + KASSERT(p2->p_tracevp == NULL, ("new process has a ktrace vnode")); + if (p1->p_traceflag & KTRFAC_INHERIT) { + p2->p_traceflag = p1->p_traceflag; + if ((p2->p_tracevp = p1->p_tracevp) != NULL) { + VREF(p2->p_tracevp); + KASSERT(p1->p_tracecred != NULL, + ("ktrace vnode with no cred")); + p2->p_tracecred = crhold(p1->p_tracecred); + } + } + mtx_unlock(&ktrace_mtx); +} + +/* * When a thread returns, drain any asynchronous records generated by the * system call. */ @@ -694,10 +788,7 @@ ktrace(td, uap) if (p->p_tracevp == vp) { if (ktrcanset(td, p)) { mtx_lock(&ktrace_mtx); - cred = p->p_tracecred; - p->p_tracecred = NULL; - p->p_tracevp = NULL; - p->p_traceflag = 0; + ktr_freeproc(p, &cred, NULL); mtx_unlock(&ktrace_mtx); vrele_count++; crfree(cred); @@ -864,14 +955,9 @@ ktrops(td, p, ops, facs, vp) p->p_traceflag |= KTRFAC_ROOT; } else { /* KTROP_CLEAR */ - if (((p->p_traceflag &= ~facs) & KTRFAC_MASK) == 0) { + if (((p->p_traceflag &= ~facs) & KTRFAC_MASK) == 0) /* no more tracing */ - p->p_traceflag = 0; - tracevp = p->p_tracevp; - p->p_tracevp = NULL; - tracecred = p->p_tracecred; - p->p_tracecred = NULL; - } + ktr_freeproc(p, &tracecred, &tracevp); } mtx_unlock(&ktrace_mtx); PROC_UNLOCK(p); @@ -1036,10 +1122,7 @@ ktr_writerequest(struct thread *td, stru PROC_LOCK(p); if (p->p_tracevp == vp) { mtx_lock(&ktrace_mtx); - p->p_tracevp = NULL; - p->p_traceflag = 0; - cred = p->p_tracecred; - p->p_tracecred = NULL; + ktr_freeproc(p, &cred, NULL); mtx_unlock(&ktrace_mtx); vrele_count++; } @@ -1051,11 +1134,6 @@ ktr_writerequest(struct thread *td, stru } sx_sunlock(&allproc_lock); - /* - * We can't clear any pending requests in threads that have cached - * them but not yet committed them, as those are per-thread. The - * thread will have to clear it itself on system call return. - */ vfslocked = VFS_LOCK_GIANT(vp->v_mount); while (vrele_count-- > 0) vrele(vp); Modified: head/sys/sys/ktrace.h ============================================================================== --- head/sys/sys/ktrace.h Thu Oct 21 19:11:14 2010 (r214157) +++ head/sys/sys/ktrace.h Thu Oct 21 19:17:40 2010 (r214158) @@ -191,8 +191,6 @@ struct stat; #define KTRFAC_DROP 0x20000000 /* last event was dropped */ #ifdef _KERNEL -extern struct mtx ktrace_mtx; - void ktrnamei(char *); void ktrcsw(int, int); void ktrpsig(int, sig_t, sigset_t *, int); @@ -200,7 +198,9 @@ void ktrgenio(int, enum uio_rw, struct u void ktrsyscall(int, int narg, register_t args[]); void ktrsysctl(int *name, u_int namelen); void ktrsysret(int, int, register_t); +void ktrprocexec(struct proc *, struct ucred **, struct vnode **); void ktrprocexit(struct thread *); +void ktrprocfork(struct proc *, struct proc *); void ktruserret(struct thread *); void ktrstruct(const char *, void *, size_t); #define ktrsockaddr(s) \ From owner-svn-src-head@FreeBSD.ORG Thu Oct 21 19:28: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 26AFF106566B; Thu, 21 Oct 2010 19:28:53 +0000 (UTC) (envelope-from bschmidt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 162E28FC15; Thu, 21 Oct 2010 19:28: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 o9LJSqh4001277; Thu, 21 Oct 2010 19:28:52 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9LJSqgS001275; Thu, 21 Oct 2010 19:28:52 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201010211928.o9LJSqgS001275@svn.freebsd.org> From: Bernhard Schmidt Date: Thu, 21 Oct 2010 19:28: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: r214160 - head/sys/dev/iwi 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, 21 Oct 2010 19:28:53 -0000 Author: bschmidt Date: Thu Oct 21 19:28:52 2010 New Revision: 214160 URL: http://svn.freebsd.org/changeset/base/214160 Log: Instead of calling return when reaching the end of the assoc notification break the loop instead. We want to run the code after the while loop to set an associd and capinfo. If we don't do this net80211 will drop frames because it assumes the node has not yet been associated. MFC after: 1 week Modified: head/sys/dev/iwi/if_iwi.c Modified: head/sys/dev/iwi/if_iwi.c ============================================================================== --- head/sys/dev/iwi/if_iwi.c Thu Oct 21 19:27:27 2010 (r214159) +++ head/sys/dev/iwi/if_iwi.c Thu Oct 21 19:28:52 2010 (r214160) @@ -1356,7 +1356,7 @@ iwi_checkforqos(struct ieee80211vap *vap wme = NULL; while (frm < efrm) { - IEEE80211_VERIFY_LENGTH(efrm - frm, frm[1], return); + IEEE80211_VERIFY_LENGTH(efrm - frm, frm[1], break); switch (*frm) { case IEEE80211_ELEMID_VENDOR: if (iswmeoui(frm)) From owner-svn-src-head@FreeBSD.ORG Thu Oct 21 19:30: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 D67D9106566C; Thu, 21 Oct 2010 19:30:55 +0000 (UTC) (envelope-from bschmidt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C61E38FC12; Thu, 21 Oct 2010 19:30: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 o9LJUtOO001399; Thu, 21 Oct 2010 19:30:55 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9LJUtim001397; Thu, 21 Oct 2010 19:30:55 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201010211930.o9LJUtim001397@svn.freebsd.org> From: Bernhard Schmidt Date: Thu, 21 Oct 2010 19:30: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: r214162 - head/sys/dev/iwi 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, 21 Oct 2010 19:30:55 -0000 Author: bschmidt Date: Thu Oct 21 19:30:55 2010 New Revision: 214162 URL: http://svn.freebsd.org/changeset/base/214162 Log: The firmware always sets bit 14 and 15, to get the real associd we need to clear those bits. MFC after: 1 week Modified: head/sys/dev/iwi/if_iwi.c Modified: head/sys/dev/iwi/if_iwi.c ============================================================================== --- head/sys/dev/iwi/if_iwi.c Thu Oct 21 19:29:20 2010 (r214161) +++ head/sys/dev/iwi/if_iwi.c Thu Oct 21 19:30:55 2010 (r214162) @@ -1368,7 +1368,7 @@ iwi_checkforqos(struct ieee80211vap *vap ni = vap->iv_bss; ni->ni_capinfo = capinfo; - ni->ni_associd = associd; + ni->ni_associd = associd & 0x3fff; if (wme != NULL) ni->ni_flags |= IEEE80211_NODE_QOS; else From owner-svn-src-head@FreeBSD.ORG Thu Oct 21 19:44: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 6990C1065675; Thu, 21 Oct 2010 19:44:28 +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 583BA8FC08; Thu, 21 Oct 2010 19:44: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 o9LJiSsm001710; Thu, 21 Oct 2010 19:44:28 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9LJiSnk001707; Thu, 21 Oct 2010 19:44:28 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201010211944.o9LJiSnk001707@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 21 Oct 2010 19:44: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: r214163 - head/sys/geom/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: Thu, 21 Oct 2010 19:44:28 -0000 Author: pjd Date: Thu Oct 21 19:44:28 2010 New Revision: 214163 URL: http://svn.freebsd.org/changeset/base/214163 Log: Free opencrypto sessions on suspend, as they also might keep encryption keys. Modified: head/sys/geom/eli/g_eli.c head/sys/geom/eli/g_eli.h Modified: head/sys/geom/eli/g_eli.c ============================================================================== --- head/sys/geom/eli/g_eli.c Thu Oct 21 19:30:55 2010 (r214162) +++ head/sys/geom/eli/g_eli.c Thu Oct 21 19:44:28 2010 (r214163) @@ -314,6 +314,69 @@ g_eli_start(struct bio *bp) } } +static int +g_eli_newsession(struct g_eli_worker *wr) +{ + struct g_eli_softc *sc; + struct cryptoini crie, cria; + int error; + + sc = wr->w_softc; + + bzero(&crie, sizeof(crie)); + crie.cri_alg = sc->sc_ealgo; + crie.cri_klen = sc->sc_ekeylen; + if (sc->sc_ealgo == CRYPTO_AES_XTS) + crie.cri_klen <<= 1; + crie.cri_key = sc->sc_ekeys[0]; + if (sc->sc_flags & G_ELI_FLAG_AUTH) { + bzero(&cria, sizeof(cria)); + cria.cri_alg = sc->sc_aalgo; + cria.cri_klen = sc->sc_akeylen; + cria.cri_key = sc->sc_akey; + crie.cri_next = &cria; + } + + switch (sc->sc_crypto) { + case G_ELI_CRYPTO_SW: + error = crypto_newsession(&wr->w_sid, &crie, + CRYPTOCAP_F_SOFTWARE); + break; + case G_ELI_CRYPTO_HW: + error = crypto_newsession(&wr->w_sid, &crie, + CRYPTOCAP_F_HARDWARE); + break; + case G_ELI_CRYPTO_UNKNOWN: + error = crypto_newsession(&wr->w_sid, &crie, + CRYPTOCAP_F_HARDWARE); + if (error == 0) { + mtx_lock(&sc->sc_queue_mtx); + if (sc->sc_crypto == G_ELI_CRYPTO_UNKNOWN) + sc->sc_crypto = G_ELI_CRYPTO_HW; + mtx_unlock(&sc->sc_queue_mtx); + } else { + error = crypto_newsession(&wr->w_sid, &crie, + CRYPTOCAP_F_SOFTWARE); + mtx_lock(&sc->sc_queue_mtx); + if (sc->sc_crypto == G_ELI_CRYPTO_UNKNOWN) + sc->sc_crypto = G_ELI_CRYPTO_SW; + mtx_unlock(&sc->sc_queue_mtx); + } + break; + default: + panic("%s: invalid condition", __func__); + } + + return (error); +} + +static void +g_eli_freesession(struct g_eli_worker *wr) +{ + + crypto_freesession(wr->w_sid); +} + static void g_eli_cancel(struct g_eli_softc *sc) { @@ -361,6 +424,7 @@ g_eli_worker(void *arg) struct g_eli_softc *sc; struct g_eli_worker *wr; struct bio *bp; + int error; wr = arg; sc = wr->w_softc; @@ -388,7 +452,7 @@ again: if (sc->sc_flags & G_ELI_FLAG_DESTROY) { g_eli_cancel(sc); LIST_REMOVE(wr, w_next); - crypto_freesession(wr->w_sid); + g_eli_freesession(wr); free(wr, M_ELI); G_ELI_DEBUG(1, "Thread %s exiting.", curthread->td_proc->p_comm); @@ -411,12 +475,21 @@ again: * Suspend requested, mark the worker as * suspended and go to sleep. */ - wr->w_active = 0; + if (wr->w_active) { + g_eli_freesession(wr); + wr->w_active = FALSE; + } wakeup(&sc->sc_workers); msleep(sc, &sc->sc_queue_mtx, PRIBIO, "geli:suspend", 0); - if (!(sc->sc_flags & G_ELI_FLAG_SUSPEND)) - wr->w_active = 1; + if (!wr->w_active && + !(sc->sc_flags & G_ELI_FLAG_SUSPEND)) { + error = g_eli_newsession(wr); + KASSERT(error == 0, + ("g_eli_newsession() failed on resume (error=%d)", + error)); + wr->w_active = TRUE; + } goto again; } msleep(sc, &sc->sc_queue_mtx, PDROP, "geli:w", 0); @@ -630,7 +703,6 @@ g_eli_create(struct gctl_req *req, struc struct g_geom *gp; struct g_provider *pp; struct g_consumer *cp; - struct cryptoini crie, cria; u_int i, threads; int error; @@ -658,7 +730,7 @@ g_eli_create(struct gctl_req *req, struc gp->access = g_std_access; sc->sc_inflight = 0; - sc->sc_crypto = G_ELI_CRYPTO_SW; + sc->sc_crypto = G_ELI_CRYPTO_UNKNOWN; sc->sc_flags = md->md_flags; /* Backward compatibility. */ if (md->md_version < 4) @@ -772,20 +844,6 @@ g_eli_create(struct gctl_req *req, struc LIST_INIT(&sc->sc_workers); - bzero(&crie, sizeof(crie)); - crie.cri_alg = sc->sc_ealgo; - crie.cri_klen = sc->sc_ekeylen; - if (sc->sc_ealgo == CRYPTO_AES_XTS) - crie.cri_klen <<= 1; - crie.cri_key = sc->sc_ekeys[0]; - if (sc->sc_flags & G_ELI_FLAG_AUTH) { - bzero(&cria, sizeof(cria)); - cria.cri_alg = sc->sc_aalgo; - cria.cri_klen = sc->sc_akeylen; - cria.cri_key = sc->sc_akey; - crie.cri_next = &cria; - } - threads = g_eli_threads; if (threads == 0) threads = mp_ncpus; @@ -805,20 +863,7 @@ g_eli_create(struct gctl_req *req, struc wr->w_number = i; wr->w_active = TRUE; - /* - * If this is the first pass, try to get hardware support. - * Use software cryptography, if we cannot get it. - */ - if (LIST_EMPTY(&sc->sc_workers)) { - error = crypto_newsession(&wr->w_sid, &crie, - CRYPTOCAP_F_HARDWARE); - if (error == 0) - sc->sc_crypto = G_ELI_CRYPTO_HW; - } - if (sc->sc_crypto == G_ELI_CRYPTO_SW) { - error = crypto_newsession(&wr->w_sid, &crie, - CRYPTOCAP_F_SOFTWARE); - } + error = g_eli_newsession(wr); if (error != 0) { free(wr, M_ELI); if (req != NULL) { @@ -834,7 +879,7 @@ g_eli_create(struct gctl_req *req, struc error = kproc_create(g_eli_worker, wr, &wr->w_proc, 0, 0, "g_eli[%u] %s", i, bpp->name); if (error != 0) { - crypto_freesession(wr->w_sid); + g_eli_freesession(wr); free(wr, M_ELI); if (req != NULL) { gctl_error(req, "Cannot create kernel thread " Modified: head/sys/geom/eli/g_eli.h ============================================================================== --- head/sys/geom/eli/g_eli.h Thu Oct 21 19:30:55 2010 (r214162) +++ head/sys/geom/eli/g_eli.h Thu Oct 21 19:44:28 2010 (r214163) @@ -113,6 +113,7 @@ extern int g_eli_debug; extern u_int g_eli_overwrites; extern u_int g_eli_batch; +#define G_ELI_CRYPTO_UNKNOWN 0 #define G_ELI_CRYPTO_HW 1 #define G_ELI_CRYPTO_SW 2 From owner-svn-src-head@FreeBSD.ORG Thu Oct 21 20:05: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 A848E1065670; Thu, 21 Oct 2010 20:05:19 +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 75C448FC19; Thu, 21 Oct 2010 20:05:19 +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 19A5446BC3; Thu, 21 Oct 2010 16:05:19 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id D67798A009; Thu, 21 Oct 2010 16:05:17 -0400 (EDT) From: John Baldwin To: d@delphij.net Date: Thu, 21 Oct 2010 16:03:59 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100819; KDE/4.4.5; amd64; ; ) References: <201010210857.o9L8vPVQ084307@svn.freebsd.org> <201010210746.41227.jhb@freebsd.org> <4CC08F9C.5010804@delphij.net> In-Reply-To: <4CC08F9C.5010804@delphij.net> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201010211604.00120.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Thu, 21 Oct 2010 16:05:17 -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, Xin LI Subject: Re: svn commit: r214125 - 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, 21 Oct 2010 20:05:19 -0000 On Thursday, October 21, 2010 3:08:12 pm Xin LI wrote: > On 10/21/10 04:46, John Baldwin wrote: > > On Thursday, October 21, 2010 4:57:25 am Xin LI wrote: > >> Author: delphij > >> Date: Thu Oct 21 08:57:25 2010 > >> New Revision: 214125 > >> URL: http://svn.freebsd.org/changeset/base/214125 > >> > >> Log: > >> In syscall_module_handler(): all switch branches return, remove > >> unreached code as pointed out in a Chinese forum [1]. > >> > >> [1] http://www.freebsdchina.org/forum/viewtopic.php?t=50619 > >> > >> Pointed out by: btw616 > >> MFC after: 1 month > > > > I think this exposes a bug though in that the default case doesn't pass > > through to chainevh. The default case should look more like the removed code > > (except returning EOPNOTSUPP instead of 0 if there is no chainevh). > > Hmm... It sounds reasonable in theory (so that modules can handle > events other than MOD_LOAD/UNLOAD) at least, while I don't think it's > really being used anywhere. Yes, I agree it probably isn't used, but it'd be a weird surprise if someone tried to make use of it in the future for MOD_QUIESCE or the like. > Will the attached patch look reasonable? (If data->chainevh is NULL > then operation is not supported, if not then delegate to the module). Yes, I think this is fine. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Thu Oct 21 20:22: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 CE604106566B; Thu, 21 Oct 2010 20:22:00 +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 BD2FE8FC16; Thu, 21 Oct 2010 20:22: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 o9LKM0RH002989; Thu, 21 Oct 2010 20:22:00 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9LKM0xE002987; Thu, 21 Oct 2010 20:22:00 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201010212022.o9LKM0xE002987@svn.freebsd.org> From: Gleb Smirnoff Date: Thu, 21 Oct 2010 20:22:00 +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: r214174 - head/usr.bin/unzip 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, 21 Oct 2010 20:22:00 -0000 Author: glebius Date: Thu Oct 21 20:22:00 2010 New Revision: 214174 URL: http://svn.freebsd.org/changeset/base/214174 Log: Fix typo in last commit. Submitted by: bcr Modified: head/usr.bin/unzip/unzip.1 Modified: head/usr.bin/unzip/unzip.1 ============================================================================== --- head/usr.bin/unzip/unzip.1 Thu Oct 21 20:21:36 2010 (r214173) +++ head/usr.bin/unzip/unzip.1 Thu Oct 21 20:22:00 2010 (r214174) @@ -111,7 +111,7 @@ Note that only one of and .Fl u may be specified. -Is specified filename is +If specified filename is .Va Qq - , then data is read from .Va stdin . From owner-svn-src-head@FreeBSD.ORG Thu Oct 21 20:31: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 50D561065695; Thu, 21 Oct 2010 20:31:51 +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 4057A8FC12; Thu, 21 Oct 2010 20:31: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 o9LKVpUS003458; Thu, 21 Oct 2010 20:31:51 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9LKVpFP003456; Thu, 21 Oct 2010 20:31:51 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201010212031.o9LKVpFP003456@svn.freebsd.org> From: Xin LI Date: Thu, 21 Oct 2010 20:31: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: r214181 - 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, 21 Oct 2010 20:31:51 -0000 Author: delphij Date: Thu Oct 21 20:31:50 2010 New Revision: 214181 URL: http://svn.freebsd.org/changeset/base/214181 Log: Call chainevh callback when we are invoked with neither MOD_LOAD nor MOD_UNLOAD. This makes it possible to add custom hooks for other module events. Return EOPNOTSUPP when there is no callback available. Pointed out by: jhb Reviewed by: jhb MFC after: 1 month Modified: head/sys/kern/kern_syscalls.c Modified: head/sys/kern/kern_syscalls.c ============================================================================== --- head/sys/kern/kern_syscalls.c Thu Oct 21 20:30:35 2010 (r214180) +++ head/sys/kern/kern_syscalls.c Thu Oct 21 20:31:50 2010 (r214181) @@ -181,7 +181,9 @@ syscall_module_handler(struct module *mo error = syscall_deregister(data->offset, &data->old_sysent); return (error); default: - return EOPNOTSUPP; + if (data->chainevh) + return (data->chainevh(mod, what, data->chainarg)); + return (EOPNOTSUPP); } /* NOTREACHED */ From owner-svn-src-head@FreeBSD.ORG Thu Oct 21 21:08: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 E24B6106566B; Thu, 21 Oct 2010 21:08:12 +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 CFCDA8FC0A; Thu, 21 Oct 2010 21:08: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 o9LL8Cs5004309; Thu, 21 Oct 2010 21:08:12 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9LL8CYF004307; Thu, 21 Oct 2010 21:08:12 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201010212108.o9LL8CYF004307@svn.freebsd.org> From: Robert Watson Date: Thu, 21 Oct 2010 21:08: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: r214185 - 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: Thu, 21 Oct 2010 21:08:13 -0000 Author: rwatson Date: Thu Oct 21 21:08:12 2010 New Revision: 214185 URL: http://svn.freebsd.org/changeset/base/214185 Log: Universally use uintmax_t in syscall_timing; rearrange arithmetic to suffer fewer rounding errors with smaller numbers; fix argc validation so multiple tests run on a single command line. 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 Thu Oct 21 20:34:29 2010 (r214184) +++ head/tools/tools/syscall_timing/syscall_timing.c Thu Oct 21 21:08:12 2010 (r214185) @@ -87,10 +87,10 @@ benchmark_stop(void) assert(clock_gettime(CLOCK_REALTIME, &ts_end) == 0); } -uint64_t -test_getuid(uint64_t num, uint64_t int_arg, const char *path) +uintmax_t +test_getuid(uintmax_t num, uintmax_t int_arg, const char *path) { - uint64_t i; + uintmax_t i; /* * Thread-local data should require no locking if system @@ -106,10 +106,10 @@ test_getuid(uint64_t num, uint64_t int_a return (i); } -uint64_t -test_getppid(uint64_t num, uint64_t int_arg, const char *path) +uintmax_t +test_getppid(uintmax_t num, uintmax_t int_arg, const char *path) { - uint64_t i; + uintmax_t i; /* * This is process-local, but can change, so will require a @@ -125,11 +125,11 @@ test_getppid(uint64_t num, uint64_t int_ return (i); } -uint64_t -test_clock_gettime(uint64_t num, uint64_t int_arg, const char *path) +uintmax_t +test_clock_gettime(uintmax_t num, uintmax_t int_arg, const char *path) { struct timespec ts; - uint64_t i; + uintmax_t i; benchmark_start(); for (i = 0; i < num; i++) { @@ -141,8 +141,8 @@ test_clock_gettime(uint64_t num, uint64_ return (i); } -uint64_t -test_pipe(uint64_t num, uint64_t int_arg, const char *path) +uintmax_t +test_pipe(uintmax_t num, uintmax_t int_arg, const char *path) { int fd[2], i; @@ -169,10 +169,10 @@ test_pipe(uint64_t num, uint64_t int_arg return (i); } -uint64_t -test_socket_stream(uint64_t num, uint64_t int_arg, const char *path) +uintmax_t +test_socket_stream(uintmax_t num, uintmax_t int_arg, const char *path) { - uint64_t i, so; + uintmax_t i, so; so = socket(int_arg, SOCK_STREAM, 0); if (so < 0) @@ -191,10 +191,10 @@ test_socket_stream(uint64_t num, uint64_ return (i); } -uint64_t -test_socket_dgram(uint64_t num, uint64_t int_arg, const char *path) +uintmax_t +test_socket_dgram(uintmax_t num, uintmax_t int_arg, const char *path) { - uint64_t i, so; + uintmax_t i, so; so = socket(int_arg, SOCK_DGRAM, 0); if (so < 0) @@ -213,10 +213,10 @@ test_socket_dgram(uint64_t num, uint64_t return (i); } -uint64_t -test_socketpair_stream(uint64_t num, uint64_t int_arg, const char *path) +uintmax_t +test_socketpair_stream(uintmax_t num, uintmax_t int_arg, const char *path) { - uint64_t i; + uintmax_t i; int so[2]; if (socketpair(PF_LOCAL, SOCK_STREAM, 0, so) == -1) @@ -236,10 +236,10 @@ test_socketpair_stream(uint64_t num, uin return (i); } -uint64_t -test_socketpair_dgram(uint64_t num, uint64_t int_arg, const char *path) +uintmax_t +test_socketpair_dgram(uintmax_t num, uintmax_t int_arg, const char *path) { - uint64_t i; + uintmax_t i; int so[2]; if (socketpair(PF_LOCAL, SOCK_DGRAM, 0, so) == -1) @@ -259,10 +259,10 @@ test_socketpair_dgram(uint64_t num, uint return (i); } -uint64_t -test_open_close(uint64_t num, uint64_t int_arg, const char *path) +uintmax_t +test_open_close(uintmax_t num, uintmax_t int_arg, const char *path) { - uint64_t i; + uintmax_t i; int fd; fd = open(path, O_RDONLY); @@ -283,11 +283,11 @@ test_open_close(uint64_t num, uint64_t i return (i); } -uint64_t -test_open_read_close(uint64_t num, uint64_t int_arg, const char *path) +uintmax_t +test_open_read_close(uintmax_t num, uintmax_t int_arg, const char *path) { char buf[int_arg]; - uint64_t i; + uintmax_t i; int fd; fd = open(path, O_RDONLY); @@ -310,8 +310,8 @@ test_open_read_close(uint64_t num, uint6 return (i); } -uint64_t -test_dup(uint64_t num, uint64_t int_arg, const char *path) +uintmax_t +test_dup(uintmax_t num, uintmax_t int_arg, const char *path) { int fd, i, shmfd; @@ -334,10 +334,10 @@ test_dup(uint64_t num, uint64_t int_arg, return (i); } -uint64_t -test_shmfd(uint64_t num, uint64_t int_arg, const char *path) +uintmax_t +test_shmfd(uintmax_t num, uintmax_t int_arg, const char *path) { - uint64_t i, shmfd; + uintmax_t i, shmfd; shmfd = shm_open(SHM_ANON, O_CREAT | O_RDWR, 0600); if (shmfd < 0) @@ -356,11 +356,11 @@ test_shmfd(uint64_t num, uint64_t int_ar return (i); } -uint64_t -test_fstat_shmfd(uint64_t num, uint64_t int_arg, const char *path) +uintmax_t +test_fstat_shmfd(uintmax_t num, uintmax_t int_arg, const char *path) { struct stat sb; - uint64_t i, shmfd; + uintmax_t i, shmfd; shmfd = shm_open(SHM_ANON, O_CREAT | O_RDWR, 0600); if (shmfd < 0) @@ -378,11 +378,11 @@ test_fstat_shmfd(uint64_t num, uint64_t return (i); } -uint64_t -test_fork(uint64_t num, uint64_t int_arg, const char *path) +uintmax_t +test_fork(uintmax_t num, uintmax_t int_arg, const char *path) { pid_t pid; - uint64_t i; + uintmax_t i; pid = fork(); if (pid < 0) @@ -407,11 +407,11 @@ test_fork(uint64_t num, uint64_t int_arg return (i); } -uint64_t -test_vfork(uint64_t num, uint64_t int_arg, const char *path) +uintmax_t +test_vfork(uintmax_t num, uintmax_t int_arg, const char *path) { pid_t pid; - uint64_t i; + uintmax_t i; pid = vfork(); if (pid < 0) @@ -440,11 +440,11 @@ test_vfork(uint64_t num, uint64_t int_ar static char *execve_args[] = { USR_BIN_TRUE, NULL}; extern char **environ; -uint64_t -test_fork_exec(uint64_t num, uint64_t int_arg, const char *path) +uintmax_t +test_fork_exec(uintmax_t num, uintmax_t int_arg, const char *path) { pid_t pid; - uint64_t i; + uintmax_t i; pid = fork(); if (pid < 0) @@ -473,11 +473,11 @@ test_fork_exec(uint64_t num, uint64_t in return (i); } -uint64_t -test_vfork_exec(uint64_t num, uint64_t int_arg, const char *path) +uintmax_t +test_vfork_exec(uintmax_t num, uintmax_t int_arg, const char *path) { pid_t pid; - uint64_t i; + uintmax_t i; pid = vfork(); if (pid < 0) @@ -506,10 +506,10 @@ test_vfork_exec(uint64_t num, uint64_t i return (i); } -uint64_t -test_chroot(uint64_t num, uint64_t int_arg, const char *path) +uintmax_t +test_chroot(uintmax_t num, uintmax_t int_arg, const char *path) { - uint64_t i; + uintmax_t i; if (chroot("/") < 0) err(-1, "test_chroot: chroot"); @@ -524,11 +524,11 @@ test_chroot(uint64_t num, uint64_t int_a return (i); } -uint64_t -test_setuid(uint64_t num, uint64_t int_arg, const char *path) +uintmax_t +test_setuid(uintmax_t num, uintmax_t int_arg, const char *path) { uid_t uid; - uint64_t i; + uintmax_t i; uid = getuid(); if (setuid(uid) < 0) @@ -546,8 +546,8 @@ test_setuid(uint64_t num, uint64_t int_a struct test { const char *t_name; - uint64_t (*t_func)(uint64_t, uint64_t, const char *); - uint64_t t_int; + uintmax_t (*t_func)(uintmax_t, uintmax_t, const char *); + uintmax_t t_int; }; static const struct test tests[] = { @@ -601,7 +601,7 @@ main(int argc, char *argv[]) long long ll; char *endp; int ch, i, j, k; - uint64_t iterations, loops; + uintmax_t iterations, loops; alarm_timeout = 0; iterations = 0; @@ -649,16 +649,16 @@ main(int argc, char *argv[]) if (loops < 1) loops = 1; - if (argc != 1) + if (argc < 1) usage(); assert(clock_getres(CLOCK_REALTIME, &ts_res) == 0); - printf("Clock resolution: %ju.%08ju\n", (uintmax_t)ts_res.tv_sec, + printf("Clock resolution: %ju.%09ju\n", (uintmax_t)ts_res.tv_sec, (uintmax_t)ts_res.tv_nsec); printf("test\tloop\ttotal\titerations\tperiteration\n"); for (j = 0; j < argc; j++) { - uint64_t calls; + uintmax_t calls, nsecsperit; the_test = NULL; for (i = 0; i < tests_count; i++) { @@ -687,9 +687,10 @@ main(int argc, char *argv[]) * the room in our arithmetic unit. Fine for system calls, * but not for long things. */ - ts_end.tv_sec *= 1000000000 / calls; - printf("0.%09ju\n", (uintmax_t)(ts_end.tv_sec + - ts_end.tv_nsec / calls)); + nsecsperit = ts_end.tv_sec * 1000000000; + nsecsperit += ts_end.tv_nsec; + nsecsperit /= calls; + printf("0.%09ju\n", (uintmax_t)nsecsperit); } } return (0); From owner-svn-src-head@FreeBSD.ORG Thu Oct 21 22:33: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 93448106566C; Thu, 21 Oct 2010 22:33:50 +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 67CB48FC08; Thu, 21 Oct 2010 22:33: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 o9LMXoKH006040; Thu, 21 Oct 2010 22:33:50 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9LMXol1006038; Thu, 21 Oct 2010 22:33:50 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201010212233.o9LMXol1006038@svn.freebsd.org> From: Warner Losh Date: Thu, 21 Oct 2010 22:33: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: r214187 - head/usr.sbin/pc-sysinstall/backend 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, 21 Oct 2010 22:33:50 -0000 Author: imp Date: Thu Oct 21 22:33:50 2010 New Revision: 214187 URL: http://svn.freebsd.org/changeset/base/214187 Log: Minor tweaks in compression support: o We need an eval here to get the right expansion of the command o bs=128k doesn't work in some cases, so eliminate it and cope with the minor performance hit. Submitted by: john hixson Modified: head/usr.sbin/pc-sysinstall/backend/functions.sh Modified: head/usr.sbin/pc-sysinstall/backend/functions.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend/functions.sh Thu Oct 21 22:18:12 2010 (r214186) +++ head/usr.sbin/pc-sysinstall/backend/functions.sh Thu Oct 21 22:33:50 2010 (r214187) @@ -138,7 +138,7 @@ rc_halt() fi echo "Running: ${CMD}" >>${LOGOUT} - ${CMD} >>${LOGOUT} 2>>${LOGOUT} + eval ${CMD} >>${LOGOUT} 2>>${LOGOUT} STATUS="$?" if [ "${STATUS}" != "0" ] then @@ -364,37 +364,37 @@ write_image() case "${COMPRESSION}" in lzw) - rc_halt "uncompress ${IMAGE_FILE} -c | dd of=${DEVICE_FILE} bs=128k" + rc_halt "uncompress ${IMAGE_FILE} -c | dd of=${DEVICE_FILE}" IMAGE_FILE="${IMAGE_FILE%.Z}" ;; lzo) - rc_halt "lzop -d $IMAGE_{FILE} -c | dd of=${DEVICE_FILE} bs=128k" + rc_halt "lzop -d $IMAGE_{FILE} -c | dd of=${DEVICE_FILE}" IMAGE_FILE="${IMAGE_FILE%.lzo}" ;; lzma) - rc_halt "lzma -d ${IMAGE_FILE} -c | dd of=${DEVICE_FILE} bs=128k" + rc_halt "lzma -d ${IMAGE_FILE} -c | dd of=${DEVICE_FILE}" IMAGE_FILE="${IMAGE_FILE%.lzma}" ;; gzip) - rc_halt "gunzip ${IMAGE_FILE} -c | dd of=${DEVICE_FILE} bs=128k" + rc_halt "gunzip ${IMAGE_FILE} -c | dd of=${DEVICE_FILE}" IMAGE_FILE="${IMAGE_FILE%.gz}" ;; bzip2) - rc_halt "bunzip2 ${IMAGE_FILE} -c | dd of=${DEVICE_FILE} bs=128k" + rc_halt "bunzip2 ${IMAGE_FILE} -c | dd of=${DEVICE_FILE}" IMAGE_FILE="${IMAGE_FILE%.bz2}" ;; xz) - rc_halt "xz -d ${IMAGE_FILE} -c | dd of=${DEVICE_FILE} bs=128k" + rc_halt "xz -d ${IMAGE_FILE} -c | dd of=${DEVICE_FILE}" IMAGE_FILE="${IMAGE_FILE%.xz}" ;; zip) - rc_halt "unzip ${IMAGE_FILE} -c | dd of=${DEVICE_FILE} bs=128k" + rc_halt "unzip ${IMAGE_FILE} -c | dd of=${DEVICE_FILE}" IMAGE_FILE="${IMAGE_FILE%.zip}" ;; @@ -404,7 +404,7 @@ write_image() esac else - rc_halt "dd if=${IMAGE_FILE} of=${DEVICE_FILE} bs=128k" + rc_halt "dd if=${IMAGE_FILE} of=${DEVICE_FILE}" fi }; From owner-svn-src-head@FreeBSD.ORG Thu Oct 21 22:46: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 0A6331065673; Thu, 21 Oct 2010 22:46:11 +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 ED34C8FC17; Thu, 21 Oct 2010 22:46: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 o9LMkAek006347; Thu, 21 Oct 2010 22:46:10 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9LMkAMs006345; Thu, 21 Oct 2010 22:46:10 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201010212246.o9LMkAMs006345@svn.freebsd.org> From: Warner Losh Date: Thu, 21 Oct 2010 22:46: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: r214188 - head/usr.sbin/pc-sysinstall/backend 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, 21 Oct 2010 22:46:11 -0000 Author: imp Date: Thu Oct 21 22:46:10 2010 New Revision: 214188 URL: http://svn.freebsd.org/changeset/base/214188 Log: More support for IMAGE installations Modified: head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh Modified: head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh Thu Oct 21 22:33:50 2010 (r214187) +++ head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh Thu Oct 21 22:46:10 2010 (r214188) @@ -219,9 +219,17 @@ setup_mbr_partitions() USINGENCROOT="0" ; export USINGENCROOT fi + if [ -n "${IMAGE}" ] + then + FS="IMAGE" + SIZE=`ls -l "${IMAGE}" | awk '{ print $5 }'` + MNT=`echo $STRING | tr -s '\t' ' ' | cut -d ' ' -f 2` + SIZE=`convert_byte_to_megabyte $SIZE` + fi + # Now check that these values are sane case $FS in - UFS|UFS+S|UFS+J|UFS+SUJ|ZFS|SWAP) ;; + UFS|UFS+S|UFS+J|UFS+SUJ|ZFS|SWAP|IMAGE) ;; *) exit_err "ERROR: Invalid file system specified on $line" ;; esac From owner-svn-src-head@FreeBSD.ORG Thu Oct 21 23:08: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 85536106564A; Thu, 21 Oct 2010 23:08:42 +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 742718FC1B; Thu, 21 Oct 2010 23:08: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 o9LN8gJP006817; Thu, 21 Oct 2010 23:08:42 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9LN8gVE006815; Thu, 21 Oct 2010 23:08:42 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201010212308.o9LN8gVE006815@svn.freebsd.org> From: Warner Losh Date: Thu, 21 Oct 2010 23:08: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: r214189 - head/usr.sbin/pc-sysinstall/backend 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, 21 Oct 2010 23:08:42 -0000 Author: imp Date: Thu Oct 21 23:08:42 2010 New Revision: 214189 URL: http://svn.freebsd.org/changeset/base/214189 Log: Fix two typos Submitted by: Benedict Reuschling Modified: head/usr.sbin/pc-sysinstall/backend/functions-extractimage.sh Modified: head/usr.sbin/pc-sysinstall/backend/functions-extractimage.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend/functions-extractimage.sh Thu Oct 21 22:46:10 2010 (r214188) +++ head/usr.sbin/pc-sysinstall/backend/functions-extractimage.sh Thu Oct 21 23:08:42 2010 (r214189) @@ -70,7 +70,7 @@ start_extract_uzip_tar() if [ "$?" != "0" ] then cd / - echo "TAR failure occured:" >>${LOGOUT} + echo "TAR failure occurred:" >>${LOGOUT} cat ${FSMNT}/.tar-extract.log | grep "tar:" >>${LOGOUT} umount ${FSMNT}.uzip mdconfig -d -u ${MDDEVICE} @@ -275,7 +275,7 @@ EOF INSFILE="${OUTFILE}" ; export INSFILE } -# Function which does the rsync download from the server specifed in cfg +# Function which does the rsync download from the server specified in cfg start_rsync_copy() { # Load our rsync config values From owner-svn-src-head@FreeBSD.ORG Fri Oct 22 00:10: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 07B6A106566B; Fri, 22 Oct 2010 00:10:49 +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 EA9758FC17; Fri, 22 Oct 2010 00:10:48 +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 o9M0AmNo008046; Fri, 22 Oct 2010 00:10:48 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9M0AmPk008044; Fri, 22 Oct 2010 00:10:48 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201010220010.o9M0AmPk008044@svn.freebsd.org> From: Warner Losh Date: Fri, 22 Oct 2010 00:10:48 +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: r214191 - 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: Fri, 22 Oct 2010 00:10:49 -0000 Author: imp Date: Fri Oct 22 00:10:48 2010 New Revision: 214191 URL: http://svn.freebsd.org/changeset/base/214191 Log: Remove unnecessary variable. Submitted by: Alex Kozlov Modified: head/usr.sbin/pc-sysinstall/backend-query/query-langs.sh Modified: head/usr.sbin/pc-sysinstall/backend-query/query-langs.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend-query/query-langs.sh Thu Oct 21 23:45:57 2010 (r214190) +++ head/usr.sbin/pc-sysinstall/backend-query/query-langs.sh Fri Oct 22 00:10:48 2010 (r214191) @@ -25,8 +25,6 @@ # # $FreeBSD$ -FOUND="0" - cat ${PROGDIR}/conf/avail-langs exit 0 From owner-svn-src-head@FreeBSD.ORG Fri Oct 22 00:11: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 E22511065672; Fri, 22 Oct 2010 00:11:55 +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 B69898FC17; Fri, 22 Oct 2010 00:11: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 o9M0BtE3008118; Fri, 22 Oct 2010 00:11:55 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9M0Bt2E008115; Fri, 22 Oct 2010 00:11:55 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201010220011.o9M0Bt2E008115@svn.freebsd.org> From: Warner Losh Date: Fri, 22 Oct 2010 00:11: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: r214192 - 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: Fri, 22 Oct 2010 00:11:56 -0000 Author: imp Date: Fri Oct 22 00:11:55 2010 New Revision: 214192 URL: http://svn.freebsd.org/changeset/base/214192 Log: More simplifications Submitted by: Alex Kozlov Modified: head/usr.sbin/pc-sysinstall/backend-query/disk-info.sh head/usr.sbin/pc-sysinstall/backend-query/test-live.sh Modified: head/usr.sbin/pc-sysinstall/backend-query/disk-info.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend-query/disk-info.sh Fri Oct 22 00:10:48 2010 (r214191) +++ head/usr.sbin/pc-sysinstall/backend-query/disk-info.sh Fri Oct 22 00:11:55 2010 (r214192) @@ -26,25 +26,16 @@ # $FreeBSD$ # Query a disk for partitions and display them -############################# +############################################################################# -. ${PROGDIR}/backend/functions.sh . ${PROGDIR}/backend/functions-disk.sh -if [ -z "${1}" ] -then - echo "Error: No disk specified!" - exit 1 -fi - -if [ ! -e "/dev/${1}" ] -then - echo "Error: Disk /dev/${1} does not exist!" - exit 1 -fi - DISK="${1}" +[ -z "${DISK}" ] && { echo 'Error: No disk specified!'; exit 1; } +[ ! -e "/dev/${DISK}" ] && \ + { echo "Error: Disk /dev/${DISK} does not exist!"; exit 1; } + get_disk_cyl "${DISK}" CYLS="${VAL}" Modified: head/usr.sbin/pc-sysinstall/backend-query/test-live.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend-query/test-live.sh Fri Oct 22 00:10:48 2010 (r214191) +++ head/usr.sbin/pc-sysinstall/backend-query/test-live.sh Fri Oct 22 00:11:55 2010 (r214192) @@ -28,13 +28,6 @@ # Script which checks if we are running from install media, or real system ############################################################################# -dmesg | grep "md0: Preloaded image" >/dev/null 2>/dev/null -if [ "$?" = "0" ] -then - echo "INSTALL-MEDIA" - exit 0 -else - echo "REAL-DISK" - exit 1 -fi +dmesg | grep -q 'md0: Preloaded image' || { echo 'REAL-DISK'; exit 1; } +echo 'INSTALL-MEDIA' From owner-svn-src-head@FreeBSD.ORG Fri Oct 22 01:31: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 ABADF106566B; Fri, 22 Oct 2010 01:31: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 41AE28FC12; Fri, 22 Oct 2010 01:31: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 o9M1VKQ2000495 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 22 Oct 2010 12:31:22 +1100 Date: Fri, 22 Oct 2010 12:31:20 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Gleb Smirnoff In-Reply-To: <201010211705.o9LH5GH5097260@svn.freebsd.org> Message-ID: <20101022120523.R1230@besplex.bde.org> References: <201010211705.o9LH5GH5097260@svn.freebsd.org> 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: r214137 - head/usr.bin/unzip 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, 22 Oct 2010 01:31:26 -0000 On Thu, 21 Oct 2010, Gleb Smirnoff wrote: > Log: > Make it possible to read input from stdin. > > Without this change I don't see a way to > unpack a multivolume archive without wasting > disk space for a temporary file. What's wrong with the canonical "cat foo*.zip | unzip /dev/stdin"? This is better for light use than engooping utilities with support for "-". This failed for an old ports version of unzip because it stat'ed /dev/stdin.zip and /dev/stdin.ZIP and found neither. Bogus. Then I tried foo.zip where foo.zip is a symlink to /dev/stdin. (This hack is also useful for broken disk utilities that want disk names in /dev with special names.) This failed because unzip first tried to seek on the pipe (failure ignored), then tried to read 0 bytes from the pipe (the read succeeded but failure to find the central directory followed, apparently because it used st_size as the size of the file. These bugs seem to be missing in the current version. /dev/stdin works, and so does a symlink to /dev/stdin although it does some lstats which probably break in other cases for symlinks. The not-unused md5 utility is still broken on device files but not on pipes using similar techniques in its library (MDXFileChunk()). First it does an fstat to get st_size. Then it tries to seek, and if the seek fails it uses a method that actually works and necessarily doesn't use st_size. Old versions used a working method in all cases. So you have to use a hack like "cat /dev/ad0 | md5" to checksum a disk device, else you get the same checksum for all disks as for all devices and all empty files. Bruce From owner-svn-src-head@FreeBSD.ORG Fri Oct 22 04:40: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 B6E1F106566B; Fri, 22 Oct 2010 04:40:04 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from gw01.mail.saunalahti.fi (gw01.mail.saunalahti.fi [195.197.172.115]) by mx1.freebsd.org (Postfix) with ESMTP id 671098FC17; Fri, 22 Oct 2010 04:40:04 +0000 (UTC) Received: from a91-153-123-205.elisa-laajakaista.fi (a91-153-123-205.elisa-laajakaista.fi [91.153.123.205]) by gw01.mail.saunalahti.fi (Postfix) with SMTP id 299C015150C; Fri, 22 Oct 2010 07:24:20 +0300 (EEST) Date: Fri, 22 Oct 2010 07:24:20 +0300 From: Jaakko Heinonen To: Benedict Reuschling Message-ID: <20101022042420.GA1389@a91-153-123-205.elisa-laajakaista.fi> References: <201010211830.o9LIUnYA099338@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201010211830.o9LIUnYA099338@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r214148 - head/lib/libc/stdlib 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, 22 Oct 2010 04:40:04 -0000 On 2010-10-21, Benedict Reuschling wrote: > Document strtonum()s behavior of setting errno to 0 when no error is found. strtonum(3) doesn't behave like this. Anyway setting errno to 0 in a library function would violate the C99 standard. %%% #include #include #include #include int main() { errno = EDOOFUS; if (strtonum("1", 1, 10, NULL) == 0) err(1, "failed"); printf("%d\n", errno); return (0); } %%% $ cc test.c $ ./a.out 88 -- Jaakko From owner-svn-src-head@FreeBSD.ORG Fri Oct 22 04:43: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 2FF001065673; Fri, 22 Oct 2010 04:43:05 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 13D798FC12; Fri, 22 Oct 2010 04:43: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 o9M4h4gV013522; Fri, 22 Oct 2010 04:43:04 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9M4h4u6013519; Fri, 22 Oct 2010 04:43:04 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201010220443.o9M4h4u6013519@svn.freebsd.org> From: Marcel Moolenaar Date: Fri, 22 Oct 2010 04:43: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: r214194 - in head/libexec/rtld-elf: . ia64 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, 22 Oct 2010 04:43:05 -0000 Author: marcel Date: Fri Oct 22 04:43:04 2010 New Revision: 214194 URL: http://svn.freebsd.org/changeset/base/214194 Log: Unbreak ia64. With r169630 I disabled symbol versioning because it broke rtld. With r211706 rtld got broken for ia64 & powerpc64. It was fixed for powerpc64 with r212497. In between, r211749 removed the exports table because the version script handled the exports. But wait, symbol versioning was disabled on ia64. With exports controlled by the version script and symbol versioning disabled, all symbols are exported and too many symbols bind to the definition in rtld. Let's just say that waird things happen. So, enable symbol versioning on ia64 and apply a work-around for the SIGSEGV that triggered r169630 to begin with: when rtld relocates itself, it comes across r_debug_state and for some reason can't find the definition. This causes a failure, relocation aborts and null pointers galore. The work-around is to ignore the missing definition when rtld is relocating itself and keep going. Maybe with the next binutils this will all go away. Maybe not, in which case I still need to figure out why r_debug_state cannot be found. BTW: r_debug_state is in the symbol map -- I don't think any other rtld symbols that rtld references are in the symbol map... Modified: head/libexec/rtld-elf/Makefile head/libexec/rtld-elf/ia64/reloc.c Modified: head/libexec/rtld-elf/Makefile ============================================================================== --- head/libexec/rtld-elf/Makefile Fri Oct 22 03:05:34 2010 (r214193) +++ head/libexec/rtld-elf/Makefile Fri Oct 22 04:43:04 2010 (r214194) @@ -34,7 +34,6 @@ LDFLAGS+= -shared -Wl,-Bsymbolic DPADD= ${LIBC_PIC} LDADD= -lc_pic -lssp_nonshared -.if ${MACHINE_CPUARCH} != "ia64" .if ${MK_SYMVER} == "yes" LIBCDIR= ${.CURDIR}/../../lib/libc VERSION_DEF= ${LIBCDIR}/Versions.def @@ -48,7 +47,6 @@ ${PROG}: ${VERSION_MAP} SYMBOL_MAPS+= ${.CURDIR}/${RTLD_ARCH}/Symbol.map .endif .endif -.endif .sinclude "${.CURDIR}/${RTLD_ARCH}/Makefile.inc" Modified: head/libexec/rtld-elf/ia64/reloc.c ============================================================================== --- head/libexec/rtld-elf/ia64/reloc.c Fri Oct 22 03:05:34 2010 (r214193) +++ head/libexec/rtld-elf/ia64/reloc.c Fri Oct 22 04:43:04 2010 (r214194) @@ -195,9 +195,22 @@ reloc_non_plt_obj(Obj_Entry *obj_rtld, O int sym_index; def = find_symdef(ELF_R_SYM(rela->r_info), obj, &defobj, - false, cache); - if (def == NULL) - return -1; + true, cache); + if (def == NULL) { + /* + * XXX r_debug_state is problematic and find_symdef() + * returns NULL for it. This probably has something to + * do with symbol versioning (r_debug_state is in the + * symbol map). If we return -1 in that case we abort + * relocating rtld, which typically is fatal. So, for + * now just skip the symbol when we're relocating + * rtld. We don't care about r_debug_state unless we + * are being debugged. + */ + if (obj != obj_rtld) + return -1; + break; + } if (def->st_shndx != SHN_UNDEF) { target = (Elf_Addr)(defobj->relocbase + def->st_value); From owner-svn-src-head@FreeBSD.ORG Fri Oct 22 08:51: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 4C591106567A; Fri, 22 Oct 2010 08:51:50 +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 3BC8A8FC21; Fri, 22 Oct 2010 08:51: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 o9M8poiX020494; Fri, 22 Oct 2010 08:51:50 GMT (envelope-from bcr@svn.freebsd.org) Received: (from bcr@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9M8poQZ020492; Fri, 22 Oct 2010 08:51:50 GMT (envelope-from bcr@svn.freebsd.org) Message-Id: <201010220851.o9M8poQZ020492@svn.freebsd.org> From: Benedict Reuschling Date: Fri, 22 Oct 2010 08:51: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: r214200 - head/lib/libc/stdlib 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, 22 Oct 2010 08:51:50 -0000 Author: bcr (doc committer) Date: Fri Oct 22 08:51:49 2010 New Revision: 214200 URL: http://svn.freebsd.org/changeset/base/214200 Log: Revert to r214147, errno is not clobbered as originally thought. Modified: head/lib/libc/stdlib/strtonum.3 Modified: head/lib/libc/stdlib/strtonum.3 ============================================================================== --- head/lib/libc/stdlib/strtonum.3 Fri Oct 22 08:46:22 2010 (r214199) +++ head/lib/libc/stdlib/strtonum.3 Fri Oct 22 08:51:49 2010 (r214200) @@ -83,8 +83,6 @@ is set, and .Fa errstr will point to an error message. On success, -.Va errno -is set to 0 and .Fa *errstr will be set to .Dv NULL ; From owner-svn-src-head@FreeBSD.ORG Fri Oct 22 11:22: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 DA0241065673; Fri, 22 Oct 2010 11:22:19 +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 C7DEC8FC1E; Fri, 22 Oct 2010 11:22: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 o9MBMJM2035345; Fri, 22 Oct 2010 11:22:19 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9MBMJfI035343; Fri, 22 Oct 2010 11:22:19 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201010221122.o9MBMJfI035343@svn.freebsd.org> From: Robert Watson Date: Fri, 22 Oct 2010 11:22: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: r214202 - 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: Fri, 22 Oct 2010 11:22:19 -0000 Author: rwatson Date: Fri Oct 22 11:22:19 2010 New Revision: 214202 URL: http://svn.freebsd.org/changeset/base/214202 Log: Validate syscall_timing test names before starting to provide earlier feedback regarding user error. Provide default loop and timing settings. Add a new test that just times pread() without the open()/close(). Mark tests requiring a path argument so we can provide better feedback to the user than EFAULT on (null). 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 Fri Oct 22 08:57:25 2010 (r214201) +++ head/tools/tools/syscall_timing/syscall_timing.c Fri Oct 22 11:22:19 2010 (r214202) @@ -284,6 +284,29 @@ test_open_close(uintmax_t num, uintmax_t } uintmax_t +test_read(uintmax_t num, uintmax_t int_arg, const char *path) +{ + char buf[int_arg]; + uintmax_t i; + int fd; + + fd = open(path, O_RDONLY); + if (fd < 0) + err(-1, "test_open_close: %s", path); + (void)pread(fd, buf, int_arg, 0); + + benchmark_start(); + for (i = 0; i < num; i++) { + if (alarm_fired) + break; + (void)pread(fd, buf, int_arg, 0); + } + benchmark_stop(); + close(fd); + return (i); +} + +uintmax_t test_open_read_close(uintmax_t num, uintmax_t int_arg, const char *path) { char buf[int_arg]; @@ -547,9 +570,12 @@ test_setuid(uintmax_t num, uintmax_t int struct test { const char *t_name; uintmax_t (*t_func)(uintmax_t, uintmax_t, const char *); + int t_flags; uintmax_t t_int; }; +#define FLAG_PATH 0x00000001 + static const struct test tests[] = { { "getuid", test_getuid }, { "getppid", test_getppid }, @@ -561,13 +587,28 @@ 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 }, - { "open_close", test_open_close }, - { "open_read_close_1", test_open_read_close, .t_int = 1 }, - { "open_read_close_10", test_open_read_close, .t_int = 10 }, - { "open_read_close_100", test_open_read_close, .t_int = 100 }, - { "open_read_close_1000", test_open_read_close, .t_int = 1000 }, - { "open_read_close_10000", test_open_read_close, .t_int = 10000 }, - { "open_read_close_100000", test_open_read_close, .t_int = 100000 }, + { "open_close", test_open_close, .t_flags = FLAG_PATH }, + { "open_read_close_1", test_open_read_close, .t_flags = FLAG_PATH, + .t_int = 1 }, + { "open_read_close_10", test_open_read_close, .t_flags = FLAG_PATH, + .t_int = 10 }, + { "open_read_close_100", test_open_read_close, .t_flags = FLAG_PATH, + .t_int = 100 }, + { "open_read_close_1000", test_open_read_close, .t_flags = FLAG_PATH, + .t_int = 1000 }, + { "open_read_close_10000", test_open_read_close, + .t_flags = FLAG_PATH, .t_int = 10000 }, + { "open_read_close_100000", test_open_read_close, + .t_flags = FLAG_PATH, .t_int = 100000 }, + { "open_read_close_1000000", test_open_read_close, + .t_flags = FLAG_PATH, .t_int = 1000000 }, + { "read_1", test_read, .t_flags = FLAG_PATH, .t_int = 1 }, + { "read_10", test_read, .t_flags = FLAG_PATH, .t_int = 10 }, + { "read_100", test_read, .t_flags = FLAG_PATH, .t_int = 100 }, + { "read_1000", test_read, .t_flags = FLAG_PATH, .t_int = 1000 }, + { "read_10000", test_read, .t_flags = FLAG_PATH, .t_int = 10000 }, + { "read_100000", test_read, .t_flags = FLAG_PATH, .t_int = 100000 }, + { "read_1000000", test_read, .t_flags = FLAG_PATH, .t_int = 1000000 }, { "dup", test_dup }, { "shmfd", test_shmfd }, { "fstat_shmfd", test_fstat_shmfd }, @@ -603,9 +644,9 @@ main(int argc, char *argv[]) int ch, i, j, k; uintmax_t iterations, loops; - alarm_timeout = 0; + alarm_timeout = 1; iterations = 0; - loops = 0; + loops = 10; path = NULL; while ((ch = getopt(argc, argv, "i:l:p:s:")) != -1) { switch (ch) { @@ -652,10 +693,27 @@ main(int argc, char *argv[]) if (argc < 1) usage(); + /* + * Validate test list and that, if a path is required, it is + * defined. + */ + for (j = 0; j < argc; j++) { + the_test = NULL; + for (i = 0; i < tests_count; i++) { + if (strcmp(argv[j], tests[i].t_name) == 0) + the_test = &tests[i]; + } + if (the_test == NULL) + usage(); + if ((the_test->t_flags & FLAG_PATH) && (path == NULL)) { + errx(-1, "%s requires -p", the_test->t_name); + } + } + assert(clock_getres(CLOCK_REALTIME, &ts_res) == 0); printf("Clock resolution: %ju.%09ju\n", (uintmax_t)ts_res.tv_sec, (uintmax_t)ts_res.tv_nsec); - printf("test\tloop\ttotal\titerations\tperiteration\n"); + printf("test\tloop\ttime\titerations\tperiteration\n"); for (j = 0; j < argc; j++) { uintmax_t calls, nsecsperit; @@ -665,8 +723,6 @@ main(int argc, char *argv[]) if (strcmp(argv[j], tests[i].t_name) == 0) the_test = &tests[i]; } - if (the_test == NULL) - usage(); /* * Run one warmup, then do the real thing (loops) times. From owner-svn-src-head@FreeBSD.ORG Fri Oct 22 11:42: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 52D35106566B; Fri, 22 Oct 2010 11:42:03 +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 278EA8FC16; Fri, 22 Oct 2010 11:42: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 o9MBg3NG037234; Fri, 22 Oct 2010 11:42:03 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9MBg3hA037232; Fri, 22 Oct 2010 11:42:03 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201010221142.o9MBg3hA037232@svn.freebsd.org> From: John Baldwin Date: Fri, 22 Oct 2010 11:42: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: r214203 - head/sys/dev/pci 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, 22 Oct 2010 11:42:03 -0000 Author: jhb Date: Fri Oct 22 11:42:02 2010 New Revision: 214203 URL: http://svn.freebsd.org/changeset/base/214203 Log: - Add a new PCI quirk to whitelist an old chipset that doesn't support PCI-express or PCI-X capabilities if we are running in a virtual machine. - Whitelist the Intel 82440 chipset used by QEMU. Tested by: jfv MFC after: 1 week Modified: head/sys/dev/pci/pci.c Modified: head/sys/dev/pci/pci.c ============================================================================== --- head/sys/dev/pci/pci.c Fri Oct 22 11:22:19 2010 (r214202) +++ head/sys/dev/pci/pci.c Fri Oct 22 11:42:02 2010 (r214203) @@ -182,6 +182,7 @@ struct pci_quirk { int type; #define PCI_QUIRK_MAP_REG 1 /* PCI map register in weird place */ #define PCI_QUIRK_DISABLE_MSI 2 /* MSI/MSI-X doesn't work */ +#define PCI_QUIRK_ENABLE_MSI_VM 3 /* Older chipset in VM where MSI works */ int arg1; int arg2; }; @@ -218,6 +219,12 @@ struct pci_quirk pci_quirks[] = { */ { 0x74501022, PCI_QUIRK_DISABLE_MSI, 0, 0 }, + /* + * Some virtualization environments emulate an older chipset + * but support MSI just fine. QEMU uses the Intel 82440. + */ + { 0x12378086, PCI_QUIRK_ENABLE_MSI_VM, 0, 0 }, + { 0 } }; @@ -1834,6 +1841,23 @@ pci_msi_device_blacklisted(device_t dev) } /* + * Returns true if a specified chipset supports MSI when it is + * emulated hardware in a virtual machine. + */ +static int +pci_msi_vm_chipset(device_t dev) +{ + struct pci_quirk *q; + + for (q = &pci_quirks[0]; q->devid; q++) { + if (q->devid == pci_get_devid(dev) && + q->type == PCI_QUIRK_ENABLE_MSI_VM) + return (1); + } + return (0); +} + +/* * Determine if MSI is blacklisted globally on this sytem. Currently, * we just check for blacklisted chipsets as represented by the * host-PCI bridge at device 0:0:0. In the future, it may become @@ -1849,8 +1873,14 @@ pci_msi_blacklisted(void) return (0); /* Blacklist all non-PCI-express and non-PCI-X chipsets. */ - if (!(pcie_chipset || pcix_chipset)) + if (!(pcie_chipset || pcix_chipset)) { + if (vm_guest != VM_GUEST_NO) { + dev = pci_find_bsf(0, 0, 0); + if (dev != NULL) + return (pci_msi_vm_chipset(dev) == 0); + } return (1); + } dev = pci_find_bsf(0, 0, 0); if (dev != NULL) From owner-svn-src-head@FreeBSD.ORG Fri Oct 22 18:07: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 7EAE1106566B; Fri, 22 Oct 2010 18:07:21 +0000 (UTC) (envelope-from rdivacky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6DFC18FC17; Fri, 22 Oct 2010 18:07: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 o9MI7L8K061659; Fri, 22 Oct 2010 18:07:21 GMT (envelope-from rdivacky@svn.freebsd.org) Received: (from rdivacky@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9MI7LD8061657; Fri, 22 Oct 2010 18:07:21 GMT (envelope-from rdivacky@svn.freebsd.org) Message-Id: <201010221807.o9MI7LD8061657@svn.freebsd.org> From: Roman Divacky Date: Fri, 22 Oct 2010 18:07: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: r214210 - head/sys/boot/i386/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: Fri, 22 Oct 2010 18:07:22 -0000 Author: rdivacky Date: Fri Oct 22 18:07:21 2010 New Revision: 214210 URL: http://svn.freebsd.org/changeset/base/214210 Log: Avoid using memcpy() for copying 32bit chunks. This shrinks the resulting code a little. Approved by: rpaulo (mentor) Reviewed by: jhb Modified: head/sys/boot/i386/boot2/boot2.c Modified: head/sys/boot/i386/boot2/boot2.c ============================================================================== --- head/sys/boot/i386/boot2/boot2.c Fri Oct 22 18:06:58 2010 (r214209) +++ head/sys/boot/i386/boot2/boot2.c Fri Oct 22 18:07:21 2010 (r214210) @@ -348,7 +348,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)) @@ -385,7 +385,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 Fri Oct 22 18:31: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 50B861065673; Fri, 22 Oct 2010 18:31:45 +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 4064B8FC1C; Fri, 22 Oct 2010 18:31: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 o9MIVjwD062430; Fri, 22 Oct 2010 18:31:45 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9MIVj85062427; Fri, 22 Oct 2010 18:31:45 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201010221831.o9MIVj85062427@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 22 Oct 2010 18:31: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: r214216 - 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: Fri, 22 Oct 2010 18:31:45 -0000 Author: yongari Date: Fri Oct 22 18:31:44 2010 New Revision: 214216 URL: http://svn.freebsd.org/changeset/base/214216 Log: Enable TX MAC state machine lockup fix for both BCM5755 or higher and BCM5906. Publicly available data sheet just says it may happen due to corrupted TxMbuf. 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 Fri Oct 22 18:14:25 2010 (r214215) +++ head/sys/dev/bge/if_bge.c Fri Oct 22 18:31:44 2010 (r214216) @@ -4409,6 +4409,7 @@ bge_init_locked(struct bge_softc *sc) { struct ifnet *ifp; uint16_t *m; + uint32_t mode; BGE_LOCK_ASSERT(sc); @@ -4514,8 +4515,12 @@ bge_init_locked(struct bge_softc *sc) /* Init TX ring. */ bge_init_tx_ring(sc); + /* Enable TX MAC state machine lockup fix. */ + mode = CSR_READ_4(sc, BGE_TX_MODE); + if (BGE_IS_5755_PLUS(sc) || sc->bge_asicrev == BGE_ASICREV_BCM5906) + mode |= BGE_TXMODE_MBUF_LOCKUP_FIX; /* Turn on transmitter. */ - BGE_SETBIT(sc, BGE_TX_MODE, BGE_TXMODE_ENABLE); + CSR_WRITE_4(sc, BGE_TX_MODE, mode | BGE_TXMODE_ENABLE); /* Turn on receiver. */ BGE_SETBIT(sc, BGE_RX_MODE, BGE_RXMODE_ENABLE); Modified: head/sys/dev/bge/if_bgereg.h ============================================================================== --- head/sys/dev/bge/if_bgereg.h Fri Oct 22 18:14:25 2010 (r214215) +++ head/sys/dev/bge/if_bgereg.h Fri Oct 22 18:31:44 2010 (r214216) @@ -765,6 +765,7 @@ #define BGE_TXMODE_FLOWCTL_ENABLE 0x00000010 #define BGE_TXMODE_BIGBACKOFF_ENABLE 0x00000020 #define BGE_TXMODE_LONGPAUSE_ENABLE 0x00000040 +#define BGE_TXMODE_MBUF_LOCKUP_FIX 0x00000100 /* Transmit MAC status register */ #define BGE_TXSTAT_RX_XOFFED 0x00000001 From owner-svn-src-head@FreeBSD.ORG Fri Oct 22 18:54: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 DE4EB1065672; Fri, 22 Oct 2010 18:54:09 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 89F728FC0C; Fri, 22 Oct 2010 18:54:09 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id o9MIke0V059441; Fri, 22 Oct 2010 12:46:40 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Fri, 22 Oct 2010 12:46:40 -0600 (MDT) Message-Id: <20101022.124640.74690513.imp@bsdimp.com> To: rdivacky@FreeBSD.org From: Warner Losh In-Reply-To: <201010221807.o9MI7LD8061657@svn.freebsd.org> References: <201010221807.o9MI7LD8061657@svn.freebsd.org> X-Mailer: Mew version 3.3 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r214210 - head/sys/boot/i386/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: Fri, 22 Oct 2010 18:54:10 -0000 > Avoid using memcpy() for copying 32bit chunks. This shrinks > the resulting code a little. I think I put the memcpy code in when I was porting to ARM to reduce the diffs since it is needed there... Warner From owner-svn-src-head@FreeBSD.ORG Fri Oct 22 19:30: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 1542F1065670; Fri, 22 Oct 2010 19:30:57 +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 04C438FC16; Fri, 22 Oct 2010 19:30: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 o9MJUuw9063790; Fri, 22 Oct 2010 19:30:56 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9MJUuR1063787; Fri, 22 Oct 2010 19:30:56 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201010221930.o9MJUuR1063787@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 22 Oct 2010 19:30: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: r214219 - 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: Fri, 22 Oct 2010 19:30:57 -0000 Author: yongari Date: Fri Oct 22 19:30:56 2010 New Revision: 214219 URL: http://svn.freebsd.org/changeset/base/214219 Log: Add workaround for BCM5906 A1 controller silicon bug. When auto-negotiation results in half-duplex operation, excess collision on the ethernet link may cause internal chip delays that may result in subsequent valid frames being dropped due to insufficient receive buffer resources. The workaround is to choose de-pipeline method as a flow control decision for SDI. De-pipeline method allows only 1 data in TxMbuf at a time such that a request to RDMA from SDI is made only when TxMbuf is empty. Thanks for david for providing detailed errata information. 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 Fri Oct 22 19:18:48 2010 (r214218) +++ head/sys/dev/bge/if_bge.c Fri Oct 22 19:30:56 2010 (r214219) @@ -1693,6 +1693,11 @@ bge_blockinit(struct bge_softc *sc) bge_writembx(sc, BGE_MBX_RX_MINI_PROD_LO, 0); } + /* Choose de-pipeline mode for BCM5906 A1. */ + if (sc->bge_asicrev == BGE_ASICREV_BCM5906 && + sc->bge_chiprev == BGE_CHIPID_BCM5906_A1) + CSR_WRITE_4(sc, BGE_ISO_PKT_TX, + (CSR_READ_4(sc, BGE_ISO_PKT_TX) & ~3) | 2); /* * The BD ring replenish thresholds control how often the * hardware fetches new BD's from the producer rings in host Modified: head/sys/dev/bge/if_bgereg.h ============================================================================== --- head/sys/dev/bge/if_bgereg.h Fri Oct 22 19:18:48 2010 (r214218) +++ head/sys/dev/bge/if_bgereg.h Fri Oct 22 19:30:56 2010 (r214219) @@ -880,6 +880,7 @@ #define BGE_SDI_STATS_CTL 0x0C08 #define BGE_SDI_STATS_ENABLE_MASK 0x0C0C #define BGE_SDI_STATS_INCREMENT_MASK 0x0C10 +#define BGE_ISO_PKT_TX 0x0C20 #define BGE_LOCSTATS_COS0 0x0C80 #define BGE_LOCSTATS_COS1 0x0C84 #define BGE_LOCSTATS_COS2 0x0C88 From owner-svn-src-head@FreeBSD.ORG Fri Oct 22 19:54: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 5C315106566C; Fri, 22 Oct 2010 19:54:17 +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 19E7A8FC1B; Fri, 22 Oct 2010 19:54:17 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7:0:d078:763c:c1b4:ed0d] (unknown [IPv6:2001:7b8:3a7:0:d078:763c:c1b4:ed0d]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 014835C43; Fri, 22 Oct 2010 21:54:15 +0200 (CEST) Message-ID: <4CC1EBEB.2020309@FreeBSD.org> Date: Fri, 22 Oct 2010 21:54:19 +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: Warner Losh References: <201010221807.o9MI7LD8061657@svn.freebsd.org> <20101022.124640.74690513.imp@bsdimp.com> In-Reply-To: <20101022.124640.74690513.imp@bsdimp.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, rdivacky@FreeBSD.org, src-committers@FreeBSD.org, svn-src-all@FreeBSD.org Subject: Re: svn commit: r214210 - head/sys/boot/i386/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: Fri, 22 Oct 2010 19:54:17 -0000 On 2010-10-22 20:46, Warner Losh wrote: >> Avoid using memcpy() for copying 32bit chunks. This shrinks >> the resulting code a little. > > I think I put the memcpy code in when I was porting to ARM to reduce > the diffs since it is needed there... Due to alignment problems otherwise? From owner-svn-src-head@FreeBSD.ORG Fri Oct 22 20:13: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 F124A106564A; Fri, 22 Oct 2010 20:13:45 +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 DFDBB8FC0C; Fri, 22 Oct 2010 20:13: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 o9MKDjKi064998; Fri, 22 Oct 2010 20:13:45 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9MKDjiO064995; Fri, 22 Oct 2010 20:13:45 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201010222013.o9MKDjiO064995@svn.freebsd.org> From: Hans Petter Selasky Date: Fri, 22 Oct 2010 20:13: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: r214221 - 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: Fri, 22 Oct 2010 20:13:46 -0000 Author: hselasky Date: Fri Oct 22 20:13:45 2010 New Revision: 214221 URL: http://svn.freebsd.org/changeset/base/214221 Log: Add possibility to generate devctl notifications regardless of UGEN presence. Submitted by: Nick Hibma Approved by: thompsa (mentor) Modified: head/sys/dev/usb/usb_device.c head/sys/dev/usb/usb_freebsd.h Modified: head/sys/dev/usb/usb_device.c ============================================================================== --- head/sys/dev/usb/usb_device.c Fri Oct 22 20:02:18 2010 (r214220) +++ head/sys/dev/usb/usb_device.c Fri Oct 22 20:13:45 2010 (r214221) @@ -98,8 +98,10 @@ static void usb_suspend_resume_sub(struc static void usbd_clear_stall_proc(struct usb_proc_msg *_pm); static usb_error_t usb_config_parse(struct usb_device *, uint8_t, uint8_t); static void usbd_set_device_strings(struct usb_device *); -#if USB_HAVE_UGEN +#if USB_HAVE_DEVCTL static void usb_notify_addq(const char *type, struct usb_device *); +#endif +#if USB_HAVE_UGEN static void usb_fifo_free_wrap(struct usb_device *, uint8_t, uint8_t); static struct cdev *usb_make_dev(struct usb_device *, int, int); static void usb_cdev_create(struct usb_device *); @@ -1858,7 +1860,9 @@ config_done: printf("%s: <%s> at %s\n", udev->ugen_name, usb_get_manufacturer(udev), device_get_nameunit(udev->bus->bdev)); +#endif +#if USB_HAVE_DEVCTL usb_notify_addq("ATTACH", udev); #endif done: @@ -2004,9 +2008,11 @@ usb_free_device(struct usb_device *udev, bus = udev->bus; usb_set_device_state(udev, USB_STATE_DETACHED); -#if USB_HAVE_UGEN +#if USB_HAVE_DEVCTL usb_notify_addq("DETACH", udev); +#endif +#if USB_HAVE_UGEN printf("%s: <%s> at %s (disconnected)\n", udev->ugen_name, usb_get_manufacturer(udev), device_get_nameunit(bus->bdev)); @@ -2373,7 +2379,7 @@ usbd_get_device_index(struct usb_device return (udev->device_index); } -#if USB_HAVE_UGEN +#if USB_HAVE_DEVCTL /*------------------------------------------------------------------------* * usb_notify_addq * @@ -2409,7 +2415,9 @@ usb_notify_addq_compat(const char *type, /* String it all together. */ snprintf(data, buf_size, "%s" +#if USB_HAVE_UGEN "%s " +#endif "vendor=0x%04x " "product=0x%04x " "devclass=0x%02x " @@ -2418,20 +2426,27 @@ usb_notify_addq_compat(const char *type, "release=0x%04x " "at " "port=%u " - "on " - "%s\n", +#if USB_HAVE_UGEN + "on %s\n" +#endif + "", ntype, +#if USB_HAVE_UGEN udev->ugen_name, +#endif UGETW(udev->ddesc.idVendor), UGETW(udev->ddesc.idProduct), udev->ddesc.bDeviceClass, udev->ddesc.bDeviceSubClass, usb_get_serial(udev), UGETW(udev->ddesc.bcdDevice), - udev->port_no, - udev->parent_hub != NULL ? + udev->port_no +#if USB_HAVE_UGEN + , udev->parent_hub != NULL ? udev->parent_hub->ugen_name : - device_get_nameunit(device_get_parent(udev->bus->bdev))); + device_get_nameunit(device_get_parent(udev->bus->bdev)) +#endif + ); devctl_queue_data(data); } @@ -2451,7 +2466,9 @@ usb_notify_addq(const char *type, struct /* announce the device */ sb = sbuf_new_auto(); sbuf_printf(sb, - "cdev=%s " +#if USB_HAVE_UGEN + "ugen=%s " +#endif "vendor=0x%04x " "product=0x%04x " "devclass=0x%02x " @@ -2460,8 +2477,13 @@ usb_notify_addq(const char *type, struct "release=0x%04x " "mode=%s " "port=%u " - "parent=%s\n", +#if USB_HAVE_UGEN + "parent=%s\n" +#endif + "", +#if USB_HAVE_UGEN udev->ugen_name, +#endif UGETW(udev->ddesc.idVendor), UGETW(udev->ddesc.idProduct), udev->ddesc.bDeviceClass, @@ -2469,10 +2491,13 @@ usb_notify_addq(const char *type, struct usb_get_serial(udev), UGETW(udev->ddesc.bcdDevice), (udev->flags.usb_mode == USB_MODE_HOST) ? "host" : "device", - udev->port_no, - udev->parent_hub != NULL ? - udev->parent_hub->ugen_name : - device_get_nameunit(device_get_parent(udev->bus->bdev))); + udev->port_no +#if USB_HAVE_UGEN + , udev->parent_hub != NULL ? + udev->parent_hub->ugen_name : + device_get_nameunit(device_get_parent(udev->bus->bdev)) +#endif + ); sbuf_finish(sb); devctl_notify("USB", "DEVICE", type, sbuf_data(sb)); sbuf_delete(sb); @@ -2487,7 +2512,9 @@ usb_notify_addq(const char *type, struct sb = sbuf_new_auto(); sbuf_printf(sb, - "cdev=%s " +#if USB_HAVE_UGEN + "ugen=%s " +#endif "vendor=0x%04x " "product=0x%04x " "devclass=0x%02x " @@ -2500,7 +2527,9 @@ usb_notify_addq(const char *type, struct "intclass=0x%02x " "intsubclass=0x%02x " "intprotocol=0x%02x\n", +#if USB_HAVE_UGEN udev->ugen_name, +#endif UGETW(udev->ddesc.idVendor), UGETW(udev->ddesc.idProduct), udev->ddesc.bDeviceClass, @@ -2518,7 +2547,9 @@ usb_notify_addq(const char *type, struct sbuf_delete(sb); } } +#endif +#if USB_HAVE_UGEN /*------------------------------------------------------------------------* * usb_fifo_free_wrap * Modified: head/sys/dev/usb/usb_freebsd.h ============================================================================== --- head/sys/dev/usb/usb_freebsd.h Fri Oct 22 20:02:18 2010 (r214220) +++ head/sys/dev/usb/usb_freebsd.h Fri Oct 22 20:13:45 2010 (r214221) @@ -33,6 +33,7 @@ /* Default USB configuration */ #define USB_HAVE_UGEN 1 +#define USB_HAVE_DEVCTL 1 #define USB_HAVE_BUSDMA 1 #define USB_HAVE_COMPAT_LINUX 1 #define USB_HAVE_USER_IO 1 From owner-svn-src-head@FreeBSD.ORG Fri Oct 22 20:13:59 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 52D9E1065703; Fri, 22 Oct 2010 20:13:59 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id EECA98FC14; Fri, 22 Oct 2010 20:13:58 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id o9MK38gG060604; Fri, 22 Oct 2010 14:03:08 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Fri, 22 Oct 2010 14:03:08 -0600 (MDT) Message-Id: <20101022.140308.487226281.imp@bsdimp.com> To: dim@FreeBSD.org From: Warner Losh In-Reply-To: <4CC1EBEB.2020309@FreeBSD.org> References: <201010221807.o9MI7LD8061657@svn.freebsd.org> <20101022.124640.74690513.imp@bsdimp.com> <4CC1EBEB.2020309@FreeBSD.org> X-Mailer: Mew version 6.3 on Emacs 23.2 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, rdivacky@FreeBSD.org, src-committers@FreeBSD.org, svn-src-all@FreeBSD.org Subject: Re: svn commit: r214210 - head/sys/boot/i386/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: Fri, 22 Oct 2010 20:13:59 -0000 In message: <4CC1EBEB.2020309@FreeBSD.org> Dimitry Andric writes: : On 2010-10-22 20:46, Warner Losh wrote: : >> Avoid using memcpy() for copying 32bit chunks. This shrinks : >> the resulting code a little. : > : > I think I put the memcpy code in when I was porting to ARM to reduce : > the diffs since it is needed there... : Due to alignment problems otherwise? Yes. At the time it didn't make a difference to the size of boot2. Now I know that we're looking for every byte to trim... Warner From owner-svn-src-head@FreeBSD.ORG Fri Oct 22 21:38: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 DBEBA106566B; Fri, 22 Oct 2010 21:38:56 +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 B02088FC16; Fri, 22 Oct 2010 21:38: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 o9MLcu3e066854; Fri, 22 Oct 2010 21:38:56 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9MLcuLY066850; Fri, 22 Oct 2010 21:38:56 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201010222138.o9MLcuLY066850@svn.freebsd.org> From: Rick Macklem Date: Fri, 22 Oct 2010 21:38: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: r214224 - in head/sys/fs: nfs nfsserver 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, 22 Oct 2010 21:38:57 -0000 Author: rmacklem Date: Fri Oct 22 21:38:56 2010 New Revision: 214224 URL: http://svn.freebsd.org/changeset/base/214224 Log: Modify the file handle hash function in the experimental NFS server so that it will work better for non-UFS file systems. The new function simply sums the bytes of the fh_fid field of fhandle_t. MFC after: 10 days Modified: head/sys/fs/nfs/nfs_var.h head/sys/fs/nfs/nfsdport.h head/sys/fs/nfsserver/nfs_nfsdport.c Modified: head/sys/fs/nfs/nfs_var.h ============================================================================== --- head/sys/fs/nfs/nfs_var.h Fri Oct 22 20:46:08 2010 (r214223) +++ head/sys/fs/nfs/nfs_var.h Fri Oct 22 21:38:56 2010 (r214224) @@ -576,6 +576,7 @@ void nfsvno_unlockvfs(mount_t); int nfsvno_lockvfs(mount_t); int nfsrv_v4rootexport(void *, struct ucred *, NFSPROC_T *); int nfsvno_testexp(struct nfsrv_descript *, struct nfsexstuff *); +int nfsrv_hashfh(fhandle_t *); /* nfs_commonkrpc.c */ int newnfs_nmcancelreqs(struct nfsmount *); Modified: head/sys/fs/nfs/nfsdport.h ============================================================================== --- head/sys/fs/nfs/nfsdport.h Fri Oct 22 20:46:08 2010 (r214223) +++ head/sys/fs/nfs/nfsdport.h Fri Oct 22 21:38:56 2010 (r214224) @@ -73,7 +73,7 @@ struct nfsexstuff { bcmp(&(f1)->fh_fid, &(f2)->fh_fid, sizeof(struct fid)) == 0) #define NFSLOCKHASH(f) \ - (&nfslockhash[(*((u_int32_t *)((f)->fh_fid.fid_data))) % NFSLOCKHASHSIZE]) + (&nfslockhash[nfsrv_hashfh(f) % NFSLOCKHASHSIZE]) #define NFSFPVNODE(f) ((struct vnode *)((f)->f_data)) #define NFSFPCRED(f) ((f)->f_cred) Modified: head/sys/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdport.c Fri Oct 22 20:46:08 2010 (r214223) +++ head/sys/fs/nfsserver/nfs_nfsdport.c Fri Oct 22 21:38:56 2010 (r214224) @@ -3087,6 +3087,21 @@ nfsvno_testexp(struct nfsrv_descript *nd return (1); } +/* + * Calculate a hash value for the fid in a file handle. + */ +int +nfsrv_hashfh(fhandle_t *fhp) +{ + int hashval = 0, i; + uint8_t *cp; + + cp = (uint8_t *)&fhp->fh_fid; + for (i = 0; i < sizeof(struct fid); i++) + hashval += *cp++; + return (hashval); +} + extern int (*nfsd_call_nfsd)(struct thread *, struct nfssvc_args *); /* From owner-svn-src-head@FreeBSD.ORG Fri Oct 22 22:13: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 E95391065675; Fri, 22 Oct 2010 22:13:11 +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 D80878FC13; Fri, 22 Oct 2010 22:13: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 o9MMDBWU067591; Fri, 22 Oct 2010 22:13:11 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9MMDBii067587; Fri, 22 Oct 2010 22:13:11 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201010222213.o9MMDBii067587@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Fri, 22 Oct 2010 22:13: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: r214225 - head/sys/geom/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: Fri, 22 Oct 2010 22:13:12 -0000 Author: pjd Date: Fri Oct 22 22:13:11 2010 New Revision: 214225 URL: http://svn.freebsd.org/changeset/base/214225 Log: Move sc_akeyctx and sc_ivctx initialization to the g_eli_mkey_propagate() function which eliminates code duplication and will ensure proper order of operation. Modified: head/sys/geom/eli/g_eli.c head/sys/geom/eli/g_eli_ctl.c head/sys/geom/eli/g_eli_key.c Modified: head/sys/geom/eli/g_eli.c ============================================================================== --- head/sys/geom/eli/g_eli.c Fri Oct 22 21:38:56 2010 (r214224) +++ head/sys/geom/eli/g_eli.c Fri Oct 22 22:13:11 2010 (r214225) @@ -817,30 +817,6 @@ g_eli_create(struct gctl_req *req, struc */ g_eli_mkey_propagate(sc, mkey); sc->sc_ekeylen = md->md_keylen; - if (sc->sc_flags & G_ELI_FLAG_AUTH) { - /* - * Precalculate SHA256 for HMAC key generation. - * This is expensive operation and we can do it only once now or - * for every access to sector, so now will be much better. - */ - SHA256_Init(&sc->sc_akeyctx); - SHA256_Update(&sc->sc_akeyctx, sc->sc_akey, - sizeof(sc->sc_akey)); - } - /* - * Precalculate SHA256 for IV generation. - * This is expensive operation and we can do it only once now or for - * every access to sector, so now will be much better. - */ - switch (sc->sc_ealgo) { - case CRYPTO_AES_XTS: - break; - default: - SHA256_Init(&sc->sc_ivctx); - SHA256_Update(&sc->sc_ivctx, sc->sc_ivkey, - sizeof(sc->sc_ivkey)); - break; - } LIST_INIT(&sc->sc_workers); Modified: head/sys/geom/eli/g_eli_ctl.c ============================================================================== --- head/sys/geom/eli/g_eli_ctl.c Fri Oct 22 21:38:56 2010 (r214224) +++ head/sys/geom/eli/g_eli_ctl.c Fri Oct 22 22:13:11 2010 (r214225) @@ -882,26 +882,10 @@ g_eli_ctl_resume(struct gctl_req *req, s mtx_lock(&sc->sc_queue_mtx); /* Restore sc_mkey, sc_ekeys, sc_akey and sc_ivkey. */ g_eli_mkey_propagate(sc, mkey); - bzero(mkey, sizeof(mkey)); - bzero(&md, sizeof(md)); - /* Restore sc_akeyctx. */ - if (sc->sc_flags & G_ELI_FLAG_AUTH) { - SHA256_Init(&sc->sc_akeyctx); - SHA256_Update(&sc->sc_akeyctx, sc->sc_akey, - sizeof(sc->sc_akey)); - } - /* Restore sc_ivctx. */ - switch (sc->sc_ealgo) { - case CRYPTO_AES_XTS: - break; - default: - SHA256_Init(&sc->sc_ivctx); - SHA256_Update(&sc->sc_ivctx, sc->sc_ivkey, - sizeof(sc->sc_ivkey)); - break; - } sc->sc_flags &= ~G_ELI_FLAG_SUSPEND; mtx_unlock(&sc->sc_queue_mtx); + bzero(mkey, sizeof(mkey)); + bzero(&md, sizeof(md)); G_ELI_DEBUG(1, "Resumed %s.", pp->name); wakeup(sc); } Modified: head/sys/geom/eli/g_eli_key.c ============================================================================== --- head/sys/geom/eli/g_eli_key.c Fri Oct 22 21:38:56 2010 (r214224) +++ head/sys/geom/eli/g_eli_key.c Fri Oct 22 22:13:11 2010 (r214225) @@ -264,5 +264,30 @@ g_eli_mkey_propagate(struct g_eli_softc /* Generate all encryption keys. */ g_eli_ekeys_generate(sc); } + + if (sc->sc_flags & G_ELI_FLAG_AUTH) { + /* + * Precalculate SHA256 for HMAC key generation. + * This is expensive operation and we can do it only once now or + * for every access to sector, so now will be much better. + */ + SHA256_Init(&sc->sc_akeyctx); + SHA256_Update(&sc->sc_akeyctx, sc->sc_akey, + sizeof(sc->sc_akey)); + } + /* + * Precalculate SHA256 for IV generation. + * This is expensive operation and we can do it only once now or for + * every access to sector, so now will be much better. + */ + switch (sc->sc_ealgo) { + case CRYPTO_AES_XTS: + break; + default: + SHA256_Init(&sc->sc_ivctx); + SHA256_Update(&sc->sc_ivctx, sc->sc_ivkey, + sizeof(sc->sc_ivkey)); + break; + } } #endif From owner-svn-src-head@FreeBSD.ORG Fri Oct 22 22:44: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 8F26A106566B; Fri, 22 Oct 2010 22:44:09 +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 7E49C8FC13; Fri, 22 Oct 2010 22:44: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 o9MMi9Ex068400; Fri, 22 Oct 2010 22:44:09 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9MMi96J068398; Fri, 22 Oct 2010 22:44:09 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201010222244.o9MMi96J068398@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Fri, 22 Oct 2010 22:44: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: r214226 - head/sys/geom/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: Fri, 22 Oct 2010 22:44:09 -0000 Author: pjd Date: Fri Oct 22 22:44:09 2010 New Revision: 214226 URL: http://svn.freebsd.org/changeset/base/214226 Log: Encryption keys array might be NULL if device is suspended. Check for this, so we don't panic when we detach suspended device. Modified: head/sys/geom/eli/g_eli.c Modified: head/sys/geom/eli/g_eli.c ============================================================================== --- head/sys/geom/eli/g_eli.c Fri Oct 22 22:13:11 2010 (r214225) +++ head/sys/geom/eli/g_eli.c Fri Oct 22 22:44:09 2010 (r214226) @@ -952,9 +952,12 @@ g_eli_destroy(struct g_eli_softc *sc, bo } mtx_destroy(&sc->sc_queue_mtx); gp->softc = NULL; - bzero(sc->sc_ekeys, - sc->sc_nekeys * (sizeof(uint8_t *) + G_ELI_DATAKEYLEN)); - free(sc->sc_ekeys, M_ELI); + if (sc->sc_ekeys != NULL) { + /* The sc_ekeys field can be NULL is device is suspended. */ + bzero(sc->sc_ekeys, + sc->sc_nekeys * (sizeof(uint8_t *) + G_ELI_DATAKEYLEN)); + free(sc->sc_ekeys, M_ELI); + } bzero(sc, sizeof(*sc)); free(sc, M_ELI); From owner-svn-src-head@FreeBSD.ORG Fri Oct 22 22:45: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 4F53C1065672; Fri, 22 Oct 2010 22:45:27 +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 3E7F58FC19; Fri, 22 Oct 2010 22:45: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 o9MMjRGL068466; Fri, 22 Oct 2010 22:45:27 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9MMjRTl068464; Fri, 22 Oct 2010 22:45:27 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201010222245.o9MMjRTl068464@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Fri, 22 Oct 2010 22:45: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: r214227 - head/sys/geom/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: Fri, 22 Oct 2010 22:45:27 -0000 Author: pjd Date: Fri Oct 22 22:45:26 2010 New Revision: 214227 URL: http://svn.freebsd.org/changeset/base/214227 Log: Add State tag, so 'geli status' will report active/suspended status, eg: # geli status Name Status Components da0.eli SUSPENDED da0 da1.eli ACTIVE da1 Modified: head/sys/geom/eli/g_eli.c Modified: head/sys/geom/eli/g_eli.c ============================================================================== --- head/sys/geom/eli/g_eli.c Fri Oct 22 22:44:09 2010 (r214226) +++ head/sys/geom/eli/g_eli.c Fri Oct 22 22:45:26 2010 (r214227) @@ -1247,6 +1247,8 @@ g_eli_dumpconf(struct sbuf *sb, const ch sc->sc_ekeylen); sbuf_printf(sb, "%s%s\n", indent, g_eli_algo2str(sc->sc_ealgo)); + sbuf_printf(sb, "%s%s\n", indent, + (sc->sc_flags & G_ELI_FLAG_SUSPEND) ? "SUSPENDED" : "ACTIVE"); } static void From owner-svn-src-head@FreeBSD.ORG Fri Oct 22 22:54: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 A6ABF106566B; Fri, 22 Oct 2010 22:54:26 +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 95AC78FC08; Fri, 22 Oct 2010 22:54: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 o9MMsQ9n068660; Fri, 22 Oct 2010 22:54:26 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9MMsQkl068658; Fri, 22 Oct 2010 22:54:26 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201010222254.o9MMsQkl068658@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Fri, 22 Oct 2010 22:54: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: r214228 - head/sys/geom/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: Fri, 22 Oct 2010 22:54:26 -0000 Author: pjd Date: Fri Oct 22 22:54:26 2010 New Revision: 214228 URL: http://svn.freebsd.org/changeset/base/214228 Log: Close a race between checking if device is already suspended and suspending it. Modified: head/sys/geom/eli/g_eli_ctl.c Modified: head/sys/geom/eli/g_eli_ctl.c ============================================================================== --- head/sys/geom/eli/g_eli_ctl.c Fri Oct 22 22:45:26 2010 (r214227) +++ head/sys/geom/eli/g_eli_ctl.c Fri Oct 22 22:54:26 2010 (r214228) @@ -840,10 +840,6 @@ g_eli_ctl_resume(struct gctl_req *req, s gctl_error(req, "Provider %s is invalid.", name); return; } - if (!(sc->sc_flags & G_ELI_FLAG_SUSPEND)) { - gctl_error(req, "Provider %s not suspended.", name); - return; - } cp = LIST_FIRST(&sc->sc_geom->consumer); pp = cp->provider; error = g_eli_read_metadata(mp, pp, &md); @@ -880,14 +876,18 @@ g_eli_ctl_resume(struct gctl_req *req, s G_ELI_DEBUG(1, "Using Master Key %u for %s.", nkey, pp->name); mtx_lock(&sc->sc_queue_mtx); - /* Restore sc_mkey, sc_ekeys, sc_akey and sc_ivkey. */ - g_eli_mkey_propagate(sc, mkey); - sc->sc_flags &= ~G_ELI_FLAG_SUSPEND; + if (!(sc->sc_flags & G_ELI_FLAG_SUSPEND)) + gctl_error(req, "Device %s is not suspended.", name); + else { + /* Restore sc_mkey, sc_ekeys, sc_akey and sc_ivkey. */ + g_eli_mkey_propagate(sc, mkey); + sc->sc_flags &= ~G_ELI_FLAG_SUSPEND; + G_ELI_DEBUG(1, "Resumed %s.", pp->name); + wakeup(sc); + } mtx_unlock(&sc->sc_queue_mtx); bzero(mkey, sizeof(mkey)); bzero(&md, sizeof(md)); - G_ELI_DEBUG(1, "Resumed %s.", pp->name); - wakeup(sc); } static int From owner-svn-src-head@FreeBSD.ORG Fri Oct 22 22:58: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 DD265106564A; Fri, 22 Oct 2010 22:58:00 +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 B18A18FC15; Fri, 22 Oct 2010 22:58: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 o9MMw0Ws068768; Fri, 22 Oct 2010 22:58:00 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9MMw0kX068766; Fri, 22 Oct 2010 22:58:00 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201010222258.o9MMw0kX068766@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Fri, 22 Oct 2010 22:58:00 +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: r214229 - head/sys/geom/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: Fri, 22 Oct 2010 22:58:01 -0000 Author: pjd Date: Fri Oct 22 22:58:00 2010 New Revision: 214229 URL: http://svn.freebsd.org/changeset/base/214229 Log: - Improve error messages, so instead of 'Not fully done', the user will get information that device is already suspended or that device is using one-time key and suspend is not supported. - 'geli suspend -a' silently skips devices that use one-time key, this is fine, but because we log which device were suspended on the console, log also which devices were skipped. Modified: head/sys/geom/eli/g_eli_ctl.c Modified: head/sys/geom/eli/g_eli_ctl.c ============================================================================== --- head/sys/geom/eli/g_eli_ctl.c Fri Oct 22 22:54:26 2010 (r214228) +++ head/sys/geom/eli/g_eli_ctl.c Fri Oct 22 22:58:00 2010 (r214229) @@ -699,22 +699,28 @@ g_eli_ctl_delkey(struct gctl_req *req, s G_ELI_DEBUG(1, "Key %d removed from %s.", nkey, pp->name); } -static int -g_eli_suspend_one(struct g_eli_softc *sc) +static void +g_eli_suspend_one(struct g_eli_softc *sc, struct gctl_req *req) { struct g_eli_worker *wr; g_topology_assert(); - if (sc == NULL) - return (ENOENT); - if (sc->sc_flags & G_ELI_FLAG_ONETIME) - return (EOPNOTSUPP); + KASSERT(sc != NULL, ("NULL sc")); + + if (sc->sc_flags & G_ELI_FLAG_ONETIME) { + gctl_error(req, + "Device %s is using one-time key, suspend not supported.", + sc->sc_name); + return; + } mtx_lock(&sc->sc_queue_mtx); if (sc->sc_flags & G_ELI_FLAG_SUSPEND) { mtx_unlock(&sc->sc_queue_mtx); - return (EALREADY); + gctl_error(req, "Device %s already suspended.", + sc->sc_name); + return; } sc->sc_flags |= G_ELI_FLAG_SUSPEND; wakeup(sc); @@ -742,8 +748,7 @@ g_eli_suspend_one(struct g_eli_softc *sc bzero(sc->sc_ivkey, sizeof(sc->sc_ivkey)); bzero(&sc->sc_ivctx, sizeof(sc->sc_ivctx)); mtx_unlock(&sc->sc_queue_mtx); - G_ELI_DEBUG(0, "%s has been suspended.", sc->sc_name); - return (0); + G_ELI_DEBUG(0, "Device %s has been suspended.", sc->sc_name); } static void @@ -751,7 +756,6 @@ g_eli_ctl_suspend(struct gctl_req *req, { struct g_eli_softc *sc; int *all, *nargs; - int error; g_topology_assert(); @@ -775,11 +779,13 @@ g_eli_ctl_suspend(struct gctl_req *req, LIST_FOREACH_SAFE(gp, &mp->geom, geom, gp2) { sc = gp->softc; - if (sc->sc_flags & G_ELI_FLAG_ONETIME) + if (sc->sc_flags & G_ELI_FLAG_ONETIME) { + G_ELI_DEBUG(0, + "Device %s is using one-time key, suspend not supported, skipping.", + sc->sc_name); continue; - error = g_eli_suspend_one(sc); - if (error != 0) - gctl_error(req, "Not fully done."); + } + g_eli_suspend_one(sc, req); } } else { const char *prov; @@ -799,9 +805,7 @@ g_eli_ctl_suspend(struct gctl_req *req, G_ELI_DEBUG(0, "No such provider: %s.", prov); continue; } - error = g_eli_suspend_one(sc); - if (error != 0) - gctl_error(req, "Not fully done."); + g_eli_suspend_one(sc, req); } } } From owner-svn-src-head@FreeBSD.ORG Sat Oct 23 09:23: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 1A671106564A; Sat, 23 Oct 2010 09:23:58 +0000 (UTC) (envelope-from gleb.kurtsou@gmail.com) Received: from mail-ey0-f182.google.com (mail-ey0-f182.google.com [209.85.215.182]) by mx1.freebsd.org (Postfix) with ESMTP id 272E88FC14; Sat, 23 Oct 2010 09:23:56 +0000 (UTC) Received: by eyb7 with SMTP id 7so849666eyb.13 for ; Sat, 23 Oct 2010 02:23:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:references:mime-version:content-type:content-disposition :in-reply-to:user-agent; bh=9AuxMN3XpmPEzcKbcSQnaOVWCI79NlF0NhtmX5YrDIw=; b=CIGHtA0nbbD6WXOR8zLGx0HcbcPXsvWHukRjradAYeacbcasqRCs1dZku6sWVERELz C0DVFViE0F/hHmMYgIQC1BKRiJCgH1TcTF8eyQeTGfDhIrntzs9gbqHorkjC439wciQt zxIlb0rs90FyUOw6BT4UIr7e/h2W1Tuy+rbQE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=W+bkd84Dkf2TnswhKg/V6/kJZ5XRucITw9thkl3xQCSJl5vkLNwFdNE7vlTEqjtkYH S4OCWEgx6O2ziSJj+EVEyv6OQyfFkBnpdeJdLFUUNj2YZy0aFIc3CEMIO52Sv3nkQP1p OtyqF/C9mxrvpWFRsm9LPsbG6zjNF0LREGPOQ= Received: by 10.213.31.134 with SMTP id y6mr4121696ebc.82.1287824445951; Sat, 23 Oct 2010 02:00:45 -0700 (PDT) Received: from localhost ([212.98.186.134]) by mx.google.com with ESMTPS id q58sm4485429eeh.21.2010.10.23.02.00.43 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 23 Oct 2010 02:00:44 -0700 (PDT) Date: Sat, 23 Oct 2010 12:00:40 +0300 From: Gleb Kurtsou To: Rick Macklem Message-ID: <20101023090040.GA67039@tops> References: <201010222138.o9MLcuLY066850@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <201010222138.o9MLcuLY066850@svn.freebsd.org> 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: r214224 - in head/sys/fs: nfs nfsserver 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, 23 Oct 2010 09:23:58 -0000 On (22/10/2010 21:38), Rick Macklem wrote: > Author: rmacklem > Date: Fri Oct 22 21:38:56 2010 > New Revision: 214224 > URL: http://svn.freebsd.org/changeset/base/214224 > > Log: > Modify the file handle hash function in the experimental NFS > server so that it will work better for non-UFS file systems. > The new function simply sums the bytes of the fh_fid field > of fhandle_t. > > MFC after: 10 days > > Modified: > head/sys/fs/nfs/nfs_var.h > head/sys/fs/nfs/nfsdport.h > head/sys/fs/nfsserver/nfs_nfsdport.c > > Modified: head/sys/fs/nfs/nfs_var.h > ============================================================================== > --- head/sys/fs/nfs/nfs_var.h Fri Oct 22 20:46:08 2010 (r214223) > +++ head/sys/fs/nfs/nfs_var.h Fri Oct 22 21:38:56 2010 (r214224) > @@ -576,6 +576,7 @@ void nfsvno_unlockvfs(mount_t); > int nfsvno_lockvfs(mount_t); > int nfsrv_v4rootexport(void *, struct ucred *, NFSPROC_T *); > int nfsvno_testexp(struct nfsrv_descript *, struct nfsexstuff *); > +int nfsrv_hashfh(fhandle_t *); > > /* nfs_commonkrpc.c */ > int newnfs_nmcancelreqs(struct nfsmount *); > > Modified: head/sys/fs/nfs/nfsdport.h > ============================================================================== > --- head/sys/fs/nfs/nfsdport.h Fri Oct 22 20:46:08 2010 (r214223) > +++ head/sys/fs/nfs/nfsdport.h Fri Oct 22 21:38:56 2010 (r214224) > @@ -73,7 +73,7 @@ struct nfsexstuff { > bcmp(&(f1)->fh_fid, &(f2)->fh_fid, sizeof(struct fid)) == 0) > > #define NFSLOCKHASH(f) \ > - (&nfslockhash[(*((u_int32_t *)((f)->fh_fid.fid_data))) % NFSLOCKHASHSIZE]) > + (&nfslockhash[nfsrv_hashfh(f) % NFSLOCKHASHSIZE]) > > #define NFSFPVNODE(f) ((struct vnode *)((f)->f_data)) > #define NFSFPCRED(f) ((f)->f_cred) > > Modified: head/sys/fs/nfsserver/nfs_nfsdport.c > ============================================================================== > --- head/sys/fs/nfsserver/nfs_nfsdport.c Fri Oct 22 20:46:08 2010 (r214223) > +++ head/sys/fs/nfsserver/nfs_nfsdport.c Fri Oct 22 21:38:56 2010 (r214224) > @@ -3087,6 +3087,21 @@ nfsvno_testexp(struct nfsrv_descript *nd > return (1); > } > > +/* > + * Calculate a hash value for the fid in a file handle. > + */ > +int > +nfsrv_hashfh(fhandle_t *fhp) > +{ > + int hashval = 0, i; > + uint8_t *cp; > + > + cp = (uint8_t *)&fhp->fh_fid; > + for (i = 0; i < sizeof(struct fid); i++) > + hashval += *cp++; > + return (hashval); > +} > + Is there a reason not to use fnv_32_buf() from sys/fnv_hash.h or hash32_buf() from sys/hash.h? Just summing up bytes for hash is not generally helpful. Thanks, Gleb. > extern int (*nfsd_call_nfsd)(struct thread *, struct nfssvc_args *); > > /* > _______________________________________________ > svn-src-all@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" From owner-svn-src-head@FreeBSD.ORG Sat Oct 23 11:26: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 0FA4F1065674; Sat, 23 Oct 2010 11:26:23 +0000 (UTC) (envelope-from bschmidt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F2C938FC16; Sat, 23 Oct 2010 11:26:22 +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 o9NBQMvf085608; Sat, 23 Oct 2010 11:26:22 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9NBQMod085606; Sat, 23 Oct 2010 11:26:22 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201010231126.o9NBQMod085606@svn.freebsd.org> From: Bernhard Schmidt Date: Sat, 23 Oct 2010 11:26:22 +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: r214236 - head/sys/dev/iwi 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, 23 Oct 2010 11:26:23 -0000 Author: bschmidt Date: Sat Oct 23 11:26:22 2010 New Revision: 214236 URL: http://svn.freebsd.org/changeset/base/214236 Log: The firmware does pad notifications to an even number of bytes (at least the association notification), the included information though always contains an elem block with an odd number of bytes. We handle the last byte as if it might contain a whole elem block, this of course is not true as one byte is not enough to hold a block, we therefore discard the complete frame. The solution here is to subtract one from the actual notification length, this is also what the Linux driver does. With this change the frames ends exactly where the last elem block ends. This commit also reverts r214160 which is no longer required and now even wrong. MFC after: 1 week Modified: head/sys/dev/iwi/if_iwi.c Modified: head/sys/dev/iwi/if_iwi.c ============================================================================== --- head/sys/dev/iwi/if_iwi.c Sat Oct 23 10:46:11 2010 (r214235) +++ head/sys/dev/iwi/if_iwi.c Sat Oct 23 11:26:22 2010 (r214236) @@ -1356,7 +1356,7 @@ iwi_checkforqos(struct ieee80211vap *vap wme = NULL; while (frm < efrm) { - IEEE80211_VERIFY_LENGTH(efrm - frm, frm[1], break); + IEEE80211_VERIFY_LENGTH(efrm - frm, frm[1], return); switch (*frm) { case IEEE80211_ELEMID_VENDOR: if (iswmeoui(frm)) @@ -1483,7 +1483,7 @@ iwi_notification_intr(struct iwi_softc * IWI_STATE_END(sc, IWI_FW_ASSOCIATING); iwi_checkforqos(vap, (const struct ieee80211_frame *)(assoc+1), - le16toh(notif->len) - sizeof(*assoc)); + le16toh(notif->len) - sizeof(*assoc) - 1); ieee80211_new_state(vap, IEEE80211_S_RUN, -1); break; case IWI_ASSOC_INIT: From owner-svn-src-head@FreeBSD.ORG Sat Oct 23 12:27: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 8DDB01065694; Sat, 23 Oct 2010 12:27:39 +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 7CEDB8FC0C; Sat, 23 Oct 2010 12:27: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 o9NCRdsL086806; Sat, 23 Oct 2010 12:27:39 GMT (envelope-from uqs@svn.freebsd.org) Received: (from uqs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9NCRdTa086804; Sat, 23 Oct 2010 12:27:39 GMT (envelope-from uqs@svn.freebsd.org) Message-Id: <201010231227.o9NCRdTa086804@svn.freebsd.org> From: Ulrich Spoerlein Date: Sat, 23 Oct 2010 12:27: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: r214237 - head/contrib/bsnmp/snmpd 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, 23 Oct 2010 12:27:39 -0000 Author: uqs Date: Sat Oct 23 12:27:39 2010 New Revision: 214237 URL: http://svn.freebsd.org/changeset/base/214237 Log: Remove mention of non-existant -o flag for debugging options. MFC after: 3 days Modified: head/contrib/bsnmp/snmpd/bsnmpd.1 Modified: head/contrib/bsnmp/snmpd/bsnmpd.1 ============================================================================== --- head/contrib/bsnmp/snmpd/bsnmpd.1 Sat Oct 23 11:26:22 2010 (r214236) +++ head/contrib/bsnmp/snmpd/bsnmpd.1 Sat Oct 23 12:27:39 2010 (r214237) @@ -31,7 +31,7 @@ .\" .\" $Begemot: bsnmp/snmpd/bsnmpd.1,v 1.12 2006/02/27 09:50:03 brandt_h Exp $ .\" -.Dd August 16, 2010 +.Dd October 23, 2010 .Dt BSNMPD 1 .Os .Sh NAME @@ -68,11 +68,9 @@ Use .Ar file as configuration file instead of the standard one. .It Fl D Ar options -Debugging options are specified with a -.Fl o -flag followed by a comma separated string of options. +Debugging options are specified as a comma separated string. The following options are available. -.Bl -tag -width ".It Cm trace Ns Cm = Ns Cm level" +.Bl -tag -width "trace=level" .It Cm dump Dump all sent and received PDUs to the terminal. .It Cm events From owner-svn-src-head@FreeBSD.ORG Sat Oct 23 13:15: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 C4B4C1065670; Sat, 23 Oct 2010 13:15: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 E4B7F8FC1D; Sat, 23 Oct 2010 13:15:07 +0000 (UTC) Received: from localhost (amavis.fra.cksoft.de [192.168.74.71]) by mail.cksoft.de (Postfix) with ESMTP id E0BEC41C7BE; Sat, 23 Oct 2010 15:15: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 QwZE-uMMHTBf; Sat, 23 Oct 2010 15:15:06 +0200 (CEST) Received: by mail.cksoft.de (Postfix, from userid 66) id 2655341C7B8; Sat, 23 Oct 2010 15:15:06 +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 959E54448F3; Sat, 23 Oct 2010 13:10:58 +0000 (UTC) Date: Sat, 23 Oct 2010 13:10:58 +0000 (UTC) From: "Bjoern A. Zeeb" X-X-Sender: bz@maildrop.int.zabbadoz.net To: Andre Oppermann In-Reply-To: <201009172205.o8HM5RPG043265@svn.freebsd.org> Message-ID: <20101023131021.C66242@maildrop.int.zabbadoz.net> References: <201009172205.o8HM5RPG043265@svn.freebsd.org> 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: Sat, 23 Oct 2010 13:15:08 -0000 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. > 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. > -- 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 Sat Oct 23 13: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 41A14106566B; Sat, 23 Oct 2010 13:16:40 +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 167918FC1E; Sat, 23 Oct 2010 13:16: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 o9NDGd9C087834; Sat, 23 Oct 2010 13:16:39 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9NDGd1B087831; Sat, 23 Oct 2010 13:16:39 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201010231316.o9NDGd1B087831@svn.freebsd.org> From: David Xu Date: Sat, 23 Oct 2010 13:16: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: r214238 - 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, 23 Oct 2010 13:16:40 -0000 Author: davidxu Date: Sat Oct 23 13:16:39 2010 New Revision: 214238 URL: http://svn.freebsd.org/changeset/base/214238 Log: In thr_exit() and kthread_exit(), only remove thread from hash if it can directly exit, otherwise let exit1() do it. The change should be in r213950, but for unknown reason, it was lost. Modified: head/sys/kern/kern_kthread.c head/sys/kern/kern_thr.c Modified: head/sys/kern/kern_kthread.c ============================================================================== --- head/sys/kern/kern_kthread.c Sat Oct 23 12:27:39 2010 (r214237) +++ head/sys/kern/kern_kthread.c Sat Oct 23 13:16:39 2010 (r214238) @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -315,17 +316,20 @@ kthread_exit(void) p = curthread->td_proc; - tidhash_remove(curthread); /* A module may be waiting for us to exit. */ wakeup(curthread); + rw_wlock(&tidhash_lock); PROC_LOCK(p); if (p->p_numthreads == 1) { PROC_UNLOCK(p); + rw_wunlock(&tidhash_lock); kproc_exit(0); /* NOTREACHED. */ } + LIST_REMOVE(curthread, td_hash); + rw_wunlock(&tidhash_lock); PROC_SLOCK(p); thread_exit(); } Modified: head/sys/kern/kern_thr.c ============================================================================== --- head/sys/kern/kern_thr.c Sat Oct 23 12:27:39 2010 (r214237) +++ head/sys/kern/kern_thr.c Sat Oct 23 13:16:39 2010 (r214238) @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -284,23 +285,23 @@ thr_exit(struct thread *td, struct thr_e kern_umtx_wake(td, uap->state, INT_MAX, 0); } - tidhash_remove(td); - + rw_wlock(&tidhash_lock); PROC_LOCK(p); - tdsigcleanup(td); - PROC_SLOCK(p); - /* * Shutting down last thread in the proc. This will actually * call exit() in the trampoline when it returns. */ if (p->p_numthreads != 1) { + LIST_REMOVE(td, td_hash); + rw_wunlock(&tidhash_lock); + tdsigcleanup(td); + PROC_SLOCK(p); thread_stopped(p); thread_exit(); /* NOTREACHED */ } - PROC_SUNLOCK(p); PROC_UNLOCK(p); + rw_wunlock(&tidhash_lock); return (0); } From owner-svn-src-head@FreeBSD.ORG Sat Oct 23 14:22: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 2AD74106566C; Sat, 23 Oct 2010 14:22:51 +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 19D088FC0A; Sat, 23 Oct 2010 14:22: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 o9NEMo3p089503; Sat, 23 Oct 2010 14:22:51 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9NEMotV089501; Sat, 23 Oct 2010 14:22:50 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201010231422.o9NEMotV089501@svn.freebsd.org> From: Edward Tomasz Napierala Date: Sat, 23 Oct 2010 14:22: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: r214245 - 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, 23 Oct 2010 14:22:51 -0000 Author: trasz Date: Sat Oct 23 14:22:50 2010 New Revision: 214245 URL: http://svn.freebsd.org/changeset/base/214245 Log: Remove workaround for ZFS bug; fix was committed to the //depot/user/pjd/zfs/... branch some time ago. MFC after: two weeks Modified: head/sys/kern/subr_acl_nfs4.c Modified: head/sys/kern/subr_acl_nfs4.c ============================================================================== --- head/sys/kern/subr_acl_nfs4.c Sat Oct 23 14:16:33 2010 (r214244) +++ head/sys/kern/subr_acl_nfs4.c Sat Oct 23 14:22:50 2010 (r214245) @@ -393,28 +393,6 @@ acl_nfs4_trivial_from_mode(struct acl *a group_deny = everyone_allow & ~group_allow; user_allow_first = group_deny & ~user_deny; -#if 1 - /* - * This is a workaround for what looks like a bug in ZFS - trivial - * ACL for mode 0077 should look like this: - * - * owner@:rwxp----------:------:deny - * owner@:------aARWcCos:------:allow - * group@:rwxp--a-R-c--s:------:allow - * everyone@:rwxp--a-R-c--s:------:allow - * - * Instead, ZFS makes it like this: - * - * owner@:rwx-----------:------:deny - * owner@:------aARWcCos:------:allow - * group@:rwxp--a-R-c--s:------:allow - * everyone@:rwxp--a-R-c--s:------:allow - */ - user_allow_first &= ~ACL_APPEND_DATA; - user_deny &= ~ACL_APPEND_DATA; - group_deny &= ~ACL_APPEND_DATA; -#endif - if (user_allow_first != 0) _acl_append(aclp, ACL_USER_OBJ, user_allow_first, ACL_ENTRY_TYPE_ALLOW); if (user_deny != 0) From owner-svn-src-head@FreeBSD.ORG Sat Oct 23 16:59: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 9386F106564A; Sat, 23 Oct 2010 16:59:39 +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 81ABD8FC15; Sat, 23 Oct 2010 16:59: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 o9NGxdCd092746; Sat, 23 Oct 2010 16:59:39 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9NGxdic092744; Sat, 23 Oct 2010 16:59:39 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201010231659.o9NGxdic092744@svn.freebsd.org> From: Robert Watson Date: Sat, 23 Oct 2010 16:59: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: r214249 - head/sys/security/mac 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, 23 Oct 2010 16:59:39 -0000 Author: rwatson Date: Sat Oct 23 16:59:39 2010 New Revision: 214249 URL: http://svn.freebsd.org/changeset/base/214249 Log: Add missing DTrace probe invocation to mac_vnode_check_open; the probe was declared, but never used. MFC after: 3 days Sponsored by: Google, Inc. Modified: head/sys/security/mac/mac_vfs.c Modified: head/sys/security/mac/mac_vfs.c ============================================================================== --- head/sys/security/mac/mac_vfs.c Sat Oct 23 14:30:27 2010 (r214248) +++ head/sys/security/mac/mac_vfs.c Sat Oct 23 16:59:39 2010 (r214249) @@ -637,6 +637,8 @@ mac_vnode_check_open(struct ucred *cred, ASSERT_VOP_LOCKED(vp, "mac_vnode_check_open"); MAC_POLICY_CHECK(vnode_check_open, cred, vp, vp->v_label, accmode); + MAC_CHECK_PROBE3(vnode_check_open, error, cred, vp, accmode); + return (error); } From owner-svn-src-head@FreeBSD.ORG Sat Oct 23 20:35: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 48AB510656C2; Sat, 23 Oct 2010 20:35:41 +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 364C88FC27; Sat, 23 Oct 2010 20:35: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 o9NKZfRN000325; Sat, 23 Oct 2010 20:35:41 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9NKZfLl000319; Sat, 23 Oct 2010 20:35:41 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201010232035.o9NKZfLl000319@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 23 Oct 2010 20:35: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: r214250 - in head/sys: netinet netinet6 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, 23 Oct 2010 20:35:41 -0000 Author: bz Date: Sat Oct 23 20:35:40 2010 New Revision: 214250 URL: http://svn.freebsd.org/changeset/base/214250 Log: Make the IPsec SADB embedded route cache a union to be able to hold both the legacy and IPv6 route destination address. Previously in case of IPv6, there was a memory overwrite due to not enough space for the IPv6 address. PR: kern/122565 MFC After: 2 weeks Modified: head/sys/netinet/ip_ipsec.c head/sys/netinet6/ip6_ipsec.c head/sys/netipsec/ipsec_output.c head/sys/netipsec/key.c head/sys/netipsec/keydb.h Modified: head/sys/netinet/ip_ipsec.c ============================================================================== --- head/sys/netinet/ip_ipsec.c Sat Oct 23 16:59:39 2010 (r214249) +++ head/sys/netinet/ip_ipsec.c Sat Oct 23 20:35:40 2010 (r214250) @@ -239,7 +239,7 @@ ip_ipsec_mtu(struct mbuf *m, int mtu) if (sp->req != NULL && sp->req->sav != NULL && sp->req->sav->sah != NULL) { - ro = &sp->req->sav->sah->sa_route; + ro = &sp->req->sav->sah->route_cache.sa_route; if (ro->ro_rt && ro->ro_rt->rt_ifp) { mtu = ro->ro_rt->rt_rmx.rmx_mtu ? Modified: head/sys/netinet6/ip6_ipsec.c ============================================================================== --- head/sys/netinet6/ip6_ipsec.c Sat Oct 23 16:59:39 2010 (r214249) +++ head/sys/netinet6/ip6_ipsec.c Sat Oct 23 20:35:40 2010 (r214250) @@ -366,7 +366,7 @@ ip6_ipsec_mtu(struct mbuf *m) if (sp->req != NULL && sp->req->sav != NULL && sp->req->sav->sah != NULL) { - ro = &sp->req->sav->sah->sa_route; + ro = &sp->req->sav->sah->route_cache.sa_route; if (ro->ro_rt && ro->ro_rt->rt_ifp) { mtu = ro->ro_rt->rt_rmx.rmx_mtu ? Modified: head/sys/netipsec/ipsec_output.c ============================================================================== --- head/sys/netipsec/ipsec_output.c Sat Oct 23 16:59:39 2010 (r214249) +++ head/sys/netipsec/ipsec_output.c Sat Oct 23 20:35:40 2010 (r214250) @@ -829,7 +829,8 @@ ipsec6_output_tunnel(struct ipsec_output } ip6 = mtod(m, struct ip6_hdr *); - state->ro = &isr->sav->sah->sa_route; + state->ro = + (struct route *)&isr->sav->sah->route_cache.sin6_route; state->dst = (struct sockaddr *)&state->ro->ro_dst; dst6 = (struct sockaddr_in6 *)state->dst; if (state->ro->ro_rt Modified: head/sys/netipsec/key.c ============================================================================== --- head/sys/netipsec/key.c Sat Oct 23 16:59:39 2010 (r214249) +++ head/sys/netipsec/key.c Sat Oct 23 20:35:40 2010 (r214250) @@ -2758,9 +2758,9 @@ key_delsah(sah) /* remove from tree of SA index */ if (__LIST_CHAINED(sah)) LIST_REMOVE(sah, chain); - if (sah->sa_route.ro_rt) { - RTFREE(sah->sa_route.ro_rt); - sah->sa_route.ro_rt = (struct rtentry *)NULL; + if (sah->route_cache.sa_route.ro_rt) { + RTFREE(sah->route_cache.sa_route.ro_rt); + sah->route_cache.sa_route.ro_rt = (struct rtentry *)NULL; } free(sah, M_IPSEC_SAH); } @@ -7925,7 +7925,7 @@ key_sa_routechange(dst) SAHTREE_LOCK(); LIST_FOREACH(sah, &V_sahtree, chain) { - ro = &sah->sa_route; + ro = &sah->route_cache.sa_route; if (ro->ro_rt && dst->sa_len == ro->ro_dst.sa_len && bcmp(dst, &ro->ro_dst, dst->sa_len) == 0) { RTFREE(ro->ro_rt); Modified: head/sys/netipsec/keydb.h ============================================================================== --- head/sys/netipsec/keydb.h Sat Oct 23 16:59:39 2010 (r214249) +++ head/sys/netipsec/keydb.h Sat Oct 23 20:35:40 2010 (r214250) @@ -85,6 +85,12 @@ struct seclifetime { u_int64_t usetime; }; +union sa_route_union { + struct route sa_route; + struct route sin_route; /* Duplicate for consistency. */ + struct route_in6 sin6_route; +}; + /* Security Association Data Base */ struct secashead { LIST_ENTRY(secashead) chain; @@ -100,7 +106,7 @@ struct secashead { /* SA chain */ /* The first of this list is newer SA */ - struct route sa_route; /* route cache */ + union sa_route_union route_cache; }; struct xformsw; From owner-svn-src-head@FreeBSD.ORG Sat Oct 23 21:25: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 AB803106564A; Sat, 23 Oct 2010 21:25:50 +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 7F9438FC13; Sat, 23 Oct 2010 21:25: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 o9NLPoE7002493; Sat, 23 Oct 2010 21:25:50 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9NLPoJ7002490; Sat, 23 Oct 2010 21:25:50 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201010232125.o9NLPoJ7002490@svn.freebsd.org> From: Pyun YongHyeon Date: Sat, 23 Oct 2010 21:25: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: r214251 - 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: Sat, 23 Oct 2010 21:25:50 -0000 Author: yongari Date: Sat Oct 23 21:25:50 2010 New Revision: 214251 URL: http://svn.freebsd.org/changeset/base/214251 Log: Apply the same workaround for SDI flow control used on BCM5906 A1 to BCM6906 A0/A2. This should fix a long standing BCM5906 A2 lockup issues. Data sheet explicitly mentions BCM5906 A0, A1 and A2 use de-pipelined mode on these revisions. Special thanks to Buganini who tried all combinations of experimental patches for more than 10 days. Tested by: Buganini gmail dot com > 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 Sat Oct 23 20:35:40 2010 (r214250) +++ head/sys/dev/bge/if_bge.c Sat Oct 23 21:25:50 2010 (r214251) @@ -1693,11 +1693,14 @@ bge_blockinit(struct bge_softc *sc) bge_writembx(sc, BGE_MBX_RX_MINI_PROD_LO, 0); } - /* Choose de-pipeline mode for BCM5906 A1. */ - if (sc->bge_asicrev == BGE_ASICREV_BCM5906 && - sc->bge_chiprev == BGE_CHIPID_BCM5906_A1) - CSR_WRITE_4(sc, BGE_ISO_PKT_TX, - (CSR_READ_4(sc, BGE_ISO_PKT_TX) & ~3) | 2); + /* 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) + CSR_WRITE_4(sc, BGE_ISO_PKT_TX, + (CSR_READ_4(sc, BGE_ISO_PKT_TX) & ~3) | 2); + } /* * The BD ring replenish thresholds control how often the * hardware fetches new BD's from the producer rings in host Modified: head/sys/dev/bge/if_bgereg.h ============================================================================== --- head/sys/dev/bge/if_bgereg.h Sat Oct 23 20:35:40 2010 (r214250) +++ head/sys/dev/bge/if_bgereg.h Sat Oct 23 21:25:50 2010 (r214251) @@ -306,6 +306,7 @@ #define BGE_CHIPID_BCM5787_A0 0xb000 #define BGE_CHIPID_BCM5787_A1 0xb001 #define BGE_CHIPID_BCM5787_A2 0xb002 +#define BGE_CHIPID_BCM5906_A0 0xc000 #define BGE_CHIPID_BCM5906_A1 0xc001 #define BGE_CHIPID_BCM5906_A2 0xc002 #define BGE_CHIPID_BCM57780_A0 0x57780000 From owner-svn-src-head@FreeBSD.ORG Sat Oct 23 22:28: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 7FF981065670; Sat, 23 Oct 2010 22:28:29 +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 53AF58FC0C; Sat, 23 Oct 2010 22:28: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 o9NMSTep003959; Sat, 23 Oct 2010 22:28:29 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9NMSTts003956; Sat, 23 Oct 2010 22:28:29 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201010232228.o9NMSTts003956@svn.freebsd.org> From: Rick Macklem Date: Sat, 23 Oct 2010 22:28: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: r214255 - in head/sys/fs: nfs nfsserver 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, 23 Oct 2010 22:28:29 -0000 Author: rmacklem Date: Sat Oct 23 22:28:29 2010 New Revision: 214255 URL: http://svn.freebsd.org/changeset/base/214255 Log: Modify the experimental NFSv4 server's file handle hash function to use the generic hash32_buf() function. Although adding the bytes seemed sufficient for UFS and ZFS, since most of the bytes are the same for file handles on the same volume, this might not be sufficient for other file systems. Use of a generic function also seems preferable to one specific to NFSv4. Suggested by: gleb.kurtsou at gmail.com MFC after: 10 days Modified: head/sys/fs/nfs/nfs_var.h head/sys/fs/nfsserver/nfs_nfsdport.c Modified: head/sys/fs/nfs/nfs_var.h ============================================================================== --- head/sys/fs/nfs/nfs_var.h Sat Oct 23 22:11:30 2010 (r214254) +++ head/sys/fs/nfs/nfs_var.h Sat Oct 23 22:28:29 2010 (r214255) @@ -576,7 +576,7 @@ void nfsvno_unlockvfs(mount_t); int nfsvno_lockvfs(mount_t); int nfsrv_v4rootexport(void *, struct ucred *, NFSPROC_T *); int nfsvno_testexp(struct nfsrv_descript *, struct nfsexstuff *); -int nfsrv_hashfh(fhandle_t *); +uint32_t nfsrv_hashfh(fhandle_t *); /* nfs_commonkrpc.c */ int newnfs_nmcancelreqs(struct nfsmount *); Modified: head/sys/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdport.c Sat Oct 23 22:11:30 2010 (r214254) +++ head/sys/fs/nfsserver/nfs_nfsdport.c Sat Oct 23 22:28:29 2010 (r214255) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); */ #include +#include #include #include #include @@ -3090,15 +3091,12 @@ nfsvno_testexp(struct nfsrv_descript *nd /* * Calculate a hash value for the fid in a file handle. */ -int +uint32_t nfsrv_hashfh(fhandle_t *fhp) { - int hashval = 0, i; - uint8_t *cp; + uint32_t hashval; - cp = (uint8_t *)&fhp->fh_fid; - for (i = 0; i < sizeof(struct fid); i++) - hashval += *cp++; + hashval = hash32_buf(&fhp->fh_fid, sizeof(struct fid), 0); return (hashval); }