From owner-svn-src-stable-9@FreeBSD.ORG Sun Oct 6 05:50:56 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 3DE10E69; Sun, 6 Oct 2013 05:50:56 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 0973F2873; Sun, 6 Oct 2013 05:50:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r965otif019891; Sun, 6 Oct 2013 05:50:55 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r965otU2019890; Sun, 6 Oct 2013 05:50:55 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201310060550.r965otU2019890@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 6 Oct 2013 05:50:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256074 - stable/9/sys/kern X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Oct 2013 05:50:56 -0000 Author: kib Date: Sun Oct 6 05:50:55 2013 New Revision: 256074 URL: http://svnweb.freebsd.org/changeset/base/256074 Log: MFC r255798: Pre-acquire the filedesc sx when a possibility exists that the later code could need to remove a kqueue from the filedesc list. Modified: stable/9/sys/kern/kern_event.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/kern_event.c ============================================================================== --- stable/9/sys/kern/kern_event.c Sat Oct 5 23:11:01 2013 (r256073) +++ stable/9/sys/kern/kern_event.c Sun Oct 6 05:50:55 2013 (r256074) @@ -965,12 +965,13 @@ kqueue_register(struct kqueue *kq, struc struct file *fp; struct knote *kn, *tkn; int error, filt, event; - int haskqglobal; + int haskqglobal, filedesc_unlock; fp = NULL; kn = NULL; error = 0; haskqglobal = 0; + filedesc_unlock = 0; filt = kev->filter; fops = kqueue_fo_find(filt); @@ -1010,6 +1011,13 @@ findkn: goto done; } + /* + * Pre-lock the filedesc before the global + * lock mutex, see the comment in + * kqueue_close(). + */ + FILEDESC_XLOCK(td->td_proc->p_fd); + filedesc_unlock = 1; KQ_GLOBAL_LOCK(&kq_global, haskqglobal); } @@ -1039,6 +1047,10 @@ findkn: /* knote is in the process of changing, wait for it to stablize. */ if (kn != NULL && (kn->kn_status & KN_INFLUX) == KN_INFLUX) { KQ_GLOBAL_UNLOCK(&kq_global, haskqglobal); + if (filedesc_unlock) { + FILEDESC_XUNLOCK(td->td_proc->p_fd); + filedesc_unlock = 0; + } kq->kq_state |= KQ_FLUXWAIT; msleep(kq, &kq->kq_lock, PSOCK | PDROP, "kqflxwt", 0); if (fp != NULL) { @@ -1155,6 +1167,8 @@ done_ev_add: done: KQ_GLOBAL_UNLOCK(&kq_global, haskqglobal); + if (filedesc_unlock) + FILEDESC_XUNLOCK(td->td_proc->p_fd); if (fp != NULL) fdrop(fp, td); if (tkn != NULL) @@ -1642,10 +1656,12 @@ kqueue_close(struct file *fp, struct thr struct knote *kn; int i; int error; + int filedesc_unlock; if ((error = kqueue_acquire(fp, &kq))) return error; + filedesc_unlock = 0; KQ_LOCK(kq); KASSERT((kq->kq_state & KQ_CLOSING) != KQ_CLOSING, @@ -1707,9 +1723,20 @@ kqueue_close(struct file *fp, struct thr KQ_UNLOCK(kq); - FILEDESC_XLOCK(fdp); + /* + * We could be called due to the knote_drop() doing fdrop(), + * called from kqueue_register(). In this case the global + * lock is owned, and filedesc sx is locked before, to not + * take the sleepable lock after non-sleepable. + */ + if (!sx_xlocked(FILEDESC_LOCK(fdp))) { + FILEDESC_XLOCK(fdp); + filedesc_unlock = 1; + } else + filedesc_unlock = 0; TAILQ_REMOVE(&fdp->fd_kqlist, kq, kq_list); - FILEDESC_XUNLOCK(fdp); + if (filedesc_unlock) + FILEDESC_XUNLOCK(fdp); seldrain(&kq->kq_sel); knlist_destroy(&kq->kq_sel.si_note); From owner-svn-src-stable-9@FreeBSD.ORG Sun Oct 6 05:53:30 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 032CB110; Sun, 6 Oct 2013 05:53:30 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id DCC242883; Sun, 6 Oct 2013 05:53:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r965rTfY020964; Sun, 6 Oct 2013 05:53:29 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r965rTIK020963; Sun, 6 Oct 2013 05:53:29 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201310060553.r965rTIK020963@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 6 Oct 2013 05:53:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256075 - stable/9/sys/security/mac X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Oct 2013 05:53:30 -0000 Author: kib Date: Sun Oct 6 05:53:29 2013 New Revision: 256075 URL: http://svnweb.freebsd.org/changeset/base/256075 Log: MFC r255945: Make the mac_policy_rm lock recursable, which allows reentrance into the mac framework. Modified: stable/9/sys/security/mac/mac_framework.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/security/mac/mac_framework.c ============================================================================== --- stable/9/sys/security/mac/mac_framework.c Sun Oct 6 05:50:55 2013 (r256074) +++ stable/9/sys/security/mac/mac_framework.c Sun Oct 6 05:53:29 2013 (r256075) @@ -292,7 +292,8 @@ mac_init(void) mac_labelzone_init(); #ifndef MAC_STATIC - rm_init_flags(&mac_policy_rm, "mac_policy_rm", RM_NOWITNESS); + rm_init_flags(&mac_policy_rm, "mac_policy_rm", RM_NOWITNESS | + RM_RECURSE); sx_init_flags(&mac_policy_sx, "mac_policy_sx", SX_NOWITNESS); #endif } From owner-svn-src-stable-9@FreeBSD.ORG Sun Oct 6 06:05:12 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id ABFB83D6; Sun, 6 Oct 2013 06:05:12 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 7D65728F7; Sun, 6 Oct 2013 06:05:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9665CKW026972; Sun, 6 Oct 2013 06:05:12 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9665C29026970; Sun, 6 Oct 2013 06:05:12 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201310060605.r9665C29026970@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 6 Oct 2013 06:05:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256076 - in stable/9/sys: kern sys X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Oct 2013 06:05:12 -0000 Author: kib Date: Sun Oct 6 06:05:11 2013 New Revision: 256076 URL: http://svnweb.freebsd.org/changeset/base/256076 Log: MFC r255940: Add LK_TRYUPGRADE operation for lockmgr(9). Modified: stable/9/sys/kern/kern_lock.c stable/9/sys/sys/lockmgr.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/sys/ (props changed) Modified: stable/9/sys/kern/kern_lock.c ============================================================================== --- stable/9/sys/kern/kern_lock.c Sun Oct 6 05:53:29 2013 (r256075) +++ stable/9/sys/kern/kern_lock.c Sun Oct 6 06:05:11 2013 (r256076) @@ -490,6 +490,7 @@ __lockmgr_args(struct lock *lk, u_int fl op = LK_EXCLUSIVE; break; case LK_UPGRADE: + case LK_TRYUPGRADE: case LK_DOWNGRADE: _lockmgr_assert(lk, KA_XLOCKED | KA_NOTRECURSED, file, line); @@ -687,6 +688,7 @@ __lockmgr_args(struct lock *lk, u_int fl } break; case LK_UPGRADE: + case LK_TRYUPGRADE: _lockmgr_assert(lk, KA_SLOCKED, file, line); v = lk->lk_lock; x = v & LK_ALL_WAITERS; @@ -707,6 +709,17 @@ __lockmgr_args(struct lock *lk, u_int fl } /* + * In LK_TRYUPGRADE mode, do not drop the lock, + * returning EBUSY instead. + */ + if (op == LK_TRYUPGRADE) { + LOCK_LOG2(lk, "%s: %p failed the nowait upgrade", + __func__, lk); + error = EBUSY; + break; + } + + /* * We have been unable to succeed in upgrading, so just * give up the shared lock. */ Modified: stable/9/sys/sys/lockmgr.h ============================================================================== --- stable/9/sys/sys/lockmgr.h Sun Oct 6 05:53:29 2013 (r256075) +++ stable/9/sys/sys/lockmgr.h Sun Oct 6 06:05:11 2013 (r256076) @@ -168,6 +168,7 @@ _lockmgr_args_rw(struct lock *lk, u_int #define LK_RELEASE 0x100000 #define LK_SHARED 0x200000 #define LK_UPGRADE 0x400000 +#define LK_TRYUPGRADE 0x800000 #define LK_TOTAL_MASK (LK_INIT_MASK | LK_EATTR_MASK | LK_TYPE_MASK) From owner-svn-src-stable-9@FreeBSD.ORG Sun Oct 6 06:09:43 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id BF04C538; Sun, 6 Oct 2013 06:09:43 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id AAB822915; Sun, 6 Oct 2013 06:09:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9669hNw028287; Sun, 6 Oct 2013 06:09:43 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9669hQM028286; Sun, 6 Oct 2013 06:09:43 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201310060609.r9669hQM028286@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 6 Oct 2013 06:09:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256077 - stable/9/sys/kern X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Oct 2013 06:09:43 -0000 Author: kib Date: Sun Oct 6 06:09:43 2013 New Revision: 256077 URL: http://svnweb.freebsd.org/changeset/base/256077 Log: MFC r255941: Increase the chance of the buffer write from the bufdaemon helper context to succeed. If the locked vnode which owns the buffer to be written is shared locked, try the non-blocking upgrade of the lock to exclusive. Modified: stable/9/sys/kern/vfs_bio.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/vfs_bio.c ============================================================================== --- stable/9/sys/kern/vfs_bio.c Sun Oct 6 06:05:11 2013 (r256076) +++ stable/9/sys/kern/vfs_bio.c Sun Oct 6 06:09:43 2013 (r256077) @@ -2671,6 +2671,8 @@ flushbufqueues(struct vnode *lvp, int qu int hasdeps; int flushed; int target; + int error; + bool unlock; if (lvp == NULL) { target = numdirtybuffers - lodirtybuffers; @@ -2751,7 +2753,16 @@ flushbufqueues(struct vnode *lvp, int qu BUF_UNLOCK(bp); continue; } - if (vn_lock(vp, LK_EXCLUSIVE | LK_NOWAIT | LK_CANRECURSE) == 0) { + if (lvp == NULL) { + unlock = true; + error = vn_lock(vp, LK_EXCLUSIVE | LK_NOWAIT); + } else { + ASSERT_VOP_LOCKED(vp, "getbuf"); + unlock = false; + error = VOP_ISLOCKED(vp) == LK_EXCLUSIVE ? 0 : + vn_lock(vp, LK_TRYUPGRADE); + } + if (error == 0) { mtx_unlock(&bqlock); CTR3(KTR_BUF, "flushbufqueue(%p) vp %p flags %X", bp, bp->b_vp, bp->b_flags); @@ -2763,7 +2774,8 @@ flushbufqueues(struct vnode *lvp, int qu notbufdflashes++; } vn_finished_write(mp); - VOP_UNLOCK(vp, 0); + if (unlock) + VOP_UNLOCK(vp, 0); flushwithdeps += hasdeps; flushed++; From owner-svn-src-stable-9@FreeBSD.ORG Sun Oct 6 06:14:30 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 5EDAF694; Sun, 6 Oct 2013 06:14:30 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4A05B294F; Sun, 6 Oct 2013 06:14:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r966EU4i032257; Sun, 6 Oct 2013 06:14:30 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r966EU5x032256; Sun, 6 Oct 2013 06:14:30 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201310060614.r966EU5x032256@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 6 Oct 2013 06:14:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256078 - stable/9/sys/kern X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Oct 2013 06:14:30 -0000 Author: kib Date: Sun Oct 6 06:14:29 2013 New Revision: 256078 URL: http://svnweb.freebsd.org/changeset/base/256078 Log: MFC r255942: For vunref(), try to upgrade the vnode lock if the function was called with the vnode shared-locked. Modified: stable/9/sys/kern/vfs_subr.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/vfs_subr.c ============================================================================== --- stable/9/sys/kern/vfs_subr.c Sun Oct 6 06:09:43 2013 (r256077) +++ stable/9/sys/kern/vfs_subr.c Sun Oct 6 06:14:29 2013 (r256078) @@ -2343,8 +2343,10 @@ vputx(struct vnode *vp, int func) } break; case VPUTX_VUNREF: - if (VOP_ISLOCKED(vp) != LK_EXCLUSIVE) - error = EBUSY; + if (VOP_ISLOCKED(vp) != LK_EXCLUSIVE) { + error = VOP_LOCK(vp, LK_TRYUPGRADE | LK_INTERLOCK); + VI_LOCK(vp); + } break; } if (vp->v_usecount > 0) From owner-svn-src-stable-9@FreeBSD.ORG Sun Oct 6 12:39:13 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 213A31DA; Sun, 6 Oct 2013 12:39:13 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 0E210280F; Sun, 6 Oct 2013 12:39:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r96CdCf7032951; Sun, 6 Oct 2013 12:39:12 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r96CdCBH032949; Sun, 6 Oct 2013 12:39:12 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201310061239.r96CdCBH032949@svn.freebsd.org> From: Dimitry Andric Date: Sun, 6 Oct 2013 12:39:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256085 - stable/9/contrib/llvm/lib/CodeGen/SelectionDAG X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Oct 2013 12:39:13 -0000 Author: dim Date: Sun Oct 6 12:39:12 2013 New Revision: 256085 URL: http://svnweb.freebsd.org/changeset/base/256085 Log: MFC r256024: Pull in r186338 from upstream llvm trunk: Remove invalid assert in DAGTypeLegalizer::RemapValue There is a comment at the top of DAGTypeLegalizer::PerformExpensiveChecks which, in part, says: // Note that these invariants may not hold momentarily when processing a node: // the node being processed may be put in a map before being marked Processed. Unfortunately, this assert would be valid only if the above-mentioned invariant held unconditionally. This was causing llc to assert when, in fact, everything was fine. Thanks to Richard Sandiford for investigating this issue! Fixes PR16562. This fixes assertions which could occur in the multimedia/ffmpeg1 and multimedia/ffmpeg2 ports. Reported by: Matthias Apitz Modified: stable/9/contrib/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp Directory Properties: stable/9/contrib/llvm/ (props changed) Modified: stable/9/contrib/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp ============================================================================== --- stable/9/contrib/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp Sun Oct 6 12:35:29 2013 (r256084) +++ stable/9/contrib/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp Sun Oct 6 12:39:12 2013 (r256085) @@ -615,7 +615,10 @@ void DAGTypeLegalizer::RemapValue(SDValu // replaced with other values. RemapValue(I->second); N = I->second; - assert(N.getNode()->getNodeId() != NewNode && "Mapped to new node!"); + + // Note that it is possible to have N.getNode()->getNodeId() == NewNode at + // this point because it is possible for a node to be put in the map before + // being processed. } } From owner-svn-src-stable-9@FreeBSD.ORG Mon Oct 7 08:14:42 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 0EF886F; Mon, 7 Oct 2013 08:14:42 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id D55152C69; Mon, 7 Oct 2013 08:14:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r978EfQH055075; Mon, 7 Oct 2013 08:14:41 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r978EfXs055074; Mon, 7 Oct 2013 08:14:41 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201310070814.r978EfXs055074@svn.freebsd.org> From: Dag-Erling Smørgrav Date: Mon, 7 Oct 2013 08:14:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256099 - stable/9/etc X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Oct 2013 08:14:42 -0000 Author: des Date: Mon Oct 7 08:14:41 2013 New Revision: 256099 URL: http://svnweb.freebsd.org/changeset/base/256099 Log: Forgotten mergeinfo Modified: Directory Properties: stable/9/etc/ (props changed) From owner-svn-src-stable-9@FreeBSD.ORG Mon Oct 7 08:19:42 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id C46F2461; Mon, 7 Oct 2013 08:19:42 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B274B2C90; Mon, 7 Oct 2013 08:19:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r978JgcY057243; Mon, 7 Oct 2013 08:19:42 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r978Jg5J057235; Mon, 7 Oct 2013 08:19:42 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201310070819.r978Jg5J057235@svn.freebsd.org> From: Dag-Erling Smørgrav Date: Mon, 7 Oct 2013 08:19:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256102 - stable/9/etc X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Oct 2013 08:19:42 -0000 Author: des Date: Mon Oct 7 08:19:41 2013 New Revision: 256102 URL: http://svnweb.freebsd.org/changeset/base/256102 Log: MFH (r255597): add unbound user to facilitate cross-building MFH (r256097): add missing entries to ftpusers and reorder Modified: stable/9/etc/ftpusers stable/9/etc/group stable/9/etc/master.passwd Directory Properties: stable/9/etc/ (props changed) Modified: stable/9/etc/ftpusers ============================================================================== --- stable/9/etc/ftpusers Mon Oct 7 08:19:30 2013 (r256101) +++ stable/9/etc/ftpusers Mon Oct 7 08:19:41 2013 (r256102) @@ -13,7 +13,10 @@ games news man sshd +smmsp +mailnull bind +unbound proxy _pflogd _dhcp @@ -23,5 +26,3 @@ auditdistd www hast nobody -mailnull -smmsp Modified: stable/9/etc/group ============================================================================== --- stable/9/etc/group Mon Oct 7 08:19:30 2013 (r256101) +++ stable/9/etc/group Mon Oct 7 08:19:41 2013 (r256102) @@ -18,6 +18,7 @@ smmsp:*:25: mailnull:*:26: guest:*:31: bind:*:53: +unbound:*:59: proxy:*:62: authpf:*:63: _pflogd:*:64: Modified: stable/9/etc/master.passwd ============================================================================== --- stable/9/etc/master.passwd Mon Oct 7 08:19:30 2013 (r256101) +++ stable/9/etc/master.passwd Mon Oct 7 08:19:41 2013 (r256102) @@ -14,6 +14,7 @@ sshd:*:22:22::0:0:Secure Shell Daemon:/v smmsp:*:25:25::0:0:Sendmail Submission User:/var/spool/clientmqueue:/usr/sbin/nologin mailnull:*:26:26::0:0:Sendmail Default User:/var/spool/mqueue:/usr/sbin/nologin bind:*:53:53::0:0:Bind Sandbox:/:/usr/sbin/nologin +unbound:*:59:59::0:0:Unbound DNS Resolver:/var/unbound:/usr/sbin/nologin proxy:*:62:62::0:0:Packet Filter pseudo-user:/nonexistent:/usr/sbin/nologin _pflogd:*:64:64::0:0:pflogd privsep user:/var/empty:/usr/sbin/nologin _dhcp:*:65:65::0:0:dhcp programs:/var/empty:/usr/sbin/nologin From owner-svn-src-stable-9@FreeBSD.ORG Mon Oct 7 12:57:28 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 832BA814; Mon, 7 Oct 2013 12:57:28 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 56EFC216E; Mon, 7 Oct 2013 12:57:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r97CvSTW004669; Mon, 7 Oct 2013 12:57:28 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r97CvRS1004666; Mon, 7 Oct 2013 12:57:27 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201310071257.r97CvRS1004666@svn.freebsd.org> From: Sergey Kandaurov Date: Mon, 7 Oct 2013 12:57:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256109 - in stable/9/sys/modules: dtrace/sdt rdma/krping toecore X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Oct 2013 12:57:28 -0000 Author: pluknet Date: Mon Oct 7 12:57:27 2013 New Revision: 256109 URL: http://svnweb.freebsd.org/changeset/base/256109 Log: MFC r237560,254319 (by uqs): Fix 'make depend'. PR: misc/180918 Submitted by: Eugene Grosbein Modified: stable/9/sys/modules/dtrace/sdt/Makefile stable/9/sys/modules/rdma/krping/Makefile stable/9/sys/modules/toecore/Makefile Directory Properties: stable/9/sys/ (props changed) stable/9/sys/modules/ (props changed) Modified: stable/9/sys/modules/dtrace/sdt/Makefile ============================================================================== --- stable/9/sys/modules/dtrace/sdt/Makefile Mon Oct 7 12:07:40 2013 (r256108) +++ stable/9/sys/modules/dtrace/sdt/Makefile Mon Oct 7 12:57:27 2013 (r256109) @@ -4,7 +4,7 @@ KMOD= sdt SRCS= sdt.c -SRCS+= vnode_if.h +SRCS+= vnode_if.h opt_kdtrace.h CFLAGS+= -I${.CURDIR}/../../../cddl/compat/opensolaris \ -I${.CURDIR}/../../../cddl/contrib/opensolaris/uts/common \ Modified: stable/9/sys/modules/rdma/krping/Makefile ============================================================================== --- stable/9/sys/modules/rdma/krping/Makefile Mon Oct 7 12:07:40 2013 (r256108) +++ stable/9/sys/modules/rdma/krping/Makefile Mon Oct 7 12:57:27 2013 (r256109) @@ -5,8 +5,8 @@ RDMA= ${.CURDIR}/../../../contrib/rdma/k KMOD= krping SRCS= krping.c krping_dev.c getopt.c -SRCS+= bus_if.h device_if.h opt_sched.h pci_if.h pcib_if.h -SRCS+= vnode_if.h -CFLAGS+= -I${.CURDIR}/../../../ofed/include +SRCS+= bus_if.h device_if.h pci_if.h pcib_if.h vnode_if.h +SRCS+= opt_sched.h opt_inet.h opt_inet6.h +CFLAGS+= -I${.CURDIR}/../../../ofed/include .include Modified: stable/9/sys/modules/toecore/Makefile ============================================================================== --- stable/9/sys/modules/toecore/Makefile Mon Oct 7 12:07:40 2013 (r256108) +++ stable/9/sys/modules/toecore/Makefile Mon Oct 7 12:57:27 2013 (r256109) @@ -4,6 +4,6 @@ KMOD= toecore SRCS= toecore.c -SRCS+= opt_ofed.h +SRCS+= opt_ofed.h opt_inet.h opt_inet6.h .include From owner-svn-src-stable-9@FreeBSD.ORG Mon Oct 7 21:54:31 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 1C56E7E; Mon, 7 Oct 2013 21:54:31 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 062362742; Mon, 7 Oct 2013 21:54:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r97LsUbf087936; Mon, 7 Oct 2013 21:54:30 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r97LsUQD087935; Mon, 7 Oct 2013 21:54:30 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201310072154.r97LsUQD087935@svn.freebsd.org> From: Xin LI Date: Mon, 7 Oct 2013 21:54:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256127 - stable/9/etc/mtree X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Oct 2013 21:54:31 -0000 Author: delphij Date: Mon Oct 7 21:54:30 2013 New Revision: 256127 URL: http://svnweb.freebsd.org/changeset/base/256127 Log: MFC r255035: Add a few missing language directories for /usr. Modified: stable/9/etc/mtree/BSD.usr.dist Directory Properties: stable/9/etc/mtree/ (props changed) Modified: stable/9/etc/mtree/BSD.usr.dist ============================================================================== --- stable/9/etc/mtree/BSD.usr.dist Mon Oct 7 21:39:42 2013 (r256126) +++ stable/9/etc/mtree/BSD.usr.dist Mon Oct 7 21:54:30 2013 (r256127) @@ -59,6 +59,8 @@ .. share calendar + de_AT.ISO_8859-15 + .. de_DE.ISO8859-1 .. fr_FR.ISO8859-1 @@ -67,8 +69,14 @@ .. hu_HU.ISO8859-2 .. + pt_BR.ISO8859-1 + .. + pt_BR.UTF-8 + .. ru_RU.KOI8-R .. + ru_RU.UTF-8 + .. uk_UA.KOI8-U .. .. From owner-svn-src-stable-9@FreeBSD.ORG Mon Oct 7 21:59:19 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 26EFA306; Mon, 7 Oct 2013 21:59:19 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 13C122771; Mon, 7 Oct 2013 21:59:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r97LxI3l089392; Mon, 7 Oct 2013 21:59:18 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r97LxIHv089390; Mon, 7 Oct 2013 21:59:18 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201310072159.r97LxIHv089390@svn.freebsd.org> From: Xin LI Date: Mon, 7 Oct 2013 21:59:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256128 - stable/9/etc/mtree X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Oct 2013 21:59:19 -0000 Author: delphij Date: Mon Oct 7 21:59:18 2013 New Revision: 256128 URL: http://svnweb.freebsd.org/changeset/base/256128 Log: MFC r248979 (emaste): Format per etc/mtree/README - Spaces instead of tabs - Sort some i18n entries Modified: stable/9/etc/mtree/BSD.usr.dist Directory Properties: stable/9/etc/mtree/ (props changed) Modified: stable/9/etc/mtree/BSD.usr.dist ============================================================================== --- stable/9/etc/mtree/BSD.usr.dist Mon Oct 7 21:54:30 2013 (r256127) +++ stable/9/etc/mtree/BSD.usr.dist Mon Oct 7 21:59:18 2013 (r256128) @@ -22,14 +22,14 @@ .. engines .. - i18n - .. + i18n + .. .. lib32 - dtrace - .. - i18n - .. + dtrace + .. + i18n + .. .. libdata gcc @@ -40,8 +40,8 @@ .. .. libexec - bsdinstall - .. + bsdinstall + .. lpr ru .. @@ -211,7 +211,7 @@ dtrace toolkit .. - .. + .. examples BSD_daemon .. @@ -336,79 +336,79 @@ fortune .. .. + i18n + csmapper + APPLE + .. + AST + .. + BIG5 + .. + CNS + .. + CP + .. + EBCDIC + .. + GB + .. + GEORGIAN + .. + ISO-8859 + .. + ISO646 + .. + JIS + .. + KAZAKH + .. + KOI + .. + KS + .. + MISC + .. + TCVN + .. + .. + esdb + APPLE + .. + AST + .. + BIG5 + .. + CP + .. + DEC + .. + EBCDIC + .. + EUC + .. + GB + .. + GEORGIAN + .. + ISO-2022 + .. + ISO-8859 + .. + ISO646 + .. + KAZAKH + .. + KOI + .. + MISC + .. + TCVN + .. + UTF + .. + .. + .. info - .. - i18n - csmapper - APPLE - .. - AST - .. - BIG5 - .. - CNS - .. - CP - .. - EBCDIC - .. - GB - .. - GEORGIAN - .. - ISO-8859 - .. - ISO646 - .. - JIS - .. - KAZAKH - .. - KOI - .. - KS - .. - MISC - .. - TCVN - .. - .. - esdb - APPLE - .. - AST - .. - BIG5 - .. - CP - .. - DEC - .. - EBCDIC - .. - EUC - .. - GB - .. - GEORGIAN - .. - ISO-2022 - .. - ISO-8859 - .. - ISO646 - .. - KAZAKH - .. - KOI - .. - MISC - .. - TCVN - .. - UTF - .. - .. .. locale UTF-8 @@ -435,26 +435,26 @@ .. ca_AD.ISO8859-1 .. - ca_ES.ISO8859-1 - .. - ca_FR.ISO8859-1 + ca_AD.ISO8859-15 .. - ca_IT.ISO8859-1 + ca_AD.UTF-8 .. - ca_AD.ISO8859-15 + ca_ES.ISO8859-1 .. ca_ES.ISO8859-15 .. - ca_FR.ISO8859-15 - .. - ca_IT.ISO8859-15 + ca_ES.UTF-8 .. - ca_AD.UTF-8 + ca_FR.ISO8859-1 .. - ca_ES.UTF-8 + ca_FR.ISO8859-15 .. ca_FR.UTF-8 .. + ca_IT.ISO8859-1 + .. + ca_IT.ISO8859-15 + .. ca_IT.UTF-8 .. cs_CZ.ISO8859-2 From owner-svn-src-stable-9@FreeBSD.ORG Mon Oct 7 22:03:40 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id CE09C5BC; Mon, 7 Oct 2013 22:03:40 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A1D2427CB; Mon, 7 Oct 2013 22:03:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r97M3elu094166; Mon, 7 Oct 2013 22:03:40 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r97M3ejD094165; Mon, 7 Oct 2013 22:03:40 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201310072203.r97M3ejD094165@svn.freebsd.org> From: Xin LI Date: Mon, 7 Oct 2013 22:03:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256129 - stable/9/etc/mtree X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Oct 2013 22:03:40 -0000 Author: delphij Date: Mon Oct 7 22:03:40 2013 New Revision: 256129 URL: http://svnweb.freebsd.org/changeset/base/256129 Log: MFC r255036: Add directories that is installed as part of bsdconfig. These are included unconditionally for now because bsdconfig is currently installed unconditionally. This fixes 'make -j 17 installworld' caused by a race condition. Modified: stable/9/etc/mtree/BSD.usr.dist Directory Properties: stable/9/etc/mtree/ (props changed) Modified: stable/9/etc/mtree/BSD.usr.dist ============================================================================== --- stable/9/etc/mtree/BSD.usr.dist Mon Oct 7 21:59:18 2013 (r256128) +++ stable/9/etc/mtree/BSD.usr.dist Mon Oct 7 22:03:40 2013 (r256129) @@ -40,6 +40,62 @@ .. .. libexec + bsdconfig + 020.docsinstall + include + .. + .. + 030.packages + include + .. + .. + 040.password + include + .. + .. + 050.diskmgmt + include + .. + .. + 070.usermgmt + include + .. + .. + 080.console + include + .. + .. + 090.timezone + include + .. + .. + 110.mouse + include + .. + .. + 120.networking + include + .. + .. + 130.security + include + .. + .. + 140.startup + include + .. + .. + 150.ttys + include + .. + .. + dot + include + .. + .. + include + .. + .. bsdinstall .. lpr @@ -58,6 +114,22 @@ sbin .. share + bsdconfig + media + .. + networking + .. + packages + .. + password + .. + startup + .. + timezone + .. + usermgmt + .. + .. calendar de_AT.ISO_8859-15 .. @@ -221,6 +293,8 @@ .. bootforth .. + bsdconfig + .. csh .. cvs From owner-svn-src-stable-9@FreeBSD.ORG Tue Oct 8 04:52:40 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id CB52256A; Tue, 8 Oct 2013 04:52:40 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id AFA05224B; Tue, 8 Oct 2013 04:52:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r984qedE055055; Tue, 8 Oct 2013 04:52:40 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r984qeKZ055054; Tue, 8 Oct 2013 04:52:40 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201310080452.r984qeKZ055054@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 8 Oct 2013 04:52:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256134 - stable/9/sys/kern X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Oct 2013 04:52:40 -0000 Author: kib Date: Tue Oct 8 04:52:40 2013 New Revision: 256134 URL: http://svnweb.freebsd.org/changeset/base/256134 Log: MFC r255979: When printing the vnode information from ddb, print the lengths of the dirty and clean buffer queues. Modified: stable/9/sys/kern/vfs_subr.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/vfs_subr.c ============================================================================== --- stable/9/sys/kern/vfs_subr.c Tue Oct 8 04:16:22 2013 (r256133) +++ stable/9/sys/kern/vfs_subr.c Tue Oct 8 04:52:40 2013 (r256134) @@ -3015,9 +3015,12 @@ vn_printf(struct vnode *vp, const char * if (mtx_owned(VI_MTX(vp))) printf(" VI_LOCKed"); if (vp->v_object != NULL) - printf(" v_object %p ref %d pages %d\n", + printf(" v_object %p ref %d pages %d " + "cleanbuf %d dirtybuf %d\n", vp->v_object, vp->v_object->ref_count, - vp->v_object->resident_page_count); + vp->v_object->resident_page_count, + vp->v_bufobj.bo_dirty.bv_cnt, + vp->v_bufobj.bo_clean.bv_cnt); printf(" "); lockmgr_printinfo(vp->v_vnlock); if (vp->v_data != NULL) From owner-svn-src-stable-9@FreeBSD.ORG Wed Oct 9 05:27:22 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 727A1E1; Wed, 9 Oct 2013 05:27:22 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 5E7652B07; Wed, 9 Oct 2013 05:27:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r995RMbM032468; Wed, 9 Oct 2013 05:27:22 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r995RMJ5032467; Wed, 9 Oct 2013 05:27:22 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201310090527.r995RMJ5032467@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 9 Oct 2013 05:27:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256177 - stable/9/share/man/man9 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Oct 2013 05:27:22 -0000 Author: kib Date: Wed Oct 9 05:27:21 2013 New Revision: 256177 URL: http://svnweb.freebsd.org/changeset/base/256177 Log: MFC r256089: Document LK_TRYUPGRADE. Modified: stable/9/share/man/man9/lock.9 Directory Properties: stable/9/share/man/man9/ (props changed) Modified: stable/9/share/man/man9/lock.9 ============================================================================== --- stable/9/share/man/man9/lock.9 Wed Oct 9 03:56:07 2013 (r256176) +++ stable/9/share/man/man9/lock.9 Wed Oct 9 05:27:21 2013 (r256177) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 16, 2009 +.Dd October 6, 2013 .Dt LOCK 9 .Os .Sh NAME @@ -164,11 +164,17 @@ If an exclusive lock has been recursed, .Xr panic 9 . .It Dv LK_UPGRADE Upgrade a shared lock to an exclusive lock. -If this call fails, the shared lock is lost. +If this call fails, the shared lock is lost, even if the +.Dv LK_NOWAIT +flag is specified. During the upgrade, the shared lock could be temporarily dropped. Attempts to upgrade an exclusive lock will cause a .Xr panic 9 . +.It Dv LK_TRYUPGRADE +Try to upgrade a shared lock to an exclusive lock. +The failure to upgrade does not result in the dropping +of the shared lock ownership. .It Dv LK_RELEASE Release the lock. Releasing a lock that is not held can cause a @@ -334,7 +340,9 @@ fail if: was requested and another thread had already requested a lock upgrade. .It Bq Er EBUSY .Dv LK_NOWAIT -was set, and a sleep would have been required. +was set, and a sleep would have been required, or +.Dv LK_TRYUPGRADE +operation was not able to upgrade the lock. .It Bq Er ENOLCK .Dv LK_SLEEPFAIL was set and From owner-svn-src-stable-9@FreeBSD.ORG Wed Oct 9 06:19:02 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 6F173BA4; Wed, 9 Oct 2013 06:19:02 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 5CC092D73; Wed, 9 Oct 2013 06:19:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r996J2UH059770; Wed, 9 Oct 2013 06:19:02 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r996J2hY059769; Wed, 9 Oct 2013 06:19:02 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201310090619.r996J2hY059769@svn.freebsd.org> From: Dimitry Andric Date: Wed, 9 Oct 2013 06:19:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256178 - stable/9/contrib/llvm/lib/Target/X86 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Oct 2013 06:19:02 -0000 Author: dim Date: Wed Oct 9 06:19:01 2013 New Revision: 256178 URL: http://svnweb.freebsd.org/changeset/base/256178 Log: MFC r256090: Pull in r192064 from upstream llvm trunk: X86: Don't fold spills into SSE operations if the stack is unaligned. Regalloc can emit unaligned spills nowadays, but we can't fold the spills into SSE ops if we can't guarantee alignment. PR12250. This fixes unaligned SSE accesses (leading to a SIGBUS) which could occur in the ffmpeg ports. Reported by: tijl Modified: stable/9/contrib/llvm/lib/Target/X86/X86InstrInfo.cpp Directory Properties: stable/9/contrib/llvm/ (props changed) Modified: stable/9/contrib/llvm/lib/Target/X86/X86InstrInfo.cpp ============================================================================== --- stable/9/contrib/llvm/lib/Target/X86/X86InstrInfo.cpp Wed Oct 9 05:27:21 2013 (r256177) +++ stable/9/contrib/llvm/lib/Target/X86/X86InstrInfo.cpp Wed Oct 9 06:19:01 2013 (r256178) @@ -3881,6 +3881,10 @@ MachineInstr* X86InstrInfo::foldMemoryOp const MachineFrameInfo *MFI = MF.getFrameInfo(); unsigned Size = MFI->getObjectSize(FrameIndex); unsigned Alignment = MFI->getObjectAlignment(FrameIndex); + // If the function stack isn't realigned we don't want to fold instructions + // that need increased alignment. + if (!RI.needsStackRealignment(MF)) + Alignment = std::min(Alignment, TM.getFrameLowering()->getStackAlignment()); if (Ops.size() == 2 && Ops[0] == 0 && Ops[1] == 1) { unsigned NewOpc = 0; unsigned RCSize = 0; From owner-svn-src-stable-9@FreeBSD.ORG Wed Oct 9 18:14:30 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 3515FF65; Wed, 9 Oct 2013 18:14:30 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 080812ADC; Wed, 9 Oct 2013 18:14:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r99IETES037692; Wed, 9 Oct 2013 18:14:29 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r99IETSl037669; Wed, 9 Oct 2013 18:14:29 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201310091814.r99IETSl037669@svn.freebsd.org> From: Alexander Motin Date: Wed, 9 Oct 2013 18:14:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256206 - stable/9/sys/sys X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Oct 2013 18:14:30 -0000 Author: mav Date: Wed Oct 9 18:14:28 2013 New Revision: 256206 URL: http://svnweb.freebsd.org/changeset/base/256206 Log: MFC r250395 (by attilio / jeff): Generalize the bitset operations, present in cpuset and offer a KPI to redefine such operations for different consumers. This will be used when NUMA support will be finished and numaset will need to be used. Added: stable/9/sys/sys/_bitset.h - copied unchanged from r250395, head/sys/sys/_bitset.h stable/9/sys/sys/bitset.h - copied unchanged from r250395, head/sys/sys/bitset.h Modified: stable/9/sys/sys/_cpuset.h stable/9/sys/sys/cpuset.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/sys/ (props changed) Copied: stable/9/sys/sys/_bitset.h (from r250395, head/sys/sys/_bitset.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/sys/sys/_bitset.h Wed Oct 9 18:14:28 2013 (r256206, copy of r250395, head/sys/sys/_bitset.h) @@ -0,0 +1,61 @@ +/*- + * Copyright (c) 2008, Jeffrey Roberson + * All rights reserved. + * + * Copyright (c) 2008 Nokia Corporation + * 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 unmodified, 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. + * + * $FreeBSD$ + */ + +#ifndef _SYS__BITSET_H_ +#define _SYS__BITSET_H_ + +/* + * Macros addressing word and bit within it, tuned to make compiler + * optimize cases when SETSIZE fits into single machine word. + */ +#define _BITSET_BITS (sizeof(long) * NBBY) + +#define __bitset_words(_s) (howmany(_s, _BITSET_BITS)) + +#define __bitset_mask(_s, n) \ + (1L << ((__bitset_words((_s)) == 1) ? \ + (__size_t)(n) : ((n) % _BITSET_BITS))) + +#define __bitset_word(_s, n) \ + ((__bitset_words((_s)) == 1) ? 0 : ((n) / _BITSET_BITS)) + +#define BITSET_DEFINE(t, _s) \ +struct t { \ + long __bits[__bitset_words((_s))]; \ +}; + +#define BITSET_T_INITIALIZER(x) \ + { .__bits = { x } } + +#define BITSET_FSET(n) \ + [ 0 ... ((n) - 1) ] = (-1L) + +#endif /* !_SYS__BITSET_H_ */ Modified: stable/9/sys/sys/_cpuset.h ============================================================================== --- stable/9/sys/sys/_cpuset.h Wed Oct 9 18:11:15 2013 (r256205) +++ stable/9/sys/sys/_cpuset.h Wed Oct 9 18:14:28 2013 (r256206) @@ -32,6 +32,8 @@ #ifndef _SYS__CPUSET_H_ #define _SYS__CPUSET_H_ +#include + #ifdef _KERNEL #define CPU_SETSIZE MAXCPU #endif @@ -42,11 +44,13 @@ #define CPU_SETSIZE CPU_MAXSIZE #endif -#define _NCPUBITS (sizeof(long) * NBBY) /* bits per mask */ -#define _NCPUWORDS howmany(CPU_SETSIZE, _NCPUBITS) +#define _NCPUBITS _BITSET_BITS +#define _NCPUWORDS __bitset_words(CPU_SETSIZE) + +BITSET_DEFINE(_cpuset, CPU_SETSIZE); +typedef struct _cpuset cpuset_t; -typedef struct _cpuset { - long __bits[howmany(CPU_SETSIZE, _NCPUBITS)]; -} cpuset_t; +#define CPUSET_FSET BITSET_FSET(_NCPUWORDS) +#define CPUSET_T_INITIALIZER BITSET_T_INITIALIZER #endif /* !_SYS__CPUSET_H_ */ Copied: stable/9/sys/sys/bitset.h (from r250395, head/sys/sys/bitset.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/sys/sys/bitset.h Wed Oct 9 18:14:28 2013 (r256206, copy of r250395, head/sys/sys/bitset.h) @@ -0,0 +1,153 @@ +/*- + * Copyright (c) 2008, Jeffrey Roberson + * All rights reserved. + * + * Copyright (c) 2008 Nokia Corporation + * 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 unmodified, 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. + * + * $FreeBSD$ + */ + +#ifndef _SYS_BITSET_H_ +#define _SYS_BITSET_H_ + +#define BIT_CLR(_s, n, p) \ + ((p)->__bits[__bitset_word(_s, n)] &= ~__bitset_mask((_s), (n))) + +#define BIT_COPY(_s, f, t) (void)(*(t) = *(f)) + +#define BIT_ISSET(_s, n, p) \ + ((((p)->__bits[__bitset_word(_s, n)] & __bitset_mask((_s), (n))) != 0)) + +#define BIT_SET(_s, n, p) \ + ((p)->__bits[__bitset_word(_s, n)] |= __bitset_mask((_s), (n))) + +#define BIT_ZERO(_s, p) do { \ + __size_t __i; \ + for (__i = 0; __i < __bitset_words((_s)); __i++) \ + (p)->__bits[__i] = 0L; \ +} while (0) + +#define BIT_FILL(_s, p) do { \ + __size_t __i; \ + for (__i = 0; __i < __bitset_words((_s)); __i++) \ + (p)->__bits[__i] = -1L; \ +} while (0) + +#define BIT_SETOF(_s, n, p) do { \ + BIT_ZERO(_s, p); \ + (p)->__bits[__bitset_word(_s, n)] = __bitset_mask((_s), (n)); \ +} while (0) + +/* Is p empty. */ +#define BIT_EMPTY(_s, p) __extension__ ({ \ + __size_t __i; \ + for (__i = 0; __i < __bitset_words((_s)); __i++) \ + if ((p)->__bits[__i]) \ + break; \ + __i == __bitset_words((_s)); \ +}) + +/* Is p full set. */ +#define BIT_ISFULLSET(_s, p) __extension__ ({ \ + __size_t __i; \ + for (__i = 0; __i < __bitset_words((_s)); __i++) \ + if ((p)->__bits[__i] != (long)-1) \ + break; \ + __i == __bitset_words((_s)); \ +}) + +/* Is c a subset of p. */ +#define BIT_SUBSET(_s, p, c) __extension__ ({ \ + __size_t __i; \ + for (__i = 0; __i < __bitset_words((_s)); __i++) \ + if (((c)->__bits[__i] & \ + (p)->__bits[__i]) != \ + (c)->__bits[__i]) \ + break; \ + __i == __bitset_words((_s)); \ +}) + +/* Are there any common bits between b & c? */ +#define BIT_OVERLAP(_s, p, c) __extension__ ({ \ + __size_t __i; \ + for (__i = 0; __i < __bitset_words((_s)); __i++) \ + if (((c)->__bits[__i] & \ + (p)->__bits[__i]) != 0) \ + break; \ + __i != __bitset_words((_s)); \ +}) + +/* Compare two sets, returns 0 if equal 1 otherwise. */ +#define BIT_CMP(_s, p, c) __extension__ ({ \ + __size_t __i; \ + for (__i = 0; __i < __bitset_words((_s)); __i++) \ + if (((c)->__bits[__i] != \ + (p)->__bits[__i])) \ + break; \ + __i != __bitset_words((_s)); \ +}) + +#define BIT_OR(_s, d, s) do { \ + __size_t __i; \ + for (__i = 0; __i < __bitset_words((_s)); __i++) \ + (d)->__bits[__i] |= (s)->__bits[__i]; \ +} while (0) + +#define BIT_AND(_s, d, s) do { \ + __size_t __i; \ + for (__i = 0; __i < __bitset_words((_s)); __i++) \ + (d)->__bits[__i] &= (s)->__bits[__i]; \ +} while (0) + +#define BIT_NAND(_s, d, s) do { \ + __size_t __i; \ + for (__i = 0; __i < __bitset_words((_s)); __i++) \ + (d)->__bits[__i] &= ~(s)->__bits[__i]; \ +} while (0) + +#define BIT_CLR_ATOMIC(_s, n, p) \ + atomic_clear_long(&(p)->__bits[__bitset_word(_s, n)], \ + __bitset_mask((_s), n)) + +#define BIT_SET_ATOMIC(_s, n, p) \ + atomic_set_long(&(p)->__bits[__bitset_word(_s, n)], \ + __bitset_mask((_s), n)) + +/* Convenience functions catering special cases. */ +#define BIT_OR_ATOMIC(_s, d, s) do { \ + __size_t __i; \ + for (__i = 0; __i < __bitset_words((_s)); __i++) \ + atomic_set_long(&(d)->__bits[__i], \ + (s)->__bits[__i]); \ +} while (0) + +#define BIT_COPY_STORE_REL(_s, f, t) do { \ + __size_t __i; \ + for (__i = 0; __i < __bitset_words((_s)); __i++) \ + atomic_store_rel_long(&(t)->__bits[__i], \ + (f)->__bits[__i]); \ +} while (0) + +#endif /* !_SYS_BITSET_H_ */ Modified: stable/9/sys/sys/cpuset.h ============================================================================== --- stable/9/sys/sys/cpuset.h Wed Oct 9 18:11:15 2013 (r256205) +++ stable/9/sys/sys/cpuset.h Wed Oct 9 18:14:28 2013 (r256206) @@ -34,124 +34,29 @@ #include +#include + #define CPUSETBUFSIZ ((2 + sizeof(long) * 2) * _NCPUWORDS) -/* - * Macros addressing word and bit within it, tuned to make compiler - * optimize cases when CPU_SETSIZE fits into single machine word. - */ -#define __cpuset_mask(n) \ - ((long)1 << ((_NCPUWORDS == 1) ? (__size_t)(n) : ((n) % _NCPUBITS))) -#define __cpuset_word(n) ((_NCPUWORDS == 1) ? 0 : ((n) / _NCPUBITS)) - -#define CPU_CLR(n, p) ((p)->__bits[__cpuset_word(n)] &= ~__cpuset_mask(n)) -#define CPU_COPY(f, t) (void)(*(t) = *(f)) -#define CPU_ISSET(n, p) (((p)->__bits[__cpuset_word(n)] & __cpuset_mask(n)) != 0) -#define CPU_SET(n, p) ((p)->__bits[__cpuset_word(n)] |= __cpuset_mask(n)) -#define CPU_ZERO(p) do { \ - __size_t __i; \ - for (__i = 0; __i < _NCPUWORDS; __i++) \ - (p)->__bits[__i] = 0; \ -} while (0) - -#define CPU_FILL(p) do { \ - __size_t __i; \ - for (__i = 0; __i < _NCPUWORDS; __i++) \ - (p)->__bits[__i] = -1; \ -} while (0) - -#define CPU_SETOF(n, p) do { \ - CPU_ZERO(p); \ - ((p)->__bits[__cpuset_word(n)] = __cpuset_mask(n)); \ -} while (0) - -/* Is p empty. */ -#define CPU_EMPTY(p) __extension__ ({ \ - __size_t __i; \ - for (__i = 0; __i < _NCPUWORDS; __i++) \ - if ((p)->__bits[__i]) \ - break; \ - __i == _NCPUWORDS; \ -}) - -/* Is p full set. */ -#define CPU_ISFULLSET(p) __extension__ ({ \ - __size_t __i; \ - for (__i = 0; __i < _NCPUWORDS; __i++) \ - if ((p)->__bits[__i] != (long)-1) \ - break; \ - __i == _NCPUWORDS; \ -}) - -/* Is c a subset of p. */ -#define CPU_SUBSET(p, c) __extension__ ({ \ - __size_t __i; \ - for (__i = 0; __i < _NCPUWORDS; __i++) \ - if (((c)->__bits[__i] & \ - (p)->__bits[__i]) != \ - (c)->__bits[__i]) \ - break; \ - __i == _NCPUWORDS; \ -}) - -/* Are there any common bits between b & c? */ -#define CPU_OVERLAP(p, c) __extension__ ({ \ - __size_t __i; \ - for (__i = 0; __i < _NCPUWORDS; __i++) \ - if (((c)->__bits[__i] & \ - (p)->__bits[__i]) != 0) \ - break; \ - __i != _NCPUWORDS; \ -}) - -/* Compare two sets, returns 0 if equal 1 otherwise. */ -#define CPU_CMP(p, c) __extension__ ({ \ - __size_t __i; \ - for (__i = 0; __i < _NCPUWORDS; __i++) \ - if (((c)->__bits[__i] != \ - (p)->__bits[__i])) \ - break; \ - __i != _NCPUWORDS; \ -}) - -#define CPU_OR(d, s) do { \ - __size_t __i; \ - for (__i = 0; __i < _NCPUWORDS; __i++) \ - (d)->__bits[__i] |= (s)->__bits[__i]; \ -} while (0) - -#define CPU_AND(d, s) do { \ - __size_t __i; \ - for (__i = 0; __i < _NCPUWORDS; __i++) \ - (d)->__bits[__i] &= (s)->__bits[__i]; \ -} while (0) - -#define CPU_NAND(d, s) do { \ - __size_t __i; \ - for (__i = 0; __i < _NCPUWORDS; __i++) \ - (d)->__bits[__i] &= ~(s)->__bits[__i]; \ -} while (0) - -#define CPU_CLR_ATOMIC(n, p) \ - atomic_clear_long(&(p)->__bits[__cpuset_word(n)], __cpuset_mask(n)) - -#define CPU_SET_ATOMIC(n, p) \ - atomic_set_long(&(p)->__bits[__cpuset_word(n)], __cpuset_mask(n)) - -/* Convenience functions catering special cases. */ -#define CPU_OR_ATOMIC(d, s) do { \ - __size_t __i; \ - for (__i = 0; __i < _NCPUWORDS; __i++) \ - atomic_set_long(&(d)->__bits[__i], \ - (s)->__bits[__i]); \ -} while (0) - -#define CPU_COPY_STORE_REL(f, t) do { \ - __size_t __i; \ - for (__i = 0; __i < _NCPUWORDS; __i++) \ - atomic_store_rel_long(&(t)->__bits[__i], \ - (f)->__bits[__i]); \ -} while (0) +#define CPU_CLR(n, p) BIT_CLR(CPU_SETSIZE, n, p) +#define CPU_COPY(f, t) BIT_COPY(CPU_SETSIZE, f, t) +#define CPU_ISSET(n, p) BIT_ISSET(CPU_SETSIZE, n, p) +#define CPU_SET(n, p) BIT_SET(CPU_SETSIZE, n, p) +#define CPU_ZERO(p) BIT_ZERO(CPU_SETSIZE, p) +#define CPU_FILL(p) BIT_FILL(CPU_SETSIZE, p) +#define CPU_SETOF(n, p) BIT_SETOF(CPU_SETSIZE, n, p) +#define CPU_EMPTY(p) BIT_EMPTY(CPU_SETSIZE, p) +#define CPU_ISFULLSET(p) BIT_ISFULLSET(CPU_SETSIZE, p) +#define CPU_SUBSET(p, c) BIT_SUBSET(CPU_SETSIZE, p, c) +#define CPU_OVERLAP(p, c) BIT_OVERLAP(CPU_SETSIZE, p, c) +#define CPU_CMP(p, c) BIT_CMP(CPU_SETSIZE, p, c) +#define CPU_OR(d, s) BIT_OR(CPU_SETSIZE, d, s) +#define CPU_AND(d, s) BIT_AND(CPU_SETSIZE, d, s) +#define CPU_NAND(d, s) BIT_NAND(CPU_SETSIZE, d, s) +#define CPU_CLR_ATOMIC(n, p) BIT_CLR_ATOMIC(CPU_SETSIZE, n, p) +#define CPU_SET_ATOMIC(n, p) BIT_SET_ATOMIC(CPU_SETSIZE, n, p) +#define CPU_OR_ATOMIC(d, s) BIT_OR_ATOMIC(CPU_SETSIZE, d, s) +#define CPU_COPY_STORE_REL(f, t) BIT_COPY_STORE_REL(CPU_SETSIZE, f, t) /* * Valid cpulevel_t values. From owner-svn-src-stable-9@FreeBSD.ORG Wed Oct 9 18:23:32 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 54D8E3B3; Wed, 9 Oct 2013 18:23:32 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 403522B5B; Wed, 9 Oct 2013 18:23:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r99INWaS043032; Wed, 9 Oct 2013 18:23:32 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r99INUMG043021; Wed, 9 Oct 2013 18:23:30 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201310091823.r99INUMG043021@svn.freebsd.org> From: Alexander Motin Date: Wed, 9 Oct 2013 18:23:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256207 - in stable/9/sys: amd64/amd64 i386/i386 i386/xen mips/mips sparc64/sparc64 sys X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Oct 2013 18:23:32 -0000 Author: mav Date: Wed Oct 9 18:23:30 2013 New Revision: 256207 URL: http://svnweb.freebsd.org/changeset/base/256207 Log: MFC r251703 (by attilio): - Add a BIT_FFS() macro and use it to replace cpusetffs_obj() Modified: stable/9/sys/amd64/amd64/mp_machdep.c stable/9/sys/i386/i386/mp_machdep.c stable/9/sys/i386/i386/pmap.c stable/9/sys/i386/xen/mp_machdep.c stable/9/sys/i386/xen/pmap.c stable/9/sys/mips/mips/mp_machdep.c stable/9/sys/sparc64/sparc64/mp_machdep.c stable/9/sys/sys/bitset.h stable/9/sys/sys/cpuset.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/sys/ (props changed) Modified: stable/9/sys/amd64/amd64/mp_machdep.c ============================================================================== --- stable/9/sys/amd64/amd64/mp_machdep.c Wed Oct 9 18:14:28 2013 (r256206) +++ stable/9/sys/amd64/amd64/mp_machdep.c Wed Oct 9 18:23:30 2013 (r256207) @@ -1151,7 +1151,7 @@ smp_targeted_tlb_shootdown(cpuset_t mask ipi_all_but_self(vector); } else { ncpu = 0; - while ((cpu = cpusetobj_ffs(&mask)) != 0) { + while ((cpu = CPU_FFS(&mask)) != 0) { cpu--; CPU_CLR(cpu, &mask); CTR3(KTR_SMP, "%s: cpu: %d ipi: %x", __func__, @@ -1300,7 +1300,7 @@ ipi_selected(cpuset_t cpus, u_int ipi) if (ipi == IPI_STOP_HARD) CPU_OR_ATOMIC(&ipi_nmi_pending, &cpus); - while ((cpu = cpusetobj_ffs(&cpus)) != 0) { + while ((cpu = CPU_FFS(&cpus)) != 0) { cpu--; CPU_CLR(cpu, &cpus); CTR3(KTR_SMP, "%s: cpu: %d ipi: %x", __func__, cpu, ipi); Modified: stable/9/sys/i386/i386/mp_machdep.c ============================================================================== --- stable/9/sys/i386/i386/mp_machdep.c Wed Oct 9 18:14:28 2013 (r256206) +++ stable/9/sys/i386/i386/mp_machdep.c Wed Oct 9 18:23:30 2013 (r256207) @@ -1256,7 +1256,7 @@ smp_targeted_tlb_shootdown(cpuset_t mask ipi_all_but_self(vector); } else { ncpu = 0; - while ((cpu = cpusetobj_ffs(&mask)) != 0) { + while ((cpu = CPU_FFS(&mask)) != 0) { cpu--; CPU_CLR(cpu, &mask); CTR3(KTR_SMP, "%s: cpu: %d ipi: %x", __func__, cpu, @@ -1405,7 +1405,7 @@ ipi_selected(cpuset_t cpus, u_int ipi) if (ipi == IPI_STOP_HARD) CPU_OR_ATOMIC(&ipi_nmi_pending, &cpus); - while ((cpu = cpusetobj_ffs(&cpus)) != 0) { + while ((cpu = CPU_FFS(&cpus)) != 0) { cpu--; CPU_CLR(cpu, &cpus); CTR3(KTR_SMP, "%s: cpu: %d ipi: %x", __func__, cpu, ipi); Modified: stable/9/sys/i386/i386/pmap.c ============================================================================== --- stable/9/sys/i386/i386/pmap.c Wed Oct 9 18:14:28 2013 (r256206) +++ stable/9/sys/i386/i386/pmap.c Wed Oct 9 18:23:30 2013 (r256207) @@ -2007,7 +2007,7 @@ pmap_lazyfix(pmap_t pmap) spins = 50000000; /* Find least significant set bit. */ - lsb = cpusetobj_ffs(&mask); + lsb = CPU_FFS(&mask); MPASS(lsb != 0); lsb--; CPU_SETOF(lsb, &mask); Modified: stable/9/sys/i386/xen/mp_machdep.c ============================================================================== --- stable/9/sys/i386/xen/mp_machdep.c Wed Oct 9 18:14:28 2013 (r256206) +++ stable/9/sys/i386/xen/mp_machdep.c Wed Oct 9 18:23:30 2013 (r256207) @@ -1038,7 +1038,7 @@ smp_targeted_tlb_shootdown(cpuset_t mask ipi_all_but_self(vector); } else { ncpu = 0; - while ((cpu = cpusetobj_ffs(&mask)) != 0) { + while ((cpu = CPU_FFS(&mask)) != 0) { cpu--; CPU_CLR(cpu, &mask); CTR3(KTR_SMP, "%s: cpu: %d ipi: %x", __func__, cpu, @@ -1131,7 +1131,7 @@ ipi_selected(cpuset_t cpus, u_int ipi) if (ipi == IPI_STOP_HARD) CPU_OR_ATOMIC(&ipi_nmi_pending, &cpus); - while ((cpu = cpusetobj_ffs(&cpus)) != 0) { + while ((cpu = CPU_FFS(&cpus)) != 0) { cpu--; CPU_CLR(cpu, &cpus); CTR3(KTR_SMP, "%s: cpu: %d ipi: %x", __func__, cpu, ipi); Modified: stable/9/sys/i386/xen/pmap.c ============================================================================== --- stable/9/sys/i386/xen/pmap.c Wed Oct 9 18:14:28 2013 (r256206) +++ stable/9/sys/i386/xen/pmap.c Wed Oct 9 18:23:30 2013 (r256207) @@ -1702,7 +1702,7 @@ pmap_lazyfix(pmap_t pmap) spins = 50000000; /* Find least significant set bit. */ - lsb = cpusetobj_ffs(&mask); + lsb = CPU_FFS(&mask); MPASS(lsb != 0); lsb--; CPU_SETOF(lsb, &mask); Modified: stable/9/sys/mips/mips/mp_machdep.c ============================================================================== --- stable/9/sys/mips/mips/mp_machdep.c Wed Oct 9 18:14:28 2013 (r256206) +++ stable/9/sys/mips/mips/mp_machdep.c Wed Oct 9 18:23:30 2013 (r256207) @@ -208,7 +208,7 @@ cpu_mp_setmaxid(void) platform_cpu_mask(&cpumask); mp_ncpus = 0; last = 1; - while ((cpu = cpusetobj_ffs(&cpumask)) != 0) { + while ((cpu = CPU_FFS(&cpumask)) != 0) { last = cpu; cpu--; CPU_CLR(cpu, &cpumask); @@ -251,7 +251,7 @@ cpu_mp_start(void) platform_cpu_mask(&cpumask); while (!CPU_EMPTY(&cpumask)) { - cpuid = cpusetobj_ffs(&cpumask) - 1; + cpuid = CPU_FFS(&cpumask) - 1; CPU_CLR(cpuid, &cpumask); if (cpuid >= MAXCPU) { Modified: stable/9/sys/sparc64/sparc64/mp_machdep.c ============================================================================== --- stable/9/sys/sparc64/sparc64/mp_machdep.c Wed Oct 9 18:14:28 2013 (r256206) +++ stable/9/sys/sparc64/sparc64/mp_machdep.c Wed Oct 9 18:23:30 2013 (r256207) @@ -557,7 +557,7 @@ spitfire_ipi_selected(cpuset_t cpus, u_l { u_int cpu; - while ((cpu = cpusetobj_ffs(&cpus)) != 0) { + while ((cpu = CPU_FFS(&cpus)) != 0) { cpu--; CPU_CLR(cpu, &cpus); spitfire_ipi_single(cpu, d0, d1, d2); Modified: stable/9/sys/sys/bitset.h ============================================================================== --- stable/9/sys/sys/bitset.h Wed Oct 9 18:14:28 2013 (r256206) +++ stable/9/sys/sys/bitset.h Wed Oct 9 18:23:30 2013 (r256207) @@ -150,4 +150,19 @@ (f)->__bits[__i]); \ } while (0) +#define BIT_FFS(_s, p) __extension__ ({ \ + __size_t __i; \ + int __bit; \ + \ + __bit = 0; \ + for (__i = 0; __i < __bitset_words((_s)); __i++) { \ + if ((p)->__bits[__i] != 0) { \ + __bit = ffsl((p)->__bits[__i]); \ + __bit += __i * _BITSET_BITS; \ + break; \ + } \ + } \ + __bit; \ +}) + #endif /* !_SYS_BITSET_H_ */ Modified: stable/9/sys/sys/cpuset.h ============================================================================== --- stable/9/sys/sys/cpuset.h Wed Oct 9 18:14:28 2013 (r256206) +++ stable/9/sys/sys/cpuset.h Wed Oct 9 18:23:30 2013 (r256207) @@ -57,6 +57,7 @@ #define CPU_SET_ATOMIC(n, p) BIT_SET_ATOMIC(CPU_SETSIZE, n, p) #define CPU_OR_ATOMIC(d, s) BIT_OR_ATOMIC(CPU_SETSIZE, d, s) #define CPU_COPY_STORE_REL(f, t) BIT_COPY_STORE_REL(CPU_SETSIZE, f, t) +#define CPU_FFS(p) BIT_FFS(CPU_SETSIZE, p) /* * Valid cpulevel_t values. From owner-svn-src-stable-9@FreeBSD.ORG Wed Oct 9 18:29:07 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 1D6A267A; Wed, 9 Oct 2013 18:29:07 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 0A6362B9E; Wed, 9 Oct 2013 18:29:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r99IT6ip044611; Wed, 9 Oct 2013 18:29:06 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r99IT6Q6044609; Wed, 9 Oct 2013 18:29:06 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201310091829.r99IT6Q6044609@svn.freebsd.org> From: Alexander Motin Date: Wed, 9 Oct 2013 18:29:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256208 - stable/9/sys/kern X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Oct 2013 18:29:07 -0000 Author: mav Date: Wed Oct 9 18:29:06 2013 New Revision: 256208 URL: http://svnweb.freebsd.org/changeset/base/256208 Log: MFC r255363: Micro-optimize cpu_search(), allowing compiler to use more efficient inline ffsl() implementation, when it is available, instead of homegrown iteration. On dual-E5645 amd64 system (2x6x2 cores) under heavy I/O load that reduces time spent inside cpu_search() from 19% to 13%, while IOPS increased by 5%. Modified: stable/9/sys/kern/sched_ule.c Modified: stable/9/sys/kern/sched_ule.c ============================================================================== --- stable/9/sys/kern/sched_ule.c Wed Oct 9 18:23:30 2013 (r256207) +++ stable/9/sys/kern/sched_ule.c Wed Oct 9 18:29:06 2013 (r256208) @@ -632,10 +632,14 @@ cpu_search(const struct cpu_group *cg, s } /* Iterate through the child CPU groups and then remaining CPUs. */ - for (i = cg->cg_children, cpu = mp_maxid; i >= 0; ) { + for (i = cg->cg_children, cpu = mp_maxid; ; ) { if (i == 0) { +#ifdef HAVE_INLINE_FFSL + cpu = CPU_FFS(&cpumask) - 1; +#else while (cpu >= 0 && !CPU_ISSET(cpu, &cpumask)) cpu--; +#endif if (cpu < 0) break; child = NULL; @@ -660,6 +664,7 @@ cpu_search(const struct cpu_group *cg, s break; } } else { /* Handle child CPU. */ + CPU_CLR(cpu, &cpumask); tdq = TDQ_CPU(cpu); load = tdq->tdq_load * 256; rndptr = DPCPU_PTR(randomval); @@ -707,8 +712,11 @@ cpu_search(const struct cpu_group *cg, s i--; if (i == 0 && CPU_EMPTY(&cpumask)) break; - } else + } +#ifndef HAVE_INLINE_FFSL + else cpu--; +#endif } return (total); } From owner-svn-src-stable-9@FreeBSD.ORG Wed Oct 9 18:44:05 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id C134BE31; Wed, 9 Oct 2013 18:44:05 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id AE36B2C8E; Wed, 9 Oct 2013 18:44:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r99Ii57l053926; Wed, 9 Oct 2013 18:44:05 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r99Ii5Pu053925; Wed, 9 Oct 2013 18:44:05 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201310091844.r99Ii5Pu053925@svn.freebsd.org> From: Alexander Motin Date: Wed, 9 Oct 2013 18:44:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256212 - stable/9/sys/cam/ctl X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Oct 2013 18:44:05 -0000 Author: mav Date: Wed Oct 9 18:44:05 2013 New Revision: 256212 URL: http://svnweb.freebsd.org/changeset/base/256212 Log: MFC r249102 (by trasz): Since the CTL version in FreeBSD does not support High Availability, ctl_is_single should always be set to 1. Make it so. Previously it was always 0, because ctl_isc_start() never got to run. Modified: stable/9/sys/cam/ctl/ctl.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/ctl/ctl.c ============================================================================== --- stable/9/sys/cam/ctl/ctl.c Wed Oct 9 18:43:29 2013 (r256211) +++ stable/9/sys/cam/ctl/ctl.c Wed Oct 9 18:44:05 2013 (r256212) @@ -316,7 +316,7 @@ static struct scsi_control_page control_ static int rcv_sync_msg; static int persis_offset; static uint8_t ctl_pause_rtr; -static int ctl_is_single; +static int ctl_is_single = 1; static int index_to_aps_page; int ctl_disable = 0; From owner-svn-src-stable-9@FreeBSD.ORG Wed Oct 9 18:45:43 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 28066155; Wed, 9 Oct 2013 18:45:43 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 14C712CA8; Wed, 9 Oct 2013 18:45:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r99Ijg87054302; Wed, 9 Oct 2013 18:45:42 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r99IjgAM054300; Wed, 9 Oct 2013 18:45:42 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201310091845.r99IjgAM054300@svn.freebsd.org> From: Alexander Motin Date: Wed, 9 Oct 2013 18:45:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256214 - stable/9/sys/cam/ctl X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Oct 2013 18:45:43 -0000 Author: mav Date: Wed Oct 9 18:45:42 2013 New Revision: 256214 URL: http://svnweb.freebsd.org/changeset/base/256214 Log: MFC r249256 (by ken): Fix a memory leak that showed up when we delete LUNs. The memory used for the LUN was never freed. ctl.c: Adjust ctl_alloc_lun() to make sure we don't clear the CTL_LUN_MALLOCED flag. Modified: stable/9/sys/cam/ctl/ctl.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/ctl/ctl.c ============================================================================== --- stable/9/sys/cam/ctl/ctl.c Wed Oct 9 18:45:01 2013 (r256213) +++ stable/9/sys/cam/ctl/ctl.c Wed Oct 9 18:45:42 2013 (r256214) @@ -4217,7 +4217,7 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft { struct ctl_lun *nlun, *lun; struct ctl_frontend *fe; - int lun_number, i; + int lun_number, i, lun_malloced; if (be_lun == NULL) return (EINVAL); @@ -4239,11 +4239,15 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft } if (ctl_lun == NULL) { lun = malloc(sizeof(*lun), M_CTL, M_WAITOK); - lun->flags = CTL_LUN_MALLOCED; - } else + lun_malloced = 1; + } else { + lun_malloced = 0; lun = ctl_lun; + } memset(lun, 0, sizeof(*lun)); + if (lun_malloced) + lun->flags = CTL_LUN_MALLOCED; mtx_lock(&ctl_softc->ctl_lock); /* @@ -4295,7 +4299,7 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft * The processor LUN is always enabled. Disk LUNs come on line * disabled, and must be enabled by the backend. */ - lun->flags = CTL_LUN_DISABLED; + lun->flags |= CTL_LUN_DISABLED; lun->backend = be_lun->be; be_lun->ctl_lun = lun; be_lun->lun_id = lun_number; From owner-svn-src-stable-9@FreeBSD.ORG Wed Oct 9 18:48:10 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 9B8122A9; Wed, 9 Oct 2013 18:48:10 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 888642CBE; Wed, 9 Oct 2013 18:48:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r99ImAcv055013; Wed, 9 Oct 2013 18:48:10 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r99ImAPH055012; Wed, 9 Oct 2013 18:48:10 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201310091848.r99ImAPH055012@svn.freebsd.org> From: Alexander Motin Date: Wed, 9 Oct 2013 18:48:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256215 - stable/9/sys/cam/ata X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Oct 2013 18:48:10 -0000 Author: mav Date: Wed Oct 9 18:48:10 2013 New Revision: 256215 URL: http://svnweb.freebsd.org/changeset/base/256215 Log: MFC r249438: Use full freeze while PMP does hard reset. This is only cosmetical change. Modified: stable/9/sys/cam/ata/ata_pmp.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/ata/ata_pmp.c ============================================================================== --- stable/9/sys/cam/ata/ata_pmp.c Wed Oct 9 18:45:42 2013 (r256214) +++ stable/9/sys/cam/ata/ata_pmp.c Wed Oct 9 18:48:10 2013 (r256215) @@ -193,8 +193,7 @@ pmpfreeze(struct cam_periph *periph, int i, 0) == CAM_REQ_CMP) { softc->frozen |= (1 << i); xpt_acquire_device(dpath->device); - cam_freeze_devq_arg(dpath, - RELSIM_RELEASE_RUNLEVEL, CAM_RL_BUS + 1); + cam_freeze_devq(dpath); xpt_free_path(dpath); } } @@ -215,8 +214,7 @@ pmprelease(struct cam_periph *periph, in xpt_path_path_id(periph->path), i, 0) == CAM_REQ_CMP) { softc->frozen &= ~(1 << i); - cam_release_devq(dpath, - RELSIM_RELEASE_RUNLEVEL, 0, CAM_RL_BUS + 1, FALSE); + cam_release_devq(dpath, 0, 0, 0, FALSE); xpt_release_device(dpath->device); xpt_free_path(dpath); } From owner-svn-src-stable-9@FreeBSD.ORG Wed Oct 9 18:58:30 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id BE6996F5; Wed, 9 Oct 2013 18:58:30 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id AA1EF2D56; Wed, 9 Oct 2013 18:58:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r99IwUOI059877; Wed, 9 Oct 2013 18:58:30 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r99IwSF8059867; Wed, 9 Oct 2013 18:58:28 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201310091858.r99IwSF8059867@svn.freebsd.org> From: Alexander Motin Date: Wed, 9 Oct 2013 18:58:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256216 - in stable/9/sys/cam: . ata ctl scsi X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Oct 2013 18:58:30 -0000 Author: mav Date: Wed Oct 9 18:58:28 2013 New Revision: 256216 URL: http://svnweb.freebsd.org/changeset/base/256216 Log: MFC r249466, r249481, r250025: Remove multilevel freezing mechanism, implemented to handle specifics of the ATA/SATA error recovery, when post-reset recovery commands should be allocated when queues are already full of payload requests. Instead of removing frozen CCBs with specified range of priorities from the queue to provide free openings, use simple hack, allowing explicit CCBs over- allocation for requests with priority higher (numerically lower) then CAM_PRIORITY_OOB threshold. Simplify CCB allocation logic by removing SIM-level allocation queue. After that SIM-level queue manages only CCBs execution, while allocation logic is localized within each single device. Modified: stable/9/sys/cam/ata/ata_da.c stable/9/sys/cam/ata/ata_xpt.c stable/9/sys/cam/cam.h stable/9/sys/cam/cam_ccb.h stable/9/sys/cam/cam_periph.c stable/9/sys/cam/cam_periph.h stable/9/sys/cam/cam_queue.c stable/9/sys/cam/cam_queue.h stable/9/sys/cam/cam_xpt.c stable/9/sys/cam/cam_xpt_internal.h stable/9/sys/cam/cam_xpt_sim.h stable/9/sys/cam/ctl/scsi_ctl.c stable/9/sys/cam/scsi/scsi_cd.c stable/9/sys/cam/scsi/scsi_pass.c stable/9/sys/cam/scsi/scsi_xpt.c Modified: stable/9/sys/cam/ata/ata_da.c ============================================================================== --- stable/9/sys/cam/ata/ata_da.c Wed Oct 9 18:48:10 2013 (r256215) +++ stable/9/sys/cam/ata/ata_da.c Wed Oct 9 18:58:28 2013 (r256216) @@ -1022,8 +1022,6 @@ adaasync(void *callback_arg, u_int32_t c else break; cam_periph_acquire(periph); - cam_freeze_devq_arg(periph->path, - RELSIM_RELEASE_RUNLEVEL, CAM_RL_DEV + 1); xpt_schedule(periph, CAM_PRIORITY_DEV); } default: @@ -1359,15 +1357,11 @@ adaregister(struct cam_periph *periph, v cgd->ident_data.support.command1 & ATA_SUPPORT_LOOKAHEAD) { softc->state = ADA_STATE_RAHEAD; cam_periph_acquire(periph); - cam_freeze_devq_arg(periph->path, - RELSIM_RELEASE_RUNLEVEL, CAM_RL_DEV + 1); xpt_schedule(periph, CAM_PRIORITY_DEV); } else if (ADA_WC >= 0 && cgd->ident_data.support.command1 & ATA_SUPPORT_WRITECACHE) { softc->state = ADA_STATE_WCACHE; cam_periph_acquire(periph); - cam_freeze_devq_arg(periph->path, - RELSIM_RELEASE_RUNLEVEL, CAM_RL_DEV + 1); xpt_schedule(periph, CAM_PRIORITY_DEV); } else softc->state = ADA_STATE_NORMAL; @@ -1659,8 +1653,6 @@ out: if ((periph->flags & CAM_PERIPH_INVALID) != 0) { softc->state = ADA_STATE_NORMAL; xpt_release_ccb(start_ccb); - cam_release_devq(periph->path, - RELSIM_RELEASE_RUNLEVEL, 0, CAM_RL_DEV + 1, FALSE); adaschedule(periph); cam_periph_release_locked(periph); return; @@ -1684,6 +1676,7 @@ out: ATA_SF_ENAB_WCACHE : ATA_SF_DIS_WCACHE, 0, 0); start_ccb->ccb_h.ccb_state = ADA_CCB_WCACHE; } + start_ccb->ccb_h.flags |= CAM_DEV_QFREEZE; xpt_action(start_ccb); break; } @@ -1696,12 +1689,14 @@ adadone(struct cam_periph *periph, union struct ada_softc *softc; struct ccb_ataio *ataio; struct ccb_getdev *cgd; + struct cam_path *path; int state; softc = (struct ada_softc *)periph->softc; ataio = &done_ccb->ataio; + path = done_ccb->ccb_h.path; - CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("adadone\n")); + CAM_DEBUG(path, CAM_DEBUG_TRACE, ("adadone\n")); state = ataio->ccb_h.ccb_state & ADA_CCB_TYPE_MASK; switch (state) { @@ -1718,7 +1713,7 @@ adadone(struct cam_periph *periph, union return; } if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) - cam_release_devq(done_ccb->ccb_h.path, + cam_release_devq(path, /*relsim_flags*/0, /*reduction*/0, /*timeout*/0, @@ -1771,9 +1766,12 @@ adadone(struct cam_periph *periph, union { if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { if (adaerror(done_ccb, 0, 0) == ERESTART) { +out: + /* Drop freeze taken due to CAM_DEV_QFREEZE */ + cam_release_devq(path, 0, 0, 0, FALSE); return; } else if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) { - cam_release_devq(done_ccb->ccb_h.path, + cam_release_devq(path, /*relsim_flags*/0, /*reduction*/0, /*timeout*/0, @@ -1790,7 +1788,7 @@ adadone(struct cam_periph *periph, union * operation. */ cgd = (struct ccb_getdev *)done_ccb; - xpt_setup_ccb(&cgd->ccb_h, periph->path, CAM_PRIORITY_NORMAL); + xpt_setup_ccb(&cgd->ccb_h, path, CAM_PRIORITY_NORMAL); cgd->ccb_h.func_code = XPT_GDEV_TYPE; xpt_action((union ccb *)cgd); if (ADA_WC >= 0 && @@ -1798,12 +1796,12 @@ adadone(struct cam_periph *periph, union softc->state = ADA_STATE_WCACHE; xpt_release_ccb(done_ccb); xpt_schedule(periph, CAM_PRIORITY_DEV); - return; + goto out; } softc->state = ADA_STATE_NORMAL; xpt_release_ccb(done_ccb); - cam_release_devq(periph->path, - RELSIM_RELEASE_RUNLEVEL, 0, CAM_RL_DEV + 1, FALSE); + /* Drop freeze taken due to CAM_DEV_QFREEZE */ + cam_release_devq(path, 0, 0, 0, FALSE); adaschedule(periph); cam_periph_release_locked(periph); return; @@ -1812,9 +1810,9 @@ adadone(struct cam_periph *periph, union { if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { if (adaerror(done_ccb, 0, 0) == ERESTART) { - return; + goto out; } else if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) { - cam_release_devq(done_ccb->ccb_h.path, + cam_release_devq(path, /*relsim_flags*/0, /*reduction*/0, /*timeout*/0, @@ -1832,8 +1830,8 @@ adadone(struct cam_periph *periph, union * operation. */ xpt_release_ccb(done_ccb); - cam_release_devq(periph->path, - RELSIM_RELEASE_RUNLEVEL, 0, CAM_RL_DEV + 1, FALSE); + /* Drop freeze taken due to CAM_DEV_QFREEZE */ + cam_release_devq(path, 0, 0, 0, FALSE); adaschedule(periph); cam_periph_release_locked(periph); return; Modified: stable/9/sys/cam/ata/ata_xpt.c ============================================================================== --- stable/9/sys/cam/ata/ata_xpt.c Wed Oct 9 18:48:10 2013 (r256215) +++ stable/9/sys/cam/ata/ata_xpt.c Wed Oct 9 18:58:28 2013 (r256216) @@ -249,12 +249,6 @@ proberegister(struct cam_periph *periph, return (status); } CAM_DEBUG(periph->path, CAM_DEBUG_PROBE, ("Probe started\n")); - - /* - * Ensure nobody slip in until probe finish. - */ - cam_freeze_devq_arg(periph->path, - RELSIM_RELEASE_RUNLEVEL, CAM_RL_XPT + 1); probeschedule(periph); return(CAM_REQ_CMP); } @@ -661,6 +655,7 @@ negotiate: default: panic("probestart: invalid action state 0x%x\n", softc->action); } + start_ccb->ccb_h.flags |= CAM_DEV_QFREEZE; xpt_action(start_ccb); } @@ -708,12 +703,15 @@ probedone(struct cam_periph *periph, uni if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { if (cam_periph_error(done_ccb, 0, softc->restart ? (SF_NO_RECOVERY | SF_NO_RETRY) : 0, - NULL) == ERESTART) + NULL) == ERESTART) { +out: + /* Drop freeze taken due to CAM_DEV_QFREEZE flag set. */ + cam_release_devq(path, 0, 0, 0, FALSE); return; + } if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) { /* Don't wedge the queue */ - xpt_release_devq(done_ccb->ccb_h.path, /*count*/1, - /*run_queue*/TRUE); + xpt_release_devq(path, /*count*/1, /*run_queue*/TRUE); } status = done_ccb->ccb_h.status & CAM_STATUS_MASK; if (softc->restart) { @@ -768,7 +766,7 @@ probedone(struct cam_periph *periph, uni PROBE_SET_ACTION(softc, PROBE_IDENTIFY_SAFTE); xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); - return; + goto out; } /* @@ -830,7 +828,7 @@ noerror: } xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); - return; + goto out; } case PROBE_IDENTIFY: { @@ -864,7 +862,7 @@ noerror: PROBE_SET_ACTION(softc, PROBE_SPINUP); xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); - return; + goto out; } ident_buf = &path->device->ident_data; if ((periph->path->device->flags & CAM_DEV_UNCONFIGURED) == 0) { @@ -955,7 +953,7 @@ noerror: PROBE_SET_ACTION(softc, PROBE_SETMODE); xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); - return; + goto out; } case PROBE_SPINUP: if (bootverbose) @@ -964,7 +962,7 @@ noerror: PROBE_SET_ACTION(softc, PROBE_IDENTIFY); xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); - return; + goto out; case PROBE_SETMODE: /* Set supported bits. */ bzero(&cts, sizeof(cts)); @@ -1035,7 +1033,7 @@ noerror: PROBE_SET_ACTION(softc, PROBE_SETPM); xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); - return; + goto out; } /* FALLTHROUGH */ case PROBE_SETPM: @@ -1046,7 +1044,7 @@ noerror: PROBE_SET_ACTION(softc, PROBE_SETAPST); xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); - return; + goto out; } /* FALLTHROUGH */ case PROBE_SETAPST: @@ -1056,7 +1054,7 @@ noerror: PROBE_SET_ACTION(softc, PROBE_SETDMAAA); xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); - return; + goto out; } /* FALLTHROUGH */ case PROBE_SETDMAAA: @@ -1066,7 +1064,7 @@ noerror: PROBE_SET_ACTION(softc, PROBE_SETAN); xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); - return; + goto out; } /* FALLTHROUGH */ case PROBE_SETAN: @@ -1078,15 +1076,14 @@ notsata: } xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); - return; + goto out; case PROBE_SET_MULTI: if (periph->path->device->flags & CAM_DEV_UNCONFIGURED) { path->device->flags &= ~CAM_DEV_UNCONFIGURED; xpt_acquire_device(path->device); done_ccb->ccb_h.func_code = XPT_GDEV_TYPE; xpt_action(done_ccb); - xpt_async(AC_FOUND_DEVICE, done_ccb->ccb_h.path, - done_ccb); + xpt_async(AC_FOUND_DEVICE, path, done_ccb); } PROBE_SET_ACTION(softc, PROBE_DONE); break; @@ -1119,7 +1116,7 @@ notsata: PROBE_SET_ACTION(softc, PROBE_FULL_INQUIRY); xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); - return; + goto out; } ata_device_transport(path); @@ -1128,7 +1125,7 @@ notsata: xpt_acquire_device(path->device); done_ccb->ccb_h.func_code = XPT_GDEV_TYPE; xpt_action(done_ccb); - xpt_async(AC_FOUND_DEVICE, done_ccb->ccb_h.path, done_ccb); + xpt_async(AC_FOUND_DEVICE, path, done_ccb); } PROBE_SET_ACTION(softc, PROBE_DONE); break; @@ -1146,7 +1143,7 @@ notsata: PROBE_SET_ACTION(softc, PROBE_PM_PRV); xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); - return; + goto out; case PROBE_PM_PRV: softc->pm_prv = (done_ccb->ataio.res.lba_high << 24) + (done_ccb->ataio.res.lba_mid << 16) + @@ -1201,12 +1198,11 @@ notsata: xpt_acquire_device(path->device); done_ccb->ccb_h.func_code = XPT_GDEV_TYPE; xpt_action(done_ccb); - xpt_async(AC_FOUND_DEVICE, done_ccb->ccb_h.path, - done_ccb); + xpt_async(AC_FOUND_DEVICE, path, done_ccb); } else { done_ccb->ccb_h.func_code = XPT_GDEV_TYPE; xpt_action(done_ccb); - xpt_async(AC_SCSI_AEN, done_ccb->ccb_h.path, done_ccb); + xpt_async(AC_SCSI_AEN, path, done_ccb); } PROBE_SET_ACTION(softc, PROBE_DONE); break; @@ -1251,8 +1247,7 @@ notsata: xpt_acquire_device(path->device); done_ccb->ccb_h.func_code = XPT_GDEV_TYPE; xpt_action(done_ccb); - xpt_async(AC_FOUND_DEVICE, done_ccb->ccb_h.path, - done_ccb); + xpt_async(AC_FOUND_DEVICE, path, done_ccb); } PROBE_SET_ACTION(softc, PROBE_DONE); break; @@ -1264,7 +1259,7 @@ done: softc->restart = 0; xpt_release_ccb(done_ccb); probeschedule(periph); - return; + goto out; } xpt_release_ccb(done_ccb); CAM_DEBUG(periph->path, CAM_DEBUG_PROBE, ("Probe completed\n")); @@ -1274,9 +1269,9 @@ done: done_ccb->ccb_h.status = found ? CAM_REQ_CMP : CAM_REQ_CMP_ERR; xpt_done(done_ccb); } + /* Drop freeze taken due to CAM_DEV_QFREEZE flag set. */ + cam_release_devq(path, 0, 0, 0, FALSE); cam_periph_invalidate(periph); - cam_release_devq(periph->path, - RELSIM_RELEASE_RUNLEVEL, 0, CAM_RL_XPT + 1, FALSE); cam_periph_release_locked(periph); } Modified: stable/9/sys/cam/cam.h ============================================================================== --- stable/9/sys/cam/cam.h Wed Oct 9 18:48:10 2013 (r256215) +++ stable/9/sys/cam/cam.h Wed Oct 9 18:58:28 2013 (r256216) @@ -80,10 +80,9 @@ typedef struct { #define CAM_PRIORITY_BUS ((CAM_RL_BUS << 8) + 0x80) #define CAM_PRIORITY_XPT ((CAM_RL_XPT << 8) + 0x80) #define CAM_PRIORITY_DEV ((CAM_RL_DEV << 8) + 0x80) +#define CAM_PRIORITY_OOB (CAM_RL_DEV << 8) #define CAM_PRIORITY_NORMAL ((CAM_RL_NORMAL << 8) + 0x80) #define CAM_PRIORITY_NONE (u_int32_t)-1 -#define CAM_PRIORITY_TO_RL(x) ((x) >> 8) -#define CAM_RL_TO_PRIORITY(x) ((x) << 8) u_int32_t generation; int index; #define CAM_UNQUEUED_INDEX -1 Modified: stable/9/sys/cam/cam_ccb.h ============================================================================== --- stable/9/sys/cam/cam_ccb.h Wed Oct 9 18:48:10 2013 (r256215) +++ stable/9/sys/cam/cam_ccb.h Wed Oct 9 18:58:28 2013 (r256216) @@ -150,8 +150,6 @@ typedef enum { /* Path statistics (error counts, etc.) */ XPT_GDEV_STATS = 0x0c, /* Device statistics (error counts, etc.) */ - XPT_FREEZE_QUEUE = 0x0d, - /* Freeze device queue */ XPT_DEV_ADVINFO = 0x0e, /* Get/Set Device advanced information */ /* SCSI Control Functions: 0x10->0x1F */ @@ -755,7 +753,6 @@ struct ccb_relsim { #define RELSIM_RELEASE_AFTER_TIMEOUT 0x02 #define RELSIM_RELEASE_AFTER_CMDCMPLT 0x04 #define RELSIM_RELEASE_AFTER_QEMPTY 0x08 -#define RELSIM_RELEASE_RUNLEVEL 0x10 u_int32_t openings; u_int32_t release_timeout; /* Abstract argument. */ u_int32_t qfrozen_cnt; Modified: stable/9/sys/cam/cam_periph.c ============================================================================== --- stable/9/sys/cam/cam_periph.c Wed Oct 9 18:48:10 2013 (r256215) +++ stable/9/sys/cam/cam_periph.c Wed Oct 9 18:58:28 2013 (r256216) @@ -1113,21 +1113,12 @@ cam_periph_runccb(union ccb *ccb, void cam_freeze_devq(struct cam_path *path) { + struct ccb_hdr ccb_h; - cam_freeze_devq_arg(path, 0, 0); -} - -void -cam_freeze_devq_arg(struct cam_path *path, uint32_t flags, uint32_t arg) -{ - struct ccb_relsim crs; - - xpt_setup_ccb(&crs.ccb_h, path, CAM_PRIORITY_NONE); - crs.ccb_h.func_code = XPT_FREEZE_QUEUE; - crs.release_flags = flags; - crs.openings = arg; - crs.release_timeout = arg; - xpt_action((union ccb *)&crs); + xpt_setup_ccb(&ccb_h, path, /*priority*/1); + ccb_h.func_code = XPT_NOOP; + ccb_h.flags = CAM_DEV_QFREEZE; + xpt_action((union ccb *)&ccb_h); } u_int32_t Modified: stable/9/sys/cam/cam_periph.h ============================================================================== --- stable/9/sys/cam/cam_periph.h Wed Oct 9 18:48:10 2013 (r256215) +++ stable/9/sys/cam/cam_periph.h Wed Oct 9 18:58:28 2013 (r256216) @@ -171,8 +171,6 @@ int cam_periph_ioctl(struct cam_periph cam_flags camflags, u_int32_t sense_flags)); void cam_freeze_devq(struct cam_path *path); -void cam_freeze_devq_arg(struct cam_path *path, u_int32_t flags, - uint32_t arg); u_int32_t cam_release_devq(struct cam_path *path, u_int32_t relsim_flags, u_int32_t opening_reduction, u_int32_t arg, int getcount_only); Modified: stable/9/sys/cam/cam_queue.c ============================================================================== --- stable/9/sys/cam/cam_queue.c Wed Oct 9 18:48:10 2013 (r256215) +++ stable/9/sys/cam/cam_queue.c Wed Oct 9 18:58:28 2013 (r256216) @@ -230,15 +230,8 @@ int cam_devq_init(struct cam_devq *devq, int devices, int openings) { bzero(devq, sizeof(*devq)); - if (camq_init(&devq->alloc_queue, devices) != 0) { + if (camq_init(&devq->send_queue, devices) != 0) return (1); - } - if (camq_init(&devq->send_queue, devices) != 0) { - camq_fini(&devq->alloc_queue); - return (1); - } - devq->alloc_openings = openings; - devq->alloc_active = 0; devq->send_openings = openings; devq->send_active = 0; return (0); @@ -247,7 +240,6 @@ cam_devq_init(struct cam_devq *devq, int void cam_devq_free(struct cam_devq *devq) { - camq_fini(&devq->alloc_queue); camq_fini(&devq->send_queue); free(devq, M_CAMDEVQ); } @@ -257,11 +249,7 @@ cam_devq_resize(struct cam_devq *camq, i { u_int32_t retval; - retval = camq_resize(&camq->alloc_queue, devices); - - if (retval == CAM_REQ_CMP) - retval = camq_resize(&camq->send_queue, devices); - + retval = camq_resize(&camq->send_queue, devices); return (retval); } @@ -328,11 +316,10 @@ int cam_ccbq_init(struct cam_ccbq *ccbq, int openings) { bzero(ccbq, sizeof(*ccbq)); - if (camq_init(&ccbq->queue, openings + (CAM_RL_VALUES - 1)) != 0) { + if (camq_init(&ccbq->queue, openings + (CAM_RL_VALUES - 1)) != 0) return (1); - } ccbq->devq_openings = openings; - ccbq->dev_openings = openings; + ccbq->dev_openings = openings; return (0); } Modified: stable/9/sys/cam/cam_queue.h ============================================================================== --- stable/9/sys/cam/cam_queue.h Wed Oct 9 18:48:10 2013 (r256215) +++ stable/9/sys/cam/cam_queue.h Wed Oct 9 18:58:28 2013 (r256216) @@ -48,7 +48,7 @@ struct camq { int array_size; int entries; u_int32_t generation; - u_int32_t qfrozen_cnt[CAM_RL_VALUES]; + u_int32_t qfrozen_cnt; }; TAILQ_HEAD(ccb_hdr_tailq, ccb_hdr); @@ -58,7 +58,8 @@ SLIST_HEAD(ccb_hdr_slist, ccb_hdr); struct cam_ccbq { struct camq queue; int devq_openings; - int dev_openings; + int devq_allocating; + int dev_openings; int dev_active; int held; }; @@ -66,11 +67,7 @@ struct cam_ccbq { struct cam_ed; struct cam_devq { - struct camq alloc_queue; struct camq send_queue; - struct cam_ed *active_dev; - int alloc_openings; - int alloc_active; int send_openings; int send_active; }; @@ -158,10 +155,10 @@ cam_ccbq_pending_ccb_count(struct cam_cc static __inline void cam_ccbq_take_opening(struct cam_ccbq *ccbq); -static __inline int +static __inline void cam_ccbq_insert_ccb(struct cam_ccbq *ccbq, union ccb *new_ccb); -static __inline int +static __inline void cam_ccbq_remove_ccb(struct cam_ccbq *ccbq, union ccb *ccb); static __inline union ccb * @@ -190,31 +187,17 @@ cam_ccbq_take_opening(struct cam_ccbq *c ccbq->held++; } -static __inline int +static __inline void cam_ccbq_insert_ccb(struct cam_ccbq *ccbq, union ccb *new_ccb) { ccbq->held--; camq_insert(&ccbq->queue, &new_ccb->ccb_h.pinfo); - if (ccbq->queue.qfrozen_cnt[CAM_PRIORITY_TO_RL( - new_ccb->ccb_h.pinfo.priority)] > 0) { - ccbq->devq_openings++; - ccbq->held++; - return (1); - } else - return (0); } -static __inline int +static __inline void cam_ccbq_remove_ccb(struct cam_ccbq *ccbq, union ccb *ccb) { camq_remove(&ccbq->queue, ccb->ccb_h.pinfo.index); - if (ccbq->queue.qfrozen_cnt[CAM_PRIORITY_TO_RL( - ccb->ccb_h.pinfo.priority)] > 0) { - ccbq->devq_openings--; - ccbq->held--; - return (1); - } else - return (0); } static __inline union ccb * @@ -248,81 +231,5 @@ cam_ccbq_release_opening(struct cam_ccbq ccbq->devq_openings++; } -static __inline int -cam_ccbq_freeze(struct cam_ccbq *ccbq, cam_rl rl, u_int32_t cnt) -{ - int i, frozen = 0; - cam_rl p, n; - - /* Find pevious run level. */ - for (p = 0; p < CAM_RL_VALUES && ccbq->queue.qfrozen_cnt[p] == 0; p++); - /* Find new run level. */ - n = min(rl, p); - /* Apply new run level. */ - for (i = rl; i < CAM_RL_VALUES; i++) - ccbq->queue.qfrozen_cnt[i] += cnt; - /* Update ccbq statistics. */ - if (n == p) - return (0); - for (i = CAMQ_HEAD; i <= ccbq->queue.entries; i++) { - cam_rl rrl = - CAM_PRIORITY_TO_RL(ccbq->queue.queue_array[i]->priority); - if (rrl < n) - continue; - if (rrl >= p) - break; - ccbq->devq_openings++; - ccbq->held++; - frozen++; - } - return (frozen); -} - -static __inline int -cam_ccbq_release(struct cam_ccbq *ccbq, cam_rl rl, u_int32_t cnt) -{ - int i, released = 0; - cam_rl p, n; - - /* Apply new run level. */ - for (i = rl; i < CAM_RL_VALUES; i++) - ccbq->queue.qfrozen_cnt[i] -= cnt; - /* Find new run level. */ - for (n = 0; n < CAM_RL_VALUES && ccbq->queue.qfrozen_cnt[n] == 0; n++); - /* Find previous run level. */ - p = min(rl, n); - /* Update ccbq statistics. */ - if (n == p) - return (0); - for (i = CAMQ_HEAD; i <= ccbq->queue.entries; i++) { - cam_rl rrl = - CAM_PRIORITY_TO_RL(ccbq->queue.queue_array[i]->priority); - if (rrl < p) - continue; - if (rrl >= n) - break; - ccbq->devq_openings--; - ccbq->held--; - released++; - } - return (released); -} - -static __inline u_int32_t -cam_ccbq_frozen(struct cam_ccbq *ccbq, cam_rl rl) -{ - - return (ccbq->queue.qfrozen_cnt[rl]); -} - -static __inline u_int32_t -cam_ccbq_frozen_top(struct cam_ccbq *ccbq) -{ - cam_rl rl; - - rl = CAM_PRIORITY_TO_RL(CAMQ_GET_PRIO(&ccbq->queue)); - return (ccbq->queue.qfrozen_cnt[rl]); -} - #endif /* _KERNEL */ #endif /* _CAM_CAM_QUEUE_H */ Modified: stable/9/sys/cam/cam_xpt.c ============================================================================== --- stable/9/sys/cam/cam_xpt.c Wed Oct 9 18:48:10 2013 (r256215) +++ stable/9/sys/cam/cam_xpt.c Wed Oct 9 18:58:28 2013 (r256216) @@ -225,13 +225,13 @@ static void xpt_async_bcast(struct asyn static path_id_t xptnextfreepathid(void); static path_id_t xptpathid(const char *sim_name, int sim_unit, int sim_bus); static union ccb *xpt_get_ccb(struct cam_ed *device); -static void xpt_run_dev_allocq(struct cam_eb *bus); -static void xpt_run_dev_sendq(struct cam_eb *bus); +static void xpt_run_dev_allocq(struct cam_ed *device); +static void xpt_run_devq(struct cam_devq *devq); static timeout_t xpt_release_devq_timeout; static void xpt_release_simq_timeout(void *arg) __unused; static void xpt_release_bus(struct cam_eb *bus); -static void xpt_release_devq_device(struct cam_ed *dev, cam_rl rl, - u_int count, int run_queue); +static void xpt_release_devq_device(struct cam_ed *dev, u_int count, + int run_queue); static struct cam_et* xpt_alloc_target(struct cam_eb *bus, target_id_t target_id); static void xpt_release_target(struct cam_et *target); @@ -298,49 +298,24 @@ static xpt_busfunc_t xptsetasyncbusfunc; static cam_status xptregister(struct cam_periph *periph, void *arg); static __inline int periph_is_queued(struct cam_periph *periph); -static __inline int device_is_alloc_queued(struct cam_ed *device); -static __inline int device_is_send_queued(struct cam_ed *device); +static __inline int device_is_queued(struct cam_ed *device); static __inline int -xpt_schedule_dev_allocq(struct cam_eb *bus, struct cam_ed *dev) -{ - int retval; - - if ((dev->drvq.entries > 0) && - (dev->ccbq.devq_openings > 0) && - (cam_ccbq_frozen(&dev->ccbq, CAM_PRIORITY_TO_RL( - CAMQ_GET_PRIO(&dev->drvq))) == 0)) { - /* - * The priority of a device waiting for CCB resources - * is that of the highest priority peripheral driver - * enqueued. - */ - retval = xpt_schedule_dev(&bus->sim->devq->alloc_queue, - &dev->alloc_ccb_entry.pinfo, - CAMQ_GET_PRIO(&dev->drvq)); - } else { - retval = 0; - } - - return (retval); -} - -static __inline int -xpt_schedule_dev_sendq(struct cam_eb *bus, struct cam_ed *dev) +xpt_schedule_devq(struct cam_devq *devq, struct cam_ed *dev) { int retval; if ((dev->ccbq.queue.entries > 0) && (dev->ccbq.dev_openings > 0) && - (cam_ccbq_frozen_top(&dev->ccbq) == 0)) { + (dev->ccbq.queue.qfrozen_cnt == 0)) { /* * The priority of a device waiting for controller * resources is that of the highest priority CCB * enqueued. */ retval = - xpt_schedule_dev(&bus->sim->devq->send_queue, - &dev->send_ccb_entry.pinfo, + xpt_schedule_dev(&devq->send_queue, + &dev->devq_entry.pinfo, CAMQ_GET_PRIO(&dev->ccbq.queue)); } else { retval = 0; @@ -355,15 +330,9 @@ periph_is_queued(struct cam_periph *peri } static __inline int -device_is_alloc_queued(struct cam_ed *device) -{ - return (device->alloc_ccb_entry.pinfo.index != CAM_UNQUEUED_INDEX); -} - -static __inline int -device_is_send_queued(struct cam_ed *device) +device_is_queued(struct cam_ed *device) { - return (device->send_ccb_entry.pinfo.index != CAM_UNQUEUED_INDEX); + return (device->devq_entry.pinfo.index != CAM_UNQUEUED_INDEX); } static void @@ -2592,17 +2561,10 @@ xpt_action_default(union ccb *start_ccb) case XPT_RESET_DEV: case XPT_ENG_EXEC: case XPT_SMP_IO: - { - int frozen; - - frozen = cam_ccbq_insert_ccb(&path->device->ccbq, start_ccb); - path->device->sim->devq->alloc_openings += frozen; - if (frozen > 0) - xpt_run_dev_allocq(path->bus); - if (xpt_schedule_dev_sendq(path->bus, path->device)) - xpt_run_dev_sendq(path->bus); + cam_ccbq_insert_ccb(&path->device->ccbq, start_ccb); + if (xpt_schedule_devq(path->bus->sim->devq, path->device)) + xpt_run_devq(path->bus->sim->devq); break; - } case XPT_CALC_GEOMETRY: { struct cam_sim *sim; @@ -2651,8 +2613,7 @@ xpt_action_default(union ccb *start_ccb) device = abort_ccb->ccb_h.path->device; ccbq = &device->ccbq; - device->sim->devq->alloc_openings -= - cam_ccbq_remove_ccb(ccbq, abort_ccb); + cam_ccbq_remove_ccb(ccbq, abort_ccb); abort_ccb->ccb_h.status = CAM_REQ_ABORTED|CAM_DEV_QFRZN; xpt_freeze_devq(abort_ccb->ccb_h.path, 1); @@ -3033,13 +2994,9 @@ xpt_action_default(union ccb *start_ccb) } } - if ((start_ccb->ccb_h.flags & CAM_DEV_QFREEZE) == 0) { - xpt_release_devq_rl(path, /*runlevel*/ - (crs->release_flags & RELSIM_RELEASE_RUNLEVEL) ? - crs->release_timeout : 0, - /*count*/1, /*run_queue*/TRUE); - } - start_ccb->crs.qfrozen_cnt = dev->ccbq.queue.qfrozen_cnt[0]; + if ((start_ccb->ccb_h.flags & CAM_DEV_QFREEZE) == 0) + xpt_release_devq(path, /*count*/1, /*run_queue*/TRUE); + start_ccb->crs.qfrozen_cnt = dev->ccbq.queue.qfrozen_cnt; start_ccb->ccb_h.status = CAM_REQ_CMP; break; } @@ -3082,16 +3039,6 @@ xpt_action_default(union ccb *start_ccb) start_ccb->ccb_h.status = CAM_REQ_CMP; break; } - case XPT_FREEZE_QUEUE: - { - struct ccb_relsim *crs = &start_ccb->crs; - - xpt_freeze_devq_rl(path, /*runlevel*/ - (crs->release_flags & RELSIM_RELEASE_RUNLEVEL) ? - crs->release_timeout : 0, /*count*/1); - start_ccb->ccb_h.status = CAM_REQ_CMP; - break; - } case XPT_NOOP: if ((start_ccb->ccb_h.flags & CAM_DEV_QFREEZE) != 0) xpt_freeze_devq(path, 1); @@ -3197,7 +3144,7 @@ xpt_schedule(struct cam_periph *perph, u camq_change_priority(&device->drvq, perph->pinfo.index, new_priority); - runq = xpt_schedule_dev_allocq(perph->path->bus, device); + runq = 1; } } else { /* New entry on the queue */ @@ -3206,12 +3153,12 @@ xpt_schedule(struct cam_periph *perph, u perph->pinfo.priority = new_priority; perph->pinfo.generation = ++device->drvq.generation; camq_insert(&device->drvq, &perph->pinfo); - runq = xpt_schedule_dev_allocq(perph->path->bus, device); + runq = 1; } if (runq != 0) { CAM_DEBUG(perph->path, CAM_DEBUG_SUBTRACE, - (" calling xpt_run_devq\n")); - xpt_run_dev_allocq(perph->path->bus); + (" calling xpt_run_dev_allocq\n")); + xpt_run_dev_allocq(device); } } @@ -3264,43 +3211,25 @@ xpt_schedule_dev(struct camq *queue, cam } static void -xpt_run_dev_allocq(struct cam_eb *bus) +xpt_run_dev_allocq(struct cam_ed *device) { - struct cam_devq *devq; - - CAM_DEBUG_PRINT(CAM_DEBUG_XPT, ("xpt_run_dev_allocq\n")); - devq = bus->sim->devq; + struct camq *drvq; - CAM_DEBUG_PRINT(CAM_DEBUG_XPT, - (" qfrozen_cnt == 0x%x, entries == %d, " - "openings == %d, active == %d\n", - devq->alloc_queue.qfrozen_cnt[0], - devq->alloc_queue.entries, - devq->alloc_openings, - devq->alloc_active)); - - devq->alloc_queue.qfrozen_cnt[0]++; - while ((devq->alloc_queue.entries > 0) - && (devq->alloc_openings > 0) - && (devq->alloc_queue.qfrozen_cnt[0] <= 1)) { - struct cam_ed_qinfo *qinfo; - struct cam_ed *device; + if (device->ccbq.devq_allocating) + return; + device->ccbq.devq_allocating = 1; + CAM_DEBUG_PRINT(CAM_DEBUG_XPT, ("xpt_run_dev_allocq(%p)\n", device)); + drvq = &device->drvq; + while ((drvq->entries > 0) && + (device->ccbq.devq_openings > 0 || + CAMQ_GET_PRIO(drvq) <= CAM_PRIORITY_OOB) && + (device->ccbq.queue.qfrozen_cnt == 0)) { union ccb *work_ccb; struct cam_periph *drv; - struct camq *drvq; - qinfo = (struct cam_ed_qinfo *)camq_remove(&devq->alloc_queue, - CAMQ_HEAD); - device = qinfo->device; - CAM_DEBUG_PRINT(CAM_DEBUG_XPT, - ("running device %p\n", device)); - - drvq = &device->drvq; KASSERT(drvq->entries > 0, ("xpt_run_dev_allocq: " "Device on queue without any work to do")); if ((work_ccb = xpt_get_ccb(device)) != NULL) { - devq->alloc_openings--; - devq->alloc_active++; drv = (struct cam_periph*)camq_remove(drvq, CAMQ_HEAD); xpt_setup_ccb(&work_ccb->ccb_h, drv->path, drv->pinfo.priority); @@ -3319,27 +3248,21 @@ xpt_run_dev_allocq(struct cam_eb *bus) */ break; } - - /* We may have more work. Attempt to reschedule. */ - xpt_schedule_dev_allocq(bus, device); } - devq->alloc_queue.qfrozen_cnt[0]--; + device->ccbq.devq_allocating = 0; } static void -xpt_run_dev_sendq(struct cam_eb *bus) +xpt_run_devq(struct cam_devq *devq) { - struct cam_devq *devq; char cdb_str[(SCSI_MAX_CDBLEN * 3) + 1]; - CAM_DEBUG_PRINT(CAM_DEBUG_XPT, ("xpt_run_dev_sendq\n")); - - devq = bus->sim->devq; + CAM_DEBUG_PRINT(CAM_DEBUG_XPT, ("xpt_run_devq\n")); - devq->send_queue.qfrozen_cnt[0]++; + devq->send_queue.qfrozen_cnt++; while ((devq->send_queue.entries > 0) && (devq->send_openings > 0) - && (devq->send_queue.qfrozen_cnt[0] <= 1)) { + && (devq->send_queue.qfrozen_cnt <= 1)) { struct cam_ed_qinfo *qinfo; struct cam_ed *device; union ccb *work_ccb; @@ -3389,9 +3312,9 @@ xpt_run_dev_sendq(struct cam_eb *bus) devq->send_openings--; devq->send_active++; - xpt_schedule_dev_sendq(bus, device); + xpt_schedule_devq(devq, device); - if (work_ccb && (work_ccb->ccb_h.flags & CAM_DEV_QFREEZE) != 0){ + if ((work_ccb->ccb_h.flags & CAM_DEV_QFREEZE) != 0) { /* * The client wants to freeze the queue * after this CCB is sent. @@ -3441,7 +3364,7 @@ xpt_run_dev_sendq(struct cam_eb *bus) sim = work_ccb->ccb_h.path->bus->sim; (*(sim->sim_action))(sim, work_ccb); } - devq->send_queue.qfrozen_cnt[0]--; + devq->send_queue.qfrozen_cnt--; } /* @@ -3904,14 +3827,7 @@ xpt_release_ccb(union ccb *free_ccb) SLIST_INSERT_HEAD(&sim->ccb_freeq, &free_ccb->ccb_h, xpt_links.sle); } - if (sim->devq == NULL) { - return; - } - sim->devq->alloc_openings++; - sim->devq->alloc_active--; - if (device_is_alloc_queued(device) == 0) - xpt_schedule_dev_allocq(bus, device); - xpt_run_dev_allocq(bus); + xpt_run_dev_allocq(device); } /* Functions accessed by SIM drivers */ @@ -4266,34 +4182,18 @@ xpt_dev_async_default(u_int32_t async_co } u_int32_t -xpt_freeze_devq_rl(struct cam_path *path, cam_rl rl, u_int count) +xpt_freeze_devq(struct cam_path *path, u_int count) { struct cam_ed *dev = path->device; mtx_assert(path->bus->sim->mtx, MA_OWNED); - dev->sim->devq->alloc_openings += - cam_ccbq_freeze(&dev->ccbq, rl, count); - /* Remove frozen device from allocq. */ - if (device_is_alloc_queued(dev) && - cam_ccbq_frozen(&dev->ccbq, CAM_PRIORITY_TO_RL( - CAMQ_GET_PRIO(&dev->drvq)))) { - camq_remove(&dev->sim->devq->alloc_queue, - dev->alloc_ccb_entry.pinfo.index); - } + dev->ccbq.queue.qfrozen_cnt += count; /* Remove frozen device from sendq. */ - if (device_is_send_queued(dev) && - cam_ccbq_frozen_top(&dev->ccbq)) { + if (device_is_queued(dev)) { camq_remove(&dev->sim->devq->send_queue, - dev->send_ccb_entry.pinfo.index); + dev->devq_entry.pinfo.index); } - return (dev->ccbq.queue.qfrozen_cnt[rl]); -} - -u_int32_t -xpt_freeze_devq(struct cam_path *path, u_int count) -{ - - return (xpt_freeze_devq_rl(path, 0, count)); + return (dev->ccbq.queue.qfrozen_cnt); } u_int32_t @@ -4301,8 +4201,8 @@ xpt_freeze_simq(struct cam_sim *sim, u_i { mtx_assert(sim->mtx, MA_OWNED); - sim->devq->send_queue.qfrozen_cnt[0] += count; - return (sim->devq->send_queue.qfrozen_cnt[0]); + sim->devq->send_queue.qfrozen_cnt += count; + return (sim->devq->send_queue.qfrozen_cnt); } static void @@ -4311,45 +4211,30 @@ xpt_release_devq_timeout(void *arg) struct cam_ed *device; device = (struct cam_ed *)arg; - - xpt_release_devq_device(device, /*rl*/0, /*count*/1, /*run_queue*/TRUE); + xpt_release_devq_device(device, /*count*/1, /*run_queue*/TRUE); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-9@FreeBSD.ORG Wed Oct 9 19:03:00 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id B102D980; Wed, 9 Oct 2013 19:03:00 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 847322DBD; Wed, 9 Oct 2013 19:03:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r99J303q064030; Wed, 9 Oct 2013 19:03:00 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r99J2xc7064008; Wed, 9 Oct 2013 19:02:59 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201310091902.r99J2xc7064008@svn.freebsd.org> From: Alexander Motin Date: Wed, 9 Oct 2013 19:02:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256217 - in stable/9/sys: cam/ctl net netpfil/ipfw X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Oct 2013 19:03:00 -0000 Author: mav Date: Wed Oct 9 19:02:59 2013 New Revision: 256217 URL: http://svnweb.freebsd.org/changeset/base/256217 Log: MFC r250131 (by eadler): Correct a few sizeof()s Modified: stable/9/sys/cam/ctl/ctl_frontend_internal.c stable/9/sys/net/if_spppsubr.c stable/9/sys/netpfil/ipfw/ip_dummynet.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/net/ (props changed) Modified: stable/9/sys/cam/ctl/ctl_frontend_internal.c ============================================================================== --- stable/9/sys/cam/ctl/ctl_frontend_internal.c Wed Oct 9 18:58:28 2013 (r256216) +++ stable/9/sys/cam/ctl/ctl_frontend_internal.c Wed Oct 9 19:02:59 2013 (r256217) @@ -253,7 +253,7 @@ cfi_init(void) sizeof(struct cfi_lun_io), CTL_PORT_PRIV_SIZE); } - memset(softc, 0, sizeof(softc)); + memset(softc, 0, sizeof(*softc)); mtx_init(&softc->lock, "CTL frontend mutex", NULL, MTX_DEF); softc->flags |= CTL_FLAG_MASTER_SHELF; Modified: stable/9/sys/net/if_spppsubr.c ============================================================================== --- stable/9/sys/net/if_spppsubr.c Wed Oct 9 18:58:28 2013 (r256216) +++ stable/9/sys/net/if_spppsubr.c Wed Oct 9 19:02:59 2013 (r256217) @@ -3619,7 +3619,7 @@ sppp_ipv6cp_RCR(struct sppp *sp, struct continue; } - bzero(&suggestaddr, sizeof(&suggestaddr)); + bzero(&suggestaddr, sizeof(suggestaddr)); if (collision && nohisaddr) { /* collision, hisaddr unknown - Conf-Rej */ type = CONF_REJ; Modified: stable/9/sys/netpfil/ipfw/ip_dummynet.c ============================================================================== --- stable/9/sys/netpfil/ipfw/ip_dummynet.c Wed Oct 9 18:58:28 2013 (r256216) +++ stable/9/sys/netpfil/ipfw/ip_dummynet.c Wed Oct 9 19:02:59 2013 (r256217) @@ -617,7 +617,7 @@ fsk_detach(struct dn_fsk *fs, int flags) fs->sched->fp->free_fsk(fs); fs->sched = NULL; if (flags & DN_DELETE_FS) { - bzero(fs, sizeof(fs)); /* safety */ + bzero(fs, sizeof(*fs)); /* safety */ free(fs, M_DUMMYNET); dn_cfg.fsk_count--; } else { From owner-svn-src-stable-9@FreeBSD.ORG Wed Oct 9 19:04:52 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 7F6CBD05; Wed, 9 Oct 2013 19:04:52 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 5E5D92DDC; Wed, 9 Oct 2013 19:04:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r99J4q35065119; Wed, 9 Oct 2013 19:04:52 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r99J4muT065081; Wed, 9 Oct 2013 19:04:48 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201310091904.r99J4muT065081@svn.freebsd.org> From: Alexander Motin Date: Wed, 9 Oct 2013 19:04:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256219 - in stable/9/sys: cam/ctl cam/scsi dev/aic7xxx dev/cp dev/ctau dev/cx dev/hptmv dev/isci/scil dev/nsp dev/sfxge/common dev/sn dev/stg kern netgraph/bluetooth/l2cap ofed/drivers... X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Oct 2013 19:04:52 -0000 Author: mav Date: Wed Oct 9 19:04:48 2013 New Revision: 256219 URL: http://svnweb.freebsd.org/changeset/base/256219 Log: MFC r250460 (by eadler): Fix a bunch of typos. Modified: stable/9/sys/cam/ctl/scsi_ctl.c stable/9/sys/cam/scsi/scsi_da.c stable/9/sys/cam/scsi/scsi_pt.c stable/9/sys/dev/aic7xxx/aic7xxx.h stable/9/sys/dev/cp/if_cp.c stable/9/sys/dev/ctau/if_ct.c stable/9/sys/dev/cx/csigma.c stable/9/sys/dev/cx/if_cx.c stable/9/sys/dev/hptmv/entry.c stable/9/sys/dev/isci/scil/scif_sas_domain.c stable/9/sys/dev/nsp/nsp.c stable/9/sys/dev/sfxge/common/efx_mcdi.c stable/9/sys/dev/sn/if_sn.c stable/9/sys/dev/stg/tmc18c30.c stable/9/sys/kern/uipc_usrreq.c stable/9/sys/netgraph/bluetooth/l2cap/ng_l2cap_cmds.c stable/9/sys/ofed/drivers/net/mlx4/eq.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/cam/ctl/scsi_ctl.c ============================================================================== --- stable/9/sys/cam/ctl/scsi_ctl.c Wed Oct 9 19:04:40 2013 (r256218) +++ stable/9/sys/cam/ctl/scsi_ctl.c Wed Oct 9 19:04:48 2013 (r256219) @@ -2142,7 +2142,7 @@ ctlfe_dump_queue(struct ctlfe_lun_softc xpt_print(periph->path, "%d requests total waiting for CCBs\n", num_items); - xpt_print(periph->path, "%ju CCBs oustanding (%ju allocated, %ju " + xpt_print(periph->path, "%ju CCBs outstanding (%ju allocated, %ju " "freed)\n", (uintmax_t)(softc->ccbs_alloced - softc->ccbs_freed), (uintmax_t)softc->ccbs_alloced, (uintmax_t)softc->ccbs_freed); Modified: stable/9/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_da.c Wed Oct 9 19:04:40 2013 (r256218) +++ stable/9/sys/cam/scsi/scsi_da.c Wed Oct 9 19:04:48 2013 (r256219) @@ -2299,7 +2299,7 @@ skipstate: out: /* - * Block out any asyncronous callbacks + * Block out any asynchronous callbacks * while we touch the pending ccb list. */ LIST_INSERT_HEAD(&softc->pending_ccbs, @@ -2961,7 +2961,7 @@ dadone(struct cam_periph *periph, union } /* - * Block out any asyncronous callbacks + * Block out any asynchronous callbacks * while we touch the pending ccb list. */ LIST_REMOVE(&done_ccb->ccb_h, periph_links.le); Modified: stable/9/sys/cam/scsi/scsi_pt.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_pt.c Wed Oct 9 19:04:40 2013 (r256218) +++ stable/9/sys/cam/scsi/scsi_pt.c Wed Oct 9 19:04:48 2013 (r256219) @@ -455,7 +455,7 @@ ptstart(struct cam_periph *periph, union start_ccb->ccb_h.ccb_state = PT_CCB_BUFFER_IO_UA; /* - * Block out any asyncronous callbacks + * Block out any asynchronous callbacks * while we touch the pending ccb list. */ LIST_INSERT_HEAD(&softc->pending_ccbs, &start_ccb->ccb_h, @@ -549,7 +549,7 @@ ptdone(struct cam_periph *periph, union } /* - * Block out any asyncronous callbacks + * Block out any asynchronous callbacks * while we touch the pending ccb list. */ LIST_REMOVE(&done_ccb->ccb_h, periph_links.le); Modified: stable/9/sys/dev/aic7xxx/aic7xxx.h ============================================================================== --- stable/9/sys/dev/aic7xxx/aic7xxx.h Wed Oct 9 19:04:40 2013 (r256218) +++ stable/9/sys/dev/aic7xxx/aic7xxx.h Wed Oct 9 19:04:48 2013 (r256219) @@ -768,7 +768,7 @@ struct ahc_syncrate { #define AHC_ULTRA2_XFER_PERIOD 0x0a /* - * Indexes into our table of syncronous transfer rates. + * Indexes into our table of synchronous transfer rates. */ #define AHC_SYNCRATE_DT 0 #define AHC_SYNCRATE_ULTRA2 1 Modified: stable/9/sys/dev/cp/if_cp.c ============================================================================== --- stable/9/sys/dev/cp/if_cp.c Wed Oct 9 19:04:40 2013 (r256218) +++ stable/9/sys/dev/cp/if_cp.c Wed Oct 9 19:04:48 2013 (r256219) @@ -1,7 +1,7 @@ /*- * Cronyx-Tau-PCI adapter driver for FreeBSD. * Supports PPP/HDLC, Cisco/HDLC and FrameRelay protocol in synchronous mode, - * and asyncronous channels with full modem control. + * and asynchronous channels with full modem control. * Keepalive protocol implemented in both Cisco and PPP modes. * * Copyright (C) 1999-2004 Cronyx Engineering. Modified: stable/9/sys/dev/ctau/if_ct.c ============================================================================== --- stable/9/sys/dev/ctau/if_ct.c Wed Oct 9 19:04:40 2013 (r256218) +++ stable/9/sys/dev/ctau/if_ct.c Wed Oct 9 19:04:48 2013 (r256219) @@ -1,7 +1,7 @@ /*- * Cronyx-Tau adapter driver for FreeBSD. * Supports PPP/HDLC and Cisco/HDLC protocol in synchronous mode, - * and asyncronous channels with full modem control. + * and asynchronous channels with full modem control. * Keepalive protocol implemented in both Cisco and PPP modes. * * Copyright (C) 1994-2002 Cronyx Engineering. Modified: stable/9/sys/dev/cx/csigma.c ============================================================================== --- stable/9/sys/dev/cx/csigma.c Wed Oct 9 19:04:40 2013 (r256218) +++ stable/9/sys/dev/cx/csigma.c Wed Oct 9 19:04:48 2013 (r256219) @@ -1168,7 +1168,7 @@ void cx_set_dtr (cx_chan_t *c, int on) switch (c->num) { default: - /* Channels 4..7 and 12..15 in syncronous mode + /* Channels 4..7 and 12..15 in synchronous mode * have no DTR signal. */ break; Modified: stable/9/sys/dev/cx/if_cx.c ============================================================================== --- stable/9/sys/dev/cx/if_cx.c Wed Oct 9 19:04:40 2013 (r256218) +++ stable/9/sys/dev/cx/if_cx.c Wed Oct 9 19:04:48 2013 (r256219) @@ -1,7 +1,7 @@ /*- * Cronyx-Sigma adapter driver for FreeBSD. * Supports PPP/HDLC and Cisco/HDLC protocol in synchronous mode, - * and asyncronous channels with full modem control. + * and asynchronous channels with full modem control. * Keepalive protocol implemented in both Cisco and PPP modes. * * Copyright (C) 1994-2002 Cronyx Engineering. Modified: stable/9/sys/dev/hptmv/entry.c ============================================================================== --- stable/9/sys/dev/hptmv/entry.c Wed Oct 9 19:04:40 2013 (r256218) +++ stable/9/sys/dev/hptmv/entry.c Wed Oct 9 19:04:48 2013 (r256219) @@ -914,8 +914,8 @@ hptmv_event_notify(MV_SATA_ADAPTER *pMvS else { - MV_ERROR("RR18xx: illigal value for param1(%d) at " - "connect/disconect event, host=%d\n", param1, + MV_ERROR("RR18xx: illegal value for param1(%d) at " + "connect/disconnect event, host=%d\n", param1, pMvSataAdapter->adapterId ); } @@ -983,7 +983,7 @@ hptmv_allocate_edma_queues(IAL_ADAPTER_T if ((pAdapter->responsesArrayBaseDmaAlignedAddr - pAdapter->responsesArrayBaseDmaAddr) != (pAdapter->responsesArrayBaseAlignedAddr - pAdapter->responsesArrayBaseAddr)) { - MV_ERROR("RR18xx[%d]: Error in Response Quueues Alignment\n", + MV_ERROR("RR18xx[%d]: Error in Response Queues Alignment\n", pAdapter->mvSataAdapter.adapterId); contigfree(pAdapter->requestsArrayBaseAddr, REQUESTS_ARRAY_SIZE, M_DEVBUF); contigfree(pAdapter->responsesArrayBaseAddr, RESPONSES_ARRAY_SIZE, M_DEVBUF); Modified: stable/9/sys/dev/isci/scil/scif_sas_domain.c ============================================================================== --- stable/9/sys/dev/isci/scil/scif_sas_domain.c Wed Oct 9 19:04:40 2013 (r256218) +++ stable/9/sys/dev/isci/scil/scif_sas_domain.c Wed Oct 9 19:04:48 2013 (r256219) @@ -637,7 +637,7 @@ void scif_sas_domain_terminate_requests( SCIF_SAS_REQUEST_T * request = NULL; // Cycle through the fast list of IO requests. Terminate each - // oustanding requests that matches the criteria supplied by the + // outstanding requests that matches the criteria supplied by the // caller. while (element != NULL) { @@ -1275,7 +1275,7 @@ U8 scif_sas_domain_get_smp_request_count SCIC_TRANSPORT_PROTOCOL protocol; // Cycle through the fast list of IO requests. Terminate each - // oustanding requests that matches the criteria supplied by the + // outstanding requests that matches the criteria supplied by the // caller. while (element != NULL) { Modified: stable/9/sys/dev/nsp/nsp.c ============================================================================== --- stable/9/sys/dev/nsp/nsp.c Wed Oct 9 19:04:40 2013 (r256218) +++ stable/9/sys/dev/nsp/nsp.c Wed Oct 9 19:04:48 2013 (r256219) @@ -88,7 +88,7 @@ __FBSDID("$FreeBSD$"); ***************************************************/ /* DEVICE CONFIGURATION FLAGS (MINOR) * - * 0x01 DISCONECT OFF + * 0x01 DISCONNECT OFF * 0x02 PARITY LINE OFF * 0x04 IDENTIFY MSG OFF ( = single lun) * 0x08 SYNC TRANSFER OFF Modified: stable/9/sys/dev/sfxge/common/efx_mcdi.c ============================================================================== --- stable/9/sys/dev/sfxge/common/efx_mcdi.c Wed Oct 9 19:04:40 2013 (r256218) +++ stable/9/sys/dev/sfxge/common/efx_mcdi.c Wed Oct 9 19:04:48 2013 (r256219) @@ -86,7 +86,7 @@ efx_mcdi_request_start( /* * efx_mcdi_request_start() is naturally serialised against both * efx_mcdi_request_poll() and efx_mcdi_ev_cpl()/efx_mcdi_ev_death(), - * by virtue of there only being one oustanding MCDI request. + * by virtue of there only being one outstanding MCDI request. * Unfortunately, upper layers may also call efx_mcdi_request_abort() * at any time, to timeout a pending mcdi request, That request may * then subsequently complete, meaning efx_mcdi_ev_cpl() or @@ -439,7 +439,7 @@ efx_mcdi_ev_death( * The MCDI request (if there is one) has been terminated, either * by a BADASSERT or REBOOT event. * - * If there is an oustanding event-completed MCDI operation, then we + * If there is an outstanding event-completed MCDI operation, then we * will never receive the completion event (because both MCDI * completions and BADASSERT events are sent to the same evq). So * complete this MCDI op. Modified: stable/9/sys/dev/sn/if_sn.c ============================================================================== --- stable/9/sys/dev/sn/if_sn.c Wed Oct 9 19:04:40 2013 (r256218) +++ stable/9/sys/dev/sn/if_sn.c Wed Oct 9 19:04:48 2013 (r256219) @@ -444,7 +444,7 @@ startagain: /* * Wait a short amount of time to see if the allocation request * completes. Otherwise, I enable the interrupt and wait for - * completion asyncronously. + * completion asynchronously. */ time_out = MEMORY_WAIT_TIME; Modified: stable/9/sys/dev/stg/tmc18c30.c ============================================================================== --- stable/9/sys/dev/stg/tmc18c30.c Wed Oct 9 19:04:40 2013 (r256218) +++ stable/9/sys/dev/stg/tmc18c30.c Wed Oct 9 19:04:48 2013 (r256219) @@ -87,7 +87,7 @@ __FBSDID("$FreeBSD$"); ***************************************************/ /* DEVICE CONFIGURATION FLAGS (MINOR) * - * 0x01 DISCONECT OFF + * 0x01 DISCONNECT OFF * 0x02 PARITY LINE OFF * 0x04 IDENTIFY MSG OFF ( = single lun) * 0x08 SYNC TRANSFER OFF Modified: stable/9/sys/kern/uipc_usrreq.c ============================================================================== --- stable/9/sys/kern/uipc_usrreq.c Wed Oct 9 19:04:40 2013 (r256218) +++ stable/9/sys/kern/uipc_usrreq.c Wed Oct 9 19:04:48 2013 (r256219) @@ -1342,7 +1342,7 @@ unp_connect(struct socket *so, struct so } /* - * The connecter's (client's) credentials are copied from its + * The connector's (client's) credentials are copied from its * process structure at the time of connect() (which is now). */ cru2x(td->td_ucred, &unp3->unp_peercred); Modified: stable/9/sys/netgraph/bluetooth/l2cap/ng_l2cap_cmds.c ============================================================================== --- stable/9/sys/netgraph/bluetooth/l2cap/ng_l2cap_cmds.c Wed Oct 9 19:04:40 2013 (r256218) +++ stable/9/sys/netgraph/bluetooth/l2cap/ng_l2cap_cmds.c Wed Oct 9 19:04:48 2013 (r256219) @@ -306,7 +306,7 @@ ng_l2cap_con_fail(ng_l2cap_con_p con, u_ /* * There still might be channels (in OPEN state?) that - * did not submit any commands, so diconnect them + * did not submit any commands, so disconnect them */ LIST_FOREACH(ch, &l2cap->chan_list, next) Modified: stable/9/sys/ofed/drivers/net/mlx4/eq.c ============================================================================== --- stable/9/sys/ofed/drivers/net/mlx4/eq.c Wed Oct 9 19:04:40 2013 (r256218) +++ stable/9/sys/ofed/drivers/net/mlx4/eq.c Wed Oct 9 19:04:48 2013 (r256219) @@ -705,7 +705,7 @@ int mlx4_test_interrupts(struct mlx4_dev /* Temporary use polling for command completions */ mlx4_cmd_use_polling(dev); - /* Map the new eq to handle all asyncronous events */ + /* Map the new eq to handle all asynchronous events */ err = mlx4_MAP_EQ(dev, MLX4_ASYNC_EVENT_MASK, 0, priv->eq_table.eq[i].eqn); if (err) { From owner-svn-src-stable-9@FreeBSD.ORG Wed Oct 9 19:16:55 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 99AC4117; Wed, 9 Oct 2013 19:16:55 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 863002E96; Wed, 9 Oct 2013 19:16:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r99JGtAs070835; Wed, 9 Oct 2013 19:16:55 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r99JGs7r070816; Wed, 9 Oct 2013 19:16:54 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201310091916.r99JGs7r070816@svn.freebsd.org> From: Alexander Motin Date: Wed, 9 Oct 2013 19:16:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256220 - stable/9/sys/cam X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Oct 2013 19:16:55 -0000 Author: mav Date: Wed Oct 9 19:16:54 2013 New Revision: 256220 URL: http://svnweb.freebsd.org/changeset/base/256220 Log: MFC r253958: Change CCB queue resize logic to be able safely handle overallocations: - (re)allocate queue space in power of 2 chunks with 64 elements minimum and never shrink it; with only 4/8 bytes per element size is insignificant. - automatically reallocate the queue to double size if it is overflowed. - if queue reallocation failed, store extra CCBs in unsorted TAILQ, fetching them back as soon as some queue element is freed. To free space in CCB for TAILQ linking, change highpowerq from keeping high-power CCBs to keeping devices frozen due to high-power CCBs. This encloses all pieces of queue resize logic inside of cam_queue.[ch], removing some not obvious duties from xpt_release_ccb(). Modified: stable/9/sys/cam/cam.h stable/9/sys/cam/cam_queue.c stable/9/sys/cam/cam_queue.h stable/9/sys/cam/cam_xpt.c stable/9/sys/cam/cam_xpt_internal.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/cam.h ============================================================================== --- stable/9/sys/cam/cam.h Wed Oct 9 19:04:48 2013 (r256219) +++ stable/9/sys/cam/cam.h Wed Oct 9 19:16:54 2013 (r256220) @@ -88,6 +88,7 @@ typedef struct { #define CAM_UNQUEUED_INDEX -1 #define CAM_ACTIVE_INDEX -2 #define CAM_DONEQ_INDEX -3 +#define CAM_EXTRAQ_INDEX INT_MAX } cam_pinfo; /* Modified: stable/9/sys/cam/cam_queue.c ============================================================================== --- stable/9/sys/cam/cam_queue.c Wed Oct 9 19:04:48 2013 (r256219) +++ stable/9/sys/cam/cam_queue.c Wed Oct 9 19:16:54 2013 (r256220) @@ -284,39 +284,24 @@ u_int32_t cam_ccbq_resize(struct cam_ccbq *ccbq, int new_size) { int delta; - int space_left; delta = new_size - (ccbq->dev_active + ccbq->dev_openings); - space_left = new_size - - ccbq->queue.entries - - ccbq->held - - ccbq->dev_active; - - /* - * Only attempt to change the underlying queue size if we are - * shrinking it and there is space for all outstanding entries - * in the new array or we have been requested to grow the array. - * We don't fail in the case where we can't reduce the array size, - * but clients that care that the queue be "garbage collected" - * should detect this condition and call us again with the - * same size once the outstanding entries have been processed. - */ - if (space_left < 0 - || camq_resize(&ccbq->queue, new_size + (CAM_RL_VALUES - 1)) == - CAM_REQ_CMP) { - ccbq->devq_openings += delta; - ccbq->dev_openings += delta; + ccbq->devq_openings += delta; + ccbq->dev_openings += delta; + + new_size = imax(64, 1 << fls(new_size + new_size / 2)); + if (new_size > ccbq->queue.array_size) + return (camq_resize(&ccbq->queue, new_size)); + else return (CAM_REQ_CMP); - } else { - return (CAM_RESRC_UNAVAIL); - } } int cam_ccbq_init(struct cam_ccbq *ccbq, int openings) { bzero(ccbq, sizeof(*ccbq)); - if (camq_init(&ccbq->queue, openings + (CAM_RL_VALUES - 1)) != 0) + if (camq_init(&ccbq->queue, + imax(64, 1 << fls(openings + openings / 2))) != 0) return (1); ccbq->devq_openings = openings; ccbq->dev_openings = openings; Modified: stable/9/sys/cam/cam_queue.h ============================================================================== --- stable/9/sys/cam/cam_queue.h Wed Oct 9 19:04:48 2013 (r256219) +++ stable/9/sys/cam/cam_queue.h Wed Oct 9 19:16:54 2013 (r256220) @@ -57,6 +57,8 @@ SLIST_HEAD(ccb_hdr_slist, ccb_hdr); struct cam_ccbq { struct camq queue; + struct ccb_hdr_tailq queue_extra_head; + int queue_extra_entries; int devq_openings; int devq_allocating; int dev_openings; @@ -177,7 +179,7 @@ cam_ccbq_release_opening(struct cam_ccbq static __inline int cam_ccbq_pending_ccb_count(struct cam_ccbq *ccbq) { - return (ccbq->queue.entries); + return (ccbq->queue.entries + ccbq->queue_extra_entries); } static __inline void @@ -190,14 +192,61 @@ cam_ccbq_take_opening(struct cam_ccbq *c static __inline void cam_ccbq_insert_ccb(struct cam_ccbq *ccbq, union ccb *new_ccb) { + struct ccb_hdr *old_ccb; + struct camq *queue = &ccbq->queue; + ccbq->held--; - camq_insert(&ccbq->queue, &new_ccb->ccb_h.pinfo); + + /* + * If queue is already full, try to resize. + * If resize fail, push CCB with lowest priority out to the TAILQ. + */ + if (queue->entries == queue->array_size && + camq_resize(&ccbq->queue, queue->array_size * 2) != CAM_REQ_CMP) { + old_ccb = (struct ccb_hdr *)camq_remove(queue, queue->entries); + TAILQ_INSERT_HEAD(&ccbq->queue_extra_head, old_ccb, + xpt_links.tqe); + old_ccb->pinfo.index = CAM_EXTRAQ_INDEX; + ccbq->queue_extra_entries++; + } + + camq_insert(queue, &new_ccb->ccb_h.pinfo); } static __inline void cam_ccbq_remove_ccb(struct cam_ccbq *ccbq, union ccb *ccb) { - camq_remove(&ccbq->queue, ccb->ccb_h.pinfo.index); + struct ccb_hdr *cccb, *bccb; + struct camq *queue = &ccbq->queue; + + /* If the CCB is on the TAILQ, remove it from there. */ + if (ccb->ccb_h.pinfo.index == CAM_EXTRAQ_INDEX) { + TAILQ_REMOVE(&ccbq->queue_extra_head, &ccb->ccb_h, + xpt_links.tqe); + ccb->ccb_h.pinfo.index = CAM_UNQUEUED_INDEX; + ccbq->queue_extra_entries--; + return; + } + + camq_remove(queue, ccb->ccb_h.pinfo.index); + + /* + * If there are some CCBs on TAILQ, find the best one and move it + * to the emptied space in the queue. + */ + bccb = TAILQ_FIRST(&ccbq->queue_extra_head); + if (bccb == NULL) + return; + TAILQ_FOREACH(cccb, &ccbq->queue_extra_head, xpt_links.tqe) { + if (bccb->pinfo.priority > cccb->pinfo.priority || + (bccb->pinfo.priority == cccb->pinfo.priority && + GENERATIONCMP(bccb->pinfo.generation, >, + cccb->pinfo.generation))) + bccb = cccb; + } + TAILQ_REMOVE(&ccbq->queue_extra_head, bccb, xpt_links.tqe); + ccbq->queue_extra_entries--; + camq_insert(queue, &bccb->pinfo); } static __inline union ccb * Modified: stable/9/sys/cam/cam_xpt.c ============================================================================== --- stable/9/sys/cam/cam_xpt.c Wed Oct 9 19:04:48 2013 (r256219) +++ stable/9/sys/cam/cam_xpt.c Wed Oct 9 19:16:54 2013 (r256220) @@ -99,7 +99,7 @@ struct xpt_softc { u_int32_t xpt_generation; /* number of high powered commands that can go through right now */ - STAILQ_HEAD(highpowerlist, ccb_hdr) highpowerq; + STAILQ_HEAD(highpowerlist, cam_ed) highpowerq; int num_highpower; /* queue for handling async rescan requests. */ @@ -2721,7 +2721,7 @@ xpt_action_default(union ccb *start_ccb) cgds->dev_openings = dev->ccbq.dev_openings; cgds->dev_active = dev->ccbq.dev_active; cgds->devq_openings = dev->ccbq.devq_openings; - cgds->devq_queued = dev->ccbq.queue.entries; + cgds->devq_queued = cam_ccbq_pending_ccb_count(&dev->ccbq); cgds->held = dev->ccbq.held; cgds->last_reset = tar->last_reset; cgds->maxtags = dev->maxtags; @@ -3292,8 +3292,8 @@ xpt_run_devq(struct cam_devq *devq) */ xpt_freeze_devq(work_ccb->ccb_h.path, 1); STAILQ_INSERT_TAIL(&xsoftc.highpowerq, - &work_ccb->ccb_h, - xpt_links.stqe); + work_ccb->ccb_h.path->device, + highpowerq_entry); mtx_unlock(&xsoftc.xpt_lock); continue; @@ -3815,11 +3815,6 @@ xpt_release_ccb(union ccb *free_ccb) mtx_assert(sim->mtx, MA_OWNED); cam_ccbq_release_opening(&device->ccbq); - if (device->flags & CAM_DEV_RESIZE_QUEUE_NEEDED) { - device->flags &= ~CAM_DEV_RESIZE_QUEUE_NEEDED; - cam_ccbq_resize(&device->ccbq, - device->ccbq.dev_openings + device->ccbq.dev_active); - } if (sim->ccb_count > sim->max_ccbs) { xpt_free_ccb(free_ccb); sim->ccb_count--; @@ -4619,9 +4614,6 @@ xpt_dev_ccbq_resize(struct cam_path *pat diff = newopenings - (dev->ccbq.dev_active + dev->ccbq.dev_openings); result = cam_ccbq_resize(&dev->ccbq, newopenings); - if (result == CAM_REQ_CMP && (diff < 0)) { - dev->flags |= CAM_DEV_RESIZE_QUEUE_NEEDED; - } if ((dev->flags & CAM_DEV_TAG_AFTER_COUNT) != 0 || (dev->inq_flags & SID_CmdQue) != 0) dev->tag_saved_openings = newopenings; @@ -5003,12 +4995,12 @@ camisr_runqueue(void *V_queue) if (ccb_h->flags & CAM_HIGH_POWER) { struct highpowerlist *hphead; - union ccb *send_ccb; + struct cam_ed *device; mtx_lock(&xsoftc.xpt_lock); hphead = &xsoftc.highpowerq; - send_ccb = (union ccb *)STAILQ_FIRST(hphead); + device = STAILQ_FIRST(hphead); /* * Increment the count since this command is done. @@ -5018,12 +5010,12 @@ camisr_runqueue(void *V_queue) /* * Any high powered commands queued up? */ - if (send_ccb != NULL) { + if (device != NULL) { - STAILQ_REMOVE_HEAD(hphead, xpt_links.stqe); + STAILQ_REMOVE_HEAD(hphead, highpowerq_entry); mtx_unlock(&xsoftc.xpt_lock); - xpt_release_devq(send_ccb->ccb_h.path, + xpt_release_devq_device(device, /*count*/1, /*runqueue*/TRUE); } else mtx_unlock(&xsoftc.xpt_lock); Modified: stable/9/sys/cam/cam_xpt_internal.h ============================================================================== --- stable/9/sys/cam/cam_xpt_internal.h Wed Oct 9 19:04:48 2013 (r256219) +++ stable/9/sys/cam/cam_xpt_internal.h Wed Oct 9 19:16:54 2013 (r256220) @@ -115,7 +115,6 @@ struct cam_ed { #define CAM_DEV_REL_TIMEOUT_PENDING 0x02 #define CAM_DEV_REL_ON_COMPLETE 0x04 #define CAM_DEV_REL_ON_QUEUE_EMPTY 0x08 -#define CAM_DEV_RESIZE_QUEUE_NEEDED 0x10 #define CAM_DEV_TAG_AFTER_COUNT 0x20 #define CAM_DEV_INQUIRY_DATA_VALID 0x40 #define CAM_DEV_IN_DV 0x80 @@ -126,6 +125,7 @@ struct cam_ed { u_int32_t tag_saved_openings; u_int32_t refcount; struct callout callout; + STAILQ_ENTRY(cam_ed) highpowerq_entry; }; /* From owner-svn-src-stable-9@FreeBSD.ORG Wed Oct 9 19:18:35 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id B3C3526C; Wed, 9 Oct 2013 19:18:35 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A07CF2EA1; Wed, 9 Oct 2013 19:18:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r99JIZYh071323; Wed, 9 Oct 2013 19:18:35 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r99JIZCd071322; Wed, 9 Oct 2013 19:18:35 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201310091918.r99JIZCd071322@svn.freebsd.org> From: Alexander Motin Date: Wed, 9 Oct 2013 19:18:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256221 - stable/9/sys/cam X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Oct 2013 19:18:35 -0000 Author: mav Date: Wed Oct 9 19:18:35 2013 New Revision: 256221 URL: http://svnweb.freebsd.org/changeset/base/256221 Log: MFC r253960: Pass SIM pointer as an argument to camisr_runqueue() instead of doneq pointer. Modified: stable/9/sys/cam/cam_xpt.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/cam_xpt.c ============================================================================== --- stable/9/sys/cam/cam_xpt.c Wed Oct 9 19:16:54 2013 (r256220) +++ stable/9/sys/cam/cam_xpt.c Wed Oct 9 19:18:35 2013 (r256221) @@ -246,7 +246,7 @@ static xpt_devicefunc_t xptpassannouncef static void xptaction(struct cam_sim *sim, union ccb *work_ccb); static void xptpoll(struct cam_sim *sim); static void camisr(void *); -static void camisr_runqueue(void *); +static void camisr_runqueue(struct cam_sim *); static dev_match_ret xptbusmatch(struct dev_match_pattern *patterns, u_int num_patterns, struct cam_eb *bus); static dev_match_ret xptdevicematch(struct dev_match_pattern *patterns, @@ -3089,7 +3089,7 @@ xpt_polled_action(union ccb *start_ccb) dev->ccbq.dev_openings < 0) && (--timeout > 0)) { DELAY(100); (*(sim->sim_poll))(sim); - camisr_runqueue(&sim->sim_doneq); + camisr_runqueue(sim); } dev->ccbq.devq_openings++; @@ -3099,7 +3099,7 @@ xpt_polled_action(union ccb *start_ccb) xpt_action(start_ccb); while(--timeout > 0) { (*(sim->sim_poll))(sim); - camisr_runqueue(&sim->sim_doneq); + camisr_runqueue(sim); if ((start_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_INPROG) break; @@ -4346,7 +4346,7 @@ xpt_batch_done(struct cam_sim *sim) sim->flags &= ~CAM_SIM_BATCH; if (!TAILQ_EMPTY(&sim->sim_doneq) && (sim->flags & CAM_SIM_ON_DONEQ) == 0) - camisr_runqueue(&sim->sim_doneq); + camisr_runqueue(sim); } union ccb * @@ -4967,7 +4967,7 @@ camisr(void *dummy) while ((sim = TAILQ_FIRST(&queue)) != NULL) { TAILQ_REMOVE(&queue, sim, links); CAM_SIM_LOCK(sim); - camisr_runqueue(&sim->sim_doneq); + camisr_runqueue(sim); sim->flags &= ~CAM_SIM_ON_DONEQ; CAM_SIM_UNLOCK(sim); } @@ -4977,15 +4977,14 @@ camisr(void *dummy) } static void -camisr_runqueue(void *V_queue) +camisr_runqueue(struct cam_sim *sim) { - cam_isrq_t *queue = V_queue; struct ccb_hdr *ccb_h; - while ((ccb_h = TAILQ_FIRST(queue)) != NULL) { + while ((ccb_h = TAILQ_FIRST(&sim->sim_doneq)) != NULL) { int runq; - TAILQ_REMOVE(queue, ccb_h, sim_links.tqe); + TAILQ_REMOVE(&sim->sim_doneq, ccb_h, sim_links.tqe); ccb_h->pinfo.index = CAM_UNQUEUED_INDEX; CAM_DEBUG(ccb_h->path, CAM_DEBUG_TRACE, @@ -5027,8 +5026,8 @@ camisr_runqueue(void *V_queue) dev = ccb_h->path->device; cam_ccbq_ccb_done(&dev->ccbq, (union ccb *)ccb_h); - ccb_h->path->bus->sim->devq->send_active--; - ccb_h->path->bus->sim->devq->send_openings++; + sim->devq->send_active--; + sim->devq->send_openings++; runq = TRUE; if (((dev->flags & CAM_DEV_REL_ON_QUEUE_EMPTY) != 0 @@ -5049,14 +5048,12 @@ camisr_runqueue(void *V_queue) && (--dev->tag_delay_count == 0)) xpt_start_tags(ccb_h->path); if (!device_is_queued(dev)) { - (void)xpt_schedule_devq( - ccb_h->path->bus->sim->devq, dev); + (void)xpt_schedule_devq(sim->devq, dev); } } if (ccb_h->status & CAM_RELEASE_SIMQ) { - xpt_release_simq(ccb_h->path->bus->sim, - /*run_queue*/TRUE); + xpt_release_simq(sim, /*run_queue*/TRUE); ccb_h->status &= ~CAM_RELEASE_SIMQ; runq = FALSE; } @@ -5067,7 +5064,7 @@ camisr_runqueue(void *V_queue) /*run_queue*/TRUE); ccb_h->status &= ~CAM_DEV_QFRZN; } else if (runq) { - xpt_run_devq(ccb_h->path->bus->sim->devq); + xpt_run_devq(sim->devq); } /* Call the peripheral driver's callback */ From owner-svn-src-stable-9@FreeBSD.ORG Wed Oct 9 19:19:54 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id C302C459; Wed, 9 Oct 2013 19:19:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B077D2EB4; Wed, 9 Oct 2013 19:19:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r99JJsRP071782; Wed, 9 Oct 2013 19:19:54 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r99JJspE071780; Wed, 9 Oct 2013 19:19:54 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201310091919.r99JJspE071780@svn.freebsd.org> From: Alexander Motin Date: Wed, 9 Oct 2013 19:19:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256222 - stable/9/sys/cam/ctl X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Oct 2013 19:19:54 -0000 Author: mav Date: Wed Oct 9 19:19:53 2013 New Revision: 256222 URL: http://svnweb.freebsd.org/changeset/base/256222 Log: MFC r253987 (by trasz): Remove dead code. Modified: stable/9/sys/cam/ctl/ctl.c stable/9/sys/cam/ctl/ctl_frontend_internal.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/ctl/ctl.c ============================================================================== --- stable/9/sys/cam/ctl/ctl.c Wed Oct 9 19:18:35 2013 (r256221) +++ stable/9/sys/cam/ctl/ctl.c Wed Oct 9 19:19:53 2013 (r256222) @@ -8950,17 +8950,7 @@ ctl_inquiry_evpd_supported(struct ctl_sc sup_page_size = sizeof(struct scsi_vpd_supported_pages) + SCSI_EVPD_NUM_SUPPORTED_PAGES; - /* - * XXX KDM GFP_??? We probably don't want to wait here, - * unless we end up having a process/thread context. - */ ctsio->kern_data_ptr = malloc(sup_page_size, M_CTL, M_WAITOK | M_ZERO); - if (ctsio->kern_data_ptr == NULL) { - ctsio->io_hdr.status = CTL_SCSI_ERROR; - ctsio->scsi_status = SCSI_STATUS_BUSY; - ctl_done((union ctl_io *)ctsio); - return (CTL_RETVAL_COMPLETE); - } pages = (struct scsi_vpd_supported_pages *)ctsio->kern_data_ptr; ctsio->kern_sg_entries = 0; @@ -9015,14 +9005,7 @@ ctl_inquiry_evpd_serial(struct ctl_scsii lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - /* XXX KDM which malloc flags here?? */ ctsio->kern_data_ptr = malloc(sizeof(*sn_ptr), M_CTL, M_WAITOK | M_ZERO); - if (ctsio->kern_data_ptr == NULL) { - ctsio->io_hdr.status = CTL_SCSI_ERROR; - ctsio->scsi_status = SCSI_STATUS_BUSY; - ctl_done((union ctl_io *)ctsio); - return (CTL_RETVAL_COMPLETE); - } sn_ptr = (struct scsi_vpd_unit_serial_number *)ctsio->kern_data_ptr; ctsio->kern_sg_entries = 0; @@ -9107,14 +9090,7 @@ ctl_inquiry_evpd_devid(struct ctl_scsiio sizeof(struct scsi_vpd_id_descriptor) + sizeof(struct scsi_vpd_id_trgt_port_grp_id); - /* XXX KDM which malloc flags here ?? */ ctsio->kern_data_ptr = malloc(devid_len, M_CTL, M_WAITOK | M_ZERO); - if (ctsio->kern_data_ptr == NULL) { - ctsio->io_hdr.status = CTL_SCSI_ERROR; - ctsio->scsi_status = SCSI_STATUS_BUSY; - ctl_done((union ctl_io *)ctsio); - return (CTL_RETVAL_COMPLETE); - } devid_ptr = (struct scsi_vpd_device_id *)ctsio->kern_data_ptr; ctsio->kern_sg_entries = 0; @@ -9337,14 +9313,7 @@ ctl_inquiry_std(struct ctl_scsiio *ctsio * in. If the user only asks for less, we'll give him * that much. */ - /* XXX KDM what malloc flags should we use here?? */ ctsio->kern_data_ptr = malloc(sizeof(*inq_ptr), M_CTL, M_WAITOK | M_ZERO); - if (ctsio->kern_data_ptr == NULL) { - ctsio->io_hdr.status = CTL_SCSI_ERROR; - ctsio->scsi_status = SCSI_STATUS_BUSY; - ctl_done((union ctl_io *)ctsio); - return (CTL_RETVAL_COMPLETE); - } inq_ptr = (struct scsi_inquiry_data *)ctsio->kern_data_ptr; ctsio->kern_sg_entries = 0; ctsio->kern_data_resid = 0; Modified: stable/9/sys/cam/ctl/ctl_frontend_internal.c ============================================================================== --- stable/9/sys/cam/ctl/ctl_frontend_internal.c Wed Oct 9 19:18:35 2013 (r256221) +++ stable/9/sys/cam/ctl/ctl_frontend_internal.c Wed Oct 9 19:19:53 2013 (r256222) @@ -495,9 +495,6 @@ cfi_lun_disable(void *arg, struct ctl_id return (0); } -/* - * XXX KDM run this inside a thread, or inside the caller's context? - */ static void cfi_datamove(union ctl_io *io) { @@ -537,18 +534,8 @@ cfi_datamove(union ctl_io *io) ext_sglen = ctsio->ext_sg_entries * sizeof(*ext_sglist); - /* - * XXX KDM GFP_KERNEL, don't know what the caller's context - * is. Need to figure that out. - */ ext_sglist = (struct ctl_sg_entry *)malloc(ext_sglen, M_CTL_CFI, M_WAITOK); - if (ext_sglist == NULL) { - ctl_set_internal_failure(ctsio, - /*sks_valid*/ 0, - /*retry_count*/ 0); - return; - } ext_sglist_malloced = 1; if (memcpy(ext_sglist, ctsio->ext_data_ptr, ext_sglen) != 0) { ctl_set_internal_failure(ctsio, From owner-svn-src-stable-9@FreeBSD.ORG Wed Oct 9 19:22:02 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 660D2651; Wed, 9 Oct 2013 19:22:02 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 535922EF9; Wed, 9 Oct 2013 19:22:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r99JM25P074628; Wed, 9 Oct 2013 19:22:02 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r99JM1i3074624; Wed, 9 Oct 2013 19:22:01 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201310091922.r99JM1i3074624@svn.freebsd.org> From: Alexander Motin Date: Wed, 9 Oct 2013 19:22:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256223 - stable/9/sys/cam X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Oct 2013 19:22:02 -0000 Author: mav Date: Wed Oct 9 19:22:01 2013 New Revision: 256223 URL: http://svnweb.freebsd.org/changeset/base/256223 Log: MFC r254058: Remove droping topology mutex after iterating 100 periphs in CAMGETPASSTHRU. That is not so slow and so often operation to handle unneeded otherwise xsoftc.xpt_generation and respective locking complications. Modified: stable/9/sys/cam/cam_periph.c stable/9/sys/cam/cam_xpt.c stable/9/sys/cam/cam_xpt_periph.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/cam_periph.c ============================================================================== --- stable/9/sys/cam/cam_periph.c Wed Oct 9 19:19:53 2013 (r256222) +++ stable/9/sys/cam/cam_periph.c Wed Oct 9 19:22:01 2013 (r256223) @@ -258,7 +258,7 @@ failure: break; case 3: CAM_DEBUG(periph->path, CAM_DEBUG_INFO, ("Periph destroyed\n")); - xpt_remove_periph(periph, /*topology_lock_held*/ 0); + xpt_remove_periph(periph); /* FALLTHROUGH */ case 2: xpt_lock_buses(); @@ -645,7 +645,7 @@ camperiphfree(struct cam_periph *periph) TAILQ_REMOVE(&(*p_drv)->units, periph, unit_links); (*p_drv)->generation++; - xpt_remove_periph(periph, /*topology_lock_held*/ 1); + xpt_remove_periph(periph); xpt_unlock_buses(); CAM_DEBUG(periph->path, CAM_DEBUG_INFO, ("Periph destroyed\n")); Modified: stable/9/sys/cam/cam_xpt.c ============================================================================== --- stable/9/sys/cam/cam_xpt.c Wed Oct 9 19:19:53 2013 (r256222) +++ stable/9/sys/cam/cam_xpt.c Wed Oct 9 19:22:01 2013 (r256223) @@ -96,7 +96,6 @@ typedef enum { struct xpt_softc { xpt_flags flags; - u_int32_t xpt_generation; /* number of high powered commands that can go through right now */ STAILQ_HEAD(highpowerlist, cam_ed) highpowerq; @@ -608,24 +607,11 @@ xptdoioctl(struct cdev *dev, u_long cmd, struct periph_driver **p_drv; char *name; u_int unit; - u_int cur_generation; int base_periph_found; - int splbreaknum; ccb = (union ccb *)addr; unit = ccb->cgdl.unit_number; name = ccb->cgdl.periph_name; - /* - * Every 100 devices, we want to drop our lock protection to - * give the software interrupt handler a chance to run. - * Most systems won't run into this check, but this should - * avoid starvation in the software interrupt handler in - * large systems. - */ - splbreaknum = 100; - - ccb = (union ccb *)addr; - base_periph_found = 0; /* @@ -639,8 +625,6 @@ xptdoioctl(struct cdev *dev, u_long cmd, /* Keep the list from changing while we traverse it */ xpt_lock_buses(); -ptstartover: - cur_generation = xsoftc.xpt_generation; /* first find our driver in the list of drivers */ for (p_drv = periph_drivers; *p_drv != NULL; p_drv++) @@ -667,15 +651,8 @@ ptstartover: for (periph = TAILQ_FIRST(&(*p_drv)->units); periph != NULL; periph = TAILQ_NEXT(periph, unit_links)) { - if (periph->unit_number == unit) { + if (periph->unit_number == unit) break; - } else if (--splbreaknum == 0) { - xpt_unlock_buses(); - xpt_lock_buses(); - splbreaknum = 100; - if (cur_generation != xsoftc.xpt_generation) - goto ptstartover; - } } /* * If we found the peripheral driver that the user passed @@ -1015,15 +992,11 @@ xpt_add_periph(struct cam_periph *periph SLIST_INSERT_HEAD(periph_head, periph, periph_links); } - xpt_lock_buses(); - xsoftc.xpt_generation++; - xpt_unlock_buses(); - return (status); } void -xpt_remove_periph(struct cam_periph *periph, int topology_lock_held) +xpt_remove_periph(struct cam_periph *periph) { struct cam_ed *device; @@ -1043,14 +1016,6 @@ xpt_remove_periph(struct cam_periph *per SLIST_REMOVE(periph_head, periph, cam_periph, periph_links); } - - if (topology_lock_held == 0) - xpt_lock_buses(); - - xsoftc.xpt_generation++; - - if (topology_lock_held == 0) - xpt_unlock_buses(); } Modified: stable/9/sys/cam/cam_xpt_periph.h ============================================================================== --- stable/9/sys/cam/cam_xpt_periph.h Wed Oct 9 19:19:53 2013 (r256222) +++ stable/9/sys/cam/cam_xpt_periph.h Wed Oct 9 19:22:01 2013 (r256223) @@ -42,8 +42,7 @@ void xpt_polled_action(union ccb *ccb); void xpt_release_ccb(union ccb *released_ccb); void xpt_schedule(struct cam_periph *perph, u_int32_t new_priority); int32_t xpt_add_periph(struct cam_periph *periph); -void xpt_remove_periph(struct cam_periph *periph, - int topology_lock_held); +void xpt_remove_periph(struct cam_periph *periph); void xpt_announce_periph(struct cam_periph *periph, char *announce_string); void xpt_announce_quirks(struct cam_periph *periph, From owner-svn-src-stable-9@FreeBSD.ORG Wed Oct 9 19:23:13 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id A75AB797; Wed, 9 Oct 2013 19:23:13 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 7A6E92F08; Wed, 9 Oct 2013 19:23:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r99JNDJY075049; Wed, 9 Oct 2013 19:23:13 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r99JNDZ9075046; Wed, 9 Oct 2013 19:23:13 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201310091923.r99JNDZ9075046@svn.freebsd.org> From: Alexander Motin Date: Wed, 9 Oct 2013 19:23:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256224 - in stable/9/sys/cam: ata scsi X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Oct 2013 19:23:13 -0000 Author: mav Date: Wed Oct 9 19:23:12 2013 New Revision: 256224 URL: http://svnweb.freebsd.org/changeset/base/256224 Log: MFC r254329 (by smh): Added 4K quirks for:- * OCZ Agility 2 SSDs * Marvell SSDs * Intel X25-M Series SSDs Modified: stable/9/sys/cam/ata/ata_da.c stable/9/sys/cam/scsi/scsi_da.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/ata/ata_da.c ============================================================================== --- stable/9/sys/cam/ata/ata_da.c Wed Oct 9 19:22:01 2013 (r256223) +++ stable/9/sys/cam/ata/ata_da.c Wed Oct 9 19:23:12 2013 (r256224) @@ -350,6 +350,14 @@ static struct ada_quirk_entry ada_quirk_ }, { /* + * Intel X25-M Series SSDs + * 4k optimised & trim only works in 4k requests + 4k aligned + */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "INTEL SSDSA2M*", "*" }, + /*quirks*/ADA_Q_4K + }, + { + /* * Kingston E100 Series SSDs * 4k optimised & trim only works in 4k requests + 4k aligned */ @@ -366,6 +374,22 @@ static struct ada_quirk_entry ada_quirk_ }, { /* + * Marvell SSDs (entry taken from OpenSolaris) + * 4k optimised & trim only works in 4k requests + 4k aligned + */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "MARVELL SD88SA02*", "*" }, + /*quirks*/ADA_Q_4K + }, + { + /* + * OCZ Agility 2 SSDs + * 4k optimised & trim only works in 4k requests + 4k aligned + */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "OCZ-AGILITY2*", "*" }, + /*quirks*/ADA_Q_4K + }, + { + /* * OCZ Agility 3 SSDs * 4k optimised & trim only works in 4k requests + 4k aligned */ Modified: stable/9/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_da.c Wed Oct 9 19:22:01 2013 (r256223) +++ stable/9/sys/cam/scsi/scsi_da.c Wed Oct 9 19:23:12 2013 (r256224) @@ -1008,6 +1008,14 @@ static struct da_quirk_entry da_quirk_ta }, { /* + * Intel X25-M Series SSDs + * 4k optimised & trim only works in 4k requests + 4k aligned + */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "INTEL SSDSA2M*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* * Kingston E100 Series SSDs * 4k optimised & trim only works in 4k requests + 4k aligned */ @@ -1024,6 +1032,22 @@ static struct da_quirk_entry da_quirk_ta }, { /* + * Marvell SSDs (entry taken from OpenSolaris) + * 4k optimised & trim only works in 4k requests + 4k aligned + */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "MARVELL SD88SA02*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* + * OCZ Agility 2 SSDs + * 4k optimised & trim only works in 4k requests + 4k aligned + */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "OCZ-AGILITY2*", "*" }, + /*quirks*/DA_Q_4K + }, + { + /* * OCZ Agility 3 SSDs * 4k optimised & trim only works in 4k requests + 4k aligned */ From owner-svn-src-stable-9@FreeBSD.ORG Wed Oct 9 19:25:23 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id D3DE09AB; Wed, 9 Oct 2013 19:25:23 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B20722F2C; Wed, 9 Oct 2013 19:25:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r99JPNGd076057; Wed, 9 Oct 2013 19:25:23 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r99JPM5e076034; Wed, 9 Oct 2013 19:25:22 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201310091925.r99JPM5e076034@svn.freebsd.org> From: Alexander Motin Date: Wed, 9 Oct 2013 19:25:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256225 - stable/9/sys/cam X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Oct 2013 19:25:24 -0000 Author: mav Date: Wed Oct 9 19:25:22 2013 New Revision: 256225 URL: http://svnweb.freebsd.org/changeset/base/256225 Log: MFC r255126: Add debug trace points for freeze/release device queue. Modified: stable/9/sys/cam/cam_debug.h stable/9/sys/cam/cam_periph.c stable/9/sys/cam/cam_xpt.c stable/9/sys/cam/cam_xpt.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/cam_debug.h ============================================================================== --- stable/9/sys/cam/cam_debug.h Wed Oct 9 19:23:12 2013 (r256224) +++ stable/9/sys/cam/cam_debug.h Wed Oct 9 19:25:22 2013 (r256225) @@ -99,6 +99,17 @@ extern u_int32_t cam_debug_delay; DELAY(cam_debug_delay); \ } +#define CAM_DEBUG_DEV(dev, flag, printfargs) \ + if (((flag) & (CAM_DEBUG_COMPILE) & cam_dflags) \ + && (cam_dpath != NULL) \ + && (xpt_path_comp_dev(cam_dpath, dev) >= 0) \ + && (xpt_path_comp_dev(cam_dpath, dev) < 2)) { \ + xpt_print_device(dev); \ + printf printfargs; \ + if (cam_debug_delay != 0) \ + DELAY(cam_debug_delay); \ + } + #define CAM_DEBUG_PRINT(flag, printfargs) \ if (((flag) & (CAM_DEBUG_COMPILE) & cam_dflags)) { \ printf("cam_debug: "); \ Modified: stable/9/sys/cam/cam_periph.c ============================================================================== --- stable/9/sys/cam/cam_periph.c Wed Oct 9 19:23:12 2013 (r256224) +++ stable/9/sys/cam/cam_periph.c Wed Oct 9 19:25:22 2013 (r256225) @@ -1115,6 +1115,7 @@ cam_freeze_devq(struct cam_path *path) { struct ccb_hdr ccb_h; + CAM_DEBUG(path, CAM_DEBUG_TRACE, ("cam_freeze_devq\n")); xpt_setup_ccb(&ccb_h, path, /*priority*/1); ccb_h.func_code = XPT_NOOP; ccb_h.flags = CAM_DEV_QFREEZE; @@ -1128,6 +1129,8 @@ cam_release_devq(struct cam_path *path, { struct ccb_relsim crs; + CAM_DEBUG(path, CAM_DEBUG_TRACE, ("cam_release_devq(%u, %u, %u, %d)\n", + relsim_flags, openings, arg, getcount_only)); xpt_setup_ccb(&crs.ccb_h, path, CAM_PRIORITY_NORMAL); crs.ccb_h.func_code = XPT_REL_SIMQ; crs.ccb_h.flags = getcount_only ? CAM_DEV_QFREEZE : 0; Modified: stable/9/sys/cam/cam_xpt.c ============================================================================== --- stable/9/sys/cam/cam_xpt.c Wed Oct 9 19:23:12 2013 (r256224) +++ stable/9/sys/cam/cam_xpt.c Wed Oct 9 19:25:22 2013 (r256225) @@ -3594,6 +3594,40 @@ xpt_path_comp(struct cam_path *path1, st return (retval); } +int +xpt_path_comp_dev(struct cam_path *path, struct cam_ed *dev) +{ + int retval = 0; + + if (path->bus != dev->target->bus) { + if (path->bus->path_id == CAM_BUS_WILDCARD) + retval = 1; + else if (dev->target->bus->path_id == CAM_BUS_WILDCARD) + retval = 2; + else + return (-1); + } + if (path->target != dev->target) { + if (path->target->target_id == CAM_TARGET_WILDCARD) { + if (retval == 0) + retval = 1; + } else if (dev->target->target_id == CAM_TARGET_WILDCARD) + retval = 2; + else + return (-1); + } + if (path->device != dev) { + if (path->device->lun_id == CAM_LUN_WILDCARD) { + if (retval == 0) + retval = 1; + } else if (dev->lun_id == CAM_LUN_WILDCARD) + retval = 2; + else + return (-1); + } + return (retval); +} + void xpt_print_path(struct cam_path *path) { @@ -3627,6 +3661,21 @@ xpt_print_path(struct cam_path *path) } void +xpt_print_device(struct cam_ed *device) +{ + + if (device == NULL) + printf("(nopath): "); + else { + printf("(noperiph:%s%d:%d:%d:%d): ", device->sim->sim_name, + device->sim->unit_number, + device->sim->bus_id, + device->target->target_id, + device->lun_id); + } +} + +void xpt_print(struct cam_path *path, const char *fmt, ...) { va_list ap; @@ -4147,6 +4196,8 @@ xpt_freeze_devq(struct cam_path *path, u struct cam_ed *dev = path->device; mtx_assert(path->bus->sim->mtx, MA_OWNED); + CAM_DEBUG(path, CAM_DEBUG_TRACE, ("xpt_freeze_devq() %u->%u\n", + dev->ccbq.queue.qfrozen_cnt, dev->ccbq.queue.qfrozen_cnt + count)); dev->ccbq.queue.qfrozen_cnt += count; /* Remove frozen device from sendq. */ if (device_is_queued(dev)) { @@ -4171,6 +4222,7 @@ xpt_release_devq_timeout(void *arg) struct cam_ed *device; device = (struct cam_ed *)arg; + CAM_DEBUG_DEV(device, CAM_DEBUG_TRACE, ("xpt_release_devq_timeout\n")); xpt_release_devq_device(device, /*count*/1, /*run_queue*/TRUE); } @@ -4179,6 +4231,8 @@ xpt_release_devq(struct cam_path *path, { mtx_assert(path->bus->sim->mtx, MA_OWNED); + CAM_DEBUG(path, CAM_DEBUG_TRACE, ("xpt_release_devq(%d, %d)\n", + count, run_queue)); xpt_release_devq_device(path->device, count, run_queue); } @@ -4186,6 +4240,9 @@ void xpt_release_devq_device(struct cam_ed *dev, u_int count, int run_queue) { + CAM_DEBUG_DEV(dev, CAM_DEBUG_TRACE, + ("xpt_release_devq_device(%d, %d) %u->%u\n", count, run_queue, + dev->ccbq.queue.qfrozen_cnt, dev->ccbq.queue.qfrozen_cnt - count)); if (count > dev->ccbq.queue.qfrozen_cnt) { #ifdef INVARIANTS printf("xpt_release_devq(): requested %u > present %u\n", Modified: stable/9/sys/cam/cam_xpt.h ============================================================================== --- stable/9/sys/cam/cam_xpt.h Wed Oct 9 19:23:12 2013 (r256224) +++ stable/9/sys/cam/cam_xpt.h Wed Oct 9 19:25:22 2013 (r256225) @@ -35,6 +35,7 @@ /* Forward Declarations */ union ccb; struct cam_periph; +struct cam_ed; struct cam_sim; /* @@ -89,7 +90,10 @@ void xpt_path_counts(struct cam_path * uint32_t *device_ref); int xpt_path_comp(struct cam_path *path1, struct cam_path *path2); +int xpt_path_comp_dev(struct cam_path *path, + struct cam_ed *dev); void xpt_print_path(struct cam_path *path); +void xpt_print_device(struct cam_ed *device); void xpt_print(struct cam_path *path, const char *fmt, ...); int xpt_path_string(struct cam_path *path, char *str, size_t str_len); From owner-svn-src-stable-9@FreeBSD.ORG Wed Oct 9 19:26:35 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id DCBD7B5D; Wed, 9 Oct 2013 19:26:35 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id AF95D2F3D; Wed, 9 Oct 2013 19:26:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r99JQZrb076713; Wed, 9 Oct 2013 19:26:35 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r99JQZSl076712; Wed, 9 Oct 2013 19:26:35 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201310091926.r99JQZSl076712@svn.freebsd.org> From: Alexander Motin Date: Wed, 9 Oct 2013 19:26:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256226 - stable/9/sys/cam/scsi X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Oct 2013 19:26:36 -0000 Author: mav Date: Wed Oct 9 19:26:35 2013 New Revision: 256226 URL: http://svnweb.freebsd.org/changeset/base/256226 Log: MFC r255304: Fix kernel panic if cache->nelms is zero. Modified: stable/9/sys/cam/scsi/scsi_enc_ses.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/scsi/scsi_enc_ses.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_enc_ses.c Wed Oct 9 19:25:22 2013 (r256225) +++ stable/9/sys/cam/scsi/scsi_enc_ses.c Wed Oct 9 19:26:35 2013 (r256226) @@ -567,8 +567,8 @@ ses_cache_free_elm_addlstatus(enc_softc_ return; for (cur_elm = cache->elm_map, - last_elm = &cache->elm_map[cache->nelms - 1]; - cur_elm <= last_elm; cur_elm++) { + last_elm = &cache->elm_map[cache->nelms]; + cur_elm != last_elm; cur_elm++) { ses_element_t *elmpriv; elmpriv = cur_elm->elm_private; @@ -598,8 +598,8 @@ ses_cache_free_elm_descs(enc_softc_t *en return; for (cur_elm = cache->elm_map, - last_elm = &cache->elm_map[cache->nelms - 1]; - cur_elm <= last_elm; cur_elm++) { + last_elm = &cache->elm_map[cache->nelms]; + cur_elm != last_elm; cur_elm++) { ses_element_t *elmpriv; elmpriv = cur_elm->elm_private; @@ -644,8 +644,8 @@ ses_cache_free_elm_map(enc_softc_t *enc, ses_cache_free_elm_descs(enc, cache); ses_cache_free_elm_addlstatus(enc, cache); for (cur_elm = cache->elm_map, - last_elm = &cache->elm_map[cache->nelms - 1]; - cur_elm <= last_elm; cur_elm++) { + last_elm = &cache->elm_map[cache->nelms]; + cur_elm != last_elm; cur_elm++) { ENC_FREE_AND_NULL(cur_elm->elm_private); } @@ -717,8 +717,8 @@ ses_cache_clone(enc_softc_t *enc, enc_ca dst->elm_map = ENC_MALLOCZ(dst->nelms * sizeof(enc_element_t)); memcpy(dst->elm_map, src->elm_map, dst->nelms * sizeof(enc_element_t)); for (dst_elm = dst->elm_map, src_elm = src->elm_map, - last_elm = &src->elm_map[src->nelms - 1]; - src_elm <= last_elm; src_elm++, dst_elm++) { + last_elm = &src->elm_map[src->nelms]; + src_elm != last_elm; src_elm++, dst_elm++) { dst_elm->elm_private = ENC_MALLOCZ(sizeof(ses_element_t)); memcpy(dst_elm->elm_private, src_elm->elm_private, From owner-svn-src-stable-9@FreeBSD.ORG Wed Oct 9 19:28:07 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id AE628CFC; Wed, 9 Oct 2013 19:28:07 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 9B1BB2F64; Wed, 9 Oct 2013 19:28:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r99JS7tq077291; Wed, 9 Oct 2013 19:28:07 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r99JS7um077290; Wed, 9 Oct 2013 19:28:07 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201310091928.r99JS7um077290@svn.freebsd.org> From: Alexander Motin Date: Wed, 9 Oct 2013 19:28:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256227 - stable/9/sys/cam/scsi X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Oct 2013 19:28:07 -0000 Author: mav Date: Wed Oct 9 19:28:07 2013 New Revision: 256227 URL: http://svnweb.freebsd.org/changeset/base/256227 Log: MFC r255309: Make SES driver adequately react on simple enclosure devices -- read Short Enclosure status to enclosure status field, clear previous state and exit. Modified: stable/9/sys/cam/scsi/scsi_enc_ses.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/scsi/scsi_enc_ses.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_enc_ses.c Wed Oct 9 19:26:35 2013 (r256226) +++ stable/9/sys/cam/scsi/scsi_enc_ses.c Wed Oct 9 19:28:07 2013 (r256227) @@ -1555,6 +1555,18 @@ ses_process_status(enc_softc_t *enc, str ENC_VLOG(enc, "Enclosure Status Page Too Long\n"); goto out; } + + /* Check for simple enclosure reporting short enclosure status. */ + if (length >= 4 && page->hdr.page_code == SesShortStatus) { + ENC_DLOG(enc, "Got Short Enclosure Status page\n"); + ses->ses_flags &= ~(SES_FLAG_ADDLSTATUS | SES_FLAG_DESC); + ses_cache_free(enc, enc_cache); + enc_cache->enc_status = page->hdr.page_specific_flags; + enc_update_request(enc, SES_PUBLISH_CACHE); + err = 0; + goto out; + } + /* Make sure the length contains at least one header and status */ if (length < (sizeof(*page) + sizeof(*page->elements))) { ENC_VLOG(enc, "Enclosure Status Page Too Short\n"); From owner-svn-src-stable-9@FreeBSD.ORG Wed Oct 9 19:34:12 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 784CA2CD; Wed, 9 Oct 2013 19:34:12 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 651BE2FDD; Wed, 9 Oct 2013 19:34:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r99JYCPR080897; Wed, 9 Oct 2013 19:34:12 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r99JYC7q080896; Wed, 9 Oct 2013 19:34:12 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201310091934.r99JYC7q080896@svn.freebsd.org> From: Glen Barber Date: Wed, 9 Oct 2013 19:34:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256230 - stable/9/etc/rc.d X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Oct 2013 19:34:12 -0000 Author: gjb Date: Wed Oct 9 19:34:11 2013 New Revision: 256230 URL: http://svnweb.freebsd.org/changeset/base/256230 Log: MFC r228541, r256022: r228541 (by pjd): - Put one file into one line. This makes keeping local changes and merging with FreeBSD easier for vendors. - For optional files use variables starting with underscore r256022: - Do not install bluetooth rc(8) scripts if MK_BLUETOOTH = no. Modified: stable/9/etc/rc.d/Makefile Directory Properties: stable/9/etc/rc.d/ (props changed) Modified: stable/9/etc/rc.d/Makefile ============================================================================== --- stable/9/etc/rc.d/Makefile Wed Oct 9 19:30:13 2013 (r256229) +++ stable/9/etc/rc.d/Makefile Wed Oct 9 19:34:11 2013 (r256230) @@ -2,64 +2,182 @@ .include -FILES= DAEMON FILESYSTEMS LOGIN NETWORKING SERVERS \ - abi accounting addswap adjkerntz amd \ - apm apmd archdep atm1 atm2 atm3 auditd auditdistd \ - bgfsck bluetooth bootparams bridge bsnmpd bthidd \ - ccd cleanvar cleartmp cron \ - ddb defaultroute devd devfs dhclient \ - dmesg dumpon \ +FILES= DAEMON \ + FILESYSTEMS \ + LOGIN \ + NETWORKING \ + SERVERS \ + abi \ + accounting \ + addswap \ + adjkerntz \ + amd \ + apm \ + apmd \ + archdep \ + atm1 \ + atm2 \ + atm3 \ + auditd \ + bgfsck \ + ${_bluetooth} \ + bootparams \ + bridge \ + bsnmpd \ + ${_bthidd} \ + ccd \ + cleanvar \ + cleartmp \ + cron \ + ddb \ + defaultroute \ + devd \ + devfs \ + dhclient \ + dmesg \ + dumpon \ encswap \ - faith fsck ftp-proxy ftpd \ - gbde geli geli2 gptboot gssd \ - hastd hcsecd \ - hostapd hostid hostid_save hostname \ - inetd initrandom \ - ip6addrctl ipfilter ipfs ipfw ipmon \ - ipnat ipsec \ + faith \ + fsck \ + ftp-proxy \ + ftpd \ + gbde \ + geli \ + geli2 \ + gptboot \ + gssd \ + hastd \ + ${_hcsecd} \ + hostapd \ + hostid \ + hostid_save \ + hostname \ + inetd \ + initrandom \ + ip6addrctl \ + ipfilter \ + ipfs \ + ipfw \ + ipmon \ + ipnat \ + ipsec \ + ${_ipxrouted} \ jail \ - kadmind kerberos keyserv kld kldxref kpasswdd \ - ldconfig local localpkg lockd lpd \ - mixer motd mountcritlocal mountcritremote mountlate \ - mdconfig mdconfig2 mountd moused mroute6d mrouted msgs \ - named natd netif netoptions netwait \ - newsyslog nfsclient nfscbd nfsd \ - nfsuserd nisdomain nsswitch ntpd ntpdate \ + kadmind \ + kerberos \ + keyserv \ + kld \ + kldxref \ + kpasswdd \ + ldconfig \ + local \ + localpkg \ + lockd \ + lpd \ + mixer \ + motd \ + mountcritlocal \ + mountcritremote \ + mountlate \ + mdconfig \ + mdconfig2 \ + mountd \ + moused \ + mroute6d \ + mrouted \ + msgs \ + named \ + natd \ + netif \ + netoptions \ + netwait \ + newsyslog \ + nfsclient \ + nfscbd \ + nfsd \ + nfsuserd \ + nisdomain \ + ${_nscd} \ + nsswitch \ + ntpd \ + ntpdate \ + ${_opensm} \ othermta \ - pf pflog pfsync \ - powerd power_profile ppp pppoed pwcheck \ + pf \ + pflog \ + pfsync \ + powerd \ + power_profile \ + ppp \ + pppoed \ + pwcheck \ quota \ - random rarpd rctl resolv rfcomm_pppd_server root \ - route6d routed routing rpcbind rtadvd rtsold rwho \ - savecore sdpd securelevel sendmail \ - serial sppp statd static_arp static_ndp stf swap1 \ - syscons sysctl syslogd \ - timed tmp \ + random \ + rarpd \ + rctl \ + resolv \ + rfcomm_pppd_server \ + root \ + route6d \ + routed \ + routing \ + rpcbind \ + rtadvd \ + rtsold \ + rwho \ + savecore \ + sdpd \ + securelevel \ + sendmail \ + serial \ + sppp \ + ${_sshd} \ + statd \ + static_arp \ + static_ndp \ + stf \ + swap1 \ + syscons \ + sysctl \ + syslogd \ + timed \ + tmp \ + ${_ubthidhci} \ ugidfw \ - var virecover \ - watchdogd wpa_supplicant \ - ypbind yppasswdd ypserv \ - ypset ypupdated ypxfrd \ - zfs zvol + var \ + virecover \ + watchdogd \ + wpa_supplicant \ + ypbind \ + yppasswdd \ + ypserv \ + ypset \ + ypupdated \ + ypxfrd \ + zfs \ + zvol .if ${MK_IPX} != "no" -FILES+= ipxrouted +_ipxrouted= ipxrouted .endif .if ${MK_OFED} != "no" -FILES+= opensm +_opensm= opensm .endif .if ${MK_OPENSSH} != "no" -FILES+= sshd +_sshd= sshd .endif .if ${MK_NS_CACHING} != "no" -FILES+= nscd +_nscd= nscd .endif .if ${MK_BLUETOOTH} != "no" -FILES+= ubthidhci +_bluetooth= bluetooth +_bthidd= bthidd +_hcsecd= hcsecd +_ubthidhci= ubthidhci .endif FILESDIR= /etc/rc.d From owner-svn-src-stable-9@FreeBSD.ORG Wed Oct 9 19:53:43 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 24B29CB3; Wed, 9 Oct 2013 19:53:43 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 10E75215A; Wed, 9 Oct 2013 19:53:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r99Jrgq9091093; Wed, 9 Oct 2013 19:53:42 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r99JrgYZ091092; Wed, 9 Oct 2013 19:53:42 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201310091953.r99JrgYZ091092@svn.freebsd.org> From: Alexander Motin Date: Wed, 9 Oct 2013 19:53:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256233 - stable/9/sys/dev/mps X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Oct 2013 19:53:43 -0000 Author: mav Date: Wed Oct 9 19:53:42 2013 New Revision: 256233 URL: http://svnweb.freebsd.org/changeset/base/256233 Log: MFC r241145 (by ken): Add casts to unbreak the i386 PAE build for the mps(4) driver. Modified: stable/9/sys/dev/mps/mps_sas.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/mps/mps_sas.c ============================================================================== --- stable/9/sys/dev/mps/mps_sas.c Wed Oct 9 19:37:51 2013 (r256232) +++ stable/9/sys/dev/mps/mps_sas.c Wed Oct 9 19:53:42 2013 (r256233) @@ -2803,7 +2803,7 @@ mpssas_send_smpcmd(struct mpssas_softc * bus_dma_segment_t *req_sg; req_sg = (bus_dma_segment_t *)ccb->smpio.smp_request; - request = (uint8_t *)req_sg[0].ds_addr; + request = (uint8_t *)(uintptr_t)req_sg[0].ds_addr; } else request = ccb->smpio.smp_request; @@ -2811,7 +2811,7 @@ mpssas_send_smpcmd(struct mpssas_softc * bus_dma_segment_t *rsp_sg; rsp_sg = (bus_dma_segment_t *)ccb->smpio.smp_response; - response = (uint8_t *)rsp_sg[0].ds_addr; + response = (uint8_t *)(uintptr_t)rsp_sg[0].ds_addr; } else response = ccb->smpio.smp_response; break; From owner-svn-src-stable-9@FreeBSD.ORG Wed Oct 9 19:55:55 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id E1509E29; Wed, 9 Oct 2013 19:55:55 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id CE2B2217E; Wed, 9 Oct 2013 19:55:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r99Jttk7091650; Wed, 9 Oct 2013 19:55:55 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r99Jtt9H091649; Wed, 9 Oct 2013 19:55:55 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201310091955.r99Jtt9H091649@svn.freebsd.org> From: Alexander Motin Date: Wed, 9 Oct 2013 19:55:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256234 - stable/9/sys/dev/mps X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Oct 2013 19:55:56 -0000 Author: mav Date: Wed Oct 9 19:55:55 2013 New Revision: 256234 URL: http://svnweb.freebsd.org/changeset/base/256234 Log: MFC r241759 (by jwd): Don't lose the 255'th disk behind the initiator. Modified: stable/9/sys/dev/mps/mps_sas.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/mps/mps_sas.c ============================================================================== --- stable/9/sys/dev/mps/mps_sas.c Wed Oct 9 19:53:42 2013 (r256233) +++ stable/9/sys/dev/mps/mps_sas.c Wed Oct 9 19:55:55 2013 (r256234) @@ -961,7 +961,7 @@ mpssas_action(struct cam_sim *sim, union cpi->hba_eng_cnt = 0; cpi->max_target = sassc->sc->facts->MaxTargets - 1; cpi->max_lun = 255; - cpi->initiator_id = 255; + cpi->initiator_id = sassc->sc->facts->MaxTargets - 1; strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN); strncpy(cpi->hba_vid, "LSILogic", HBA_IDLEN); strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN); From owner-svn-src-stable-9@FreeBSD.ORG Wed Oct 9 19:57:27 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id B79C9DC; Wed, 9 Oct 2013 19:57:27 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A42C02191; Wed, 9 Oct 2013 19:57:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r99JvRKT092235; Wed, 9 Oct 2013 19:57:27 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r99JvRTq092234; Wed, 9 Oct 2013 19:57:27 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201310091957.r99JvRTq092234@svn.freebsd.org> From: Alexander Motin Date: Wed, 9 Oct 2013 19:57:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256235 - stable/9/sys/dev/mps X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Oct 2013 19:57:27 -0000 Author: mav Date: Wed Oct 9 19:57:27 2013 New Revision: 256235 URL: http://svnweb.freebsd.org/changeset/base/256235 Log: MFC r253809: Fix a printf typo. Modified: stable/9/sys/dev/mps/mps_sas.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/mps/mps_sas.c ============================================================================== --- stable/9/sys/dev/mps/mps_sas.c Wed Oct 9 19:55:55 2013 (r256234) +++ stable/9/sys/dev/mps/mps_sas.c Wed Oct 9 19:57:27 2013 (r256235) @@ -3073,7 +3073,7 @@ mpssas_action_resetdev(struct mpssas_sof tm = mps_alloc_command(sc); if (tm == NULL) { mps_dprint(sc, MPS_ERROR, - "comand alloc failure in mpssas_action_resetdev\n"); + "command alloc failure in mpssas_action_resetdev\n"); ccb->ccb_h.status = CAM_RESRC_UNAVAIL; xpt_done(ccb); return; From owner-svn-src-stable-9@FreeBSD.ORG Wed Oct 9 19:59:26 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 76959237; Wed, 9 Oct 2013 19:59:26 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 6211B21A4; Wed, 9 Oct 2013 19:59:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r99JxQob092833; Wed, 9 Oct 2013 19:59:26 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r99JxQK5092832; Wed, 9 Oct 2013 19:59:26 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201310091959.r99JxQK5092832@svn.freebsd.org> From: Alexander Motin Date: Wed, 9 Oct 2013 19:59:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256236 - stable/9/sys/dev/mps X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Oct 2013 19:59:26 -0000 Author: mav Date: Wed Oct 9 19:59:25 2013 New Revision: 256236 URL: http://svnweb.freebsd.org/changeset/base/256236 Log: MFC r254253, r254257: r253460 accidentally some moderately expensive debugging code, even when debugging isn't enabled. Work around this. Modified: stable/9/sys/dev/mps/mps_sas.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/mps/mps_sas.c ============================================================================== --- stable/9/sys/dev/mps/mps_sas.c Wed Oct 9 19:57:27 2013 (r256235) +++ stable/9/sys/dev/mps/mps_sas.c Wed Oct 9 19:59:25 2013 (r256236) @@ -308,6 +308,10 @@ mpssas_log_command(struct mps_command *c if (cm == NULL) return; + /* No need to be in here if debugging isn't enabled */ + if ((cm->cm_sc->mps_debug & level) == 0) + return; + sbuf_new(&sb, str, sizeof(str), 0); va_start(ap, fmt); From owner-svn-src-stable-9@FreeBSD.ORG Thu Oct 10 01:20:19 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 6BCF9E8E; Thu, 10 Oct 2013 01:20:19 +0000 (UTC) (envelope-from jmg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 3EB0423AC; Thu, 10 Oct 2013 01:20:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9A1KJkp059725; Thu, 10 Oct 2013 01:20:19 GMT (envelope-from jmg@svn.freebsd.org) Received: (from jmg@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9A1KIY1059722; Thu, 10 Oct 2013 01:20:18 GMT (envelope-from jmg@svn.freebsd.org) Message-Id: <201310100120.r9A1KIY1059722@svn.freebsd.org> From: John-Mark Gurney Date: Thu, 10 Oct 2013 01:20:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256249 - in stable/9/share/man: man8 man9 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Oct 2013 01:20:19 -0000 Author: jmg Date: Thu Oct 10 01:20:18 2013 New Revision: 256249 URL: http://svnweb.freebsd.org/changeset/base/256249 Log: partial MFC of r256114: add missing sections, de-Xr non-existent page Modified: stable/9/share/man/man8/picobsd.8 stable/9/share/man/man9/firmware.9 Directory Properties: stable/9/share/man/man8/ (props changed) stable/9/share/man/man9/ (props changed) Modified: stable/9/share/man/man8/picobsd.8 ============================================================================== --- stable/9/share/man/man8/picobsd.8 Wed Oct 9 23:53:21 2013 (r256248) +++ stable/9/share/man/man8/picobsd.8 Thu Oct 10 01:20:18 2013 (r256249) @@ -20,7 +20,7 @@ utility is a script which produces a min which typically fits on a small media such as a floppy disk, or can be downloaded as a single image file from some media such as CDROM, flash memory, or through -.Xr etherboot . +etherboot. .Pp The .Nm @@ -64,7 +64,7 @@ kernel. This is the default behaviour, and is extremely useful as the kernel itself can be loaded, using -.Xr etherboot +etherboot or .Xr pxeboot 8 , .\" @@ -378,9 +378,7 @@ If the build is successful, the director .Pa build_dir-bridge/ will contain a .Pa kernel -that can be downloaded with -.Xr etherboot , -a floppy image called +that can be downloaded with etherboot, a floppy image called .Pa picobsd.bin , plus the products of the compilation in other directories. If you want to modify the source tree in @@ -480,9 +478,7 @@ Booting from a floppy is normally rather minutes), things are much faster if you store your image on a hard disk, Compact Flash, or CDROM. .Pp -You can also use -.Xr etherboot -to load the preloaded, uncompressed kernel image +You can also use etherboot to load the preloaded, uncompressed kernel image which is a byproduct of the .Nm build. Modified: stable/9/share/man/man9/firmware.9 ============================================================================== --- stable/9/share/man/man9/firmware.9 Wed Oct 9 23:53:21 2013 (r256248) +++ stable/9/share/man/man9/firmware.9 Thu Oct 10 01:20:18 2013 (r256249) @@ -254,8 +254,8 @@ IxNpeMicrocode.dat .Pp Note that generating the firmware modules in this way requires the availability of the following tools: -.Xr awk , -.Xr make , +.Xr awk 1 , +.Xr make 1 , the compiler and the linker. .Sh SEE ALSO .Xr kld 4 , From owner-svn-src-stable-9@FreeBSD.ORG Thu Oct 10 03:35:31 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id DE34CFAB; Thu, 10 Oct 2013 03:35:31 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id AFB1D2A3F; Thu, 10 Oct 2013 03:35:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9A3ZVPC030861; Thu, 10 Oct 2013 03:35:31 GMT (envelope-from jhibbits@svn.freebsd.org) Received: (from jhibbits@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9A3ZVoj030860; Thu, 10 Oct 2013 03:35:31 GMT (envelope-from jhibbits@svn.freebsd.org) Message-Id: <201310100335.r9A3ZVoj030860@svn.freebsd.org> From: Justin Hibbits Date: Thu, 10 Oct 2013 03:35:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256250 - stable/9/sys/powerpc/ofw X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Oct 2013 03:35:32 -0000 Author: jhibbits Date: Thu Oct 10 03:35:30 2013 New Revision: 256250 URL: http://svnweb.freebsd.org/changeset/base/256250 Log: MFC r252115,255378 Cache the Open Firmware CPU properties at attach time, so we don't always enter it at runtime to get static data. Modified: stable/9/sys/powerpc/ofw/ofw_cpu.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/powerpc/ofw/ofw_cpu.c ============================================================================== --- stable/9/sys/powerpc/ofw/ofw_cpu.c Thu Oct 10 01:20:18 2013 (r256249) +++ stable/9/sys/powerpc/ofw/ofw_cpu.c Thu Oct 10 03:35:30 2013 (r256250) @@ -133,6 +133,11 @@ static int ofw_cpu_attach(device_t); static int ofw_cpu_read_ivar(device_t dev, device_t child, int index, uintptr_t *result); +struct ofw_cpu_softc { + struct pcpu *sc_cpu_pcpu; + uint32_t sc_nominal_mhz; +}; + static device_method_t ofw_cpu_methods[] = { /* Device interface */ DEVMETHOD(device_probe, ofw_cpu_probe), @@ -153,7 +158,7 @@ static device_method_t ofw_cpu_methods[] static driver_t ofw_cpu_driver = { "cpu", ofw_cpu_methods, - 0 + sizeof(struct ofw_cpu_softc) }; static devclass_t ofw_cpu_devclass; @@ -175,6 +180,15 @@ ofw_cpu_probe(device_t dev) static int ofw_cpu_attach(device_t dev) { + struct ofw_cpu_softc *sc; + uint32_t cell; + + sc = device_get_softc(dev); + OF_getprop(ofw_bus_get_node(dev), "reg", &cell, sizeof(cell)); + sc->sc_cpu_pcpu = pcpu_find(cell); + OF_getprop(ofw_bus_get_node(dev), "clock-frequency", &cell, sizeof(cell)); + sc->sc_nominal_mhz = cell / 1000000; /* convert to MHz */ + bus_generic_probe(dev); return (bus_generic_attach(dev)); } @@ -182,19 +196,16 @@ ofw_cpu_attach(device_t dev) static int ofw_cpu_read_ivar(device_t dev, device_t child, int index, uintptr_t *result) { - uint32_t cell; + struct ofw_cpu_softc *sc; + + sc = device_get_softc(dev); switch (index) { case CPU_IVAR_PCPU: - OF_getprop(ofw_bus_get_node(dev), "reg", &cell, sizeof(cell)); - *result = (uintptr_t)(pcpu_find(cell)); + *result = (uintptr_t)sc->sc_cpu_pcpu; return (0); case CPU_IVAR_NOMINAL_MHZ: - cell = 0; - OF_getprop(ofw_bus_get_node(dev), "clock-frequency", - &cell, sizeof(cell)); - cell /= 1000000; /* convert to MHz */ - *result = (uintptr_t)(cell); + *result = (uintptr_t)sc->sc_nominal_mhz; return (0); } From owner-svn-src-stable-9@FreeBSD.ORG Thu Oct 10 03:57:47 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 93C244D3; Thu, 10 Oct 2013 03:57:47 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 7F7FE2B03; Thu, 10 Oct 2013 03:57:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9A3vlVL041486; Thu, 10 Oct 2013 03:57:47 GMT (envelope-from jhibbits@svn.freebsd.org) Received: (from jhibbits@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9A3vlSL041485; Thu, 10 Oct 2013 03:57:47 GMT (envelope-from jhibbits@svn.freebsd.org) Message-Id: <201310100357.r9A3vlSL041485@svn.freebsd.org> From: Justin Hibbits Date: Thu, 10 Oct 2013 03:57:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256252 - stable/9/sys/dev/adb X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Oct 2013 03:57:47 -0000 Author: jhibbits Date: Thu Oct 10 03:57:47 2013 New Revision: 256252 URL: http://svnweb.freebsd.org/changeset/base/256252 Log: MFC r255921 Fix powerpc/161045. ams_poll() needs to return that any data is available, not just a new packet. PR: powerpc/161045 Modified: stable/9/sys/dev/adb/adb_mouse.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/adb/adb_mouse.c ============================================================================== --- stable/9/sys/dev/adb/adb_mouse.c Thu Oct 10 03:50:23 2013 (r256251) +++ stable/9/sys/dev/adb/adb_mouse.c Thu Oct 10 03:57:47 2013 (r256252) @@ -471,7 +471,8 @@ ams_poll(struct cdev *dev, int events, s mtx_lock(&sc->sc_mtx); if (sc->xdelta == 0 && sc->ydelta == 0 && - sc->buttons == sc->last_buttons) { + sc->buttons == sc->last_buttons && + sc->packet_read_len == 0) { selrecord(p, &sc->rsel); events = 0; } else { From owner-svn-src-stable-9@FreeBSD.ORG Thu Oct 10 09:42:42 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 99FE7871; Thu, 10 Oct 2013 09:42:42 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 76C4E2D5E; Thu, 10 Oct 2013 09:42:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9A9gg6v018316; Thu, 10 Oct 2013 09:42:42 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9A9gfVa018310; Thu, 10 Oct 2013 09:42:41 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201310100942.r9A9gfVa018310@svn.freebsd.org> From: Gleb Smirnoff Date: Thu, 10 Oct 2013 09:42:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256257 - stable/9/lib/libfetch X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Oct 2013 09:42:42 -0000 Author: glebius Date: Thu Oct 10 09:42:41 2013 New Revision: 256257 URL: http://svnweb.freebsd.org/changeset/base/256257 Log: Merge from head r253514,r253680,r253805,r254650: --------------------------------------------------------------------- r253514 | des | 2013-07-21 10:59:56 +0400 (вс, 21 июл 2013) | 5 lines Use the correct request syntax for proxied (tunneled) HTTPS requests. PR: bin/180666 MFC after: 3 days --------------------------------------------------------------------- r253680 | des | 2013-07-26 19:53:43 +0400 (пт, 26 июл 2013) | 7 lines Implement certificate verification, and many other SSL-related imrovements; complete details in the PR. PR: kern/175514 Submitted by: Michael Gmelin MFC after: 1 week --------------------------------------------------------------------- r253805 | des | 2013-07-30 17:07:55 +0400 (вт, 30 июл 2013) | 5 lines Include an Accept header in requests. PR: kern/180917 MFC after: 1 week --------------------------------------------------------------------- r254650 | des | 2013-08-22 11:43:36 +0400 (чт, 22 авг 2013) | 8 lines Even though it doesn't really make sense in the context of a CONNECT request, RFC 2616 14.23 mandates the presence of the Host: header in all HTTP 1.1 requests. PR: kern/181445 Submitted by: Kimo MFC after: 3 days --------------------------------------------------------------------- Reviewed by: des Modified: stable/9/lib/libfetch/common.c stable/9/lib/libfetch/common.h stable/9/lib/libfetch/fetch.3 stable/9/lib/libfetch/http.c Directory Properties: stable/9/lib/libfetch/ (props changed) Modified: stable/9/lib/libfetch/common.c ============================================================================== --- stable/9/lib/libfetch/common.c Thu Oct 10 09:32:27 2013 (r256256) +++ stable/9/lib/libfetch/common.c Thu Oct 10 09:42:41 2013 (r256257) @@ -1,5 +1,6 @@ /*- * Copyright (c) 1998-2011 Dag-Erling Smørgrav + * Copyright (c) 2013 Michael Gmelin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -47,6 +48,10 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef WITH_SSL +#include +#endif + #include "fetch.h" #include "common.h" @@ -317,15 +322,488 @@ fetch_connect(const char *host, int port return (conn); } +#ifdef WITH_SSL +/* + * Convert characters A-Z to lowercase (intentionally avoid any locale + * specific conversions). + */ +static char +fetch_ssl_tolower(char in) +{ + if (in >= 'A' && in <= 'Z') + return (in + 32); + else + return (in); +} + +/* + * isalpha implementation that intentionally avoids any locale specific + * conversions. + */ +static int +fetch_ssl_isalpha(char in) +{ + return ((in >= 'A' && in <= 'Z') || (in >= 'a' && in <= 'z')); +} + +/* + * Check if passed hostnames a and b are equal. + */ +static int +fetch_ssl_hname_equal(const char *a, size_t alen, const char *b, + size_t blen) +{ + size_t i; + + if (alen != blen) + return (0); + for (i = 0; i < alen; ++i) { + if (fetch_ssl_tolower(a[i]) != fetch_ssl_tolower(b[i])) + return (0); + } + return (1); +} + +/* + * Check if domain label is traditional, meaning that only A-Z, a-z, 0-9 + * and '-' (hyphen) are allowed. Hyphens have to be surrounded by alpha- + * numeric characters. Double hyphens (like they're found in IDN a-labels + * 'xn--') are not allowed. Empty labels are invalid. + */ +static int +fetch_ssl_is_trad_domain_label(const char *l, size_t len, int wcok) +{ + size_t i; + + if (!len || l[0] == '-' || l[len-1] == '-') + return (0); + for (i = 0; i < len; ++i) { + if (!isdigit(l[i]) && + !fetch_ssl_isalpha(l[i]) && + !(l[i] == '*' && wcok) && + !(l[i] == '-' && l[i - 1] != '-')) + return (0); + } + return (1); +} + +/* + * Check if host name consists only of numbers. This might indicate an IP + * address, which is not a good idea for CN wildcard comparison. + */ +static int +fetch_ssl_hname_is_only_numbers(const char *hostname, size_t len) +{ + size_t i; + + for (i = 0; i < len; ++i) { + if (!((hostname[i] >= '0' && hostname[i] <= '9') || + hostname[i] == '.')) + return (0); + } + return (1); +} + +/* + * Check if the host name h passed matches the pattern passed in m which + * is usually part of subjectAltName or CN of a certificate presented to + * the client. This includes wildcard matching. The algorithm is based on + * RFC6125, sections 6.4.3 and 7.2, which clarifies RFC2818 and RFC3280. + */ +static int +fetch_ssl_hname_match(const char *h, size_t hlen, const char *m, + size_t mlen) +{ + int delta, hdotidx, mdot1idx, wcidx; + const char *hdot, *mdot1, *mdot2; + const char *wc; /* wildcard */ + + if (!(h && *h && m && *m)) + return (0); + if ((wc = strnstr(m, "*", mlen)) == NULL) + return (fetch_ssl_hname_equal(h, hlen, m, mlen)); + wcidx = wc - m; + /* hostname should not be just dots and numbers */ + if (fetch_ssl_hname_is_only_numbers(h, hlen)) + return (0); + /* only one wildcard allowed in pattern */ + if (strnstr(wc + 1, "*", mlen - wcidx - 1) != NULL) + return (0); + /* + * there must be at least two more domain labels and + * wildcard has to be in the leftmost label (RFC6125) + */ + mdot1 = strnstr(m, ".", mlen); + if (mdot1 == NULL || mdot1 < wc || (mlen - (mdot1 - m)) < 4) + return (0); + mdot1idx = mdot1 - m; + mdot2 = strnstr(mdot1 + 1, ".", mlen - mdot1idx - 1); + if (mdot2 == NULL || (mlen - (mdot2 - m)) < 2) + return (0); + /* hostname must contain a dot and not be the 1st char */ + hdot = strnstr(h, ".", hlen); + if (hdot == NULL || hdot == h) + return (0); + hdotidx = hdot - h; + /* + * host part of hostname must be at least as long as + * pattern it's supposed to match + */ + if (hdotidx < mdot1idx) + return (0); + /* + * don't allow wildcards in non-traditional domain names + * (IDN, A-label, U-label...) + */ + if (!fetch_ssl_is_trad_domain_label(h, hdotidx, 0) || + !fetch_ssl_is_trad_domain_label(m, mdot1idx, 1)) + return (0); + /* match domain part (part after first dot) */ + if (!fetch_ssl_hname_equal(hdot, hlen - hdotidx, mdot1, + mlen - mdot1idx)) + return (0); + /* match part left of wildcard */ + if (!fetch_ssl_hname_equal(h, wcidx, m, wcidx)) + return (0); + /* match part right of wildcard */ + delta = mdot1idx - wcidx - 1; + if (!fetch_ssl_hname_equal(hdot - delta, delta, + mdot1 - delta, delta)) + return (0); + /* all tests succeded, it's a match */ + return (1); +} + +/* + * Get numeric host address info - returns NULL if host was not an IP + * address. The caller is responsible for deallocation using + * freeaddrinfo(3). + */ +static struct addrinfo * +fetch_ssl_get_numeric_addrinfo(const char *hostname, size_t len) +{ + struct addrinfo hints, *res; + char *host; + + host = (char *)malloc(len + 1); + memcpy(host, hostname, len); + host[len] = '\0'; + memset(&hints, 0, sizeof(hints)); + hints.ai_family = PF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + hints.ai_protocol = 0; + hints.ai_flags = AI_NUMERICHOST; + /* port is not relevant for this purpose */ + getaddrinfo(host, "443", &hints, &res); + free(host); + return res; +} + +/* + * Compare ip address in addrinfo with address passes. + */ +static int +fetch_ssl_ipaddr_match_bin(const struct addrinfo *lhost, const char *rhost, + size_t rhostlen) +{ + const void *left; + + if (lhost->ai_family == AF_INET && rhostlen == 4) { + left = (void *)&((struct sockaddr_in*)(void *) + lhost->ai_addr)->sin_addr.s_addr; +#ifdef INET6 + } else if (lhost->ai_family == AF_INET6 && rhostlen == 16) { + left = (void *)&((struct sockaddr_in6 *)(void *) + lhost->ai_addr)->sin6_addr; +#endif + } else + return (0); + return (!memcmp(left, (const void *)rhost, rhostlen) ? 1 : 0); +} + +/* + * Compare ip address in addrinfo with host passed. If host is not an IP + * address, comparison will fail. + */ +static int +fetch_ssl_ipaddr_match(const struct addrinfo *laddr, const char *r, + size_t rlen) +{ + struct addrinfo *raddr; + int ret; + char *rip; + + ret = 0; + if ((raddr = fetch_ssl_get_numeric_addrinfo(r, rlen)) == NULL) + return 0; /* not a numeric host */ + + if (laddr->ai_family == raddr->ai_family) { + if (laddr->ai_family == AF_INET) { + rip = (char *)&((struct sockaddr_in *)(void *) + raddr->ai_addr)->sin_addr.s_addr; + ret = fetch_ssl_ipaddr_match_bin(laddr, rip, 4); +#ifdef INET6 + } else if (laddr->ai_family == AF_INET6) { + rip = (char *)&((struct sockaddr_in6 *)(void *) + raddr->ai_addr)->sin6_addr; + ret = fetch_ssl_ipaddr_match_bin(laddr, rip, 16); +#endif + } + + } + freeaddrinfo(raddr); + return (ret); +} + +/* + * Verify server certificate by subjectAltName. + */ +static int +fetch_ssl_verify_altname(STACK_OF(GENERAL_NAME) *altnames, + const char *host, struct addrinfo *ip) +{ + const GENERAL_NAME *name; + size_t nslen; + int i; + const char *ns; + + for (i = 0; i < sk_GENERAL_NAME_num(altnames); ++i) { +#if OPENSSL_VERSION_NUMBER < 0x10000000L + /* + * This is a workaround, since the following line causes + * alignment issues in clang: + * name = sk_GENERAL_NAME_value(altnames, i); + * OpenSSL explicitly warns not to use those macros + * directly, but there isn't much choice (and there + * shouldn't be any ill side effects) + */ + name = (GENERAL_NAME *)SKM_sk_value(void, altnames, i); +#else + name = sk_GENERAL_NAME_value(altnames, i); +#endif + ns = (const char *)ASN1_STRING_data(name->d.ia5); + nslen = (size_t)ASN1_STRING_length(name->d.ia5); + + if (name->type == GEN_DNS && ip == NULL && + fetch_ssl_hname_match(host, strlen(host), ns, nslen)) + return (1); + else if (name->type == GEN_IPADD && ip != NULL && + fetch_ssl_ipaddr_match_bin(ip, ns, nslen)) + return (1); + } + return (0); +} + +/* + * Verify server certificate by CN. + */ +static int +fetch_ssl_verify_cn(X509_NAME *subject, const char *host, + struct addrinfo *ip) +{ + ASN1_STRING *namedata; + X509_NAME_ENTRY *nameentry; + int cnlen, lastpos, loc, ret; + unsigned char *cn; + + ret = 0; + lastpos = -1; + loc = -1; + cn = NULL; + /* get most specific CN (last entry in list) and compare */ + while ((lastpos = X509_NAME_get_index_by_NID(subject, + NID_commonName, lastpos)) != -1) + loc = lastpos; + + if (loc > -1) { + nameentry = X509_NAME_get_entry(subject, loc); + namedata = X509_NAME_ENTRY_get_data(nameentry); + cnlen = ASN1_STRING_to_UTF8(&cn, namedata); + if (ip == NULL && + fetch_ssl_hname_match(host, strlen(host), cn, cnlen)) + ret = 1; + else if (ip != NULL && fetch_ssl_ipaddr_match(ip, cn, cnlen)) + ret = 1; + OPENSSL_free(cn); + } + return (ret); +} + +/* + * Verify that server certificate subjectAltName/CN matches + * hostname. First check, if there are alternative subject names. If yes, + * those have to match. Only if those don't exist it falls back to + * checking the subject's CN. + */ +static int +fetch_ssl_verify_hname(X509 *cert, const char *host) +{ + struct addrinfo *ip; + STACK_OF(GENERAL_NAME) *altnames; + X509_NAME *subject; + int ret; + + ret = 0; + ip = fetch_ssl_get_numeric_addrinfo(host, strlen(host)); + altnames = X509_get_ext_d2i(cert, NID_subject_alt_name, + NULL, NULL); + + if (altnames != NULL) { + ret = fetch_ssl_verify_altname(altnames, host, ip); + } else { + subject = X509_get_subject_name(cert); + if (subject != NULL) + ret = fetch_ssl_verify_cn(subject, host, ip); + } + + if (ip != NULL) + freeaddrinfo(ip); + if (altnames != NULL) + GENERAL_NAMES_free(altnames); + return (ret); +} + +/* + * Configure transport security layer based on environment. + */ +static void +fetch_ssl_setup_transport_layer(SSL_CTX *ctx, int verbose) +{ + long ssl_ctx_options; + + ssl_ctx_options = SSL_OP_ALL | SSL_OP_NO_TICKET; + if (getenv("SSL_ALLOW_SSL2") == NULL) + ssl_ctx_options |= SSL_OP_NO_SSLv2; + if (getenv("SSL_NO_SSL3") != NULL) + ssl_ctx_options |= SSL_OP_NO_SSLv3; + if (getenv("SSL_NO_TLS1") != NULL) + ssl_ctx_options |= SSL_OP_NO_TLSv1; + if (verbose) + fetch_info("SSL options: %x", ssl_ctx_options); + SSL_CTX_set_options(ctx, ssl_ctx_options); +} + + +/* + * Configure peer verification based on environment. + */ +static int +fetch_ssl_setup_peer_verification(SSL_CTX *ctx, int verbose) +{ + X509_LOOKUP *crl_lookup; + X509_STORE *crl_store; + const char *ca_cert_file, *ca_cert_path, *crl_file; + + if (getenv("SSL_NO_VERIFY_PEER") == NULL) { + ca_cert_file = getenv("SSL_CA_CERT_FILE") != NULL ? + getenv("SSL_CA_CERT_FILE") : "/etc/ssl/cert.pem"; + ca_cert_path = getenv("SSL_CA_CERT_PATH"); + if (verbose) { + fetch_info("Peer verification enabled"); + if (ca_cert_file != NULL) + fetch_info("Using CA cert file: %s", + ca_cert_file); + if (ca_cert_path != NULL) + fetch_info("Using CA cert path: %s", + ca_cert_path); + } + SSL_CTX_set_verify(ctx, SSL_VERIFY_PEER, + fetch_ssl_cb_verify_crt); + SSL_CTX_load_verify_locations(ctx, ca_cert_file, + ca_cert_path); + if ((crl_file = getenv("SSL_CRL_FILE")) != NULL) { + if (verbose) + fetch_info("Using CRL file: %s", crl_file); + crl_store = SSL_CTX_get_cert_store(ctx); + crl_lookup = X509_STORE_add_lookup(crl_store, + X509_LOOKUP_file()); + if (crl_lookup == NULL || + !X509_load_crl_file(crl_lookup, crl_file, + X509_FILETYPE_PEM)) { + fprintf(stderr, + "Could not load CRL file %s\n", + crl_file); + return (0); + } + X509_STORE_set_flags(crl_store, + X509_V_FLAG_CRL_CHECK | + X509_V_FLAG_CRL_CHECK_ALL); + } + } + return (1); +} + +/* + * Configure client certificate based on environment. + */ +static int +fetch_ssl_setup_client_certificate(SSL_CTX *ctx, int verbose) +{ + const char *client_cert_file, *client_key_file; + + if ((client_cert_file = getenv("SSL_CLIENT_CERT_FILE")) != NULL) { + client_key_file = getenv("SSL_CLIENT_KEY_FILE") != NULL ? + getenv("SSL_CLIENT_KEY_FILE") : client_cert_file; + if (verbose) { + fetch_info("Using client cert file: %s", + client_cert_file); + fetch_info("Using client key file: %s", + client_key_file); + } + if (SSL_CTX_use_certificate_chain_file(ctx, + client_cert_file) != 1) { + fprintf(stderr, + "Could not load client certificate %s\n", + client_cert_file); + return (0); + } + if (SSL_CTX_use_PrivateKey_file(ctx, client_key_file, + SSL_FILETYPE_PEM) != 1) { + fprintf(stderr, + "Could not load client key %s\n", + client_key_file); + return (0); + } + } + return (1); +} + +/* + * Callback for SSL certificate verification, this is called on server + * cert verification. It takes no decision, but informs the user in case + * verification failed. + */ +int +fetch_ssl_cb_verify_crt(int verified, X509_STORE_CTX *ctx) +{ + X509 *crt; + X509_NAME *name; + char *str; + + str = NULL; + if (!verified) { + if ((crt = X509_STORE_CTX_get_current_cert(ctx)) != NULL && + (name = X509_get_subject_name(crt)) != NULL) + str = X509_NAME_oneline(name, 0, 0); + fprintf(stderr, "Certificate verification failed for %s\n", + str != NULL ? str : "no relevant certificate"); + OPENSSL_free(str); + } + return (verified); +} + +#endif /* * Enable SSL on a connection. */ int -fetch_ssl(conn_t *conn, int verbose) +fetch_ssl(conn_t *conn, const struct url *URL, int verbose) { #ifdef WITH_SSL int ret, ssl_err; + X509_NAME *name; + char *str; /* Init the SSL library and context */ if (!SSL_library_init()){ @@ -339,8 +817,14 @@ fetch_ssl(conn_t *conn, int verbose) conn->ssl_ctx = SSL_CTX_new(conn->ssl_meth); SSL_CTX_set_mode(conn->ssl_ctx, SSL_MODE_AUTO_RETRY); + fetch_ssl_setup_transport_layer(conn->ssl_ctx, verbose); + if (!fetch_ssl_setup_peer_verification(conn->ssl_ctx, verbose)) + return (-1); + if (!fetch_ssl_setup_client_certificate(conn->ssl_ctx, verbose)) + return (-1); + conn->ssl = SSL_new(conn->ssl_ctx); - if (conn->ssl == NULL){ + if (conn->ssl == NULL) { fprintf(stderr, "SSL context creation failed\n"); return (-1); } @@ -353,22 +837,35 @@ fetch_ssl(conn_t *conn, int verbose) return (-1); } } + conn->ssl_cert = SSL_get_peer_certificate(conn->ssl); - if (verbose) { - X509_NAME *name; - char *str; + if (conn->ssl_cert == NULL) { + fprintf(stderr, "No server SSL certificate\n"); + return (-1); + } - fprintf(stderr, "SSL connection established using %s\n", + if (getenv("SSL_NO_VERIFY_HOSTNAME") == NULL) { + if (verbose) + fetch_info("Verify hostname"); + if (!fetch_ssl_verify_hname(conn->ssl_cert, URL->host)) { + fprintf(stderr, + "SSL certificate subject doesn't match host %s\n", + URL->host); + return (-1); + } + } + + if (verbose) { + fetch_info("SSL connection established using %s", SSL_get_cipher(conn->ssl)); - conn->ssl_cert = SSL_get_peer_certificate(conn->ssl); name = X509_get_subject_name(conn->ssl_cert); str = X509_NAME_oneline(name, 0, 0); - printf("Certificate subject: %s\n", str); - free(str); + fetch_info("Certificate subject: %s", str); + OPENSSL_free(str); name = X509_get_issuer_name(conn->ssl_cert); str = X509_NAME_oneline(name, 0, 0); - printf("Certificate issuer: %s\n", str); - free(str); + fetch_info("Certificate issuer: %s", str); + OPENSSL_free(str); } return (0); @@ -726,6 +1223,22 @@ fetch_close(conn_t *conn) if (--conn->ref > 0) return (0); +#ifdef WITH_SSL + if (conn->ssl) { + SSL_shutdown(conn->ssl); + SSL_set_connect_state(conn->ssl); + SSL_free(conn->ssl); + conn->ssl = NULL; + } + if (conn->ssl_ctx) { + SSL_CTX_free(conn->ssl_ctx); + conn->ssl_ctx = NULL; + } + if (conn->ssl_cert) { + X509_free(conn->ssl_cert); + conn->ssl_cert = NULL; + } +#endif ret = close(conn->sd); free(conn->cache.buf); free(conn->buf); Modified: stable/9/lib/libfetch/common.h ============================================================================== --- stable/9/lib/libfetch/common.h Thu Oct 10 09:32:27 2013 (r256256) +++ stable/9/lib/libfetch/common.h Thu Oct 10 09:42:41 2013 (r256257) @@ -87,7 +87,10 @@ int fetch_bind(int, int, const char *) conn_t *fetch_connect(const char *, int, int, int); conn_t *fetch_reopen(int); conn_t *fetch_ref(conn_t *); -int fetch_ssl(conn_t *, int); +#ifdef WITH_SSL +int fetch_ssl_cb_verify_crt(int, X509_STORE_CTX*); +#endif +int fetch_ssl(conn_t *, const struct url *, int); ssize_t fetch_read(conn_t *, char *, size_t); int fetch_getln(conn_t *); ssize_t fetch_write(conn_t *, const char *, size_t); Modified: stable/9/lib/libfetch/fetch.3 ============================================================================== --- stable/9/lib/libfetch/fetch.3 Thu Oct 10 09:32:27 2013 (r256256) +++ stable/9/lib/libfetch/fetch.3 Thu Oct 10 09:42:41 2013 (r256257) @@ -1,5 +1,6 @@ .\"- -.\" Copyright (c) 1998-2011 Dag-Erling Smørgrav +.\" Copyright (c) 1998-2013 Dag-Erling Smørgrav +.\" Copyright (c) 2013 Michael Gmelin .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -25,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 27, 2011 +.Dd July 30, 2013 .Dt FETCH 3 .Os .Sh NAME @@ -392,6 +393,60 @@ method in a manner consistent with the r library, .Fn fetchPutHTTP is currently unimplemented. +.Sh HTTPS SCHEME +Based on HTTP SCHEME. +By default the peer is verified using the CA bundle located in +.Pa /etc/ssl/cert.pem . +The file may contain multiple CA certificates. +A common source of a current CA bundle is +.Pa \%security/ca_root_nss . +.Pp +The CA bundle used for peer verification can be changed by setting the +environment variables +.Ev SSL_CA_CERT_FILE +to point to a concatenated bundle of trusted certificates and +.Ev SSL_CA_CERT_PATH +to point to a directory containing hashes of trusted CAs (see +.Xr verify 1 ) . +.Pp +A certificate revocation list (CRL) can be used by setting the +environment variable +.Ev SSL_CRL_FILE +(see +.Xr crl 1 ) . +.Pp +Peer verification can be disabled by setting the environment variable +.Ev SSL_NO_VERIFY_PEER . +Note that this also disables CRL checking. +.Pp +By default the service identity is verified according to the rules +detailed in RFC6125 (also known as hostname verification). +This feature can be disabled by setting the environment variable +.Ev SSL_NO_VERIFY_HOSTNAME . +.Pp +Client certificate based authentication is supported. +The environment variable +.Ev SSL_CLIENT_CERT_FILE +should be set to point to a file containing key and client certificate +to be used in PEM format. In case the key is stored in a separate +file, the environment variable +.Ev SSL_CLIENT_KEY_FILE +can be set to point to the key in PEM format. +In case the key uses a password, the user will be prompted on standard +input (see +.Xr PEM 3 ) . +.Pp +By default +.Nm libfetch +allows SSLv3 and TLSv1 when negotiating the connecting with the remote +peer. +You can change this behavior by setting the environment variable +.Ev SSL_ALLOW_SSL2 +to allow SSLv2 (not recommended) and +.Ev SSL_NO_SSL3 +or +.Ev SSL_NO_TLS1 +to disable the respective methods. .Sh AUTHENTICATION Apart from setting the appropriate environment variables and specifying the user name and password in the URL or the @@ -516,6 +571,15 @@ variable is set. Same as .Ev FTP_PROXY , for compatibility. +.It Ev HTTP_ACCEPT +Specifies the value of the +.Va Accept +header for HTTP requests. +If empty, no +.Va Accept +header is sent. +The default is +.Dq */* . .It Ev HTTP_AUTH Specifies HTTP authorization parameters as a colon-separated list of items. @@ -579,6 +643,31 @@ which proxies should not be used. Same as .Ev NO_PROXY , for compatibility. +.It Ev SSL_ALLOW_SSL2 +Allow SSL version 2 when negotiating the connection (not recommended). +.It Ev SSL_CA_CERT_FILE +CA certificate bundle containing trusted CA certificates. +Default value: +.Pa /etc/ssl/cert.pem . +.It Ev SSL_CA_CERT_PATH +Path containing trusted CA hashes. +.It Ev SSL_CLIENT_CERT_FILE +PEM encoded client certificate/key which will be used in +client certificate authentication. +.It Ev SSL_CLIENT_KEY_FILE +PEM encoded client key in case key and client certificate +are stored separately. +.It Ev SSL_CRL_FILE +File containing certificate revocation list. +.It Ev SSL_NO_SSL3 +Don't allow SSL version 3 when negotiating the connection. +.It Ev SSL_NO_TLS1 +Don't allow TLV version 1 when negotiating the connection. +.It Ev SSL_NO_VERIFY_HOSTNAME +If set, do not verify that the hostname matches the subject of the +certificate presented by the server. +.It Ev SSL_NO_VERIFY_PEER +If set, do not verify the peer certificate against trusted CAs. .El .Sh EXAMPLES To access a proxy server on @@ -610,6 +699,19 @@ as follows: .Bd -literal -offset indent NO_PROXY=localhost,127.0.0.1 .Ed +.Pp +Access HTTPS website without any certificate verification whatsoever: +.Bd -literal -offset indent +SSL_NO_VERIFY_PEER=1 +SSL_NO_VERIFY_HOSTNAME=1 +.Ed +.Pp +Access HTTPS website using client certificate based authentication +and a private CA: +.Bd -literal -offset indent +SSL_CLIENT_CERT_FILE=/path/to/client.pem +SSL_CA_CERT_FILE=/path/to/myca.pem +.Ed .Sh SEE ALSO .Xr fetch 1 , .Xr ftpio 3 , @@ -678,7 +780,8 @@ with numerous suggestions and contributi .An Hajimu Umemoto Aq ume@FreeBSD.org , .An Henry Whincup Aq henry@techiebod.com , .An Jukka A. Ukkonen Aq jau@iki.fi , -.An Jean-Fran\(,cois Dockes Aq jf@dockes.org +.An Jean-Fran\(,cois Dockes Aq jf@dockes.org , +.An Michael Gmelin Aq freebsd@grem.de and others. It replaces the older .Nm ftpio @@ -688,7 +791,9 @@ and .An Jordan K. Hubbard Aq jkh@FreeBSD.org . .Pp This manual page was written by -.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org . +.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org +and +.An Michael Gmelin Aq freebsd@grem.de . .Sh BUGS Some parts of the library are not yet implemented. The most notable @@ -717,6 +822,10 @@ implemented, superfluous at this site" i .Fn fetchStatFTP does not check that the result of an MDTM command is a valid date. .Pp +In case password protected keys are used for client certificate based +authentication the user is prompted for the password on each and every +fetch operation. +.Pp The man page is incomplete, poorly written and produces badly formatted text. .Pp Modified: stable/9/lib/libfetch/http.c ============================================================================== --- stable/9/lib/libfetch/http.c Thu Oct 10 09:32:27 2013 (r256256) +++ stable/9/lib/libfetch/http.c Thu Oct 10 09:42:41 2013 (r256257) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2000-2011 Dag-Erling Smørgrav + * Copyright (c) 2000-2013 Dag-Erling Smørgrav * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -1400,6 +1400,8 @@ http_connect(struct url *URL, struct url if (strcasecmp(URL->scheme, SCHEME_HTTPS) == 0 && purl) { http_cmd(conn, "CONNECT %s:%d HTTP/1.1", URL->host, URL->port); + http_cmd(conn, "Host: %s:%d", + URL->host, URL->port); http_cmd(conn, ""); if (http_get_reply(conn) != HTTP_OK) { fetch_close(conn); @@ -1408,7 +1410,7 @@ http_connect(struct url *URL, struct url http_get_reply(conn); } if (strcasecmp(URL->scheme, SCHEME_HTTPS) == 0 && - fetch_ssl(conn, verbose) == -1) { + fetch_ssl(conn, URL, verbose) == -1) { fetch_close(conn); /* grrr */ errno = EAUTH; @@ -1581,7 +1583,7 @@ http_request(struct url *URL, const char if (verbose) fetch_info("requesting %s://%s%s", url->scheme, host, url->doc); - if (purl) { + if (purl && strcasecmp(URL->scheme, SCHEME_HTTPS) != 0) { http_cmd(conn, "%s %s://%s%s HTTP/1.1", op, url->scheme, host, url->doc); } else { @@ -1664,6 +1666,12 @@ http_request(struct url *URL, const char } /* other headers */ + if ((p = getenv("HTTP_ACCEPT")) != NULL) { + if (*p != '\0') + http_cmd(conn, "Accept: %s", p); + } else { + http_cmd(conn, "Accept: */*"); + } if ((p = getenv("HTTP_REFERER")) != NULL && *p != '\0') { if (strcasecmp(p, "auto") == 0) http_cmd(conn, "Referer: %s://%s%s", From owner-svn-src-stable-9@FreeBSD.ORG Thu Oct 10 11:56:44 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 466D2AFD; Thu, 10 Oct 2013 11:56:44 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 3354A250A; Thu, 10 Oct 2013 11:56:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9ABuiqd087040; Thu, 10 Oct 2013 11:56:44 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9ABuiM4087039; Thu, 10 Oct 2013 11:56:44 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201310101156.r9ABuiM4087039@svn.freebsd.org> From: Glen Barber Date: Thu, 10 Oct 2013 11:56:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256264 - stable/9/etc/rc.d X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Oct 2013 11:56:44 -0000 Author: gjb Date: Thu Oct 10 11:56:43 2013 New Revision: 256264 URL: http://svnweb.freebsd.org/changeset/base/256264 Log: Fix mismerge introduced in r256230, adding auditdistd back to etc/rc.d/Makefile. Submitted by: Herbert J. Skuhra Pointyhat to: gjb Modified: stable/9/etc/rc.d/Makefile Modified: stable/9/etc/rc.d/Makefile ============================================================================== --- stable/9/etc/rc.d/Makefile Thu Oct 10 11:51:11 2013 (r256263) +++ stable/9/etc/rc.d/Makefile Thu Oct 10 11:56:43 2013 (r256264) @@ -19,6 +19,7 @@ FILES= DAEMON \ atm2 \ atm3 \ auditd \ + auditdistd \ bgfsck \ ${_bluetooth} \ bootparams \ From owner-svn-src-stable-9@FreeBSD.ORG Thu Oct 10 12:46:28 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id EB62063F; Thu, 10 Oct 2013 12:46:27 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id C9EE42912; Thu, 10 Oct 2013 12:46:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9ACkRQD012785; Thu, 10 Oct 2013 12:46:27 GMT (envelope-from bdrewery@svn.freebsd.org) Received: (from bdrewery@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9ACkQOY012780; Thu, 10 Oct 2013 12:46:26 GMT (envelope-from bdrewery@svn.freebsd.org) Message-Id: <201310101246.r9ACkQOY012780@svn.freebsd.org> From: Bryan Drewery Date: Thu, 10 Oct 2013 12:46:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256266 - in stable/9/sys/boot: i386/efi powerpc/boot1.chrp userboot/libstand userboot/test userboot/userboot X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Oct 2013 12:46:28 -0000 Author: bdrewery (ports committer) Date: Thu Oct 10 12:46:26 2013 New Revision: 256266 URL: http://svnweb.freebsd.org/changeset/base/256266 Log: MFC r255944: Use MK_SSP=no after including bsd.own.mk to disable SSP instead of user-knob WITH[OUT]_SSP to avoid hitting an error if user has WITH_SSP in their make.conf. Ports now use this knob. make[7]: "/usr/src/share/mk/bsd.own.mk" line 466: WITH_SSP and WITHOUT_SSP can't both be set. Approved by: bapt Modified: stable/9/sys/boot/i386/efi/Makefile stable/9/sys/boot/powerpc/boot1.chrp/Makefile stable/9/sys/boot/userboot/libstand/Makefile stable/9/sys/boot/userboot/test/Makefile stable/9/sys/boot/userboot/userboot/Makefile Directory Properties: stable/9/sys/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) Modified: stable/9/sys/boot/i386/efi/Makefile ============================================================================== --- stable/9/sys/boot/i386/efi/Makefile Thu Oct 10 12:44:00 2013 (r256265) +++ stable/9/sys/boot/i386/efi/Makefile Thu Oct 10 12:46:26 2013 (r256266) @@ -1,10 +1,10 @@ # $FreeBSD$ NO_MAN= -WITHOUT_SSP= BUILDING_EFI= .include +MK_SSP= no PROG= loader.sym INTERNALPROG= Modified: stable/9/sys/boot/powerpc/boot1.chrp/Makefile ============================================================================== --- stable/9/sys/boot/powerpc/boot1.chrp/Makefile Thu Oct 10 12:44:00 2013 (r256265) +++ stable/9/sys/boot/powerpc/boot1.chrp/Makefile Thu Oct 10 12:46:26 2013 (r256266) @@ -1,6 +1,6 @@ # $FreeBSD$ -WITHOUT_SSP= +SSP_CFLAGS= PROG= boot1.elf NEWVERSWHAT= "Open Firmware boot block" ${MACHINE_ARCH} Modified: stable/9/sys/boot/userboot/libstand/Makefile ============================================================================== --- stable/9/sys/boot/userboot/libstand/Makefile Thu Oct 10 12:44:00 2013 (r256265) +++ stable/9/sys/boot/userboot/libstand/Makefile Thu Oct 10 12:46:26 2013 (r256266) @@ -6,10 +6,10 @@ # quite large. # -WITHOUT_SSP= NO_MAN= .include +MK_SSP= no S= ${.CURDIR}/../../../../lib/libstand Modified: stable/9/sys/boot/userboot/test/Makefile ============================================================================== --- stable/9/sys/boot/userboot/test/Makefile Thu Oct 10 12:44:00 2013 (r256265) +++ stable/9/sys/boot/userboot/test/Makefile Thu Oct 10 12:46:26 2013 (r256266) @@ -2,9 +2,9 @@ NO_MAN= -WITHOUT_SSP= .include +MK_SSP= no PROG= test INTERNALPROG= Modified: stable/9/sys/boot/userboot/userboot/Makefile ============================================================================== --- stable/9/sys/boot/userboot/userboot/Makefile Thu Oct 10 12:44:00 2013 (r256265) +++ stable/9/sys/boot/userboot/userboot/Makefile Thu Oct 10 12:46:26 2013 (r256266) @@ -1,9 +1,9 @@ # $FreeBSD$ NO_MAN= -WITHOUT_SSP= .include +MK_SSP= no SHLIB_NAME= userboot.so NO_CTF= yes From owner-svn-src-stable-9@FreeBSD.ORG Thu Oct 10 12:47:34 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 3F11D935; Thu, 10 Oct 2013 12:47:34 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 2A0D02922; Thu, 10 Oct 2013 12:47:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9AClYkU013325; Thu, 10 Oct 2013 12:47:34 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9AClXmB013314; Thu, 10 Oct 2013 12:47:33 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201310101247.r9AClXmB013314@svn.freebsd.org> From: Gleb Smirnoff Date: Thu, 10 Oct 2013 12:47:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256267 - stable/9/usr.bin/fetch X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Oct 2013 12:47:34 -0000 Author: glebius Date: Thu Oct 10 12:47:33 2013 New Revision: 256267 URL: http://svnweb.freebsd.org/changeset/base/256267 Log: Merge r253680,253805 from head: ---------------------------------------------------------------------- r253680 | des | 2013-07-26 19:53:43 +0400 (Fri, 26 Jul 2013) | 7 lines Implement certificate verification, and many other SSL-related imrovements; complete details in the PR. PR: kern/175514 Submitted by: Michael Gmelin MFC after: 1 week ---------------------------------------------------------------------- r253805 | des | 2013-07-30 17:07:55 +0400 (Tue, 30 Jul 2013) | 5 lines Include an Accept header in requests. PR: kern/180917 MFC after: 1 week Reviewed by: des Modified: stable/9/usr.bin/fetch/fetch.1 stable/9/usr.bin/fetch/fetch.c Directory Properties: stable/9/usr.bin/fetch/ (props changed) Modified: stable/9/usr.bin/fetch/fetch.1 ============================================================================== --- stable/9/usr.bin/fetch/fetch.1 Thu Oct 10 12:46:26 2013 (r256266) +++ stable/9/usr.bin/fetch/fetch.1 Thu Oct 10 12:47:33 2013 (r256267) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 27, 2011 +.Dd July 30, 2013 .Dt FETCH 1 .Os .Sh NAME @@ -38,22 +38,51 @@ .Sh SYNOPSIS .Nm .Op Fl 146AadFlMmnPpqRrsUv +.Op Fl -allow-sslv2 .Op Fl B Ar bytes +.Op Fl -bind-address= Ns Ar host +.Op Fl -ca-cert= Ns Ar file +.Op Fl -ca-path= Ns Ar dir +.Op Fl -cert= Ns Ar file +.Op Fl -crl= Ns Ar file .Op Fl i Ar file +.Op Fl -key= Ns Ar file .Op Fl N Ar file +.Op Fl -no-passive +.Op Fl -no-proxy= Ns Ar list +.Op Fl -no-sslv3 +.Op Fl -no-tlsv1 +.Op Fl -no-verify-hostname +.Op Fl -no-verify-peer .Op Fl o Ar file +.Op Fl -referer= Ns Ar URL .Op Fl S Ar bytes .Op Fl T Ar seconds +.Op Fl -user-agent= Ns Ar agent-string .Op Fl w Ar seconds .Ar URL ... .Nm .Op Fl 146AadFlMmnPpqRrsUv .Op Fl B Ar bytes +.Op Fl -bind-address= Ns Ar host +.Op Fl -ca-cert= Ns Ar file +.Op Fl -ca-path= Ns Ar dir +.Op Fl -cert= Ns Ar file +.Op Fl -crl= Ns Ar file .Op Fl i Ar file +.Op Fl -key= Ns Ar file .Op Fl N Ar file +.Op Fl -no-passive +.Op Fl -no-proxy= Ns Ar list +.Op Fl -no-sslv3 +.Op Fl -no-tlsv1 +.Op Fl -no-verify-hostname +.Op Fl -no-verify-peer .Op Fl o Ar file +.Op Fl -referer= Ns Ar URL .Op Fl S Ar bytes .Op Fl T Ar seconds +.Op Fl -user-agent= Ns Ar agent-string .Op Fl w Ar seconds .Fl h Ar host Fl f Ar file Oo Fl c Ar dir Oc .Sh DESCRIPTION @@ -67,23 +96,26 @@ command line. .Pp The following options are available: .Bl -tag -width Fl -.It Fl 1 +.It Fl 1 , -one-file Stop and return exit code 0 at the first successfully retrieved file. -.It Fl 4 +.It Fl 4 , -ipv4-only Forces .Nm to use IPv4 addresses only. -.It Fl 6 +.It Fl 6 , -ipv6-only Forces .Nm to use IPv6 addresses only. -.It Fl A +.It Fl A , -no-redirect Do not automatically follow ``temporary'' (302) redirects. Some broken Web sites will return a redirect instead of a not-found error when the requested object does not exist. -.It Fl a +.It Fl a , -retry Automatically retry the transfer upon soft failures. -.It Fl B Ar bytes +.It Fl -allow-sslv2 +[SSL] +Allow SSL version 2 when negotiating the connection. +.It Fl B Ar bytes , Fl -buffer-size= Ns Ar bytes Specify the read buffer size in bytes. The default is 4096 bytes. Attempts to set a buffer size lower than this will be silently @@ -92,15 +124,43 @@ The number of reads actually performed i two or higher (see the .Fl v flag). +.It Fl -bind-address= Ns Ar host +Specifies a hostname or IP address to which sockets used for outgoing +connections will be bound. .It Fl c Ar dir The file to retrieve is in directory .Ar dir on the remote host. This option is deprecated and is provided for backward compatibility only. -.It Fl d +.It Fl -ca-cert= Ns Ar file +[SSL] +Path to certificate bundle containing trusted CA certificates. +If not specified, +.Pa /etc/ssl/cert.pem +is used. +The file may contain multiple CA certificates. The port +.Pa security/ca_root_nss +is a common source of a current CA bundle. +.It Fl -ca-path= Ns Ar dir +[SSL] +The directory +.Ar dir +contains trusted CA hashes. +.It Fl -cert= Ns Ar file +[SSL] +.Ar file +is a PEM encoded client certificate/key which will be used in +client certificate authentication. +.It Fl -crl= Ns Ar file +[SSL] +Points to certificate revocation list +.Ar file , +which has to be in PEM format and may contain peer certificates that have +been revoked. +.It Fl d , -direct Use a direct connection even if a proxy is configured. -.It Fl F +.It Fl F , -force-restart In combination with the .Fl r flag, forces a restart even if the local and remote files have @@ -118,17 +178,22 @@ The file to retrieve is located on the h .Ar host . This option is deprecated and is provided for backward compatibility only. -.It Fl i Ar file +.It Fl i Ar file , Fl -if-modified-since= Ns Ar file If-Modified-Since mode: the remote file will only be retrieved if it is newer than .Ar file on the local host. (HTTP only) -.It Fl l +.It Fl -key= Ns Ar file +[SSL] +.Ar file +is a PEM encoded client key that will be used in client certificate +authentication in case key and client certificate are stored separately. +.It Fl l , -symlink If the target is a file-scheme URL, make a symbolic link to the target rather than trying to copy it. .It Fl M -.It Fl m +.It Fl m , -mirror Mirror mode: if the file already exists locally and has the same size and modification time as the remote file, it will not be fetched. Note that the @@ -136,7 +201,7 @@ Note that the and .Fl r flags are mutually exclusive. -.It Fl N Ar file +.It Fl N Ar file , Fl -netrc= Ns Ar file Use .Ar file instead of @@ -146,9 +211,28 @@ See .Xr ftp 1 for a description of the file format. This feature is experimental. -.It Fl n +.It Fl n , -no-mtime Do not preserve the modification time of the transferred file. -.It Fl o Ar file +.It Fl -no-passive +Forces the FTP code to use active mode. +.It Fl -no-proxy= Ns Ar list +Either a single asterisk, which disables the use of proxies +altogether, or a comma- or whitespace-separated list of hosts for +which proxies should not be used. +.It Fl -no-sslv3 +[SSL] +Don't allow SSL version 3 when negotiating the connection. +.It Fl -no-tlsv1 +[SSL] +Don't allow TLS version 1 when negotiating the connection. +.It Fl -no-verify-hostname +[SSL] +Do not verify that the hostname matches the subject of the +certificate presented by the server. +.It Fl -no-verify-peer +[SSL] +Do not verify the peer certificate against trusted CAs. +.It Fl o Ar file , Fl output= Ns Ar file Set the output file name to .Ar file . By default, a ``pathname'' is extracted from the specified URI, and @@ -163,36 +247,45 @@ If the argument is a directory, fetched file(s) will be placed within the directory, with name(s) selected as in the default behaviour. .It Fl P -.It Fl p +.It Fl p , -passive Use passive FTP. These flags have no effect, since passive FTP is the default, but are provided for compatibility with earlier versions where active FTP was the default. -To force active mode, set the +To force active mode, use the +.Fl -no-passive +flag or set the .Ev FTP_PASSIVE_MODE environment variable to .Ql NO . -.It Fl q +.It Fl -referer= Ns Ar URL +Specifies the referrer URL to use for HTTP requests. +If +.Ar URL +is set to +.Dq auto , +the document URL will be used as referrer URL. +.It Fl q , -quiet Quiet mode. -.It Fl R +.It Fl R , -keep-output The output files are precious, and should not be deleted under any circumstances, even if the transfer failed or was incomplete. -.It Fl r +.It Fl r , -restart Restart a previously interrupted transfer. Note that the .Fl m and .Fl r flags are mutually exclusive. -.It Fl S Ar bytes +.It Fl S Ar bytes , Fl -require-size= Ns Ar bytes Require the file size reported by the server to match the specified value. If it does not, a message is printed and the file is not fetched. If the server does not support reporting file sizes, this option is ignored and the file is fetched unconditionally. -.It Fl s +.It Fl s , -print-size Print the size in bytes of each requested file, without fetching it. -.It Fl T Ar seconds +.It Fl T Ar seconds , Fl -timeout= Ns Ar seconds Set timeout value to .Ar seconds . Overrides the environment variables @@ -200,15 +293,19 @@ Overrides the environment variables for FTP transfers or .Ev HTTP_TIMEOUT for HTTP transfers if set. -.It Fl U +.It Fl U , -passive-portrange-default When using passive FTP, allocate the port for the data connection from the low (default) port range. See .Xr ip 4 for details on how to specify which port range this corresponds to. -.It Fl v +.It Fl -user-agent= Ns Ar agent-string +Specifies the User-Agent string to use for HTTP requests. +This can be useful when working with HTTP origin or proxy servers that +differentiate between user agents. +.It Fl v , -verbose Increase verbosity level. -.It Fl w Ar seconds +.It Fl w Ar seconds , Fl -retry-delay= Ns Ar seconds When the .Fl a flag is specified, wait this many seconds between successive retries. @@ -242,6 +339,7 @@ for a description of additional environm .Ev FTP_PASSWORD , .Ev FTP_PROXY , .Ev ftp_proxy , +.Ev HTTP_ACCEPT , .Ev HTTP_AUTH , .Ev HTTP_PROXY , .Ev http_proxy , @@ -249,8 +347,19 @@ for a description of additional environm .Ev HTTP_REFERER , .Ev HTTP_USER_AGENT , .Ev NETRC , -.Ev NO_PROXY No and -.Ev no_proxy . +.Ev NO_PROXY , +.Ev no_proxy , +.Ev SSL_ALLOW_SSL2 , +.Ev SSL_CA_CERT_FILE , +.Ev SSL_CA_CERT_PATH , +.Ev SSL_CLIENT_CERT_FILE , +.Ev SSL_CLIENT_KEY_FILE , +.Ev SSL_CRL_FILE , +.Ev SSL_NO_SSL3 , +.Ev SSL_NO_TLS1 , +.Ev SSL_NO_VERIFY_HOSTNAME +and +.Ev SSL_NO_VERIFY_PEER . .Sh EXIT STATUS The .Nm @@ -287,7 +396,9 @@ by and later completely rewritten to use the .Xr fetch 3 library by -.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org . +.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org +and +.An Michael Gmelin Aq freebsd@grem.de . .Sh NOTES The .Fl b Modified: stable/9/usr.bin/fetch/fetch.c ============================================================================== --- stable/9/usr.bin/fetch/fetch.c Thu Oct 10 12:46:26 2013 (r256266) +++ stable/9/usr.bin/fetch/fetch.c Thu Oct 10 12:47:33 2013 (r256267) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2000-2011 Dag-Erling Smørgrav + * Copyright (c) 2013 Michael Gmelin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -37,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -93,6 +95,78 @@ long ftp_timeout = TIMEOUT; /* default long http_timeout = TIMEOUT; /* default timeout for HTTP transfers */ char *buf; /* transfer buffer */ +enum options +{ + OPTION_BIND_ADDRESS, + OPTION_NO_FTP_PASSIVE_MODE, + OPTION_HTTP_REFERER, + OPTION_HTTP_USER_AGENT, + OPTION_NO_PROXY, + OPTION_SSL_ALLOW_SSL2, + OPTION_SSL_CA_CERT_FILE, + OPTION_SSL_CA_CERT_PATH, + OPTION_SSL_CLIENT_CERT_FILE, + OPTION_SSL_CLIENT_KEY_FILE, + OPTION_SSL_CRL_FILE, + OPTION_SSL_NO_SSL3, + OPTION_SSL_NO_TLS1, + OPTION_SSL_NO_VERIFY_HOSTNAME, + OPTION_SSL_NO_VERIFY_PEER +}; + + +static struct option longopts[] = +{ + /* mapping to single character argument */ + { "one-file", no_argument, NULL, '1' }, + { "ipv4-only", no_argument, NULL, '4' }, + { "ipv6-only", no_argument, NULL, '6' }, + { "no-redirect", no_argument, NULL, 'A' }, + { "retry", no_argument, NULL, 'a' }, + { "buffer-size", required_argument, NULL, 'B' }, + /* -c not mapped, since it's deprecated */ + { "direct", no_argument, NULL, 'd' }, + { "force-restart", no_argument, NULL, 'F' }, + /* -f not mapped, since it's deprecated */ + /* -h not mapped, since it's deprecated */ + { "if-modified-since", required_argument, NULL, 'i' }, + { "symlink", no_argument, NULL, 'l' }, + /* -M not mapped since it's the same as -m */ + { "mirror", no_argument, NULL, 'm' }, + { "netrc", required_argument, NULL, 'N' }, + { "no-mtime", no_argument, NULL, 'n' }, + { "output", required_argument, NULL, 'o' }, + /* -P not mapped since it's the same as -p */ + { "passive", no_argument, NULL, 'p' }, + { "quiet", no_argument, NULL, 'q' }, + { "keep-output", no_argument, NULL, 'R' }, + { "restart", no_argument, NULL, 'r' }, + { "require-size", required_argument, NULL, 'S' }, + { "print-size", no_argument, NULL, 's' }, + { "timeout", required_argument, NULL, 'T' }, + { "passive-portrange-default", no_argument, NULL, 'T' }, + { "verbose", no_argument, NULL, 'v' }, + { "retry-delay", required_argument, NULL, 'w' }, + + /* options without a single character equivalent */ + { "bind-address", required_argument, NULL, OPTION_BIND_ADDRESS }, + { "no-passive", no_argument, NULL, OPTION_NO_FTP_PASSIVE_MODE }, + { "referer", required_argument, NULL, OPTION_HTTP_REFERER }, + { "user-agent", required_argument, NULL, OPTION_HTTP_USER_AGENT }, + { "no-proxy", required_argument, NULL, OPTION_NO_PROXY }, + { "allow-sslv2", no_argument, NULL, OPTION_SSL_ALLOW_SSL2 }, + { "ca-cert", required_argument, NULL, OPTION_SSL_CA_CERT_FILE }, + { "ca-path", required_argument, NULL, OPTION_SSL_CA_CERT_PATH }, + { "cert", required_argument, NULL, OPTION_SSL_CLIENT_CERT_FILE }, + { "key", required_argument, NULL, OPTION_SSL_CLIENT_KEY_FILE }, + { "crl", required_argument, NULL, OPTION_SSL_CRL_FILE }, + { "no-sslv3", no_argument, NULL, OPTION_SSL_NO_SSL3 }, + { "no-tlsv1", no_argument, NULL, OPTION_SSL_NO_TLS1 }, + { "no-verify-hostname", no_argument, NULL, OPTION_SSL_NO_VERIFY_HOSTNAME }, + { "no-verify-peer", no_argument, NULL, OPTION_SSL_NO_VERIFY_PEER }, + + { NULL, 0, NULL, 0 } +}; /* * Signal handler @@ -769,11 +843,19 @@ fetch(char *URL, const char *path) static void usage(void) { - fprintf(stderr, "%s\n%s\n%s\n%s\n", -"usage: fetch [-146AadFlMmnPpqRrsUv] [-B bytes] [-N file] [-o file] [-S bytes]", -" [-T seconds] [-w seconds] [-i file] URL ...", -" fetch [-146AadFlMmnPpqRrsUv] [-B bytes] [-N file] [-o file] [-S bytes]", -" [-T seconds] [-w seconds] [-i file] -h host -f file [-c dir]"); + fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n", +"usage: fetch [-146AadFlMmnPpqRrsUv] [--allow-sslv2] [-B bytes]", +" [--bind-address=host] [--ca-cert=file] [--ca-path=dir] [--cert=file]", +" [--crl=file] [-i file] [--key=file] [-N file] [--no-passive]", +" [--no-proxy=list] [--no-sslv3] [--no-tlsv1] [--no-verify-hostname]", +" [--no-verify-peer] [-o file] [--referer=URL] [-S bytes] [-T seconds]", +" [--user-agent=agent-string] [-w seconds] URL ...", +" fetch [-146AadFlMmnPpqRrsUv] [--allow-sslv2] [-B bytes]", +" [--bind-address=host] [--ca-cert=file] [--ca-path=dir] [--cert=file]", +" [--crl=file] [-i file] [--key=file] [-N file] [--no-passive]", +" [--no-proxy=list] [--no-sslv3] [--no-tlsv1] [--no-verify-hostname]", +" [--no-verify-peer] [-o file] [--referer=URL] [-S bytes] [-T seconds]", +" [--user-agent=agent-string] [-w seconds] -h host -f file [-c dir]"); } @@ -789,8 +871,10 @@ main(int argc, char *argv[]) char *end, *q; int c, e, r; - while ((c = getopt(argc, argv, - "146AaB:bc:dFf:Hh:i:lMmN:nPpo:qRrS:sT:tUvw:")) != -1) + + while ((c = getopt_long(argc, argv, + "146AaB:bc:dFf:Hh:i:lMmN:nPpo:qRrS:sT:tUvw:", + longopts, NULL)) != -1) switch (c) { case '1': once_flag = 1; @@ -904,6 +988,51 @@ main(int argc, char *argv[]) if (*optarg == '\0' || *end != '\0') errx(1, "invalid delay (%s)", optarg); break; + case OPTION_BIND_ADDRESS: + setenv("FETCH_BIND_ADDRESS", optarg, 1); + break; + case OPTION_NO_FTP_PASSIVE_MODE: + setenv("FTP_PASSIVE_MODE", "no", 1); + break; + case OPTION_HTTP_REFERER: + setenv("HTTP_REFERER", optarg, 1); + break; + case OPTION_HTTP_USER_AGENT: + setenv("HTTP_USER_AGENT", optarg, 1); + break; + case OPTION_NO_PROXY: + setenv("NO_PROXY", optarg, 1); + break; + case OPTION_SSL_ALLOW_SSL2: + setenv("SSL_ALLOW_SSL2", "", 1); + break; + case OPTION_SSL_CA_CERT_FILE: + setenv("SSL_CA_CERT_FILE", optarg, 1); + break; + case OPTION_SSL_CA_CERT_PATH: + setenv("SSL_CA_CERT_PATH", optarg, 1); + break; + case OPTION_SSL_CLIENT_CERT_FILE: + setenv("SSL_CLIENT_CERT_FILE", optarg, 1); + break; + case OPTION_SSL_CLIENT_KEY_FILE: + setenv("SSL_CLIENT_KEY_FILE", optarg, 1); + break; + case OPTION_SSL_CRL_FILE: + setenv("SSL_CLIENT_CRL_FILE", optarg, 1); + break; + case OPTION_SSL_NO_SSL3: + setenv("SSL_NO_SSL3", "", 1); + break; + case OPTION_SSL_NO_TLS1: + setenv("SSL_NO_TLS1", "", 1); + break; + case OPTION_SSL_NO_VERIFY_HOSTNAME: + setenv("SSL_NO_VERIFY_HOSTNAME", "", 1); + break; + case OPTION_SSL_NO_VERIFY_PEER: + setenv("SSL_NO_VERIFY_PEER", "", 1); + break; default: usage(); exit(1); From owner-svn-src-stable-9@FreeBSD.ORG Thu Oct 10 14:34:02 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id BB60987B; Thu, 10 Oct 2013 14:34:02 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A6DB820DE; Thu, 10 Oct 2013 14:34:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9AEY2eo069290; Thu, 10 Oct 2013 14:34:02 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9AEY1ai069285; Thu, 10 Oct 2013 14:34:01 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201310101434.r9AEY1ai069285@svn.freebsd.org> From: John Baldwin Date: Thu, 10 Oct 2013 14:34:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256272 - stable/9/sys/dev/pci X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Oct 2013 14:34:02 -0000 Author: jhb Date: Thu Oct 10 14:34:01 2013 New Revision: 256272 URL: http://svnweb.freebsd.org/changeset/base/256272 Log: MFC 253450: Properly handle I/O windows in bridges with the ISA enable bit set. These beasts still exist unfortunately. More details can be found in other references, but the short version is that bridges with this bit set ignore I/O port ranges that alias to valid ISA I/O port ranges. In the driver this requires not allocating these alias regions from the parent device (so they are free to be acquired by ISA devices), and ensuring no child devices use resources from these alias regions. Modified: stable/9/sys/dev/pci/pci.c stable/9/sys/dev/pci/pci_pci.c stable/9/sys/dev/pci/pci_private.h stable/9/sys/dev/pci/pcib_private.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/pci/pci.c ============================================================================== --- stable/9/sys/dev/pci/pci.c Thu Oct 10 14:21:27 2013 (r256271) +++ stable/9/sys/dev/pci/pci.c Thu Oct 10 14:34:01 2013 (r256272) @@ -162,7 +162,7 @@ static device_method_t pci_methods[] = { DEVMETHOD(bus_delete_resource, pci_delete_resource), DEVMETHOD(bus_alloc_resource, pci_alloc_resource), DEVMETHOD(bus_adjust_resource, bus_generic_adjust_resource), - DEVMETHOD(bus_release_resource, bus_generic_rl_release_resource), + DEVMETHOD(bus_release_resource, pci_release_resource), DEVMETHOD(bus_activate_resource, pci_activate_resource), DEVMETHOD(bus_deactivate_resource, pci_deactivate_resource), DEVMETHOD(bus_child_pnpinfo_str, pci_child_pnpinfo_str_method), @@ -4172,11 +4172,11 @@ struct resource * pci_alloc_resource(device_t dev, device_t child, int type, int *rid, u_long start, u_long end, u_long count, u_int flags) { - struct pci_devinfo *dinfo = device_get_ivars(child); - struct resource_list *rl = &dinfo->resources; + struct pci_devinfo *dinfo; + struct resource_list *rl; struct resource_list_entry *rle; struct resource *res; - pcicfgregs *cfg = &dinfo->cfg; + pcicfgregs *cfg; if (device_get_parent(child) != dev) return (BUS_ALLOC_RESOURCE(device_get_parent(dev), child, @@ -4185,6 +4185,9 @@ pci_alloc_resource(device_t dev, device_ /* * Perform lazy resource allocation */ + dinfo = device_get_ivars(child); + rl = &dinfo->resources; + cfg = &dinfo->cfg; switch (type) { case SYS_RES_IRQ: /* @@ -4240,6 +4243,41 @@ pci_alloc_resource(device_t dev, device_ } int +pci_release_resource(device_t dev, device_t child, int type, int rid, + struct resource *r) +{ + struct pci_devinfo *dinfo; + struct resource_list *rl; + pcicfgregs *cfg; + + if (device_get_parent(child) != dev) + return (BUS_RELEASE_RESOURCE(device_get_parent(dev), child, + type, rid, r)); + + dinfo = device_get_ivars(child); + cfg = &dinfo->cfg; +#ifdef NEW_PCIB + /* + * PCI-PCI bridge I/O window resources are not BARs. For + * those allocations just pass the request up the tree. + */ + if (cfg->hdrtype == PCIM_HDRTYPE_BRIDGE && + (type == SYS_RES_IOPORT || type == SYS_RES_MEMORY)) { + switch (rid) { + case PCIR_IOBASEL_1: + case PCIR_MEMBASE_1: + case PCIR_PMBASEL_1: + return (bus_generic_release_resource(dev, child, type, + rid, r)); + } + } +#endif + + rl = &dinfo->resources; + return (resource_list_release(rl, dev, child, type, rid, r)); +} + +int pci_activate_resource(device_t dev, device_t child, int type, int rid, struct resource *r) { Modified: stable/9/sys/dev/pci/pci_pci.c ============================================================================== --- stable/9/sys/dev/pci/pci_pci.c Thu Oct 10 14:21:27 2013 (r256271) +++ stable/9/sys/dev/pci/pci_pci.c Thu Oct 10 14:34:01 2013 (r256272) @@ -103,13 +103,6 @@ DEFINE_CLASS_0(pcib, pcib_driver, pcib_m DRIVER_MODULE(pcib, pci, pcib_driver, pcib_devclass, NULL, NULL); #ifdef NEW_PCIB -/* - * XXX Todo: - * - properly handle the ISA enable bit. If it is set, we should change - * the behavior of the I/O window resource and rman to not allocate the - * blocked ranges (upper 768 bytes of each 1K in the first 64k of the - * I/O port address space). - */ /* * Is a resource from a child device sub-allocated from one of our @@ -189,10 +182,183 @@ pcib_write_windows(struct pcib_softc *sc } } +/* + * This is used to reject I/O port allocations that conflict with an + * ISA alias range. + */ +static int +pcib_is_isa_range(struct pcib_softc *sc, u_long start, u_long end, u_long count) +{ + u_long next_alias; + + if (!(sc->bridgectl & PCIB_BCR_ISA_ENABLE)) + return (0); + + /* Only check fixed ranges for overlap. */ + if (start + count - 1 != end) + return (0); + + /* ISA aliases are only in the lower 64KB of I/O space. */ + if (start >= 65536) + return (0); + + /* Check for overlap with 0x000 - 0x0ff as a special case. */ + if (start < 0x100) + goto alias; + + /* + * If the start address is an alias, the range is an alias. + * Otherwise, compute the start of the next alias range and + * check if it is before the end of the candidate range. + */ + if ((start & 0x300) != 0) + goto alias; + next_alias = (start & ~0x3fful) | 0x100; + if (next_alias <= end) + goto alias; + return (0); + +alias: + if (bootverbose) + device_printf(sc->dev, + "I/O range %#lx-%#lx overlaps with an ISA alias\n", start, + end); + return (1); +} + +static void +pcib_add_window_resources(struct pcib_window *w, struct resource **res, + int count) +{ + struct resource **newarray; + int error, i; + + newarray = malloc(sizeof(struct resource *) * (w->count + count), + M_DEVBUF, M_WAITOK); + if (w->res != NULL) + bcopy(w->res, newarray, sizeof(struct resource *) * w->count); + bcopy(res, newarray + w->count, sizeof(struct resource *) * count); + free(w->res, M_DEVBUF); + w->res = newarray; + w->count += count; + + for (i = 0; i < count; i++) { + error = rman_manage_region(&w->rman, rman_get_start(res[i]), + rman_get_end(res[i])); + if (error) + panic("Failed to add resource to rman"); + } +} + +typedef void (nonisa_callback)(u_long start, u_long end, void *arg); + +static void +pcib_walk_nonisa_ranges(u_long start, u_long end, nonisa_callback *cb, + void *arg) +{ + u_long next_end; + + /* + * If start is within an ISA alias range, move up to the start + * of the next non-alias range. As a special case, addresses + * in the range 0x000 - 0x0ff should also be skipped since + * those are used for various system I/O devices in ISA + * systems. + */ + if (start <= 65535) { + if (start < 0x100 || (start & 0x300) != 0) { + start &= ~0x3ff; + start += 0x400; + } + } + + /* ISA aliases are only in the lower 64KB of I/O space. */ + while (start <= MIN(end, 65535)) { + next_end = MIN(start | 0xff, end); + cb(start, next_end, arg); + start += 0x400; + } + + if (start <= end) + cb(start, end, arg); +} + +static void +count_ranges(u_long start, u_long end, void *arg) +{ + int *countp; + + countp = arg; + (*countp)++; +} + +struct alloc_state { + struct resource **res; + struct pcib_softc *sc; + int count, error; +}; + +static void +alloc_ranges(u_long start, u_long end, void *arg) +{ + struct alloc_state *as; + struct pcib_window *w; + int rid; + + as = arg; + if (as->error != 0) + return; + + w = &as->sc->io; + rid = w->reg; + if (bootverbose) + device_printf(as->sc->dev, + "allocating non-ISA range %#lx-%#lx\n", start, end); + as->res[as->count] = bus_alloc_resource(as->sc->dev, SYS_RES_IOPORT, + &rid, start, end, end - start + 1, 0); + if (as->res[as->count] == NULL) + as->error = ENXIO; + else + as->count++; +} + +static int +pcib_alloc_nonisa_ranges(struct pcib_softc *sc, u_long start, u_long end) +{ + struct alloc_state as; + int i, new_count; + + /* First, see how many ranges we need. */ + new_count = 0; + pcib_walk_nonisa_ranges(start, end, count_ranges, &new_count); + + /* Second, allocate the ranges. */ + as.res = malloc(sizeof(struct resource *) * new_count, M_DEVBUF, + M_WAITOK); + as.sc = sc; + as.count = 0; + as.error = 0; + pcib_walk_nonisa_ranges(start, end, alloc_ranges, &as); + if (as.error != 0) { + for (i = 0; i < as.count; i++) + bus_release_resource(sc->dev, SYS_RES_IOPORT, + sc->io.reg, as.res[i]); + free(as.res, M_DEVBUF); + return (as.error); + } + KASSERT(as.count == new_count, ("%s: count mismatch", __func__)); + + /* Third, add the ranges to the window. */ + pcib_add_window_resources(&sc->io, as.res, as.count); + free(as.res, M_DEVBUF); + return (0); +} + static void pcib_alloc_window(struct pcib_softc *sc, struct pcib_window *w, int type, int flags, pci_addr_t max_address) { + struct resource *res; char buf[64]; int error, rid; @@ -217,9 +383,15 @@ pcib_alloc_window(struct pcib_softc *sc, "initial %s window has too many bits, ignoring\n", w->name); return; } - rid = w->reg; - w->res = bus_alloc_resource(sc->dev, type, &rid, w->base, w->limit, - w->limit - w->base + 1, flags); + if (type == SYS_RES_IOPORT && sc->bridgectl & PCIB_BCR_ISA_ENABLE) + (void)pcib_alloc_nonisa_ranges(sc, w->base, w->limit); + else { + rid = w->reg; + res = bus_alloc_resource(sc->dev, type, &rid, w->base, w->limit, + w->limit - w->base + 1, flags); + if (res != NULL) + pcib_add_window_resources(w, &res, 1); + } if (w->res == NULL) { device_printf(sc->dev, "failed to allocate initial %s window: %#jx-%#jx\n", @@ -230,11 +402,6 @@ pcib_alloc_window(struct pcib_softc *sc, return; } pcib_activate_window(sc, type); - - error = rman_manage_region(&w->rman, rman_get_start(w->res), - rman_get_end(w->res)); - if (error) - panic("Failed to initialize rman with resource"); } /* @@ -541,6 +708,7 @@ pcib_attach_common(device_t dev) struct pcib_softc *sc; struct sysctl_ctx_list *sctx; struct sysctl_oid *soid; + int comma; sc = device_get_softc(dev); sc->dev = dev; @@ -667,10 +835,22 @@ pcib_attach_common(device_t dev) device_printf(dev, " prefetched decode 0x%jx-0x%jx\n", (uintmax_t)sc->pmembase, (uintmax_t)sc->pmemlimit); #endif - else - device_printf(dev, " no prefetched decode\n"); - if (sc->flags & PCIB_SUBTRACTIVE) - device_printf(dev, " Subtractively decoded bridge.\n"); + if (sc->bridgectl & (PCIB_BCR_ISA_ENABLE | PCIB_BCR_VGA_ENABLE) || + sc->flags & PCIB_SUBTRACTIVE) { + device_printf(dev, " special decode "); + comma = 0; + if (sc->bridgectl & PCIB_BCR_ISA_ENABLE) { + printf("ISA"); + comma = 1; + } + if (sc->bridgectl & PCIB_BCR_VGA_ENABLE) { + printf("%sVGA", comma ? ", " : ""); + comma = 1; + } + if (sc->flags & PCIB_SUBTRACTIVE) + printf("%ssubtractive", comma ? ", " : ""); + printf("\n"); + } } /* @@ -817,23 +997,197 @@ pcib_suballoc_resource(struct pcib_softc return (res); } +/* Allocate a fresh resource range for an unconfigured window. */ +static int +pcib_alloc_new_window(struct pcib_softc *sc, struct pcib_window *w, int type, + u_long start, u_long end, u_long count, u_int flags) +{ + struct resource *res; + u_long base, limit, wmask; + int rid; + + /* + * If this is an I/O window on a bridge with ISA enable set + * and the start address is below 64k, then try to allocate an + * initial window of 0x1000 bytes long starting at address + * 0xf000 and walking down. Note that if the original request + * was larger than the non-aliased range size of 0x100 our + * caller would have raised the start address up to 64k + * already. + */ + if (type == SYS_RES_IOPORT && sc->bridgectl & PCIB_BCR_ISA_ENABLE && + start < 65536) { + for (base = 0xf000; (long)base >= 0; base -= 0x1000) { + limit = base + 0xfff; + + /* + * Skip ranges that wouldn't work for the + * original request. Note that the actual + * window that overlaps are the non-alias + * ranges within [base, limit], so this isn't + * quite a simple comparison. + */ + if (start + count > limit - 0x400) + continue; + if (base == 0) { + /* + * The first open region for the window at + * 0 is 0x400-0x4ff. + */ + if (end - count + 1 < 0x400) + continue; + } else { + if (end - count + 1 < base) + continue; + } + + if (pcib_alloc_nonisa_ranges(sc, base, limit) == 0) { + w->base = base; + w->limit = limit; + return (0); + } + } + return (ENOSPC); + } + + wmask = (1ul << w->step) - 1; + if (RF_ALIGNMENT(flags) < w->step) { + flags &= ~RF_ALIGNMENT_MASK; + flags |= RF_ALIGNMENT_LOG2(w->step); + } + start &= ~wmask; + end |= wmask; + count = roundup2(count, 1ul << w->step); + rid = w->reg; + res = bus_alloc_resource(sc->dev, type, &rid, start, end, count, + flags & ~RF_ACTIVE); + if (res == NULL) + return (ENOSPC); + pcib_add_window_resources(w, &res, 1); + pcib_activate_window(sc, type); + w->base = rman_get_start(res); + w->limit = rman_get_end(res); + return (0); +} + +/* Try to expand an existing window to the requested base and limit. */ +static int +pcib_expand_window(struct pcib_softc *sc, struct pcib_window *w, int type, + u_long base, u_long limit) +{ + struct resource *res; + int error, i, force_64k_base; + + KASSERT(base <= w->base && limit >= w->limit, + ("attempting to shrink window")); + + /* + * XXX: pcib_grow_window() doesn't try to do this anyway and + * the error handling for all the edge cases would be tedious. + */ + KASSERT(limit == w->limit || base == w->base, + ("attempting to grow both ends of a window")); + + /* + * Yet more special handling for requests to expand an I/O + * window behind an ISA-enabled bridge. Since I/O windows + * have to grow in 0x1000 increments and the end of the 0xffff + * range is an alias, growing a window below 64k will always + * result in allocating new resources and never adjusting an + * existing resource. + */ + if (type == SYS_RES_IOPORT && sc->bridgectl & PCIB_BCR_ISA_ENABLE && + (limit <= 65535 || (base <= 65535 && base != w->base))) { + KASSERT(limit == w->limit || limit <= 65535, + ("attempting to grow both ends across 64k ISA alias")); + + if (base != w->base) + error = pcib_alloc_nonisa_ranges(sc, base, w->base - 1); + else + error = pcib_alloc_nonisa_ranges(sc, w->limit + 1, + limit); + if (error == 0) { + w->base = base; + w->limit = limit; + } + return (error); + } + + /* + * Find the existing resource to adjust. Usually there is only one, + * but for an ISA-enabled bridge we might be growing the I/O window + * above 64k and need to find the existing resource that maps all + * of the area above 64k. + */ + for (i = 0; i < w->count; i++) { + if (rman_get_end(w->res[i]) == w->limit) + break; + } + KASSERT(i != w->count, ("did not find existing resource")); + res = w->res[i]; + + /* + * Usually the resource we found should match the window's + * existing range. The one exception is the ISA-enabled case + * mentioned above in which case the resource should start at + * 64k. + */ + if (type == SYS_RES_IOPORT && sc->bridgectl & PCIB_BCR_ISA_ENABLE && + w->base <= 65535) { + KASSERT(rman_get_start(res) == 65536, + ("existing resource mismatch")); + force_64k_base = 1; + } else { + KASSERT(w->base == rman_get_start(res), + ("existing resource mismatch")); + force_64k_base = 0; + } + + error = bus_adjust_resource(sc->dev, type, res, force_64k_base ? + rman_get_start(res) : base, limit); + if (error) + return (error); + + /* Add the newly allocated region to the resource manager. */ + if (w->base != base) { + error = rman_manage_region(&w->rman, base, w->base - 1); + w->base = base; + } else { + error = rman_manage_region(&w->rman, w->limit + 1, limit); + w->limit = limit; + } + if (error) { + if (bootverbose) + device_printf(sc->dev, + "failed to expand %s resource manager\n", w->name); + (void)bus_adjust_resource(sc->dev, type, res, force_64k_base ? + rman_get_start(res) : w->base, w->limit); + } + return (error); +} + /* * Attempt to grow a window to make room for a given resource request. - * The 'step' parameter is log_2 of the desired I/O window's alignment. */ static int pcib_grow_window(struct pcib_softc *sc, struct pcib_window *w, int type, u_long start, u_long end, u_long count, u_int flags) { u_long align, start_free, end_free, front, back, wmask; - int error, rid; + int error; /* * Clamp the desired resource range to the maximum address * this window supports. Reject impossible requests. + * + * For I/O port requests behind a bridge with the ISA enable + * bit set, force large allocations to start above 64k. */ if (!w->valid) return (EINVAL); + if (sc->bridgectl & PCIB_BCR_ISA_ENABLE && count > 0x100 && + start < 65536) + start = 65536; if (end > w->rman.rm_end) end = w->rman.rm_end; if (start + count - 1 > end || start + count < start) @@ -845,40 +1199,19 @@ pcib_grow_window(struct pcib_softc *sc, * aligned space for this resource. */ if (w->res == NULL) { - if (RF_ALIGNMENT(flags) < w->step) { - flags &= ~RF_ALIGNMENT_MASK; - flags |= RF_ALIGNMENT_LOG2(w->step); - } - start &= ~wmask; - end |= wmask; - count = roundup2(count, 1ul << w->step); - rid = w->reg; - w->res = bus_alloc_resource(sc->dev, type, &rid, start, end, - count, flags & ~RF_ACTIVE); - if (w->res == NULL) { + error = pcib_alloc_new_window(sc, w, type, start, end, count, + flags); + if (error) { if (bootverbose) device_printf(sc->dev, "failed to allocate initial %s window (%#lx-%#lx,%#lx)\n", w->name, start, end, count); - return (ENXIO); + return (error); } if (bootverbose) device_printf(sc->dev, - "allocated initial %s window of %#lx-%#lx\n", - w->name, rman_get_start(w->res), - rman_get_end(w->res)); - error = rman_manage_region(&w->rman, rman_get_start(w->res), - rman_get_end(w->res)); - if (error) { - if (bootverbose) - device_printf(sc->dev, - "failed to add initial %s window to rman\n", - w->name); - bus_release_resource(sc->dev, type, w->reg, w->res); - w->res = NULL; - return (error); - } - pcib_activate_window(sc, type); + "allocated initial %s window of %#jx-%#jx\n", + w->name, (uintmax_t)w->base, (uintmax_t)w->limit); goto updatewin; } @@ -892,6 +1225,11 @@ pcib_grow_window(struct pcib_softc *sc, * edge of the window, grow from the inner edge of the free * region. Otherwise grow from the window boundary. * + * Growing an I/O window below 64k for a bridge with the ISA + * enable bit doesn't require any special magic as the step + * size of an I/O window (1k) always includes multiple + * non-alias ranges when it is grown in either direction. + * * XXX: Special case: if w->res is completely empty and the * request size is larger than w->res, we should find the * optimal aligned buffer containing w->res and allocate that. @@ -901,10 +1239,10 @@ pcib_grow_window(struct pcib_softc *sc, "attempting to grow %s window for (%#lx-%#lx,%#lx)\n", w->name, start, end, count); align = 1ul << RF_ALIGNMENT(flags); - if (start < rman_get_start(w->res)) { + if (start < w->base) { if (rman_first_free_region(&w->rman, &start_free, &end_free) != - 0 || start_free != rman_get_start(w->res)) - end_free = rman_get_start(w->res); + 0 || start_free != w->base) + end_free = w->base; if (end_free > end) end_free = end + 1; @@ -925,15 +1263,15 @@ pcib_grow_window(struct pcib_softc *sc, printf("\tfront candidate range: %#lx-%#lx\n", front, end_free); front &= ~wmask; - front = rman_get_start(w->res) - front; + front = w->base - front; } else front = 0; } else front = 0; - if (end > rman_get_end(w->res)) { + if (end > w->limit) { if (rman_last_free_region(&w->rman, &start_free, &end_free) != - 0 || end_free != rman_get_end(w->res)) - start_free = rman_get_end(w->res) + 1; + 0 || end_free != w->limit) + start_free = w->limit + 1; if (start_free < start) start_free = start; @@ -953,7 +1291,7 @@ pcib_grow_window(struct pcib_softc *sc, printf("\tback candidate range: %#lx-%#lx\n", start_free, back); back |= wmask; - back -= rman_get_end(w->res); + back -= w->limit; } else back = 0; } else @@ -966,16 +1304,14 @@ pcib_grow_window(struct pcib_softc *sc, error = ENOSPC; while (front != 0 || back != 0) { if (front != 0 && (front <= back || back == 0)) { - error = bus_adjust_resource(sc->dev, type, w->res, - rman_get_start(w->res) - front, - rman_get_end(w->res)); + error = pcib_expand_window(sc, w, type, w->base - front, + w->limit); if (error == 0) break; front = 0; } else { - error = bus_adjust_resource(sc->dev, type, w->res, - rman_get_start(w->res), - rman_get_end(w->res) + back); + error = pcib_expand_window(sc, w, type, w->base, + w->limit + back); if (error == 0) break; back = 0; @@ -985,32 +1321,11 @@ pcib_grow_window(struct pcib_softc *sc, if (error) return (error); if (bootverbose) - device_printf(sc->dev, "grew %s window to %#lx-%#lx\n", - w->name, rman_get_start(w->res), rman_get_end(w->res)); - - /* Add the newly allocated region to the resource manager. */ - if (w->base != rman_get_start(w->res)) { - KASSERT(w->limit == rman_get_end(w->res), ("both ends moved")); - error = rman_manage_region(&w->rman, rman_get_start(w->res), - w->base - 1); - } else { - KASSERT(w->limit != rman_get_end(w->res), - ("neither end moved")); - error = rman_manage_region(&w->rman, w->limit + 1, - rman_get_end(w->res)); - } - if (error) { - if (bootverbose) - device_printf(sc->dev, - "failed to expand %s resource manager\n", w->name); - bus_adjust_resource(sc->dev, type, w->res, w->base, w->limit); - return (error); - } + device_printf(sc->dev, "grew %s window to %#jx-%#jx\n", + w->name, (uintmax_t)w->base, (uintmax_t)w->limit); updatewin: - /* Save the new window. */ - w->base = rman_get_start(w->res); - w->limit = rman_get_end(w->res); + /* Write the new window. */ KASSERT((w->base & wmask) == 0, ("start address is not aligned")); KASSERT((w->limit & wmask) == wmask, ("end address is not aligned")); pcib_write_windows(sc, w->mask); @@ -1046,6 +1361,8 @@ pcib_alloc_resource(device_t dev, device switch (type) { case SYS_RES_IOPORT: + if (pcib_is_isa_range(sc, start, end, count)) + return (NULL); r = pcib_suballoc_resource(sc, &sc->io, child, type, rid, start, end, count, flags); if (r != NULL || (sc->flags & PCIB_SUBTRACTIVE) != 0) Modified: stable/9/sys/dev/pci/pci_private.h ============================================================================== --- stable/9/sys/dev/pci/pci_private.h Thu Oct 10 14:21:27 2013 (r256271) +++ stable/9/sys/dev/pci/pci_private.h Thu Oct 10 14:34:01 2013 (r256272) @@ -91,6 +91,8 @@ int pci_msix_count_method(device_t dev, struct resource *pci_alloc_resource(device_t dev, device_t child, int type, int *rid, u_long start, u_long end, u_long count, u_int flags); +int pci_release_resource(device_t dev, device_t child, int type, + int rid, struct resource *r); int pci_activate_resource(device_t dev, device_t child, int type, int rid, struct resource *r); int pci_deactivate_resource(device_t dev, device_t child, int type, Modified: stable/9/sys/dev/pci/pcib_private.h ============================================================================== --- stable/9/sys/dev/pci/pcib_private.h Thu Oct 10 14:21:27 2013 (r256271) +++ stable/9/sys/dev/pci/pcib_private.h Thu Oct 10 14:34:01 2013 (r256272) @@ -73,7 +73,8 @@ struct pcib_window { pci_addr_t base; /* base address */ pci_addr_t limit; /* topmost address */ struct rman rman; - struct resource *res; + struct resource **res; + int count; /* size of 'res' array */ int reg; /* resource id from parent */ int valid; int mask; /* WIN_* bitmask of this window */ From owner-svn-src-stable-9@FreeBSD.ORG Fri Oct 11 04:42:17 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id E24C6FD3; Fri, 11 Oct 2013 04:42:17 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id CF227257B; Fri, 11 Oct 2013 04:42:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9B4gHvP004685; Fri, 11 Oct 2013 04:42:17 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9B4gHAA004684; Fri, 11 Oct 2013 04:42:17 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201310110442.r9B4gHAA004684@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 11 Oct 2013 04:42:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256305 - stable/9/sys/compat/freebsd32 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Oct 2013 04:42:18 -0000 Author: kib Date: Fri Oct 11 04:42:17 2013 New Revision: 256305 URL: http://svnweb.freebsd.org/changeset/base/256305 Log: MFC r256061: Add padding to match the compat32 struct stat32 definition to the real struct stat on 32bit architectures. Modified: stable/9/sys/compat/freebsd32/freebsd32.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/compat/freebsd32/freebsd32.h ============================================================================== --- stable/9/sys/compat/freebsd32/freebsd32.h Thu Oct 10 22:46:49 2013 (r256304) +++ stable/9/sys/compat/freebsd32/freebsd32.h Fri Oct 11 04:42:17 2013 (r256305) @@ -166,6 +166,7 @@ struct stat32 { u_int32_t st_blksize; u_int32_t st_flags; u_int32_t st_gen; + int32_t st_lspare; struct timespec32 st_birthtim; unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec32)); unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec32)); From owner-svn-src-stable-9@FreeBSD.ORG Fri Oct 11 18:19:09 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 12F5597C; Fri, 11 Oct 2013 18:19:09 +0000 (UTC) (envelope-from roberto@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id EC0372903; Fri, 11 Oct 2013 18:19:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9BIJ8YV027460; Fri, 11 Oct 2013 18:19:08 GMT (envelope-from roberto@svn.freebsd.org) Received: (from roberto@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9BIJ8Ml027458; Fri, 11 Oct 2013 18:19:08 GMT (envelope-from roberto@svn.freebsd.org) Message-Id: <201310111819.r9BIJ8Ml027458@svn.freebsd.org> From: Ollivier Robert Date: Fri, 11 Oct 2013 18:19:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256324 - in stable/9/usr.sbin/ntp: . libparse X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Oct 2013 18:19:09 -0000 Author: roberto Date: Fri Oct 11 18:19:08 2013 New Revision: 256324 URL: http://svnweb.freebsd.org/changeset/base/256324 Log: MFC r256009: Meinberg clocks support was inadvertently removed during the last vendor import. Add it back. Modified: stable/9/usr.sbin/ntp/config.h stable/9/usr.sbin/ntp/libparse/Makefile Directory Properties: stable/9/usr.sbin/ntp/ (props changed) Modified: stable/9/usr.sbin/ntp/config.h ============================================================================== --- stable/9/usr.sbin/ntp/config.h Fri Oct 11 18:14:49 2013 (r256323) +++ stable/9/usr.sbin/ntp/config.h Fri Oct 11 18:19:08 2013 (r256324) @@ -84,7 +84,7 @@ #define CLOCK_LOCAL 1 /* Meinberg clocks */ -/* #undef CLOCK_MEINBERG */ +#define CLOCK_MEINBERG 1 /* Magnavox MX4200 GPS receiver */ /* #undef CLOCK_MX4200 */ Modified: stable/9/usr.sbin/ntp/libparse/Makefile ============================================================================== --- stable/9/usr.sbin/ntp/libparse/Makefile Fri Oct 11 18:14:49 2013 (r256323) +++ stable/9/usr.sbin/ntp/libparse/Makefile Fri Oct 11 18:19:08 2013 (r256324) @@ -9,7 +9,7 @@ SRCS= clk_computime.c clk_dcf7000.c clk_ clk_rawdcf.c clk_rcc8000.c clk_schmid.c clk_trimtaip.c \ clk_trimtsip.c clk_varitext.c clk_wharton.c data_mbg.c \ info_trimble.c parse.c parse_conf.c trim_info.c \ - binio.c gpstolfp.c + binio.c gpstolfp.c ieee754io.c mfp_mul.c CFLAGS+= -I${.CURDIR}/../../../contrib/ntp/include -I${.CURDIR}/../ From owner-svn-src-stable-9@FreeBSD.ORG Sat Oct 12 04:35:39 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 470661A4; Sat, 12 Oct 2013 04:35:39 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 3470328BE; Sat, 12 Oct 2013 04:35:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9C4Zdpq050183; Sat, 12 Oct 2013 04:35:39 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9C4Zdlq050182; Sat, 12 Oct 2013 04:35:39 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201310120435.r9C4Zdlq050182@svn.freebsd.org> From: Glen Barber Date: Sat, 12 Oct 2013 04:35:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256364 - stable/9/release X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Oct 2013 04:35:39 -0000 Author: gjb Date: Sat Oct 12 04:35:38 2013 New Revision: 256364 URL: http://svnweb.freebsd.org/changeset/base/256364 Log: MFC r256246: Remove hash generation from release.sh, as it is run as part of the 'install' target in the release/Makefile. Sponsored by: The FreeBSD Foundation Modified: stable/9/release/release.sh Directory Properties: stable/9/release/ (props changed) Modified: stable/9/release/release.sh ============================================================================== --- stable/9/release/release.sh Sat Oct 12 00:42:41 2013 (r256363) +++ stable/9/release/release.sh Sat Oct 12 04:35:38 2013 (r256364) @@ -217,8 +217,3 @@ eval chroot ${CHROOTDIR} make -C /usr/sr release RELSTRING=${RELSTRING} eval chroot ${CHROOTDIR} make -C /usr/src/release ${RELEASE_RMAKEFLAGS} \ install DESTDIR=/R RELSTRING=${RELSTRING} - -cd ${CHROOTDIR}/R - -sha256 FreeBSD-* > CHECKSUM.SHA256 -md5 FreeBSD-* > CHECKSUM.MD5 From owner-svn-src-stable-9@FreeBSD.ORG Sat Oct 12 15:56:18 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 05153883; Sat, 12 Oct 2013 15:56:18 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id E23D423E1; Sat, 12 Oct 2013 15:56:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9CFuHlO099738; Sat, 12 Oct 2013 15:56:17 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9CFuDdx099675; Sat, 12 Oct 2013 15:56:13 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201310121556.r9CFuDdx099675@svn.freebsd.org> From: Dimitry Andric Date: Sat, 12 Oct 2013 15:56:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256382 - in stable/9/contrib/llvm: include/llvm/IR lib/AsmParser lib/IR lib/Target/X86 tools/clang/include/clang-c tools/clang/include/clang/AST tools/clang/include/clang/Basic tools/c... X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Oct 2013 15:56:18 -0000 Author: dim Date: Sat Oct 12 15:56:13 2013 New Revision: 256382 URL: http://svnweb.freebsd.org/changeset/base/256382 Log: MFC r256030: Pull in r189644 from upstream llvm trunk: Add ms_abi and sysv_abi attribute handling. Based on a patch by Benno Rice! This will help to develop EFI support. Verified by: benno Modified: stable/9/contrib/llvm/include/llvm/IR/CallingConv.h stable/9/contrib/llvm/lib/AsmParser/LLLexer.cpp stable/9/contrib/llvm/lib/AsmParser/LLParser.cpp stable/9/contrib/llvm/lib/AsmParser/LLToken.h stable/9/contrib/llvm/lib/IR/AsmWriter.cpp stable/9/contrib/llvm/lib/Target/X86/X86CallingConv.td stable/9/contrib/llvm/lib/Target/X86/X86FastISel.cpp stable/9/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp stable/9/contrib/llvm/lib/Target/X86/X86Subtarget.h stable/9/contrib/llvm/tools/clang/include/clang-c/Index.h stable/9/contrib/llvm/tools/clang/include/clang/AST/Type.h stable/9/contrib/llvm/tools/clang/include/clang/Basic/Attr.td stable/9/contrib/llvm/tools/clang/include/clang/Basic/Specifiers.h stable/9/contrib/llvm/tools/clang/lib/AST/DumpXML.cpp stable/9/contrib/llvm/tools/clang/lib/AST/MicrosoftMangle.cpp stable/9/contrib/llvm/tools/clang/lib/AST/Type.cpp stable/9/contrib/llvm/tools/clang/lib/AST/TypePrinter.cpp stable/9/contrib/llvm/tools/clang/lib/Basic/Targets.cpp stable/9/contrib/llvm/tools/clang/lib/CodeGen/CGCall.cpp stable/9/contrib/llvm/tools/clang/lib/Sema/SemaDeclAttr.cpp stable/9/contrib/llvm/tools/clang/lib/Sema/SemaType.cpp Directory Properties: stable/9/contrib/llvm/ (props changed) stable/9/contrib/llvm/tools/clang/ (props changed) Modified: stable/9/contrib/llvm/include/llvm/IR/CallingConv.h ============================================================================== --- stable/9/contrib/llvm/include/llvm/IR/CallingConv.h Sat Oct 12 15:31:36 2013 (r256381) +++ stable/9/contrib/llvm/include/llvm/IR/CallingConv.h Sat Oct 12 15:56:13 2013 (r256382) @@ -119,8 +119,17 @@ namespace CallingConv { SPIR_KERNEL = 76, /// Intel_OCL_BI - Calling conventions for Intel OpenCL built-ins - Intel_OCL_BI = 77 + Intel_OCL_BI = 77, + /// \brief The C convention as specified in the x86-64 supplement to the + /// System V ABI, used on most non-Windows systems. + X86_64_SysV = 78, + + /// \brief The C convention as implemented on Windows/x86-64. This + /// convention differs from the more common \c X86_64_SysV convention + /// in a number of ways, most notably in that XMM registers used to pass + /// arguments are shadowed by GPRs, and vice versa. + X86_64_Win64 = 79 }; } // End CallingConv namespace Modified: stable/9/contrib/llvm/lib/AsmParser/LLLexer.cpp ============================================================================== --- stable/9/contrib/llvm/lib/AsmParser/LLLexer.cpp Sat Oct 12 15:31:36 2013 (r256381) +++ stable/9/contrib/llvm/lib/AsmParser/LLLexer.cpp Sat Oct 12 15:56:13 2013 (r256382) @@ -556,6 +556,8 @@ lltok::Kind LLLexer::LexIdentifier() { KEYWORD(spir_kernel); KEYWORD(spir_func); KEYWORD(intel_ocl_bicc); + KEYWORD(x86_64_sysvcc); + KEYWORD(x86_64_win64cc); KEYWORD(cc); KEYWORD(c); Modified: stable/9/contrib/llvm/lib/AsmParser/LLParser.cpp ============================================================================== --- stable/9/contrib/llvm/lib/AsmParser/LLParser.cpp Sat Oct 12 15:31:36 2013 (r256381) +++ stable/9/contrib/llvm/lib/AsmParser/LLParser.cpp Sat Oct 12 15:56:13 2013 (r256382) @@ -1337,6 +1337,8 @@ bool LLParser::ParseOptionalVisibility(u /// ::= 'ptx_device' /// ::= 'spir_func' /// ::= 'spir_kernel' +/// ::= 'x86_64_sysvcc' +/// ::= 'x86_64_win64cc' /// ::= 'cc' UINT /// bool LLParser::ParseOptionalCallingConv(CallingConv::ID &CC) { @@ -1357,6 +1359,8 @@ bool LLParser::ParseOptionalCallingConv( case lltok::kw_spir_kernel: CC = CallingConv::SPIR_KERNEL; break; case lltok::kw_spir_func: CC = CallingConv::SPIR_FUNC; break; case lltok::kw_intel_ocl_bicc: CC = CallingConv::Intel_OCL_BI; break; + case lltok::kw_x86_64_sysvcc: CC = CallingConv::X86_64_SysV; break; + case lltok::kw_x86_64_win64cc: CC = CallingConv::X86_64_Win64; break; case lltok::kw_cc: { unsigned ArbitraryCC; Lex.Lex(); Modified: stable/9/contrib/llvm/lib/AsmParser/LLToken.h ============================================================================== --- stable/9/contrib/llvm/lib/AsmParser/LLToken.h Sat Oct 12 15:31:36 2013 (r256381) +++ stable/9/contrib/llvm/lib/AsmParser/LLToken.h Sat Oct 12 15:56:13 2013 (r256382) @@ -84,12 +84,13 @@ namespace lltok { kw_c, kw_cc, kw_ccc, kw_fastcc, kw_coldcc, - kw_intel_ocl_bicc, + kw_intel_ocl_bicc, kw_x86_stdcallcc, kw_x86_fastcallcc, kw_x86_thiscallcc, kw_arm_apcscc, kw_arm_aapcscc, kw_arm_aapcs_vfpcc, kw_msp430_intrcc, kw_ptx_kernel, kw_ptx_device, kw_spir_kernel, kw_spir_func, + kw_x86_64_sysvcc, kw_x86_64_win64cc, // Attributes: kw_attributes, Modified: stable/9/contrib/llvm/lib/IR/AsmWriter.cpp ============================================================================== --- stable/9/contrib/llvm/lib/IR/AsmWriter.cpp Sat Oct 12 15:31:36 2013 (r256381) +++ stable/9/contrib/llvm/lib/IR/AsmWriter.cpp Sat Oct 12 15:56:13 2013 (r256382) @@ -81,6 +81,8 @@ static void PrintCallingConv(unsigned cc case CallingConv::MSP430_INTR: Out << "msp430_intrcc"; break; case CallingConv::PTX_Kernel: Out << "ptx_kernel"; break; case CallingConv::PTX_Device: Out << "ptx_device"; break; + case CallingConv::X86_64_SysV: Out << "x86_64_sysvcc"; break; + case CallingConv::X86_64_Win64: Out << "x86_64_win64cc"; break; } } Modified: stable/9/contrib/llvm/lib/Target/X86/X86CallingConv.td ============================================================================== --- stable/9/contrib/llvm/lib/Target/X86/X86CallingConv.td Sat Oct 12 15:31:36 2013 (r256381) +++ stable/9/contrib/llvm/lib/Target/X86/X86CallingConv.td Sat Oct 12 15:56:13 2013 (r256382) @@ -156,6 +156,11 @@ def RetCC_X86_32 : CallingConv<[ def RetCC_X86_64 : CallingConv<[ // HiPE uses RetCC_X86_64_HiPE CCIfCC<"CallingConv::HiPE", CCDelegateTo>, + + // Handle explicit CC selection + CCIfCC<"CallingConv::X86_64_Win64", CCDelegateTo>, + CCIfCC<"CallingConv::X86_64_SysV", CCDelegateTo>, + // Mingw64 and native Win64 use Win64 CC CCIfSubtarget<"isTargetWin64()", CCDelegateTo>, @@ -489,6 +494,8 @@ def CC_X86_32 : CallingConv<[ def CC_X86_64 : CallingConv<[ CCIfCC<"CallingConv::GHC", CCDelegateTo>, CCIfCC<"CallingConv::HiPE", CCDelegateTo>, + CCIfCC<"CallingConv::X86_64_Win64", CCDelegateTo>, + CCIfCC<"CallingConv::X86_64_SysV", CCDelegateTo>, // Mingw64 and native Win64 use Win64 CC CCIfSubtarget<"isTargetWin64()", CCDelegateTo>, Modified: stable/9/contrib/llvm/lib/Target/X86/X86FastISel.cpp ============================================================================== --- stable/9/contrib/llvm/lib/Target/X86/X86FastISel.cpp Sat Oct 12 15:31:36 2013 (r256381) +++ stable/9/contrib/llvm/lib/Target/X86/X86FastISel.cpp Sat Oct 12 15:56:13 2013 (r256382) @@ -717,10 +717,11 @@ bool X86FastISel::X86SelectRet(const Ins CallingConv::ID CC = F.getCallingConv(); if (CC != CallingConv::C && CC != CallingConv::Fast && - CC != CallingConv::X86_FastCall) + CC != CallingConv::X86_FastCall && + CC != CallingConv::X86_64_SysV) return false; - if (Subtarget->isTargetWin64()) + if (Subtarget->isCallingConvWin64(CC)) return false; // Don't handle popping bytes on return for now. @@ -1643,9 +1644,6 @@ bool X86FastISel::FastLowerArguments() { if (!FuncInfo.CanLowerReturn) return false; - if (Subtarget->isTargetWin64()) - return false; - const Function *F = FuncInfo.Fn; if (F->isVarArg()) return false; @@ -1653,7 +1651,10 @@ bool X86FastISel::FastLowerArguments() { CallingConv::ID CC = F->getCallingConv(); if (CC != CallingConv::C) return false; - + + if (Subtarget->isCallingConvWin64(CC)) + return false; + if (!Subtarget->is64Bit()) return false; @@ -1757,8 +1758,10 @@ bool X86FastISel::DoSelectCall(const Ins // Handle only C and fastcc calling conventions for now. ImmutableCallSite CS(CI); CallingConv::ID CC = CS.getCallingConv(); + bool isWin64 = Subtarget->isCallingConvWin64(CC); if (CC != CallingConv::C && CC != CallingConv::Fast && - CC != CallingConv::X86_FastCall) + CC != CallingConv::X86_FastCall && CC != CallingConv::X86_64_Win64 && + CC != CallingConv::X86_64_SysV) return false; // fastcc with -tailcallopt is intended to provide a guaranteed @@ -1772,7 +1775,7 @@ bool X86FastISel::DoSelectCall(const Ins // Don't know how to handle Win64 varargs yet. Nothing special needed for // x86-32. Special handling for x86-64 is implemented. - if (isVarArg && Subtarget->isTargetWin64()) + if (isVarArg && isWin64) return false; // Fast-isel doesn't know about callee-pop yet. @@ -1902,7 +1905,7 @@ bool X86FastISel::DoSelectCall(const Ins I->getParent()->getContext()); // Allocate shadow area for Win64 - if (Subtarget->isTargetWin64()) + if (isWin64) CCInfo.AllocateStack(32, 8); CCInfo.AnalyzeCallOperands(ArgVTs, ArgFlags, CC_X86); @@ -2016,7 +2019,7 @@ bool X86FastISel::DoSelectCall(const Ins X86::EBX).addReg(Base); } - if (Subtarget->is64Bit() && isVarArg && !Subtarget->isTargetWin64()) { + if (Subtarget->is64Bit() && isVarArg && !isWin64) { // Count the number of XMM registers allocated. static const uint16_t XMMArgRegs[] = { X86::XMM0, X86::XMM1, X86::XMM2, X86::XMM3, @@ -2085,7 +2088,7 @@ bool X86FastISel::DoSelectCall(const Ins if (Subtarget->isPICStyleGOT()) MIB.addReg(X86::EBX, RegState::Implicit); - if (Subtarget->is64Bit() && isVarArg && !Subtarget->isTargetWin64()) + if (Subtarget->is64Bit() && isVarArg && !isWin64) MIB.addReg(X86::AL, RegState::Implicit); // Add implicit physical register uses to the call. Modified: stable/9/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp ============================================================================== --- stable/9/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp Sat Oct 12 15:31:36 2013 (r256381) +++ stable/9/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp Sat Oct 12 15:56:13 2013 (r256382) @@ -1883,13 +1883,19 @@ static bool IsTailCallConvention(Calling CC == CallingConv::HiPE); } +/// \brief Return true if the calling convention is a C calling convention. +static bool IsCCallConvention(CallingConv::ID CC) { + return (CC == CallingConv::C || CC == CallingConv::X86_64_Win64 || + CC == CallingConv::X86_64_SysV); +} + bool X86TargetLowering::mayBeEmittedAsTailCall(CallInst *CI) const { if (!CI->isTailCall() || getTargetMachine().Options.DisableTailCalls) return false; CallSite CS(CI); CallingConv::ID CalleeCC = CS.getCallingConv(); - if (!IsTailCallConvention(CalleeCC) && CalleeCC != CallingConv::C) + if (!IsTailCallConvention(CalleeCC) && !IsCCallConvention(CalleeCC)) return false; return true; @@ -1964,7 +1970,7 @@ X86TargetLowering::LowerFormalArguments( MachineFrameInfo *MFI = MF.getFrameInfo(); bool Is64Bit = Subtarget->is64Bit(); bool IsWindows = Subtarget->isTargetWindows(); - bool IsWin64 = Subtarget->isTargetWin64(); + bool IsWin64 = Subtarget->isCallingConvWin64(CallConv); assert(!(isVarArg && IsTailCallConvention(CallConv)) && "Var args not supported with calling convention fastcc, ghc or hipe"); @@ -1975,9 +1981,8 @@ X86TargetLowering::LowerFormalArguments( ArgLocs, *DAG.getContext()); // Allocate shadow area for Win64 - if (IsWin64) { + if (IsWin64) CCInfo.AllocateStack(32, 8); - } CCInfo.AnalyzeFormalArguments(Ins, CC_X86); @@ -2290,7 +2295,7 @@ X86TargetLowering::LowerCall(TargetLower MachineFunction &MF = DAG.getMachineFunction(); bool Is64Bit = Subtarget->is64Bit(); - bool IsWin64 = Subtarget->isTargetWin64(); + bool IsWin64 = Subtarget->isCallingConvWin64(CallConv); bool IsWindows = Subtarget->isTargetWindows(); StructReturnType SR = callIsStructReturn(Outs); bool IsSibcall = false; @@ -2323,9 +2328,8 @@ X86TargetLowering::LowerCall(TargetLower ArgLocs, *DAG.getContext()); // Allocate shadow area for Win64 - if (IsWin64) { + if (IsWin64) CCInfo.AllocateStack(32, 8); - } CCInfo.AnalyzeCallOperands(Outs, CC_X86); @@ -2831,13 +2835,12 @@ X86TargetLowering::IsEligibleForTailCall const SmallVectorImpl &OutVals, const SmallVectorImpl &Ins, SelectionDAG &DAG) const { - if (!IsTailCallConvention(CalleeCC) && - CalleeCC != CallingConv::C) + if (!IsTailCallConvention(CalleeCC) && !IsCCallConvention(CalleeCC)) return false; // If -tailcallopt is specified, make fastcc functions tail-callable. const MachineFunction &MF = DAG.getMachineFunction(); - const Function *CallerF = DAG.getMachineFunction().getFunction(); + const Function *CallerF = MF.getFunction(); // If the function return type is x86_fp80 and the callee return type is not, // then the FP_EXTEND of the call result is not a nop. It's not safe to @@ -2847,6 +2850,8 @@ X86TargetLowering::IsEligibleForTailCall CallingConv::ID CallerCC = CallerF->getCallingConv(); bool CCMatch = CallerCC == CalleeCC; + bool IsCalleeWin64 = Subtarget->isCallingConvWin64(CalleeCC); + bool IsCallerWin64 = Subtarget->isCallingConvWin64(CallerCC); if (getTargetMachine().Options.GuaranteedTailCallOpt) { if (IsTailCallConvention(CalleeCC) && CCMatch) @@ -2878,7 +2883,7 @@ X86TargetLowering::IsEligibleForTailCall // Optimizing for varargs on Win64 is unlikely to be safe without // additional testing. - if (Subtarget->isTargetWin64()) + if (IsCalleeWin64 || IsCallerWin64) return false; SmallVector ArgLocs; @@ -2953,9 +2958,8 @@ X86TargetLowering::IsEligibleForTailCall getTargetMachine(), ArgLocs, *DAG.getContext()); // Allocate shadow area for Win64 - if (Subtarget->isTargetWin64()) { + if (IsCalleeWin64) CCInfo.AllocateStack(32, 8); - } CCInfo.AnalyzeCallOperands(Outs, CC_X86); if (CCInfo.getNextStackOffset()) { Modified: stable/9/contrib/llvm/lib/Target/X86/X86Subtarget.h ============================================================================== --- stable/9/contrib/llvm/lib/Target/X86/X86Subtarget.h Sat Oct 12 15:31:36 2013 (r256381) +++ stable/9/contrib/llvm/lib/Target/X86/X86Subtarget.h Sat Oct 12 15:56:13 2013 (r256382) @@ -338,7 +338,13 @@ public: } bool isPICStyleStubAny() const { return PICStyle == PICStyles::StubDynamicNoPIC || - PICStyle == PICStyles::StubPIC; } + PICStyle == PICStyles::StubPIC; + } + + bool isCallingConvWin64(CallingConv::ID CC) const { + return (isTargetWin64() && CC != CallingConv::X86_64_SysV) || + CC == CallingConv::X86_64_Win64; + } /// ClassifyGlobalReference - Classify a global variable reference for the /// current subtarget according to how we should reference it in a non-pcrel Modified: stable/9/contrib/llvm/tools/clang/include/clang-c/Index.h ============================================================================== --- stable/9/contrib/llvm/tools/clang/include/clang-c/Index.h Sat Oct 12 15:31:36 2013 (r256381) +++ stable/9/contrib/llvm/tools/clang/include/clang-c/Index.h Sat Oct 12 15:56:13 2013 (r256382) @@ -2683,6 +2683,8 @@ enum CXCallingConv { CXCallingConv_AAPCS_VFP = 7, CXCallingConv_PnaclCall = 8, CXCallingConv_IntelOclBicc = 9, + CXCallingConv_X86_64Win64 = 10, + CXCallingConv_X86_64SysV = 11, CXCallingConv_Invalid = 100, CXCallingConv_Unexposed = 200 Modified: stable/9/contrib/llvm/tools/clang/include/clang/AST/Type.h ============================================================================== --- stable/9/contrib/llvm/tools/clang/include/clang/AST/Type.h Sat Oct 12 15:31:36 2013 (r256381) +++ stable/9/contrib/llvm/tools/clang/include/clang/AST/Type.h Sat Oct 12 15:56:13 2013 (r256382) @@ -3335,7 +3335,9 @@ public: attr_thiscall, attr_pascal, attr_pnaclcall, - attr_inteloclbicc + attr_inteloclbicc, + attr_ms_abi, + attr_sysv_abi }; private: Modified: stable/9/contrib/llvm/tools/clang/include/clang/Basic/Attr.td ============================================================================== --- stable/9/contrib/llvm/tools/clang/include/clang/Basic/Attr.td Sat Oct 12 15:31:36 2013 (r256381) +++ stable/9/contrib/llvm/tools/clang/include/clang/Basic/Attr.td Sat Oct 12 15:56:13 2013 (r256382) @@ -417,6 +417,10 @@ def MayAlias : InheritableAttr { let Spellings = [GNU<"may_alias">, CXX11<"gnu", "may_alias">]; } +def MSABI : InheritableAttr { + let Spellings = [GNU<"ms_abi">, CXX11<"gnu", "ms_abi">]; +} + def MSP430Interrupt : InheritableAttr { let Spellings = []; let Args = [UnsignedArgument<"Number">]; @@ -664,6 +668,10 @@ def StdCall : InheritableAttr { Keyword<"__stdcall">, Keyword<"_stdcall">]; } +def SysVABI : InheritableAttr { + let Spellings = [GNU<"sysv_abi">, CXX11<"gnu", "sysv_abi">]; +} + def ThisCall : InheritableAttr { let Spellings = [GNU<"thiscall">, CXX11<"gnu", "thiscall">, Keyword<"__thiscall">, Keyword<"_thiscall">]; Modified: stable/9/contrib/llvm/tools/clang/include/clang/Basic/Specifiers.h ============================================================================== --- stable/9/contrib/llvm/tools/clang/include/clang/Basic/Specifiers.h Sat Oct 12 15:31:36 2013 (r256381) +++ stable/9/contrib/llvm/tools/clang/include/clang/Basic/Specifiers.h Sat Oct 12 15:56:13 2013 (r256382) @@ -206,6 +206,8 @@ namespace clang { CC_X86FastCall, // __attribute__((fastcall)) CC_X86ThisCall, // __attribute__((thiscall)) CC_X86Pascal, // __attribute__((pascal)) + CC_X86_64Win64, // __attribute__((ms_abi)) + CC_X86_64SysV, // __attribute__((sysv_abi)) CC_AAPCS, // __attribute__((pcs("aapcs"))) CC_AAPCS_VFP, // __attribute__((pcs("aapcs-vfp"))) CC_PnaclCall, // __attribute__((pnaclcall)) Modified: stable/9/contrib/llvm/tools/clang/lib/AST/DumpXML.cpp ============================================================================== --- stable/9/contrib/llvm/tools/clang/lib/AST/DumpXML.cpp Sat Oct 12 15:31:36 2013 (r256381) +++ stable/9/contrib/llvm/tools/clang/lib/AST/DumpXML.cpp Sat Oct 12 15:56:13 2013 (r256382) @@ -921,6 +921,8 @@ struct XMLDumper : public XMLDeclVisitor case CC_X86StdCall: return set("cc", "x86_stdcall"); case CC_X86ThisCall: return set("cc", "x86_thiscall"); case CC_X86Pascal: return set("cc", "x86_pascal"); + case CC_X86_64Win64: return set("cc", "x86_64_win64"); + case CC_X86_64SysV: return set("cc", "x86_64_sysv"); case CC_AAPCS: return set("cc", "aapcs"); case CC_AAPCS_VFP: return set("cc", "aapcs_vfp"); case CC_PnaclCall: return set("cc", "pnaclcall"); Modified: stable/9/contrib/llvm/tools/clang/lib/AST/MicrosoftMangle.cpp ============================================================================== --- stable/9/contrib/llvm/tools/clang/lib/AST/MicrosoftMangle.cpp Sat Oct 12 15:31:36 2013 (r256381) +++ stable/9/contrib/llvm/tools/clang/lib/AST/MicrosoftMangle.cpp Sat Oct 12 15:56:13 2013 (r256382) @@ -1311,6 +1311,8 @@ void MicrosoftCXXNameMangler::mangleCall switch (CC) { default: llvm_unreachable("Unsupported CC for mangling"); + case CC_X86_64Win64: + case CC_X86_64SysV: case CC_Default: case CC_C: Out << 'A'; break; case CC_X86Pascal: Out << 'C'; break; Modified: stable/9/contrib/llvm/tools/clang/lib/AST/Type.cpp ============================================================================== --- stable/9/contrib/llvm/tools/clang/lib/AST/Type.cpp Sat Oct 12 15:31:36 2013 (r256381) +++ stable/9/contrib/llvm/tools/clang/lib/AST/Type.cpp Sat Oct 12 15:56:13 2013 (r256382) @@ -1574,6 +1574,8 @@ StringRef FunctionType::getNameForCallCo case CC_X86FastCall: return "fastcall"; case CC_X86ThisCall: return "thiscall"; case CC_X86Pascal: return "pascal"; + case CC_X86_64Win64: return "ms_abi"; + case CC_X86_64SysV: return "sysv_abi"; case CC_AAPCS: return "aapcs"; case CC_AAPCS_VFP: return "aapcs-vfp"; case CC_PnaclCall: return "pnaclcall"; Modified: stable/9/contrib/llvm/tools/clang/lib/AST/TypePrinter.cpp ============================================================================== --- stable/9/contrib/llvm/tools/clang/lib/AST/TypePrinter.cpp Sat Oct 12 15:31:36 2013 (r256381) +++ stable/9/contrib/llvm/tools/clang/lib/AST/TypePrinter.cpp Sat Oct 12 15:56:13 2013 (r256382) @@ -650,6 +650,12 @@ void TypePrinter::printFunctionProtoAfte case CC_IntelOclBicc: OS << " __attribute__((intel_ocl_bicc))"; break; + case CC_X86_64Win64: + OS << " __attribute__((ms_abi))"; + break; + case CC_X86_64SysV: + OS << " __attribute__((sysv_abi))"; + break; } if (Info.getNoReturn()) OS << " __attribute__((noreturn))"; @@ -1160,6 +1166,8 @@ void TypePrinter::printAttributedAfter(c case AttributedType::attr_stdcall: OS << "stdcall"; break; case AttributedType::attr_thiscall: OS << "thiscall"; break; case AttributedType::attr_pascal: OS << "pascal"; break; + case AttributedType::attr_ms_abi: OS << "ms_abi"; break; + case AttributedType::attr_sysv_abi: OS << "sysv_abi"; break; case AttributedType::attr_pcs: { OS << "pcs("; QualType t = T->getEquivalentType(); Modified: stable/9/contrib/llvm/tools/clang/lib/Basic/Targets.cpp ============================================================================== --- stable/9/contrib/llvm/tools/clang/lib/Basic/Targets.cpp Sat Oct 12 15:31:36 2013 (r256381) +++ stable/9/contrib/llvm/tools/clang/lib/Basic/Targets.cpp Sat Oct 12 15:56:13 2013 (r256382) @@ -3182,8 +3182,9 @@ public: virtual CallingConvCheckResult checkCallingConvention(CallingConv CC) const { return (CC == CC_Default || - CC == CC_C || - CC == CC_IntelOclBicc) ? CCCR_OK : CCCR_Warning; + CC == CC_C || + CC == CC_IntelOclBicc || + CC == CC_X86_64Win64) ? CCCR_OK : CCCR_Warning; } virtual CallingConv getDefaultCallingConv(CallingConvMethodType MT) const { @@ -3219,6 +3220,11 @@ public: virtual BuiltinVaListKind getBuiltinVaListKind() const { return TargetInfo::CharPtrBuiltinVaList; } + virtual CallingConvCheckResult checkCallingConvention(CallingConv CC) const { + return (CC == CC_C || + CC == CC_IntelOclBicc || + CC == CC_X86_64SysV) ? CCCR_OK : CCCR_Warning; + } }; } // end anonymous namespace Modified: stable/9/contrib/llvm/tools/clang/lib/CodeGen/CGCall.cpp ============================================================================== --- stable/9/contrib/llvm/tools/clang/lib/CodeGen/CGCall.cpp Sat Oct 12 15:31:36 2013 (r256381) +++ stable/9/contrib/llvm/tools/clang/lib/CodeGen/CGCall.cpp Sat Oct 12 15:56:13 2013 (r256382) @@ -41,6 +41,8 @@ static unsigned ClangCallConvToLLVMCallC case CC_X86StdCall: return llvm::CallingConv::X86_StdCall; case CC_X86FastCall: return llvm::CallingConv::X86_FastCall; case CC_X86ThisCall: return llvm::CallingConv::X86_ThisCall; + case CC_X86_64Win64: return llvm::CallingConv::X86_64_Win64; + case CC_X86_64SysV: return llvm::CallingConv::X86_64_SysV; case CC_AAPCS: return llvm::CallingConv::ARM_AAPCS; case CC_AAPCS_VFP: return llvm::CallingConv::ARM_AAPCS_VFP; case CC_IntelOclBicc: return llvm::CallingConv::Intel_OCL_BI; Modified: stable/9/contrib/llvm/tools/clang/lib/Sema/SemaDeclAttr.cpp ============================================================================== --- stable/9/contrib/llvm/tools/clang/lib/Sema/SemaDeclAttr.cpp Sat Oct 12 15:31:36 2013 (r256381) +++ stable/9/contrib/llvm/tools/clang/lib/Sema/SemaDeclAttr.cpp Sat Oct 12 15:56:13 2013 (r256382) @@ -3961,6 +3961,16 @@ static void handleCallConvAttr(Sema &S, PascalAttr(Attr.getRange(), S.Context, Attr.getAttributeSpellingListIndex())); return; + case AttributeList::AT_MSABI: + D->addAttr(::new (S.Context) + MSABIAttr(Attr.getRange(), S.Context, + Attr.getAttributeSpellingListIndex())); + return; + case AttributeList::AT_SysVABI: + D->addAttr(::new (S.Context) + SysVABIAttr(Attr.getRange(), S.Context, + Attr.getAttributeSpellingListIndex())); + return; case AttributeList::AT_Pcs: { PcsAttr::PCSType PCS; switch (CC) { @@ -4036,6 +4046,14 @@ bool Sema::CheckCallingConvAttr(const At case AttributeList::AT_StdCall: CC = CC_X86StdCall; break; case AttributeList::AT_ThisCall: CC = CC_X86ThisCall; break; case AttributeList::AT_Pascal: CC = CC_X86Pascal; break; + case AttributeList::AT_MSABI: + CC = Context.getTargetInfo().getTriple().isOSWindows() ? CC_C : + CC_X86_64Win64; + break; + case AttributeList::AT_SysVABI: + CC = Context.getTargetInfo().getTriple().isOSWindows() ? CC_X86_64SysV : + CC_C; + break; case AttributeList::AT_Pcs: { Expr *Arg = attr.getArg(0); StringLiteral *Str = dyn_cast(Arg); @@ -4876,6 +4894,8 @@ static void ProcessInheritableDeclAttr(S case AttributeList::AT_FastCall: case AttributeList::AT_ThisCall: case AttributeList::AT_Pascal: + case AttributeList::AT_MSABI: + case AttributeList::AT_SysVABI: case AttributeList::AT_Pcs: case AttributeList::AT_PnaclCall: case AttributeList::AT_IntelOclBicc: Modified: stable/9/contrib/llvm/tools/clang/lib/Sema/SemaType.cpp ============================================================================== --- stable/9/contrib/llvm/tools/clang/lib/Sema/SemaType.cpp Sat Oct 12 15:31:36 2013 (r256381) +++ stable/9/contrib/llvm/tools/clang/lib/Sema/SemaType.cpp Sat Oct 12 15:56:13 2013 (r256382) @@ -105,6 +105,8 @@ static void diagnoseBadTypeAttribute(Sem case AttributeList::AT_StdCall: \ case AttributeList::AT_ThisCall: \ case AttributeList::AT_Pascal: \ + case AttributeList::AT_MSABI: \ + case AttributeList::AT_SysVABI: \ case AttributeList::AT_Regparm: \ case AttributeList::AT_Pcs: \ case AttributeList::AT_PnaclCall: \ @@ -3296,6 +3298,10 @@ static AttributeList::Kind getAttrListKi return AttributeList::AT_PnaclCall; case AttributedType::attr_inteloclbicc: return AttributeList::AT_IntelOclBicc; + case AttributedType::attr_ms_abi: + return AttributeList::AT_MSABI; + case AttributedType::attr_sysv_abi: + return AttributeList::AT_SysVABI; } llvm_unreachable("unexpected attribute kind!"); } From owner-svn-src-stable-9@FreeBSD.ORG Sat Oct 12 16:11:58 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 8E29EE22; Sat, 12 Oct 2013 16:11:58 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 60EDF24A4; Sat, 12 Oct 2013 16:11:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9CGBwJx008791; Sat, 12 Oct 2013 16:11:58 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9CGBwKT008790; Sat, 12 Oct 2013 16:11:58 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201310121611.r9CGBwKT008790@svn.freebsd.org> From: Dimitry Andric Date: Sat, 12 Oct 2013 16:11:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256384 - in stable: 7/contrib/binutils/bfd 8/contrib/binutils/bfd 9/contrib/binutils/bfd X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Oct 2013 16:11:58 -0000 Author: dim Date: Sat Oct 12 16:11:57 2013 New Revision: 256384 URL: http://svnweb.freebsd.org/changeset/base/256384 Log: MFC r255931: Fix a bug in ld, where indirect symbols are not handled properly during linking of a shared library, leading to corrupt indexes in the dynamic symbol table. This should fix the multimedia/ffmpegthumbnailer port. Reported by: swills Modified: stable/9/contrib/binutils/bfd/elflink.c Directory Properties: stable/9/contrib/binutils/ (props changed) Changes in other areas also in this revision: Modified: stable/7/contrib/binutils/bfd/elflink.c stable/8/contrib/binutils/bfd/elflink.c Directory Properties: stable/7/contrib/binutils/ (props changed) stable/8/contrib/binutils/ (props changed) Modified: stable/9/contrib/binutils/bfd/elflink.c ============================================================================== --- stable/9/contrib/binutils/bfd/elflink.c Sat Oct 12 16:03:31 2013 (r256383) +++ stable/9/contrib/binutils/bfd/elflink.c Sat Oct 12 16:11:57 2013 (r256384) @@ -488,12 +488,28 @@ bfd_elf_record_link_assignment (bfd *out if (h->root.u.undef.next != NULL || htab->root.undefs_tail == &h->root) bfd_link_repair_undef_list (&htab->root); } - - if (h->root.type == bfd_link_hash_new) + else if (h->root.type == bfd_link_hash_new) { bfd_elf_link_mark_dynamic_symbol (info, h, NULL); h->non_elf = 0; } + else if (h->root.type == bfd_link_hash_indirect) + { + const struct elf_backend_data *bed = get_elf_backend_data (output_bfd); + struct elf_link_hash_entry *hv = h; + do + hv = (struct elf_link_hash_entry *) hv->root.u.i.link; + while (hv->root.type == bfd_link_hash_indirect + || hv->root.type == bfd_link_hash_warning); + h->root.type = bfd_link_hash_undefined; + hv->root.type = bfd_link_hash_indirect; + hv->root.u.i.link = (struct bfd_link_hash_entry *) h; + (*bed->elf_backend_copy_indirect_symbol) (info, h, hv); + } + else if (h->root.type == bfd_link_hash_warning) + { + abort (); + } /* If this symbol is being provided by the linker script, and it is currently defined by a dynamic object, but not by a regular @@ -1417,10 +1433,10 @@ _bfd_elf_merge_symbol (bfd *abfd, case, we make the versioned symbol point to the normal one. */ const struct elf_backend_data *bed = get_elf_backend_data (abfd); flip->root.type = h->root.type; + flip->root.u.undef.abfd = h->root.u.undef.abfd; h->root.type = bfd_link_hash_indirect; h->root.u.i.link = (struct bfd_link_hash_entry *) flip; (*bed->elf_backend_copy_indirect_symbol) (info, flip, h); - flip->root.u.undef.abfd = h->root.u.undef.abfd; if (h->def_dynamic) { h->def_dynamic = 0; From owner-svn-src-stable-9@FreeBSD.ORG Sat Oct 12 17:31:22 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 3596DC03; Sat, 12 Oct 2013 17:31:22 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 226112813; Sat, 12 Oct 2013 17:31:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9CHVMRi051116; Sat, 12 Oct 2013 17:31:22 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9CHVLAD051110; Sat, 12 Oct 2013 17:31:21 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201310121731.r9CHVLAD051110@svn.freebsd.org> From: Ian Lepore Date: Sat, 12 Oct 2013 17:31:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256386 - in stable/9: include sys/conf X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Oct 2013 17:31:22 -0000 Author: ian Date: Sat Oct 12 17:31:21 2013 New Revision: 256386 URL: http://svnweb.freebsd.org/changeset/base/256386 Log: MFC r255775 r255796 r255807 r255930 r255929 r255957: Create a separate script to generate osreldate.h rather than sourcing newvers.sh into a temporary subshell with inline make rules. Fixes PR 160646. Allow the path to the system source directory to be passed in to newvers.sh. Pass it in from include/Makefile. If it isn't passed in, fall back to the old logic of using dirname $0. Fixes PR 174422. PR: 160646 174422 Added: stable/9/include/mk-osreldate.sh - copied, changed from r255775, head/include/mk-osreldate.sh Modified: stable/9/include/Makefile stable/9/sys/conf/newvers.sh Directory Properties: stable/9/include/ (props changed) stable/9/sys/ (props changed) stable/9/sys/conf/ (props changed) Modified: stable/9/include/Makefile ============================================================================== --- stable/9/include/Makefile Sat Oct 12 17:27:59 2013 (r256385) +++ stable/9/include/Makefile Sat Oct 12 17:31:21 2013 (r256386) @@ -99,19 +99,18 @@ SHARED?= copies INCS+= osreldate.h -osreldate.h: ${.CURDIR}/../sys/conf/newvers.sh ${.CURDIR}/../sys/sys/param.h \ - ${.CURDIR}/Makefile - @${ECHO} creating osreldate.h from newvers.sh - @MAKE=${MAKE}; \ - PARAMFILE=${.CURDIR}/../sys/sys/param.h; \ - . ${.CURDIR}/../sys/conf/newvers.sh; \ - echo "$$COPYRIGHT" > osreldate.h; \ - echo "#ifdef _KERNEL" >> osreldate.h; \ - echo "#error \" cannot be used in the kernel, use \"" >> osreldate.h; \ - echo "#else" >> osreldate.h; \ - echo "#undef __FreeBSD_version" >> osreldate.h; \ - echo "#define __FreeBSD_version $$RELDATE" >> osreldate.h; \ - echo "#endif" >> osreldate.h +SYSDIR= ${.CURDIR}/../sys +NEWVERS_SH= ${SYSDIR}/conf/newvers.sh +PARAM_H= ${SYSDIR}/sys/param.h +MK_OSRELDATE_SH= ${.CURDIR}/mk-osreldate.sh + +osreldate.h vers.c: ${NEWVERS_SH} ${PARAM_H} ${MK_OSRELDATE_SH} + env ECHO="${ECHO}" \ + MAKE="${MAKE}" \ + NEWVERS_SH=${NEWVERS_SH} \ + PARAM_H=${PARAM_H} \ + SYSDIR=${SYSDIR} \ + sh ${MK_OSRELDATE_SH} .for i in ${LHDRS} INCSLINKS+= sys/$i ${INCLUDEDIR}/$i Copied and modified: stable/9/include/mk-osreldate.sh (from r255775, head/include/mk-osreldate.sh) ============================================================================== --- head/include/mk-osreldate.sh Sat Sep 21 22:36:07 2013 (r255775, copy source) +++ stable/9/include/mk-osreldate.sh Sat Oct 12 17:31:21 2013 (r256386) @@ -36,7 +36,9 @@ trap "rm -f $tmpfile" EXIT ${ECHO} creating osreldate.h from newvers.sh export PARAMFILE="${PARAM_H:=$CURDIR/../sys/sys/param.h}" -. "${NEWVERS_SH:=$CURDIR/../sys/conf/newvers.sh}" +set +e +. "${NEWVERS_SH:=$CURDIR/../sys/conf/newvers.sh}" || exit 1 +set -e cat > $tmpfile <